[PATCH] D145791: [MC] Always encode instruction into SmallVector

Alexis Engelke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 10:29:23 PST 2023


aengelke added a comment.

I don't think there are "obviously missed" problems; IMHO the main problem is the abstraction itself, which for every write involves a function call (`raw_ostream::write`, unlikely to be inlined due to size and unlikely to be optimizable as the buffer pointers/mode are mutable members) and an indirect function call (`write_impl`, extremely unlikely to be devirtualized due to general code complexity). The impact of the latter could //probably// be reduced by buffering in `raw_svector_ostream`, but that'd be a substantial and massively breaking change with unknown (and hardly quantifiable) benefits. If you have any suggestions for more generally applicable approaches, I'd be happy to try them; but right now getting rid of the (apparently completely unneeded) abstraction appears to be the easiest, least intrusive, and most performant change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145791



More information about the llvm-commits mailing list