[Mlir-commits] [mlir] [MLIR][Mem2Reg] Improve performance by avoiding recomputations (PR #91444)

Tobias Gysi llvmlistbot at llvm.org
Wed May 8 01:55:52 PDT 2024


================
@@ -500,15 +507,29 @@ void MemorySlotPromoter::computeReachingDefInRegion(Region *region,
   }
 }
 
+/// Gets or creates a block index mapping for `region`.
+static const DenseMap<Block *, size_t> &
+getOrCreateBlockIndices(BlockIndexCache &blockIndexCache, Region *region) {
+  auto [it, created] = blockIndexCache.try_emplace(region);
----------------
gysit wrote:

```suggestion
  auto [it, inserted] = blockIndexCache.try_emplace(region);
```
ultra nit: I think this is the standard naming convention for the result of a try_emplace.

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


More information about the Mlir-commits mailing list