[PATCH] D93654: [TableGen] Change getAllDerivedDefinitions() to return an ArrayRef

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 14:27:31 PST 2020


craig.topper added a comment.

In D93654#2470606 <https://reviews.llvm.org/D93654#2470606>, @Paul-C-Anagnostopoulos wrote:

> I'm not sure where to go from here, then. Do you think I should start over, by eliminating the caching and then profiling?
>
> I don't think the caching causes more copies of the vectors, since the one that would have been returned is simply now cached. And additional copying should be reduced as I go through the uses of getAllDerivedDefinitions().

The caching may extend the lifetime of the vector. If it was previously a local variable, it would go out of scope and be deleted when the function ends. Now the caching will keep it around until tablegen exits. So its possible many short lived vectors that didn't have overlapping lifetimes become many long lived objects that do overlap increasing peak memory usage.


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

https://reviews.llvm.org/D93654



More information about the llvm-commits mailing list