Skip to content

crashes with assertion failure when running opt -passes=globalopt #156656

@k-arrows

Description

@k-arrows

Run opt with -passes=globalopt

Reproducer:
https://godbolt.org/z/6obEYeKEh

Backtrace:

opt: /root/llvm-project/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = llvm::CallBase; From = llvm::User]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' 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=globalopt <source>
1.	Running pass "globalopt" on module "<source>"
 #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 0x000071ca6f842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000071ca6f8969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000071ca6f842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000071ca6f8287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000071ca6f82871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x000071ca6f839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x00000000030ac2ea optimizeGlobalsInModule(llvm::Module&, llvm::DataLayout const&, llvm::function_ref<llvm::TargetLibraryInfo& (llvm::Function&)>, llvm::function_ref<llvm::TargetTransformInfo& (llvm::Function&)>, llvm::function_ref<llvm::BlockFrequencyInfo& (llvm::Function&)>, llvm::function_ref<llvm::DominatorTree& (llvm::Function&)>, llvm::function_ref<void (llvm::Function&)>, llvm::function_ref<void (llvm::Function&)>) (.constprop.0) GlobalOpt.cpp:0:0
 #9 0x00000000030ad19f llvm::GlobalOptPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x30ad19f)
#10 0x0000000002e23dae llvm::detail::PassModel<llvm::Module, llvm::GlobalOptPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e23dae)
#11 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)
#12 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)
#13 0x000000000096ae17 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96ae17)
#14 0x000071ca6f829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#15 0x000071ca6f829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#16 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

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions