<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94145>94145</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[SDAG] Assertion `DAG.isGuaranteedNotToBeUndefOrPoison(R, false) && "Can't create node that may be undef/poison!"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
crash-on-valid,
llvm:SelectionDAG
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dtcxzyw
</td>
</tr>
</table>
<pre>
Reproducer: https://godbolt.org/z/nvr4G5nb1
```
; llc test.ll -o -
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-gnu"
define i32 @main(i16 %0) {
entry:
%1 = lshr i16 %0, 1
%2 = and i16 %1, 1
%3 = xor i16 %2, 1
%cond.i.i.i = shl i16 1, %3
%cond.i.fr.i.i = freeze i16 %cond.i.i.i
%conv1260.i.i = zext i16 %cond.i.fr.i.i to i32
ret i32 %conv1260.i.i
}
```
```
llc: /home/dtcxzyw/WorkSpace/Projects/compilers/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15700: llvm::SDValue {anonymous}::DAGCombiner::visitFREEZE(llvm::SDNode*): Assertion `DAG.isGuaranteedNotToBeUndefOrPoison(R, false) && "Can't create node that may be undef/poison!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: bin/llc test.ll -o -
1. Running pass 'Function Pass Manager' on module 'test.ll'.
2. Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@main'
#0 0x0000725f47609280 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0x209280)
#1 0x0000725f4760628f llvm::sys::RunSignalHandlers() (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSupport.so.19.0git+0x20628f)
#2 0x0000725f476063e5 SignalHandler(int) Signals.cpp:0:0
#3 0x0000725f46c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x0000725f46c969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x0000725f46c969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x0000725f46c969fc pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x0000725f46c42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#8 0x0000725f46c287f3 abort ./stdlib/abort.c:81:7
#9 0x0000725f46c2871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x0000725f46c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x0000725f4a701a50 (anonymous namespace)::DAGCombiner::visitFREEZE(llvm::SDNode*) DAGCombiner.cpp:0:0
#12 0x0000725f4a7537eb (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#13 0x0000725f4a75555d llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOptLevel) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSelectionDAG.so.19.0git+0x15555d)
#14 0x0000725f4a9b031c llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSelectionDAG.so.19.0git+0x3b031c)
#15 0x0000725f4a9b3f8e llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSelectionDAG.so.19.0git+0x3b3f8e)
#16 0x0000725f4a9b5189 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSelectionDAG.so.19.0git+0x3b5189)
#17 0x0000725f4a9a9bcd llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSelectionDAG.so.19.0git+0x3a9bcd)
#18 0x0000725f49e295b2 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMCodeGen.so.19.0git+0x4295b2)
#19 0x0000725f47cfeb9d llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMCore.so.19.0git+0x2feb9d)
#20 0x0000725f47cfede9 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMCore.so.19.0git+0x2fede9)
#21 0x0000725f47cff6a2 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMCore.so.19.0git+0x2ff6a2)
#22 0x0000608bca261ecb compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#23 0x0000608bca255e2c main (bin/llc+0x15e2c)
#24 0x0000725f46c29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#25 0x0000725f46c29e40 call_init ./csu/../csu/libc-start.c:128:20
#26 0x0000725f46c29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#27 0x0000608bca256c55 _start (bin/llc+0x16c55)
```
LLVM version: de37c06f01772e02465ccc9f538894c76d89a7a1
I guess it should be caused by 9e22c7a0ea87228dffcdfd7ab62724f72e0b3e30. @RKSimon
> I'm still reducing a decent test case but wanted to get the buildbot fix ASAP.
Do you think the root causes of these problems are the same? If not, I will post a fix later :)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org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