[PATCH] D92674: [TableGen] Cache two things to improve speed.

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 4 13:41:18 PST 2020


Paul-C-Anagnostopoulos added a comment.

@dblaikie will attest to the fact that I still don't understand the C++ baroque memory management model. It took me awhile to figure out how to use the std::unordered_map.

I presume the extra copy is made each time one of the vectors is returned? Is there an cleverer way to fix this than changing all 221 calls to getAllDerivedDefinitions?

Any backend that works on the instructions and then, in a second step, works with CodeGenTarget, ends up asking for the instruction vector at least twice. One of them, I think InstrInfoEmitter, asks for it three times. getInstructionsByEnumValue helps, but doesn't completely solve the problem. And there are various other subsets of the records, some large, that are requested multiple times: PatFrags, AtomicNoRet, VOP, Commutable_REV.

I should note that timing these changes is rather dicey. The timings vary so much from one run to the next that it's tough to decide whether I'm actually getting anywhere. To convince myself these changes actually helped, I ran various backends at least 30 times each.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92674



More information about the llvm-commits mailing list