[opt] [ctx-instr-lower] Assertion Error When GUID Metadata Is Unavailable
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
`ctx-instr-lower` lowers tags generated by `ctx-instr-gen` to executable IR code but breaks if GUID is unavailable (e.g., from `assign-guid`).
Reproducer:
https://godbolt.org/z/jPPrn7zj6
Backtrace:
```
opt: /root/llvm-project/llvm/lib/Analysis/CtxProfAnalysis.cpp:444: static llvm::GlobalValue::GUID llvm::AssignGUIDPass::getGUID(const llvm::Function&): Assertion `MD && "guid not found for defined function"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S --passes=ctx-instr-gen,ctx-instr-lower
1. Running pass "ctx-instr-lower" on module ""
#0 0x00000000059945f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59945f8)
#1 0x00000000059914a4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x0000772549642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007725496969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x0000772549642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007725496287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000077254962871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x0000772549639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x0000000004d5a9bc llvm::AssignGUIDPass::getGUID(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4d5a9bc)
#9 0x00000000035ea860 (anonymous namespace)::CtxInstrumentationLowerer::lowerFunction(llvm::Function&) PGOCtxProfLowering.cpp:0:0
#10 0x00000000035ece95 llvm::PGOCtxProfLoweringPass::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x35ece95)
#11 0x0000000002fb45fe llvm::detail::PassModel>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2fb45fe)
#12 0x000000000576acc1 llvm::PassManager>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x576acc1)
#13 0x0000000000986d8a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef, llvm::ArrayRef>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x986d8a)
#14 0x000000000097b001 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97b001)
#15 0x0000772549629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#16 0x0000772549629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#17 0x0000000000972415 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x972415)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
Contributor guide
Assessment
This issue has not been assessed yet.