mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78005 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user