Skip to content

"!dbg attachment points at wrong subprogram for function" after InlinerPass #141568

Open
@mikaelholmen

Description

@mikaelholmen

llvm commit: 8fe33a0
Reproduce with:
opt -passes="inline" bbi-106975.ll -S -verify-each
Result:

!dbg attachment points at wrong subprogram for function
!15 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 9, type: !6, scopeLine: 9, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
ptr @f
  br label %for.body.i, !llvm.loop !3
!4 = !DILocation(line: 6, column: 3, scope: !5)
!5 = distinct !DISubprogram(name: "a", scope: !1, file: !1, line: 3, type: !6, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
!5 = distinct !DISubprogram(name: "a", scope: !1, file: !1, line: 3, type: !6, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
LLVM ERROR: Broken module found after pass "InlinerPass", compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: build-all/bin/opt -passes=inline bbi-106975.ll -S -verify-each
1.	Running pass "cgscc(inline)" on module "bbi-106975.ll"
 #0 0x000055e012d317c6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build-all/bin/opt+0x46be7c6)
 #1 0x000055e012d2f20e llvm::sys::RunSignalHandlers() (build-all/bin/opt+0x46bc20e)
 #2 0x000055e012d320b9 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007fd2706c6d10 __restore_rt (/lib64/libpthread.so.0+0x12d10)
 #4 0x00007fd26e06652f raise (/lib64/libc.so.6+0x4e52f)
 #5 0x00007fd26e039e65 abort (/lib64/libc.so.6+0x21e65)
 #6 0x000055e012d17ef3 llvm::report_fatal_error(llvm::Twine const&, bool) (build-all/bin/opt+0x46a4ef3)
 #7 0x000055e0141b113a void llvm::detail::UniqueFunctionBase<void, llvm::StringRef, llvm::Any, llvm::PreservedAnalyses const&>::CallImpl<llvm::VerifyInstrumentation::registerCallbacks(llvm::PassInstrumentationCallbacks&, llvm::AnalysisManager<llvm::Module>*)::$_0>(void*, llvm::StringRef, llvm::Any&, llvm::PreservedAnalyses const&) StandardInstrumentations.cpp:0:0
 #8 0x000055e0139344e2 llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (build-all/bin/opt+0x52c14e2)
 #9 0x000055e0141f79fd llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) PassBuilderPipelines.cpp:0:0
#10 0x000055e013935a7d llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x52c2a7d)
#11 0x000055e0141f7b6d llvm::detail::PassModel<llvm::Module, llvm::ModuleToPostOrderCGSCCPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilderPipelines.cpp:0:0
#12 0x000055e012f21bf7 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x48aebf7)
#13 0x000055e014183dec 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) (build-all/bin/opt+0x5b10dec)
#14 0x000055e012cf3c7e optMain (build-all/bin/opt+0x4680c7e)
#15 0x00007fd26e0527e5 __libc_start_main (/lib64/libc.so.6+0x3a7e5)
#16 0x000055e012cf176e _start (build-all/bin/opt+0x467e76e)
Abort (core dumped)

This doesn't seem to be new, I've reproduced it with old builds from June 2019.

bbi-106975.ll.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]llvm:analysis

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions