[clang] 6d3f6c2 - [RecursiveASTVisitor] Do not inline TraverseStmt (NFC) (#107601)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 16 00:49:24 PDT 2024


Author: Nikita Popov
Date: 2024-09-16T09:49:21+02:00
New Revision: 6d3f6c2170dd60e86743c205e33ead2f455656b4

URL: https://github.com/llvm/llvm-project/commit/6d3f6c2170dd60e86743c205e33ead2f455656b4
DIFF: https://github.com/llvm/llvm-project/commit/6d3f6c2170dd60e86743c205e33ead2f455656b4.diff

LOG: [RecursiveASTVisitor] Do not inline TraverseStmt (NFC) (#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.

Added: 
    

Modified: 
    clang/include/clang/AST/RecursiveASTVisitor.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 3389670a2ab9d9..cd9947f7ab9805 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -652,9 +652,11 @@ 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>
-bool RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S,
-                                                DataRecursionQueue *Queue) {
+LLVM_ATTRIBUTE_NOINLINE bool
+RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S, DataRecursionQueue *Queue) {
   if (!S)
     return true;
 


        


More information about the cfe-commits mailing list