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

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 12:37:40 PDT 2024


aeubanks 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?

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


More information about the llvm-commits mailing list