[PATCH] D154781: Revert "[TableGen] Use heap allocated arrays instead of vectors for TreePatternNode::Types and ResultPerm. NFC"

Tomas Matheson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 02:43:15 PDT 2023


tmatheson added a comment.

Thanks, I've done a complete revert for simplicity, but I do think that using `getNumTypes()` etc rather than `Types.size()` was nicer.

My concern with adding the bounds checking to `getExtType` would be that the class is already quite sprawling, and it would only be a matter of time before someone used `Types` directly and raised the same problems. Ideally whatever does the bounds checking should be encapsulated well so that we can be confident it is correct. std::vector accomplishes this already.

I'm not sure what the performance bottlenecks are here but maybe avoiding the allocation in most cases with SmallVector is something to consider too. Or combining the two vectors, since they should always be the same length.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154781



More information about the llvm-commits mailing list