[llvm] 2d8cd32 - [InstCombine] Avoid repeated hash lookups (NFC) (#111618)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 20:37:36 PDT 2024


Author: Kazu Hirata
Date: 2024-10-08T20:37:33-07:00
New Revision: 2d8cd32ae5a69a9f3baaeca18a8318115586b3b8

URL: https://github.com/llvm/llvm-project/commit/2d8cd32ae5a69a9f3baaeca18a8318115586b3b8
DIFF: https://github.com/llvm/llvm-project/commit/2d8cd32ae5a69a9f3baaeca18a8318115586b3b8.diff

LOG: [InstCombine] Avoid repeated hash lookups (NFC) (#111618)

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 6c3fc987d9add2..d1eb84b5ca5c10 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -602,8 +602,9 @@ static Value *rewriteGEPAsOffset(Value *Start, Value *Base, GEPNoWrapFlags NW,
       for (unsigned I = 0, E = PHI->getNumIncomingValues(); I < E; ++I) {
         Value *NewIncoming = PHI->getIncomingValue(I);
 
-        if (NewInsts.contains(NewIncoming))
-          NewIncoming = NewInsts[NewIncoming];
+        auto It = NewInsts.find(NewIncoming);
+        if (It != NewInsts.end())
+          NewIncoming = It->second;
 
         NewPhi->addIncoming(NewIncoming, PHI->getIncomingBlock(I));
       }


        


More information about the llvm-commits mailing list