Open HazyFish opened 1 year ago
The follow code causes assertion failure LRegs.size() == 1 && "Can't handle this yet!" when targeting x86_64 / i386. The problem doesn't exist when alloca is in the previous BB or when i64 instead of double is used.
LRegs.size() == 1 && "Can't handle this yet!"
x86_64
i386
alloca
i64
double
https://godbolt.org/z/4T3GGfhdM
define void @f(i1 %0, double %1, double %2, double* %3) { BB: %C = fcmp ugt double %1, %2 br label %BB1 BB1: ; preds = %BB1, %BB %A = alloca i1, i32 2 %G = getelementptr i1, i1* %A, i1 %C %B1 = frem double %2, 0.5 %S3 = select i1 %C, double %1, double %B1 %L = load i1, i1* %G store double %S3, double* %3 br i1 %L, label %BB1, label %BB2 BB2: ; preds = %BB1 ret void }
llc: /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1565: llvm::SUnit *(anonymous namespace)::ScheduleDAGRRList::PickNodeToScheduleBottomUp(): Assertion `LRegs.size() == 1 && "Can't handle this yet!"' failed. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: ./llvm-project/build-debug/bin/llc -mtriple=x86_64 ./crash-reports/dag-isel-x86_64/1.ll 1. Running pass 'Function Pass Manager' on module './crash-reports/dag-isel-x86_64/1.ll'. 2. Running pass 'X86 DAG->DAG Instruction Selection' on function '@f' #0 0x0000000003b0f2aa llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:11 #1 0x0000000003b0f45b PrintStackTraceSignalHandler(void*) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Support/Unix/Signals.inc:636:1 #2 0x0000000003b0daa6 llvm::sys::RunSignalHandlers() /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Support/Signals.cpp:104:5 #3 0x0000000003b0fb85 SignalHandler(int) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1 #4 0x00007efe3602c980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980) #5 0x00007efe34f1ce87 raise /build/glibc-CVJwZb/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0 #6 0x00007efe34f1e7f1 abort /build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c:81:0 #7 0x00007efe34f0e3fa __assert_fail_base /build/glibc-CVJwZb/glibc-2.27/assert/assert.c:89:0 #8 0x00007efe34f0e472 (/lib/x86_64-linux-gnu/libc.so.6+0x30472) #9 0x0000000003756e32 (anonymous namespace)::ScheduleDAGRRList::PickNodeToScheduleBottomUp() /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1566:20 #10 0x0000000003756406 (anonymous namespace)::ScheduleDAGRRList::ListScheduleBottomUp() /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1630:17 #11 0x000000000375618f (anonymous namespace)::ScheduleDAGRRList::Schedule() /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:381:3 #12 0x0000000003765c41 llvm::ScheduleDAGSDNodes::Run(llvm::SelectionDAG*, llvm::MachineBasicBlock*) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:64:1 #13 0x0000000003872d1f llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:952:3 #14 0x000000000387148d llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, bool&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:688:1 #15 0x0000000003870f2b llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1603:11 #16 0x000000000386e4d6 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:467:3 #17 0x000000000102887a (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:191:7 #18 0x00000000028bfd55 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:91:8 #19 0x0000000002fa7ca6 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1430:23 #20 0x0000000002facad2 llvm::FPPassManager::runOnModule(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1476:16 #21 0x0000000002fa8579 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1545:23 #22 0x0000000002fa80ed llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:535:16 #23 0x0000000002facdb1 llvm::legacy::PassManager::run(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1672:3 #24 0x0000000000d3dd1c compileModule(char**, llvm::LLVMContext&) /home/henry/aflplusplus-isel/llvm-project/llvm/tools/llc/llc.cpp:737:41 #25 0x0000000000d3c0c2 main /home/henry/aflplusplus-isel/llvm-project/llvm/tools/llc/llc.cpp:418:13 #26 0x00007efe34effc87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0 #27 0x0000000000d3b8ca _start (./llvm-project/build-debug/bin/llc+0xd3b8ca)
cc @DataCorrupted
@llvm/issue-subscribers-backend-x86
Description
The follow code causes assertion failure
LRegs.size() == 1 && "Can't handle this yet!"
when targetingx86_64
/i386
. The problem doesn't exist whenalloca
is in the previous BB or wheni64
instead ofdouble
is used.Minimal Reproduction
https://godbolt.org/z/4T3GGfhdM
Code
Stack Trace