diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-02-24 10:15:29 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-02-24 10:15:29 +0000 |
commit | aed352273e8deddea35a6f9b8d4dbc9b98ba04c0 (patch) | |
tree | 6eddcff36bd08acdb134d0c0aed9f4274d71b5ae /llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp | |
parent | 4a705e7ea0cb911d9ec2933b99f5d1f7c1ba9ad3 (diff) | |
download | llvm-aed352273e8deddea35a6f9b8d4dbc9b98ba04c0.zip llvm-aed352273e8deddea35a6f9b8d4dbc9b98ba04c0.tar.gz llvm-aed352273e8deddea35a6f9b8d4dbc9b98ba04c0.tar.bz2 |
[APInt] Add APInt::setBits() method to set all bits in range
The current pattern for setting bits in range is typically:
Mask |= APInt::getBitsSet(MaskSizeInBits, LoPos, HiPos);
Which can be particularly slow for large APInts (MaskSizeInBits > 64) as they require the allocation memory for the temporary variable.
This is one of the key compile time issues identified in PR32037.
This patch adds the APInt::setBits() helper method which avoids the temporary memory allocation completely, this first implementation uses setBit() internally instead but already significantly reduces the regression in PR32037 (~10% drop). Additional optimization may be possible.
I investigated whether there is need for APInt::clearBits() and APInt::flipBits() equivalents but haven't seen these patterns to be particularly common, but reusing the code would be trivial.
Differential Revision: https://reviews.llvm.org/D30265
llvm-svn: 296102
Diffstat (limited to 'llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions