summaryrefslogtreecommitdiff
path: root/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-03-28 18:42:50 +0000
committerChad Rosier <mcrosier@apple.com>2012-03-28 18:42:50 +0000
commit89e2b318e2266a7e3fe44151642c1850ec9bd275 (patch)
tree7e29f88789601fed361a7f0870d4d578429040fd /lib/Analysis/ValueTracking.cpp
parent442ee9c3f7f6b29ff4ca82f3fdd7e20fc9cd5ee4 (diff)
downloadllvm-89e2b318e2266a7e3fe44151642c1850ec9bd275.tar.gz
llvm-89e2b318e2266a7e3fe44151642c1850ec9bd275.tar.bz2
llvm-89e2b318e2266a7e3fe44151642c1850ec9bd275.tar.xz
Revert r153521 as it's causing large regressions on the nightly testers.
Original commit message for r153521 (aka r153423): Use the new range metadata in computeMaskedBits and add a new optimization to instruction simplify that lets us remove an and when loding a boolean value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153587 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ValueTracking.cpp')
-rw-r--r--lib/Analysis/ValueTracking.cpp26
1 files changed, 0 insertions, 26 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 17bad941e5..01e00caa3b 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -20,10 +20,8 @@
#include "llvm/GlobalAlias.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/LLVMContext.h"
-#include "llvm/Metadata.h"
#include "llvm/Operator.h"
#include "llvm/Target/TargetData.h"
-#include "llvm/Support/ConstantRange.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/PatternMatch.h"
@@ -197,26 +195,6 @@ static void ComputeMaskedBitsMul(Value *Op0, Value *Op1, bool NSW,
KnownOne.setBit(BitWidth - 1);
}
-static void computeMaskedBitsLoad(const MDNode &Ranges, const APInt &Mask,
- APInt &KnownZero) {
- unsigned BitWidth = Mask.getBitWidth();
- unsigned NumRanges = Ranges.getNumOperands() / 2;
- assert(NumRanges >= 1);
-
- // Use the high end of the ranges to find leading zeros.
- unsigned MinLeadingZeros = BitWidth;
- for (unsigned i = 0; i < NumRanges; ++i) {
- ConstantInt *Lower = cast<ConstantInt>(Ranges.getOperand(2*i + 0));
- ConstantInt *Upper = cast<ConstantInt>(Ranges.getOperand(2*i + 1));
- ConstantRange Range(Lower->getValue(), Upper->getValue());
- if (Range.isWrappedSet())
- MinLeadingZeros = 0; // -1 has no zeros
- unsigned LeadingZeros = (Upper->getValue() - 1).countLeadingZeros();
- MinLeadingZeros = std::min(LeadingZeros, MinLeadingZeros);
- }
-
- KnownZero = Mask & APInt::getHighBitsSet(BitWidth, MinLeadingZeros);
-}
/// ComputeMaskedBits - Determine which of the bits specified in Mask are
/// known to be either zero or one and return them in the KnownZero/KnownOne
/// bit sets. This code only analyzes bits in Mask, in order to short-circuit
@@ -337,10 +315,6 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
APInt KnownZero2(KnownZero), KnownOne2(KnownOne);
switch (I->getOpcode()) {
default: break;
- case Instruction::Load:
- if (MDNode *MD = cast<LoadInst>(I)->getMetadata(LLVMContext::MD_range))
- computeMaskedBitsLoad(*MD, Mask, KnownZero);
- return;
case Instruction::And: {
// If either the LHS or the RHS are Zero, the result is zero.
ComputeMaskedBits(I->getOperand(1), Mask, KnownZero, KnownOne, TD, Depth+1);