summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/BypassSlowDivision.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/BypassSlowDivision.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/BypassSlowDivision.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/BypassSlowDivision.cpp b/llvm/lib/Transforms/Utils/BypassSlowDivision.cpp
index 1cfe3bd5364..7ffdad597a9 100644
--- a/llvm/lib/Transforms/Utils/BypassSlowDivision.cpp
+++ b/llvm/lib/Transforms/Utils/BypassSlowDivision.cpp
@@ -22,6 +22,7 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
+#include "llvm/Support/KnownBits.h"
#include "llvm/Transforms/Utils/Local.h"
using namespace llvm;
@@ -256,14 +257,14 @@ ValueRange FastDivInsertionTask::getValueRange(Value *V,
unsigned HiBits = LongLen - ShortLen;
const DataLayout &DL = SlowDivOrRem->getModule()->getDataLayout();
- APInt Zeros(LongLen, 0), Ones(LongLen, 0);
+ KnownBits Known(LongLen);
- computeKnownBits(V, Zeros, Ones, DL);
+ computeKnownBits(V, Known, DL);
- if (Zeros.countLeadingOnes() >= HiBits)
+ if (Known.Zero.countLeadingOnes() >= HiBits)
return VALRNG_KNOWN_SHORT;
- if (Ones.countLeadingZeros() < HiBits)
+ if (Known.One.countLeadingZeros() < HiBits)
return VALRNG_LIKELY_LONG;
// Long integer divisions are often used in hashtable implementations. It's
OpenPOWER on IntegriCloud