[clang] [RecursiveASTVisitor] Do not inline TraverseStmt (NFC) (PR #107601)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 6 08:50:29 PDT 2024
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/107601
As things are now, this reduces size of clang bootstrapped with ThinLTO by 0.3% and reduces thin link time by 0.3%. More importantly, it avoids a large regression once https://github.com/llvm/llvm-project/pull/107114 is merged. Without this change, there would be a 0.4% regression in code size and 4% (!) regression in thin link time. There is no impact on run-time performance.
>From c56f9d8cb3766fd867c4ebd483abedc5a8b88f29 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Fri, 6 Sep 2024 17:45:14 +0200
Subject: [PATCH] [RecursiveASTVisitor] Do not inline TraverseStmt (NFC)
---
clang/include/clang/AST/RecursiveASTVisitor.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 3389670a2ab9d9..634aa8f115b612 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -652,7 +652,10 @@ bool RecursiveASTVisitor<Derived>::PostVisitStmt(Stmt *S) {
#undef DISPATCH_STMT
+// Inlining this method can lead to large code size and compile-time increases
+// without any benefit to runtime performance.
template <typename Derived>
+LLVM_ATTRIBUTE_NOINLINE
bool RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S,
DataRecursionQueue *Queue) {
if (!S)
More information about the cfe-commits
mailing list