[Mlir-commits] [mlir] [MLIR][Mem2Reg] Improve performance by avoiding recomputations (PR #91444)
Tobias Gysi
llvmlistbot at llvm.org
Wed May 8 01:55:53 PDT 2024
================
@@ -605,20 +627,24 @@ void MemorySlotPromoter::promoteSlot() {
LogicalResult mlir::tryToPromoteMemorySlots(
ArrayRef<PromotableAllocationOpInterface> allocators, OpBuilder &builder,
- const DataLayout &dataLayout, Mem2RegStatistics statistics) {
+ const DataLayout &dataLayout, DominanceInfo &dominance,
+ Mem2RegStatistics statistics) {
bool promotedAny = false;
+ // Cache for block index maps. This is required to avoid expensive
+ // recomputations.
+ BlockIndexCache blockIndexCache;
+
for (PromotableAllocationOpInterface allocator : allocators) {
----------------
gysit wrote:
This sounds like a reasonable follow up step to me. The advantage is that the block indices could be cached longer and the possible disadvantage is that `tryToPromoteMemorySlots` always promotes all allocas of the region (which today we do anyways)? Are there other trade-offs?
https://github.com/llvm/llvm-project/pull/91444
More information about the Mlir-commits
mailing list