Skip to content

Commit c35e1f2

Browse files
committed
address review comments
1 parent fc47fa9 commit c35e1f2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mlir/lib/Transforms/Mem2Reg.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ void MemorySlotPromoter::computeReachingDefInRegion(Region *region,
510510
/// Gets or creates a block index mapping for `region`.
511511
static const DenseMap<Block *, size_t> &
512512
getOrCreateBlockIndices(BlockIndexCache &blockIndexCache, Region *region) {
513-
auto [it, created] = blockIndexCache.try_emplace(region);
514-
if (!created)
513+
auto [it, inserted] = blockIndexCache.try_emplace(region);
514+
if (!inserted)
515515
return it->second;
516516

517517
DenseMap<Block *, size_t> &blockIndices = it->second;
@@ -631,8 +631,9 @@ LogicalResult mlir::tryToPromoteMemorySlots(
631631
Mem2RegStatistics statistics) {
632632
bool promotedAny = false;
633633

634-
// Cache for block index maps. This is required to avoid expensive
635-
// recomputations.
634+
// A cache that stores deterministic block indices which are used to determine
635+
// a valid operation modification order. The block index maps are computed
636+
// lazily and cached to avoid expensive recomputation.
636637
BlockIndexCache blockIndexCache;
637638

638639
for (PromotableAllocationOpInterface allocator : allocators) {

0 commit comments

Comments
 (0)