[clang] Reduce memory usage in AST parent map generation by lazily checking if nodes have been seen (PR #129934)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 11 09:50:37 PDT 2025


higher-performance wrote:

> > Checking in - has everybody had a chance to review this? Can we merge?
> 
> Was @cor3ntin correct here?
> 
> > I think we are a bit confused, so can someone tell me if I'm wrong
> > N is always going to be fairly small (and always 1 in the non-template case)
> > We care about the order of parents
> > We are just trying to avoid duplicate
> > Intrusive linked list

Depends which part you mean, but I don't believe so - I tried to respond to it [here](#issuecomment-2704643649). Ultimately I was saying we can't have an intrusive linked list because of that constraint. The part about "just trying" to avoid duplicates is somewhat ambiguous; the code only seems to want to avoid duplicates nodes that carry memoization data, but not other nodes. It may just be an optimization but I'm not confident enough to say if duplicating those will cause a problem. The part about caring about parent order is true as I've mentioned earlier, and the part about N being small I just don't know -- it probably depends on the codebase and how many parents/ancestors a class has.

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


More information about the cfe-commits mailing list