[PATCH] D20401: [Lexer] Don't merge macro args from different macro files

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 19 18:20:37 PDT 2021


nickdesaulniers added a comment.

I know this was sped up slightly in 3339c568c43e4644f02289e5edfc78c860f19c9f, but this change makes `updateConsecutiveMacroArgTokens` the hottest function in clang in a bottom up profile of an entire build of the Linux kernel.  It thrashes the one entry LastFileIDLookup cache, and we end up looking up the same FileID again and again and again for each token when we expand nested function like macros.

Is there anything we can do to speed this up?  Is there any way to record which FileID corresponds to a given Token so that we don't have to keep rematerializing that?  Is it possible to find whether two SourceLocations correspond to the same FileID without having to figure out which FileID in particular each belongs to?

> I discussed this bug with Argyrios off-list, who lgtm'd on the condition that it doesn't introduce a performance regression.

Well, I'd say it's a performance regression, though perhaps reported 5 years too late.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D20401



More information about the cfe-commits mailing list