r351196 - Reduce ASTMatchers stack footprint. Addresses http://llvm.org/PR38851

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 15 07:34:27 PST 2019


Author: alexfh
Date: Tue Jan 15 07:34:26 2019
New Revision: 351196

URL: http://llvm.org/viewvc/llvm-project?rev=351196&view=rev
Log:
Reduce ASTMatchers stack footprint. Addresses http://llvm.org/PR38851

The BoundNodesTreeBuilder class is used both directly and indirectly as a local
variable in matchesAncestorOfRecursively, memoizedMatchesAncestorOfRecursively
and other functions that happen to be on long recursive call paths. By reducing
the inline storage size of the SmallVector we dramatically reduce the stack
requirements of ASTMatchers. Running clang-tidy with a large number of checks
enabled on a few arbitrarily chosen files show no performance regression.

Modified:
    cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=351196&r1=351195&r2=351196&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Tue Jan 15 07:34:26 2019
@@ -261,7 +261,7 @@ public:
   }
 
 private:
-  SmallVector<BoundNodesMap, 16> Bindings;
+  SmallVector<BoundNodesMap, 1> Bindings;
 };
 
 class ASTMatchFinder;




More information about the cfe-commits mailing list