Skip to content

Commit 42494e5

Browse files
[Transforms] Avoid repeated hash lookups (NFC) (#108322)
1 parent 67e7f05 commit 42494e5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mlir/lib/Transforms/Mem2Reg.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,8 @@ SmallPtrSet<Block *, 16> MemorySlotPromotionAnalyzer::computeSlotLiveIn(
343343
// blocks.
344344
SmallPtrSet<Block *, 16> visited;
345345
for (Operation *user : slot.ptr.getUsers()) {
346-
if (visited.contains(user->getBlock()))
346+
if (!visited.insert(user->getBlock()).second)
347347
continue;
348-
visited.insert(user->getBlock());
349348

350349
for (Operation &op : user->getBlock()->getOperations()) {
351350
if (auto memOp = dyn_cast<PromotableMemOpInterface>(op)) {

0 commit comments

Comments
 (0)