[llvm-branch-commits] [PromoteMem2Reg] Optimize memory usage in PromoteMem2Reg (PR #142474)

Vitaly Buka via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jun 2 13:05:54 PDT 2025


https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/142474

When BasicBlock has a large number of allocas, and
successors, we had to copy entire IncomingVals and
IncomingLocs vectors for successors.

Additional changes in IncomingVals and
IncomingLocs are infrequent (only Load/Store into
alloc affect arrays).

Given the nature of DFS traversal, instead of copying
the entire vector, we can keep track of the changes
and undo all changes done by successors.





More information about the llvm-branch-commits mailing list