From a1db9f2451ad3b036e1615808e46f745edb5c8d6 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 5 Sep 2025 13:18:42 +0100 Subject: [PATCH 1/2] [Option] Mark getLastArg(NoClaim) as noinline. 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 --- llvm/include/llvm/Option/ArgList.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/Option/ArgList.h b/llvm/include/llvm/Option/ArgList.h index 313164bc29689..1d316633027cf 100644 --- a/llvm/include/llvm/Option/ArgList.h +++ b/llvm/include/llvm/Option/ArgList.h @@ -254,7 +254,7 @@ class ArgList { /// Return the last argument matching \p Id, or null. template - Arg *getLastArg(OptSpecifiers ...Ids) const { + LLVM_ATTRIBUTE_NOINLINE Arg * getLastArg(OptSpecifiers ...Ids) const { Arg *Res = nullptr; for (Arg *A : filtered(Ids...)) { Res = A; @@ -266,7 +266,7 @@ 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 - Arg *getLastArgNoClaim(OptSpecifiers ...Ids) const { + LLVM_ATTRIBUTE_NOINLINE Arg * getLastArgNoClaim(OptSpecifiers ...Ids) const { for (Arg *A : filtered_reverse(Ids...)) return A; return nullptr; From 16c1cad229d372da219ecebe19e647eccfb860e4 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 5 Sep 2025 20:39:23 +0100 Subject: [PATCH 2/2] !fixup fix formatting --- llvm/include/llvm/Option/ArgList.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/include/llvm/Option/ArgList.h b/llvm/include/llvm/Option/ArgList.h index 1d316633027cf..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 - LLVM_ATTRIBUTE_NOINLINE Arg * getLastArg(OptSpecifiers ...Ids) const { + template + 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 - LLVM_ATTRIBUTE_NOINLINE Arg * getLastArgNoClaim(OptSpecifiers ...Ids) const { + template + LLVM_ATTRIBUTE_NOINLINE Arg *getLastArgNoClaim(OptSpecifiers... Ids) const { for (Arg *A : filtered_reverse(Ids...)) return A; return nullptr;