[opt] -passes="constraint-elimination,loop(loop-unroll-and-jam)" causes SIGSEGV
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Reproducer: https://godbolt.org/z/vxb7zerKK
```
Trip Count for Parallel Loop at depth 1 containing: %for.outer.i,%for.inner.i,%for.latch.i
Loop at depth 2 containing: %for.inner.i
Changed!
Old: 536870911
New: 0
Delta: 536870911
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=cgscc(function(constraint-elimination)),cgscc(function(loop(loop-unroll-and-jam)))
1. Running pass "cgscc(function(loop(loop-unroll-and-jam)))" on module ""
2. Running pass "loop(loop-unroll-and-jam)" on function "combined_bridge"
#0 0x0000000005c4f1f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5c4f1f8)
#1 0x0000000005c4c024 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5c4c024)
#2 0x0000000005c4c19a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x000077380e442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000077380e4969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000077380e442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000077380e4287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x0000000005278855 llvm::ScalarEvolution::verify() const (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5278855)
#8 0x0000000004e0a869 llvm::UnrollAndJamLoop(llvm::Loop*, unsigned int, unsigned int, unsigned int, bool, llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::TargetTransformInfo const*, llvm::OptimizationRemarkEmitter*, llvm::Loop**) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4e0a869)
#9 0x00000000049b9b4e llvm::LoopUnrollAndJamPass::run(llvm::LoopNest&, llvm::AnalysisManager&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x49b9b4e)
#10 0x00000000031ca8be llvm::detail::PassModel, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::LoopNest&, llvm::AnalysisManager&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x31ca8be)
#11 0x000000000495e12d llvm::PassManager, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::runWithLoopNestPasses(llvm::Loop&, llvm::AnalysisManager&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x495e12d)
#12 0x000000000495ed23 llvm::PassManager, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x495ed23)
#13 0x000000000495fc8f llvm::FunctionToLoopPassAdaptor::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x495fc8f)
#14 0x0000000000f2afbe llvm::detail::PassModel>::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf2afbe)
#15 0x00000000059b06a6 llvm::PassManager>::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59b06a6)
#16 0x0000000000f2bd9e llvm::detail::PassModel>, llvm::AnalysisManager>::run(llvm::Function&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf2bd9e)
#17 0x0000000004fb4253 llvm::CGSCCToFunctionPassAdaptor::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4fb4253)
#18 0x0000000000f2ab3e 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+0xf2ab3e)
#19 0x0000000004facc5e llvm::PassManager, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4facc5e)
#20 0x00000000031c94be 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+0x31c94be)
#21 0x0000000004fae259 llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4fae259)
#22 0x0000000000f2ab1e llvm::detail::PassModel>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf2ab1e)
#23 0x00000000059b2206 llvm::PassManager>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59b2206)
#24 0x000000000096f30a 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+0x96f30a)
#25 0x00000000009633af optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9633af)
#26 0x000077380e429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#27 0x000077380e429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#28 0x0000000000958895 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x958895)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
Note:
- Breaking down into 2 opt executions (`opt -passes="constraint-elimination"` first, then `opt -passes="loop-unroll-and-jam"` on the produced IR) does not reproduce the issue.
- Likely not an analysis pass result preservation issue as `opt -passes="constraint-elimination,invalidate,loop(loop-unroll-and-jam)"` also crashes.
Generated by fuzzer.
Contributor guide
Assessment
This issue has not been assessed yet.