[llvm] 71cceb1 - [CodeGen] Avoid repeated hash lookups (NFC) (#126852)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 08:45:56 PST 2025


Author: Kazu Hirata
Date: 2025-02-12T08:45:53-08:00
New Revision: 71cceb1439c119385ca65c8a14af8584414831a2

URL: https://github.com/llvm/llvm-project/commit/71cceb1439c119385ca65c8a14af8584414831a2
DIFF: https://github.com/llvm/llvm-project/commit/71cceb1439c119385ca65c8a14af8584414831a2.diff

LOG: [CodeGen] Avoid repeated hash lookups (NFC) (#126852)

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/MachinePipeliner.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/MachinePipeliner.h b/llvm/include/llvm/CodeGen/MachinePipeliner.h
index f95a02aad4559..0362b501ed347 100644
--- a/llvm/include/llvm/CodeGen/MachinePipeliner.h
+++ b/llvm/include/llvm/CodeGen/MachinePipeliner.h
@@ -468,9 +468,10 @@ class NodeSet {
         SUnit *SuccSUnit = Succ.getDst();
         if (V != SuccSUnit)
           continue;
-        if (SUnitToDistance[U] + Succ.getLatency() > SUnitToDistance[V]) {
-          SUnitToDistance[V] = SUnitToDistance[U] + Succ.getLatency();
-        }
+        unsigned &DU = SUnitToDistance[U];
+        unsigned &DV = SUnitToDistance[V];
+        if (DU + Succ.getLatency() > DV)
+          DV = DU + Succ.getLatency();
       }
     }
     // Handle a back-edge in loop carried dependencies


        


More information about the llvm-commits mailing list