[PATCH] D92674: [TableGen] Cache the vectors of records returned by getAllDerivedDefinitions().

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 11:40:34 PST 2020


Paul-C-Anagnostopoulos added inline comments.


================
Comment at: llvm/lib/TableGen/Record.cpp:2600
+// the same vectors multiple times.
 std::vector<Record *> RecordKeeper::getAllDerivedDefinitions(
+    StringRef ClassName) const {
----------------
dblaikie wrote:
> Now that the result is cached, perhaps this function could return by const ref instead of by value, to avoid unnecessary copies of the resulting vector?
The vector must be copied, because there is nothing stopping the caller from modifying it.

Do you think it's worth the effort to establish the rule that it cannot be modified and then investigate every call to see what's going on?



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