llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.09k stars 11.59k forks source link

Assertion `N->getOpcode() != ISD::DELETED_NODE && "Node was deleted but visit returned NULL!"` failed #64772

Closed chfast closed 1 year ago

chfast commented 1 year ago
llc: /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2068: llvm::SDValue {anonymous}::DAGCombiner::combine(llvm::SDNode*): Assertion `N->getOpcode() != ISD::DELETED_NODE && "Node was deleted but visit returned NULL!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
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 '@f'
 #0 0x00000000033aaca8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x33aaca8)
 #1 0x00000000033a859c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f9a0ba5f420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007f9a0b52200b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007f9a0b501859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x00007f9a0b501729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #6 0x00007f9a0b512fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #7 0x0000000003028be4 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
 #8 0x0000000003029efc (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) DAGCombiner.cpp:0:0
 #9 0x000000000302c4fc llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOpt::Level) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x302c4fc)
#10 0x000000000317b627 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x317b627)
#11 0x000000000317eeb8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x317eeb8)
#12 0x0000000003180bb2 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#13 0x0000000002692dc9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x0000000002c09289 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2c09289)
#15 0x0000000002c094c1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2c094c1)
#16 0x0000000002c09ce2 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2c09ce2)
#17 0x000000000075f342 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#18 0x000000000069abc6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x69abc6)
#19 0x00007f9a0b503083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#20 0x0000000000755cfe _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x755cfe)
Program terminated with signal: SIGSEGV
Compiler returned: 139
target triple = "riscv64"

define void @f() {
  %B1 = shl i64 -9223372036854775808, 0
  %LGV6 = load i8, ptr null, align 1
  %G3 = getelementptr i32, ptr null, i64 %B1
  %B5 = ashr i64 -9223372036854775808, 0
  store i1 false, ptr %G3, align 1
  store i8 1, ptr null, align 1
  store i1 false, ptr null, align 1
  ret void
}

https://godbolt.org/z/sPWrjfonf

llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-risc-v

topperc commented 1 year ago

It doesn't fail with -riscv-use-aa=false so it looks like a recent regression since using AA is relatively new.

wangpc-pp commented 1 year ago

CC @Yunzezhu94

chfast commented 1 year ago

This comes from fuzzing, so you don't need to revert the change.

topperc commented 1 year ago

Candidate patch https://reviews.llvm.org/D158208