[llvm] [IPO] Avoid repeated hash lookups (NFC) (PR #130462)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 8 20:07:23 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/130462
None
>From 7fb213f0b46d6e74e4f7c8de4b02ee08d14ae68e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 8 Mar 2025 01:08:39 -0800
Subject: [PATCH] [IPO] Avoid repeated hash lookups (NFC)
---
llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 6fe81f7b063ec..1fca1b54065d4 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -406,15 +406,16 @@ static FunctionSummary *calculatePrevailingSummary(
}
}
+ auto &CPS = CachedPrevailingSummary[VI];
if (Local) {
assert(!Prevailing);
- CachedPrevailingSummary[VI] = Local;
+ CPS = Local;
} else if (Prevailing) {
assert(!Local);
- CachedPrevailingSummary[VI] = Prevailing;
+ CPS = Prevailing;
}
- return CachedPrevailingSummary[VI];
+ return CPS;
}
bool llvm::thinLTOPropagateFunctionAttrs(
More information about the llvm-commits
mailing list