[PATCH] D82771: [ASTMatcher] Fix a performance regression: memorize the child match.

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 30 01:35:11 PDT 2020


klimek added a comment.

In D82771#2121924 <https://reviews.llvm.org/D82771#2121924>, @hokein wrote:

> In D82771#2120214 <https://reviews.llvm.org/D82771#2120214>, @klimek wrote:
>
> > In what situation are we calling child matchers repeatedly with the same matcher on the same node?
>
>
> I guess a pattern like https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp#L29-L40?


Ah, so this is when we go hasDeclaration.

I'm wondering whether what we really want to memoize are matchers that go across the AST, like hasType, hasDeclaration, etc, where we can expect a linear number of nodes hitting that  matcher.

hasChild specifically seems weird to memoize when we don't memoize other has matchers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82771/new/

https://reviews.llvm.org/D82771





More information about the cfe-commits mailing list