Issue 156894
Summary crashes with assertion failure when running opt -passes=loop-vectorize
Labels loopoptim, crash
Assignees
Reporter k-arrows
    Run opt with -passes=loop-vectorize

Reproducer:
https://godbolt.org/z/fMaPMYhE5

Backtrace:
```console
opt: /root/llvm-project/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp:381: bool canonicalHeaderAndLatch(llvm::VPBlockBase*, const llvm::VPDominatorTree&): Assertion `cast<VPInstruction>(Term)->getOpcode() == VPInstruction::BranchOnCond && "terminator must be a BranchOnCond"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=loop-vectorize <source>
1.	Running pass "function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)" on module "<source>"
2.	Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "non_branch_terminator"
 #0 0x000000000579c848 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x579c848)
 #1 0x00000000057996f4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000720f57a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x0000720f57a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x0000720f57a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x0000720f57a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000720f57a2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x0000720f57a39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x00000000036a7074 canonicalHeaderAndLatch(llvm::VPBlockBase*, llvm::VPDominatorTree const&) VPlanConstruction.cpp:0:0
 #9 0x00000000036ac8d1 llvm::VPlanTransforms::buildVPlan0(llvm::Loop*, llvm::LoopInfo&, llvm::Type*, llvm::DebugLoc, llvm::PredicatedScalarEvolution&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36ac8d1)
#10 0x000000000352862e llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x352862e)
#11 0x00000000035290c4 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x35290c4)
#12 0x000000000352ce82 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x352ce82)
#13 0x00000000035302d0 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x35302d0)
#14 0x000000000353097d llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x353097d)
#15 0x0000000002e2700e llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e2700e)
#16 0x00000000055886f1 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x55886f1)
#17 0x0000000000edfbae llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xedfbae)
#18 0x0000000005586c5a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5586c5a)
#19 0x000000000096cd6e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96cd6e)
#20 0x0000000005586611 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5586611)
#21 0x0000000000977068 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x977068)
#22 0x000000000096b0d7 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96b0d7)
#23 0x0000720f57a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x0000720f57a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x00000000009621f5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9621f5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to