[PATCH] D150375: [FuncSpec] Replace LoopInfo with BlockFrequencyInfo.

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 01:20:11 PDT 2023


bjope added subscribers: aeubanks, asbirlea.
bjope added a comment.

In D150375#4375324 <https://reviews.llvm.org/D150375#4375324>, @bjope wrote:

> In D150375#4371980 <https://reviews.llvm.org/D150375#4371980>, @uabelho wrote:
>
>> In D150375#4367861 <https://reviews.llvm.org/D150375#4367861>, @uabelho wrote:
>>
>>> Hello,
>>>
>>> The following starts crashing with this patch:
>>>
>>>   opt -passes="ipsccp,function(adce)" -mtriple=hexagon bbi-82827.ll -o /dev/null
>>>
>>> Result:
>>>
>>>   PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
>>>   Stack dump:
>>>   0.	Program arguments: ../../main-github/llvm/build-all/bin/opt -passes=ipsccp,function(adce) -mtriple=hexagon bbi-82827.ll -o /dev/null
>>>    #0 0x00005590a334c8b7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../main-github/llvm/build-all/bin/opt+0x2d978b7)
>>>    #1 0x00005590a334a5de llvm::sys::RunSignalHandlers() (../../main-github/llvm/build-all/bin/opt+0x2d955de)
>>>    #2 0x00005590a334cf4f SignalHandler(int) Signals.cpp:0:0
>>>    #3 0x00007f396568d630 __restore_rt sigaction.c:0:0
>>>    #4 0x00005590a2c565a1 llvm::DebugLoc::get() const (../../main-github/llvm/build-all/bin/opt+0x26a15a1)
>>>    #5 0x00005590a3db2f31 (anonymous namespace)::AggressiveDeadCodeElimination::markLive(llvm::Instruction*) ADCE.cpp:0:0
>>>    #6 0x00005590a3dafca1 (anonymous namespace)::AggressiveDeadCodeElimination::performDeadCodeElimination() ADCE.cpp:0:0
>>>    #7 0x00005590a3dae4a9 llvm::ADCEPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x37f94a9)
>>>    #8 0x00005590a35590dd llvm::detail::PassModel<llvm::Function, llvm::ADCEPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x2fa40dd)
>>>    #9 0x00005590a2d2c314 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0x2777314)
>>>   #10 0x00005590a11e95ed llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (../../main-github/llvm/build-all/bin/opt+0xc345ed)
>>>   #11 0x00005590a2d306fe llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0x277b6fe)
>>>   #12 0x00005590a11e938d llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0xc3438d)
>>>   #13 0x00005590a2d2b4a4 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (../../main-github/llvm/build-all/bin/opt+0x27764a4)
>>>   #14 0x00005590a0e2314e llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) (../../main-github/llvm/build-all/bin/opt+0x86e14e)
>>>   #15 0x00005590a0e3181e main (../../main-github/llvm/build-all/bin/opt+0x87c81e)
>>>   #16 0x00007f3962dc0555 __libc_start_main (/lib64/libc.so.6+0x22555)
>>>   #17 0x00005590a0e1d8a0 _start (../../main-github/llvm/build-all/bin/opt+0x8688a0)
>>>   Segmentation fault (core dumped)
>>>
>>> F27626509: bbi-82827.ll <https://reviews.llvm.org/F27626509>
>>
>> Ping @labrinea
>>
>> Can you take a look at this regression?
>
> It also crashes when using `opt -passes="ipsccp,print<postdomtree>" -mtriple=hexagon bbi-82827.ll -o /dev/null`.
> So it is something with the PostDominatorTree analysis getting messed up?

@aeubanks / @asbirlea : Can you see any obvious mistake here, when it comes to new-PM and analysis passes?

`PostDominatorTreeAnalysis` is preserved (regardless of changes). There is a `FAM.getCachedResult<PostDominatorTreeAnalysis>(F)` that might happen if `getAnalysis` is called(?). But I think the new thing here is that when using BlockFrequencyAnalysis that will run the PostDominatorTreeAnalysis (via BranchProbabilityAnalysis) even if it isn't cached already.

As a workaround(?) might be to comment out `PA.preserve<PostDominatorTreeAnalysis>()`. But I'm not sure it solve the problem completely (the given repoducer no longer crashes at least).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150375/new/

https://reviews.llvm.org/D150375



More information about the llvm-commits mailing list