<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82431>82431</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[18 regression] [x86_64] [znver] SDValue llvm::SelectionDAG::getNode(unsigned int, const SDLoc &, SDVTList, ArrayRef<SDValue>, const SDNodeFlags): Assertion `Op.getOpcode() != ISD::DELETED_NODE && "Operand is DELETED_NODE!"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
berolinux
</td>
</tr>
</table>
<pre>
When building the reduced test case in this bug report with AMD specific optimizations (`-target-cpu znver1`, `-target-cpu znver2` etc.), clang 18 crashes with an assertion error.
```
$ clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -target-cpu znver1 -O -x c test.c
clang: /builddir/build/BUILD/llvm-project-release-18.x/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:9845: SDValue llvm::SelectionDAG::getNode(unsigned int, const SDLoc &, SDVTList, ArrayRef<SDValue>, const SDNodeFlags): Assertion `Op.getOpcode() != ISD::DELETED_NODE && "Operand is DELETED_NODE!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -target-cpu znver1 -O -x c test.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'test.c'.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@d'
#0 0x0000ffff9d700510 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-18.so+0x4300510)
#1 0x0000ffff9d6ff084 llvm::sys::RunSignalHandlers() (/lib64/libLLVM-18.so+0x42ff084)
#2 0x0000ffff9d6ffd3c (/lib64/libLLVM-18.so+0x42ffd3c)
#3 0x0000ffffa6fa37bc (linux-vdso.so.1+0x7bc)
#4 0x0000ffffa6dee458 (/lib64/libc.so.6+0x8e458)
#5 0x0000ffffa6da457c raise (/lib64/libc.so.6+0x4457c)
#6 0x0000ffffa6d90280 abort (/lib64/libc.so.6+0x30280)
#7 0x0000ffffa6d9dd04 (/lib64/libc.so.6+0x3dd04)
#8 0x0000ffffa6d9dd7c (/lib64/libc.so.6+0x3dd7c)
#9 0x0000ffff9e327848 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::SDVTList, llvm::ArrayRef<llvm::SDValue>, llvm::SDNodeFlags) (/lib64/libLLVM-18.so+0x4f27848)
#10 0x0000ffff9e37dd68 llvm::SelectionDAGISel::Select_INLINEASM(llvm::SDNode*) (/lib64/libLLVM-18.so+0x4f7dd68)
#11 0x0000ffffa15162b0 (/lib64/libLLVM-18.so+0x81162b0)
#12 0x0000ffff9e37b8f4 llvm::SelectionDAGISel::DoInstructionSelection() (/lib64/libLLVM-18.so+0x4f7b8f4)
#13 0x0000ffff9e375b58 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/lib64/libLLVM-18.so+0x4f75b58)
#14 0x0000ffff9e37313c llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/lib64/libLLVM-18.so+0x4f7313c)
#15 0x0000ffff9e36f670 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/lib64/libLLVM-18.so+0x4f6f670)
#16 0x0000ffffa150c408 (/lib64/libLLVM-18.so+0x810c408)
#17 0x0000ffff9dd0bc50 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/lib64/libLLVM-18.so+0x490bc50)
#18 0x0000ffff9d988408 llvm::FPPassManager::runOnFunction(llvm::Function&) (/lib64/libLLVM-18.so+0x4588408)
#19 0x0000ffff9d993e64 llvm::FPPassManager::runOnModule(llvm::Module&) (/lib64/libLLVM-18.so+0x4593e64)
#20 0x0000ffff9d98d040 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib64/libLLVM-18.so+0x458d040)
#21 0x0000ffffa5370130 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/lib64/libclang-cpp.so.18+0x2b70130)
#22 0x0000ffffa5773ae4 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib64/libclang-cpp.so.18+0x2f73ae4)
#23 0x0000ffffa3ea841c clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.18+0x16a841c)
#24 0x0000ffffa61ea008 clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.18+0x39ea008)
#25 0x0000ffffa616a698 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.18+0x396a698)
#26 0x0000ffffa6264c50 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.18+0x3a64c50)
#27 0x0000aaaaade950d8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-18+0x250d8)
#28 0x0000aaaaade91824 (/usr/bin/clang-18+0x21824)
#29 0x0000aaaaade9011c clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang-18+0x2011c)
#30 0x0000aaaaade9de50 main (/usr/bin/clang-18+0x2de50)
#31 0x0000ffffa6d90944 (/lib64/libc.so.6+0x30944)
#32 0x0000ffffa6d90a18 __libc_start_main (/lib64/libc.so.6+0x30a18)
#33 0x0000aaaaade8dd30 _start (/usr/bin/clang-18+0x1dd30)
Aborted (core dumped)
```
Reduced test case:
```c
struct {
long a[1];
} b;
char c();
void d() { asm("" : "+m"(b.a[1 + (c() & 1)])); }
```
The test case is extracted from the Linux kernel.
</pre>
<img width="1px" height="1px" alt="" src="http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