davrec added a comment. In D128113#3733764 <https://reviews.llvm.org/D128113#3733764>, @mizvekov wrote:
> In D128113#3733051 <https://reviews.llvm.org/D128113#3733051>, @joanahalili > wrote: > >> We have a translation unit, on which we see an increase of compilation time >> and clang memory allocation from 11GB to 14GB. We are working on an isolated >> case. > > Thanks for looking into this! > > What I can imagine may be happening here is that if we instantiate a template > with a very large argument pack consisting of mostly the same template > arguments, we will create many more `SubstTemplateTypeParmType` nodes with > this patch, as they won't unique so much anymore, because each will have a > different pack index. If this is indeed a major problem, and/or if performance is an issue for other of the patches in the stack, maybe the solution is along the lines of what I raised in https://discourse.llvm.org/t/rfc-improving-diagnostics-with-template-specialization-resugaring/64294/5: introduce an option that determines how much sugar we construct in the AST, and modify `ASTContext::get*Type(...)` accordingly. For now it could have two possible values, 'medium' and 'maximum', and `getSubstTemplateTypeParmType(...)` could be modified so it always uses PackIndex=0 whenever it is only set to 'medium'. And, for later patches, resugaring would only be enabled when it is set to 'maximum'. (And maybe later a 'minimum' option could be experimented with which disables all sugar except that needed to keep tests passing.) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128113/new/ https://reviews.llvm.org/D128113 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits