diff options
author | Dan Gohman <gohman@apple.com> | 2009-08-03 22:07:33 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-08-03 22:07:33 +0000 |
commit | f011f5a8a20dc04cd87eb9ce8ae857299ea91c6b (patch) | |
tree | 45837b51f5056ef4e8d3508ed4d0405ee6d90e06 /llvm/lib/Transforms | |
parent | feb01a100b305be28d698742d50dce1784985cfb (diff) | |
download | bcm5719-llvm-f011f5a8a20dc04cd87eb9ce8ae857299ea91c6b.tar.gz bcm5719-llvm-f011f5a8a20dc04cd87eb9ce8ae857299ea91c6b.zip |
Add a new Constant::getIntegerValue helper function, and convert a
few places in InstCombine to use it, to fix problems handling pointer
types. This fixes the recent llvm-gcc bootstrap error.
llvm-svn: 78005
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 4d2248e2917..b9b4ccb6cfb 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1014,8 +1014,8 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask, if ((DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask) { // all known if ((RHSKnownOne & LHSKnownOne) == RHSKnownOne) { - Constant *AndC = ConstantInt::get(VTy, - ~RHSKnownOne & DemandedMask); + Constant *AndC = Constant::getIntegerValue(VTy, + ~RHSKnownOne & DemandedMask); Instruction *And = BinaryOperator::CreateAnd(I->getOperand(0), AndC, "tmp"); return InsertNewInstBefore(And, *I); @@ -1406,12 +1406,8 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask, // If the client is only demanding bits that we know, return the known // constant. - if ((DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask) { - Constant *C = ConstantInt::get(VTy, RHSKnownOne); - if (isa<PointerType>(V->getType())) - C = ConstantExpr::getIntToPtr(C, V->getType()); - return C; - } + if ((DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask) + return Constant::getIntegerValue(VTy, RHSKnownOne); return false; } |