[llvm] [BasicBlockUtils] Remove redundant llvm.dbg instructions after blocks to reduce compile time (PR #89069)

via llvm-commits llvm-commits at lists.llvm.org
Sun May 5 18:13:12 PDT 2024


coderchenlin wrote:

> seems like we're doing a linear scan of dbg instructions every time we call `MergeBlockIntoPredecessor`, which otherwise looks to be more constant-time-ish in the number of instructions in the block than linear-time-ish. the compile time blow-up is in SimplifyCFG, and the call to `MergeBlockIntoPredecessor` in `SimplifyCFGOpt::simplifyOnce` is probably the issue.
> 
> the call to `RemoveRedundantDbgInstrs` should probably be somewhere more targeted, rather than something commonly called like `MergeBlockIntoPredecessor` that may be called on blocks containing some set of instructions multiple times. e.g. once per-block in some pass that doesn't modify the CFG, or once after the CFG is finalized.
> 
> can we revert this and then land a more targeted solution?

Thanks for the new case, I will try to find another way to fix the original case. @slackito @aeubanks 

https://github.com/llvm/llvm-project/pull/89069


More information about the llvm-commits mailing list