[opt] -passes="loop(indvars),loop-fusion" causes SIGSEGV
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Reproducer: https://godbolt.org/z/8qPcM9f31
```
opt: /root/llvm-project/llvm/lib/Transforms/Scalar/LoopFuse.cpp:936: bool {anonymous}::LoopFuser::fuseCandidates(): Assertion `FusedCand.isEligibleForFusion(SE) && "Fused candidate should be eligible for fusion!"' 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 -verify-each -passes=cgscc(function(loop(indvars))),cgscc(function(loop-fusion))
1. Running pass "cgscc(function(loop-fusion))" on module ""
2. Running pass "loop-fusion" on function "combined_bridge"
#0 0x0000000005c4f168 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5c4f168)
#1 0x0000000005c4bf94 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5c4bf94)
#2 0x0000000005c4c10a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x000070b495642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000070b4956969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000070b495642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000070b4956287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000070b49562871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000070b495639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x000000000492214d (anonymous namespace)::LoopFuser::fuseCandidates() LoopFuse.cpp:0:0
#10 0x000000000492308b llvm::LoopFusePass::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x492308b)
#11 0x00000000031c76be llvm::detail::PassModel>::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x31c76be)
#12 0x00000000059b0706 llvm::PassManager>::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59b0706)
#13 0x0000000000f26b6e llvm::detail::PassModel>, llvm::AnalysisManager>::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf26b6e)
#14 0x0000000004fb40a3 llvm::CGSCCToFunctionPassAdaptor::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4fb40a3)
#15 0x0000000000f2590e llvm::detail::PassModel, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf2590e)
#16 0x0000000004facaae llvm::PassManager, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4facaae)
#17 0x00000000031c690e llvm::detail::PassModel, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>, llvm::AnalysisManager, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x31c690e)
#18 0x0000000004fae0a9 llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4fae0a9)
#19 0x0000000000f258ee llvm::detail::PassModel>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf258ee)
#20 0x00000000059b2266 llvm::PassManager>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59b2266)
#21 0x000000000096f03a 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+0x96f03a)
#22 0x00000000009630df optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9630df)
#23 0x000070b495629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x000070b495629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x00000000009585c5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9585c5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
Note:
- Likely to be an analysis pass result preservation issue in `indvars` related code. `opt -passes="loop(indvars),invalidate,loop-fusion"` fixes the crash.
Generated by fuzzer.
Contributor guide
Assessment
This issue has not been assessed yet.