[llvm] [Transforms] Avoid repeated hash looksup (NFC) (PR #107727)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 7 16:12:14 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/107727
None
>From 64bcebd8a42021a2b3e1b430bb512cb51b6794e9 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 7 Sep 2024 11:35:36 -0700
Subject: [PATCH] [Transforms] Avoid repeated hash looksup (NFC)
---
llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
index c7b88d3c48a69f..2c2400d9dd7a82 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
@@ -139,11 +139,9 @@ static bool processHeaderPhiOperands(BasicBlock *Header, BasicBlock *Latch,
SmallPtrSet<Instruction *, 8> VisitedInstr;
std::function<bool(Instruction * I)> ProcessInstr = [&](Instruction *I) {
- if (VisitedInstr.count(I))
+ if (!VisitedInstr.insert(I).second)
return true;
- VisitedInstr.insert(I);
-
if (AftBlocks.count(I->getParent()))
for (auto &U : I->operands())
if (Instruction *II = dyn_cast<Instruction>(U))
More information about the llvm-commits
mailing list