[llvm] 6a1fd24 - [CodeGen] Avoid repeated hash lookups (NFC) (#131422)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 15 09:12:02 PDT 2025


Author: Kazu Hirata
Date: 2025-03-15T09:11:59-07:00
New Revision: 6a1fd24e9ac0835944eb392a3627c5c636671525

URL: https://github.com/llvm/llvm-project/commit/6a1fd24e9ac0835944eb392a3627c5c636671525
DIFF: https://github.com/llvm/llvm-project/commit/6a1fd24e9ac0835944eb392a3627c5c636671525.diff

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 2510b77c6d5be..a9afc8ff65ea7 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -2772,14 +2772,15 @@ void InstrRefBasedLDV::buildMLocValueMap(
       // visited this pass, if they're not going to be already.
       for (auto *s : MBB->successors()) {
         // Does branching to this successor represent a back-edge?
-        if (BBToOrder[s] > BBToOrder[MBB]) {
+        unsigned Order = BBToOrder[s];
+        if (Order > BBToOrder[MBB]) {
           // No: visit it during this dataflow iteration.
           if (OnWorklist.insert(s).second)
-            Worklist.push(BBToOrder[s]);
+            Worklist.push(Order);
         } else {
           // Yes: visit it on the next iteration.
           if (OnPending.insert(s).second)
-            Pending.push(BBToOrder[s]);
+            Pending.push(Order);
         }
       }
     }
@@ -3349,11 +3350,12 @@ void InstrRefBasedLDV::buildVLocValueMap(
           if (!LiveInIdx.contains(s))
             continue;
 
-          if (BBToOrder[s] > BBToOrder[MBB]) {
+          unsigned Order = BBToOrder[s];
+          if (Order > BBToOrder[MBB]) {
             if (OnWorklist.insert(s).second)
-              Worklist.push(BBToOrder[s]);
+              Worklist.push(Order);
           } else if (OnPending.insert(s).second && (FirstTrip || OLChanged)) {
-            Pending.push(BBToOrder[s]);
+            Pending.push(Order);
           }
         }
       }


        


More information about the llvm-commits mailing list