Skip to content

opt -passes=loop-distribute crashes #156685

@k-arrows

Description

@k-arrows

Run opt with -passes=loop-distribute

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

Backtrace:

opt: /root/llvm-project/llvm/lib/Transforms/Scalar/LoopDistribute.cpp:948: void {anonymous}::LoopDistributeForLoop::setForced(): Assertion `Op && mdconst::hasa<ConstantInt>(*Op) && "invalid metadata"' 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-distribute <source>
1.	Running pass "function(loop-distribute)" on module "<source>"
2.	Running pass "loop-distribute" on function "test"
 #0 0x000000000578f178 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x578f178)
 #1 0x000000000578c024 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x000072d465442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000072d4654969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000072d465442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000072d4654287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000072d46542871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x000072d465439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x00000000044d9a20 llvm::LoopDistributePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x44d9a20)
 #9 0x0000000002e24e4e llvm::detail::PassModel<llvm::Function, llvm::LoopDistributePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e24e4e)
#10 0x000000000557ad21 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x557ad21)
#11 0x0000000000edbafe 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+0xedbafe)
#12 0x000000000557928a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x557928a)
#13 0x000000000096caae 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+0x96caae)
#14 0x0000000005578c41 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5578c41)
#15 0x0000000000976da8 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+0x976da8)
#16 0x000000000096ae17 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96ae17)
#17 0x000072d465429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#18 0x000072d465429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#19 0x0000000000961f35 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x961f35)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]loopoptim

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions