<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63312>63312</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
SDAG uses deleted node (UNREACHABLE executed at SelectionDAG/InstrEmitter.cpp:1209)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:X86,
llvm:crash
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chfast
</td>
</tr>
</table>
<pre>
```
t277: ch = <<Deleted Node!>>
This target-independent node should have been selected!
UNREACHABLE executed at /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:1209!
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 'X86 DAG->DAG Instruction Selection' on function '@f'
#0 0x0000559ce33b722f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x355b22f)
#1 0x0000559ce33b4984 SignalHandler(int) Signals.cpp:0:0
#2 0x00007fc570c5f420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007fc57072c00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007fc57070b859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x0000559ce330a8ce (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x34ae8ce)
#6 0x0000559ce31fc2a8 llvm::InstrEmitter::EmitSpecialNode(llvm::SDNode*, bool, bool, llvm::DenseMap<llvm::SDValue, llvm::Register, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x33a02a8)
#7 0x0000559ce30938c9 llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&)::'lambda'(llvm::SDNode*, bool, bool, llvm::DenseMap<llvm::SDValue, llvm::Register, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&)::operator()(llvm::SDNode*, bool, bool, llvm::DenseMap<llvm::SDValue, llvm::Register, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&) const ScheduleDAGSDNodes.cpp:0:0
#8 0x0000559ce309631a llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x323a31a)
#9 0x0000559ce31808bd llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x33248bd)
#10 0x0000559ce3183e38 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3327e38)
#11 0x0000559ce3185b32 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#12 0x0000559ce1ad46d0 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#13 0x0000559ce2648c5e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x0000559ce2bddba1 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d81ba1)
#15 0x0000559ce2bddde9 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d81de9)
#16 0x0000559ce2bde662 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d82662)
#17 0x0000559ce06d1c44 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
```
```llvm
; ModuleID = 'crash-x86_64-1.bc'
source_filename = "M"
target triple = "x86_64-unknown-linux-gnu"
@G = external global i16
@G.1 = external global i8
@G.2 = external global i8
@G.3 = external global i32
@G.4 = external global i64
@G.5 = external global i1
@G.6 = external global i64
@G.7 = external global ptr
@G.8 = external global i1
@G.9 = external global float
@G.10 = external global double
@G.11 = external global i1
@G.12 = external global double
@G.13 = external global double
@G.14 = external global double
@G.15 = external global i1
@G.16 = external global i64
@G.17 = external global i32
@G.18 = external global i16
@G.19 = external global i16
@G.20 = external global i1
define void @f(i8 %0, float %1) {
BB:
%A29 = alloca i1, align 1
%A19 = alloca i1, align 1
%A6 = alloca i1, align 1
%L19 = load i8, ptr %A6, align 1
%L18 = load i8, ptr %A6, align 1
%L17 = load float, ptr %A6, align 4
store i1 undef, ptr %A6, align 1
%B20 = mul i8 %L18, %L19
%A3 = alloca i64, align 8
%L26 = load double, ptr poison, align 8
%LGV = load i32, ptr @G.3, align 4
%A5 = alloca i64, align 8
store i1 false, ptr @G.15, align 1
store i1 false, ptr %A19, align 1
store i8 %B20, ptr %A5, align 1
store i1 poison, ptr %A29, align 1
store ptr null, ptr %A3, align 8
store i8 0, ptr @G.2, align 1
%LGV11 = load double, ptr @G.10, align 8
%L3 = load i1, ptr poison, align 1
%L27 = load i8, ptr poison, align 1
store i64 undef, ptr %A5, align 4
%G = getelementptr i8, ptr %A5, i8 %0
%L23 = load i8, ptr %G, align 1
%B7 = fdiv float %L17, %1
%A = alloca i1, align 1
%L1 = load i32, ptr poison, align 4
%C = icmp slt i32 1, %L1
%C24 = icmp sgt i8 %L23, %0
%B29 = udiv i1 %L3, true
store i1 %C, ptr %A, align 1
%C29 = icmp ule i8 poison, %L27
store i32 poison, ptr poison, align 4
store float 0.000000e+00, ptr %G, align 4
store ptr poison, ptr poison, align 8
store i1 %B29, ptr %G, align 1
store float %B7, ptr %A19, align 4
store i1 false, ptr @G.15, align 1
store i1 %C24, ptr %A19, align 1
store i1 %C29, ptr @G.20, align 1
ret void
}
```
When using a build with ASan this reports the following issue:
```
==3571885==ERROR: AddressSanitizer: use-after-poison on address 0x621000037324 at pc 0x555562d71364 bp 0x7fffffffc5e0 sp 0x7fffffffc5d8
READ of size 4 at 0x621000037324 thread T0
#0 0x555562d71363 in getIROrder /blockchain/projects/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:736:40
#1 0x555562d71363 in getNodeOrdering /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1811:27
#2 0x555562d71363 in (anonymous namespace)::src_ls_rr_sort::operator()(llvm::SUnit*, llvm::SUnit*) const /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDA
GRRList.cpp:2666:26
#3 0x555562d70dbc in popFromQueueImpl<(anonymous namespace)::src_ls_rr_sort> /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1860:9
#4 0x555562d70dbc in llvm::SUnit* (anonymous namespace)::popFromQueue<(anonymous namespace)::src_ls_rr_sort>(std::vector<llvm::SUnit*, std::allocator<llvm::SUnit*>>&, (anonymous n
amespace)::src_ls_rr_sort&, llvm::ScheduleDAG*) /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1878:10
#5 0x555562d7159c in (anonymous namespace)::RegReductionPriorityQueue<(anonymous namespace)::src_ls_rr_sort>::pop() /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG
/ScheduleDAGRRList.cpp:1912:16
#6 0x555562d49f32 in (anonymous namespace)::ScheduleDAGRRList::PickNodeToScheduleBottomUp() /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1
479:70
#7 0x555562d44591 in ListScheduleBottomUp /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1632:17
#8 0x555562d44591 in (anonymous namespace)::ScheduleDAGRRList::Schedule() /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:384:3
#9 0x555563077362 in llvm::SelectionDAGISel::CodeGenAndEmitDAG() /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:965:16
#10 0x55556306deb7 in llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /blockchain/projects/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1700
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1z4yiz_jXKDWUXAn1e5EKO42yqMrs5yeycvUshgW1OMKgEmvHsrz-FkG3kyGNn3uy8F5vKxGPUdD_9dNN8iWjNV5Kx6yCeBfH8irRmrZrrar0k2lyVin6_DhLY_8J5AAuD0jTABajWIMBzEOCbAN_MmWCGUfC7oixAYYBv7W8n_3nNNTCkWTEz4ZKymknKpAFSUQb0WrWCgjX5ykDJmASaCVYZRq2Srvufvz_dFje_FbOHW8C2rGqtGWJAgBaNUiZACyG-biZ1o_6PVbuv9oOXAVrcKMrumAzQ4rlTzJWcF3cBWtxLbZrbDTeGNdOqrgNchAjme7OPD7fF8y3QbbnhBhBQtivQsFo1BhgF1sbUOsBFgBYBWqy4WbfltFIbz_wQFNe6ZTpAC0AkBVxWoqUMmDUDVUP0GpSkejUNqdjUmX82pHoFtN1YYK4JTgOYPzZq1ZANIM2q3TBpLAhLhaqtlUptai5YM2HbWqiGNbZNELmaEK1ZY73XE9O08jVAi5LLDmcFJsqqIHVtFbWmbs1Ug8k2SyZEbyb6uzRkG-A5l4YJG2-t2qZi-wCHFthTKyWXK1ATrUGA0kUrO7bBo234RCRZWTgpUBJsFG0Fs1IDZSjtnUdjCv_KEjAv7iYBvp0Xd6CLX-tM7EPb61_ubFsLEVza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