-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed
Bug
Copy link
Labels
Description
Reproducer: https://godbolt.org/z/jMqM4hvTd
Reduced testcase:
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-musl"
define i64 @backsmith_pure_6(i64 %0) {
entry:
%sub.i = add i64 %0, 1
%1 = bitcast <2 x i32> zeroinitializer to i64
%mul.i = mul i64 %sub.i, %1
ret i64 %mul.i
}Dump:
llc: /root/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(From&) [with To = llvm::ConstantSDNode; From = llvm::SDValue]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@backsmith_pure_6'
#0 0x0000000004210fd8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4210fd8)
#1 0x000000000420de84 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x00007d94c7e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007d94c7e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007d94c7e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007d94c7e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x00007d94c7e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x00007d94c7e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x0000000001e6d3af llvm::RISCVTargetLowering::isMulAddWithConstProfitable(llvm::SDValue, llvm::SDValue) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x1e6d3af)
#9 0x0000000003d55092 (anonymous namespace)::DAGCombiner::isMulAddWithConstProfitable(llvm::SDNode*, llvm::SDValue, llvm::SDValue) (.isra.0) DAGCombiner.cpp:0:0
#10 0x0000000003e08331 llvm::SDValue (anonymous namespace)::DAGCombiner::visitMUL<llvm::EmptyMatchContext>(llvm::SDNode*) DAGCombiner.cpp:0:0
#11 0x0000000003e33d75 (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*) DAGCombiner.cpp:0:0
#12 0x0000000003e3642b (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#13 0x0000000003e37e60 (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) DAGCombiner.cpp:0:0
#14 0x0000000003e3a8b3 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3e3a8b3)
#15 0x0000000003fa5e11 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fa5e11)
#16 0x0000000003fa97c8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fa97c8)
#17 0x0000000003fab24c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fab24c)
#18 0x0000000003f96a4f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3f96a4f)
#19 0x00000000030f16b9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#20 0x000000000374a2f6 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x374a2f6)
#21 0x000000000374a6a1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x374a6a1)
#22 0x000000000374af0f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x374af0f)
#23 0x00000000008fdee4 compileModule(char**, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#24 0x00000000007c7c49 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c7c49)
#25 0x00007d94c7e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#26 0x00007d94c7e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#27 0x00000000008f30e5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8f30e5)
Program terminated with signal: SIGSEGV
Compiler returned: 139