llvm / llvm/llvm-project

[X86] Clang crashed at -O1 -mavx2 with `Node is not in map!`

Open
#211,496 2 comments 0 reactions 1 assignee Claimed by @skadewdl3 View on GitHub
backend:X86 crash-on-valid generated by fuzzer llvm:SelectionDAG
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Reproducer: https://godbolt.org/z/j14sdYznx
Testcase:
```c
#include
typedef int64_t v16i64 __attribute__((vector_size(128)));
v16i64 g28;
_Bool g31;
int32_t f18()
{
g28 = __builtin_shufflevector(g28, g28, 23, 6, 4, 28, 9, 5, 3, 5, 28, 13, 0,
14, 7, 8, 4, 2);
g31 = 0;
g28 = __builtin_shufflevector(g28, g28, 1, 5, 4, 2, 7, 29, 3, 2, 5, 10, 8,
4, 0, 8, 7, 6);
}
```

Dump at -O1 -mavx2:
```
t256: ch = TokenFactor t256, t215:1, example.c:7:35

Node is not in map!
UNREACHABLE executed at /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1314!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O1 -mavx2
1. parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module ''.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@f18'
#0 0x0000000004413058 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4413058)
#1 0x000000000440ff04 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x440ff04)
#2 0x000000000441053c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x441053c)
#3 0x000000000434f518 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x000077af19245330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x000077af1929eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
#6 0x000077af1924527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#7 0x000077af192288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#8 0x000000000435988a (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x435988a)
#9 0x0000000005bbc624 llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5bbc624)
#10 0x0000000005c1dccf llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode*, llvm::SDNode*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c1dccf)
#11 0x0000000005c1e0e0 llvm::SelectionDAG::AddModifiedNodeToCSEMaps(llvm::SDNode*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c1e0e0)
#12 0x0000000005c1eec3 llvm::SelectionDAG::ReplaceAllUsesOfValueWith(llvm::SDValue, llvm::SDValue) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c1eec3)
#13 0x0000000005c1f5dd llvm::SelectionDAG::makeEquivalentMemoryOrdering(llvm::SDValue, llvm::SDValue) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c1f5dd)
#14 0x0000000002d4aa15 combineBROADCAST_LOAD(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&) X86ISelLowering.cpp:0:0
#15 0x0000000002ebaf61 llvm::X86TargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x2ebaf61)
#16 0x0000000005af087b (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#17 0x0000000005af23e2 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5af23e2)
#18 0x0000000005c413c5 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c413c5)
#19 0x0000000005c44ca6 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c44ca6)
#20 0x0000000005c463a4 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c463a4)
#21 0x0000000005c3f84e llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5c3f84e)
#22 0x00000000036af4fd llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#23 0x0000000003cf3ba1 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3cf3ba1)
#24 0x0000000003cf40d1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3cf40d1)
#25 0x0000000003cf4a91 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3cf4a91)
#26 0x0000000004835798 (anonymous namespace)::EmitAssemblyHelper::TimeCodegenPasses(llvm::function_ref) (.isra.0) BackendUtil.cpp:0:0
#27 0x0000000004844743 (anonymous namespace)::EmitAssemblyHelper::emitAssembly(clang::BackendAction, std::unique_ptr>, clang::BackendConsumer*) BackendUtil.cpp:0:0
#28 0x0000000004844bc3 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr, std::unique_ptr>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4844bc3)
#29 0x0000000004f169ec clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f169ec)
#30 0x0000000006d17e5c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6d17e5c)
#31 0x0000000004f16e18 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f16e18)
#32 0x0000000005243b18 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x5243b18)
#33 0x00000000051d063d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x51d063d)
#34 0x000000000531807d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x531807d)
#35 0x0000000000dae7fc cc1_main(llvm::ArrayRef, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xdae7fc)
#36 0x0000000000da540a ExecuteCC1Tool(llvm::SmallVectorImpl&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr) driver.cpp:0:0
#37 0x0000000000da558d int llvm::function_ref&)>::callback_fn&)>(long, llvm::SmallVectorImpl&) driver.cpp:0:0
#38 0x0000000004f8e109 void llvm::function_ref::callback_fn>, std::__cxx11::basic_string, std::allocator>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#39 0x000000000434f954 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x434f954)
#40 0x0000000004f8ec75 clang::driver::CC1Command::Execute(llvm::ArrayRef>, std::__cxx11::basic_string, std::allocator>*, bool*) const (.part.0) Job.cpp:0:0
#41 0x0000000004f47622 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f47622)
#42 0x0000000004f4be57 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f4be57)
#43 0x0000000004f563b5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f563b5)
#44 0x0000000000daacea clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xdaacea)
#45 0x0000000000cc5afa main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcc5afa)
#46 0x000077af1922a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#47 0x000077af1922a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#48 0x0000000000da4db5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xda4db5)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 134
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.