[llvm] 2620742 - [Utils] Avoid repeated hash lookups (NFC) (#130892)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 12 08:49:39 PDT 2025


Author: Kazu Hirata
Date: 2025-03-12T08:49:35-07:00
New Revision: 2620742bf61e8ad5fdc6b245bee31ec341ef46b4

URL: https://github.com/llvm/llvm-project/commit/2620742bf61e8ad5fdc6b245bee31ec341ef46b4
DIFF: https://github.com/llvm/llvm-project/commit/2620742bf61e8ad5fdc6b245bee31ec341ef46b4.diff

LOG: [Utils] Avoid repeated hash lookups (NFC) (#130892)

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
index 054b0ba2ba664..8470f0333d249 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
@@ -400,9 +400,10 @@ llvm::UnrollAndJamLoop(Loop *L, unsigned Count, unsigned TripCount,
       Last = New;
       for (ValueToValueMapTy::iterator VI = VMap.begin(), VE = VMap.end();
            VI != VE; ++VI) {
+        auto &LVM = LastValueMap[VI->first];
         PrevItValueMap[VI->second] =
-            const_cast<Value *>(It == 1 ? VI->first : LastValueMap[VI->first]);
-        LastValueMap[VI->first] = VI->second;
+            const_cast<Value *>(It == 1 ? VI->first : LVM);
+        LVM = VI->second;
       }
 
       NewBlocks.push_back(New);


        


More information about the llvm-commits mailing list