[llvm] ec7a5b4 - [Option] Mark getLastArg(NoClaim) as noinline. (#157163)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 16 13:52:30 PDT 2025
Author: Florian Hahn
Date: 2025-09-16T20:52:26Z
New Revision: ec7a5b4028d192bf1f674554ffd2cfab5ae31412
URL: https://github.com/llvm/llvm-project/commit/ec7a5b4028d192bf1f674554ffd2cfab5ae31412
DIFF: https://github.com/llvm/llvm-project/commit/ec7a5b4028d192bf1f674554ffd2cfab5ae31412.diff
LOG: [Option] Mark getLastArg(NoClaim) as noinline. (#157163)
After https://github.com/llvm/llvm-project/pull/156730,
getLastArg(NoClaim) are now just below the inlining threshold and
inlining them causes +0.44% code size increase for Clang and a
corresponding compile-time increase without helping compile-time.
Mark them as noinline to recover the original codesize.
http://llvm-compile-time-tracker.com/compare.php?from=a271d07488a85ce677674bbe8101b10efff58c95&to=3b7b312476da2a2b1fd44815532edf9987da337e&stat=instructions:u
PR: https://github.com/llvm/llvm-project/pull/157163
Added:
Modified:
llvm/include/llvm/Option/ArgList.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Option/ArgList.h b/llvm/include/llvm/Option/ArgList.h
index 313164bc29689..3e80574355b87 100644
--- a/llvm/include/llvm/Option/ArgList.h
+++ b/llvm/include/llvm/Option/ArgList.h
@@ -253,8 +253,8 @@ class ArgList {
}
/// Return the last argument matching \p Id, or null.
- template<typename ...OptSpecifiers>
- Arg *getLastArg(OptSpecifiers ...Ids) const {
+ template <typename... OptSpecifiers>
+ LLVM_ATTRIBUTE_NOINLINE Arg *getLastArg(OptSpecifiers... Ids) const {
Arg *Res = nullptr;
for (Arg *A : filtered(Ids...)) {
Res = A;
@@ -265,8 +265,8 @@ class ArgList {
/// Return the last argument matching \p Id, or null. Do not "claim" the
/// option (don't mark it as having been used).
- template<typename ...OptSpecifiers>
- Arg *getLastArgNoClaim(OptSpecifiers ...Ids) const {
+ template <typename... OptSpecifiers>
+ LLVM_ATTRIBUTE_NOINLINE Arg *getLastArgNoClaim(OptSpecifiers... Ids) const {
for (Arg *A : filtered_reverse(Ids...))
return A;
return nullptr;
More information about the llvm-commits
mailing list