[llvm] [Scalar] Use std::move (NFC) (PR #136264)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 11:59:43 PDT 2025


https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/136264

>From 9fbdc60f24cbc244964fd35f38adfa98ac0963e4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 17 Apr 2025 23:03:39 -0700
Subject: [PATCH 1/2] [Scalar] Use std::move (NFC)

---
 llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index 7eee0283e20e6..c6778cc8cc459 100644
--- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -3327,7 +3327,7 @@ static void computeLiveInValues(DominatorTree &DT, Function &F,
     Data.LiveOut[BB] = LiveOut;
 
     // Apply the effects of this basic block
-    SetVector<Value *> LiveTmp = LiveOut;
+    SetVector<Value *> LiveTmp = std::move(LiveOut);
     LiveTmp.set_union(Data.LiveSet[BB]);
     LiveTmp.set_subtract(Data.KillSet[BB]);
 

>From c7d7e6bd54f4ac58eec8f9bf963ec817c92aa44c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 18 Apr 2025 11:59:05 -0700
Subject: [PATCH 2/2] Address a comment.

---
 llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index c6778cc8cc459..8005be8d4ca05 100644
--- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -3311,7 +3311,7 @@ static void computeLiveInValues(DominatorTree &DT, Function &F,
 
     // Compute our new liveout set, then exit early if it hasn't changed despite
     // the contribution of our successor.
-    SetVector<Value *> LiveOut = Data.LiveOut[BB];
+    SetVector<Value *> &LiveOut = Data.LiveOut[BB];
     const auto OldLiveOutSize = LiveOut.size();
     for (BasicBlock *Succ : successors(BB)) {
       assert(Data.LiveIn.count(Succ));
@@ -3324,10 +3324,9 @@ static void computeLiveInValues(DominatorTree &DT, Function &F,
       // hasn't changed.
       continue;
     }
-    Data.LiveOut[BB] = LiveOut;
 
     // Apply the effects of this basic block
-    SetVector<Value *> LiveTmp = std::move(LiveOut);
+    SetVector<Value *> LiveTmp = LiveOut;
     LiveTmp.set_union(Data.LiveSet[BB]);
     LiveTmp.set_subtract(Data.KillSet[BB]);
 



More information about the llvm-commits mailing list