[clang] [RecursiveASTVisitor] Do not inline TraverseStmt (NFC) (PR #107601)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 6 08:51:00 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Nikita Popov (nikic)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/107601.diff


1 Files Affected:

- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+3) 


``````````diff
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)

``````````

</details>


https://github.com/llvm/llvm-project/pull/107601


More information about the cfe-commits mailing list