[PATCH] optimize MachineBasicBlock::getSymbol a bit

Eli Bendersky eliben at google.com
Thu Apr 18 15:27:39 PDT 2013


MachineBasicBlock::getSymbol gets called quite a lot and was doing a lot of
repetitive work. Most of the symbol remains unchanged between MBBs in the
same function, and yet getSymbol was laboriously reconstructing the full
symbol with a concatenation of Twines. This patch optimizes this away:
MachineFunction caches the symbol "template" for its MBBs and does a
minimal amount of work to generate a new symbol without too much copying.

There's no change in functionality, but this makes
MachineBasicBlock::getSymbol somewhere between 25-50% faster (exact numbers
are hard to obtain for this very internal method).

Please take a look,
Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130418/f5e04fea/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mbb-getsymbol-optimize.1.patch
Type: application/octet-stream
Size: 4336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130418/f5e04fea/attachment.obj>


More information about the llvm-commits mailing list