[llvm] [IROutliner] Avoid repeated hash lookups (NFC) (PR #107726)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 7 16:11:30 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/107726

None

>From 1cbcdcc309a6b2936c9d4531fbe5906ec064dc2b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 7 Sep 2024 11:57:40 -0700
Subject: [PATCH] [IROutliner] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Transforms/IPO/IROutliner.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index 96c803c0186ef4..aecae7c59afa43 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -1333,11 +1333,10 @@ findExtractedOutputToOverallOutputMapping(Module &M, OutlinableRegion &Region,
       if (!isa<PointerType>(Group.ArgumentTypes[Jdx]))
         continue;
 
-      if (AggArgsUsed.contains(Jdx))
+      if (!AggArgsUsed.insert(Jdx).second)
         continue;
 
       TypeFound = true;
-      AggArgsUsed.insert(Jdx);
       Region.ExtractedArgToAgg.insert(std::make_pair(OriginalIndex, Jdx));
       Region.AggArgToExtracted.insert(std::make_pair(Jdx, OriginalIndex));
       AggArgIdx = Jdx;



More information about the llvm-commits mailing list