summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorIvan Krasin <krasin@chromium.org>2016-08-03 00:59:38 +0000
committerIvan Krasin <krasin@chromium.org>2016-08-03 00:59:38 +0000
commit3aade11252bc574105dc5c401b09f2a2efcda0ae (patch)
tree6266c979c609572d481c2bbdf49339719e867bec /llvm/lib
parent287b81d27ba797ff469e79504393909d689f7469 (diff)
downloadbcm5719-llvm-3aade11252bc574105dc5c401b09f2a2efcda0ae.tar.gz
bcm5719-llvm-3aade11252bc574105dc5c401b09f2a2efcda0ae.zip
Add -lowertypetests-bitsets-level to control bitsets generation.
Summary: Sometimes, bitsets could get really large (>300k entries) and we might want to drop a check, as it would have a too much cost. Adding a flag to control how much penalty are we willing to pay for bitsets. Reviewers: kcc Differential Revision: https://reviews.llvm.org/D23088 llvm-svn: 277556
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/IPO/LowerTypeTests.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index 8e343bcbb6e..1d7ad8bc5a4 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -48,6 +48,11 @@ static cl::opt<bool> AvoidReuse(
cl::desc("Try to avoid reuse of byte array addresses using aliases"),
cl::Hidden, cl::init(true));
+static cl::opt<unsigned> BitsetsLevel(
+ "lowertypetests-bitsets-level",
+ cl::desc("Whether to generate bitsets: 0 - never, 1 - only if no loads, 2 - always."),
+ cl::Hidden, cl::init(2));
+
bool BitSetInfo::containsGlobalOffset(uint64_t Offset) const {
if (Offset < ByteOffset)
return false;
@@ -473,8 +478,10 @@ Value *LowerTypeTests::lowerBitSetCall(
Constant *BitSizeConst = ConstantInt::get(IntPtrTy, BSI.BitSize);
Value *OffsetInRange = B.CreateICmpULT(BitOffset, BitSizeConst);
- // If the bit set is all ones, testing against it is unnecessary.
- if (BSI.isAllOnes())
+ // If the bit set is all ones (or we treat it as such), testing against it
+ // is unnecessary.
+ if (BSI.isAllOnes() || BitsetsLevel == 0 ||
+ (BitsetsLevel == 1 && BSI.BitSize > 64))
return OffsetInRange;
TerminatorInst *Term = SplitBlockAndInsertIfThen(OffsetInRange, CI, false);
OpenPOWER on IntegriCloud