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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 13 20:25:53 PDT 2025


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

None

>From 659168452fb83f57d8ce5429b74803ee736431d9 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 13 Apr 2025 15:56:54 -0700
Subject: [PATCH] [Scalar] Avoid repeated hash lookups (NFC)

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

diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index 22d41be4edb90..f98a693804645 100644
--- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -3287,8 +3287,9 @@ static void computeLiveInValues(DominatorTree &DT, Function &F,
   // Seed the liveness for each individual block
   for (BasicBlock &BB : F) {
     Data.KillSet[&BB] = computeKillSet(&BB, GC);
-    Data.LiveSet[&BB].clear();
-    computeLiveInValues(BB.rbegin(), BB.rend(), Data.LiveSet[&BB], GC);
+    auto &LiveSet = Data.LiveSet[&BB];
+    LiveSet.clear();
+    computeLiveInValues(BB.rbegin(), BB.rend(), LiveSet, GC);
 
 #ifndef NDEBUG
     for (Value *Kill : Data.KillSet[&BB])



More information about the llvm-commits mailing list