[llvm] [Scalar] Avoid repeated hash lookups (NFC) (PR #135751)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 23:15:19 PDT 2025


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

None

>From 2a2fe9881b5da1067115aefb29a4058a17077b80 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 14 Apr 2025 11:05:19 -0700
Subject: [PATCH] [Scalar] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index f98a693804645..299aa3bebe58a 100644
--- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -3332,10 +3332,10 @@ static void computeLiveInValues(DominatorTree &DT, Function &F,
     LiveTmp.set_subtract(Data.KillSet[BB]);
 
     assert(Data.LiveIn.count(BB));
-    const SetVector<Value *> &OldLiveIn = Data.LiveIn[BB];
-    // assert: OldLiveIn is a subset of LiveTmp
-    if (OldLiveIn.size() != LiveTmp.size()) {
-      Data.LiveIn[BB] = LiveTmp;
+    SetVector<Value *> &LiveIn = Data.LiveIn[BB];
+    // assert: LiveIn is a subset of LiveTmp
+    if (LiveIn.size() != LiveTmp.size()) {
+      LiveIn = std::move(LiveTmp);
       Worklist.insert_range(predecessors(BB));
     }
   } // while (!Worklist.empty())



More information about the llvm-commits mailing list