diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-24 23:12:02 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-24 23:12:02 +0000 |
commit | edb4a703255623eef2c56e644f9fdc04cadd7336 (patch) | |
tree | 0ef285683687c1c927ff68af16d77b3645e0d66d /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | fcd54f73bf465f9fa7a820344642f848b5285a3b (diff) | |
download | llvm-edb4a703255623eef2c56e644f9fdc04cadd7336.zip llvm-edb4a703255623eef2c56e644f9fdc04cadd7336.tar.gz llvm-edb4a703255623eef2c56e644f9fdc04cadd7336.tar.bz2 |
Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
llvm-svn: 77011
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index d60b4f6..7ac8b97 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -113,7 +113,7 @@ static Constant *SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0, if (IsConstantOffsetFromGlobal(Op1, GV2, Offs2, *TD) && GV1 == GV2) { // (&GV+C1) - (&GV+C2) -> C1-C2, pointer arithmetic cannot overflow. - return Context.getConstantInt(Op0->getType(), Offs1-Offs2); + return ConstantInt::get(Op0->getType(), Offs1-Offs2); } } @@ -151,7 +151,7 @@ static Constant *SymbolicallyEvaluateGEP(Constant* const* Ops, unsigned NumOps, uint64_t Offset = TD->getIndexedOffset(Ptr->getType(), (Value**)Ops+1, NumOps-1); - Constant *C = Context.getConstantInt(TD->getIntPtrType(), Offset+BasePtr); + Constant *C = ConstantInt::get(TD->getIntPtrType(), Offset+BasePtr); return Context.getConstantExprIntToPtr(C, ResultTy); } @@ -232,7 +232,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy, // Shift it to the right place, depending on endianness. Src = Context.getConstantExprShl(Src, - Context.getConstantInt(Src->getType(), ShiftAmt)); + ConstantInt::get(Src->getType(), ShiftAmt)); ShiftAmt += isLittleEndian ? SrcBitSize : -SrcBitSize; // Mix it in. @@ -255,7 +255,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy, // Shift the piece of the value into the right place, depending on // endianness. Constant *Elt = Context.getConstantExprLShr(Src, - Context.getConstantInt(Src->getType(), ShiftAmt)); + ConstantInt::get(Src->getType(), ShiftAmt)); ShiftAmt += isLittleEndian ? DstBitSize : -DstBitSize; // Truncate and remember this piece. @@ -376,7 +376,7 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy, unsigned InWidth = Input->getType()->getScalarSizeInBits(); if (TD->getPointerSizeInBits() < InWidth) { Constant *Mask = - Context.getConstantInt(APInt::getLowBitsSet(InWidth, + ConstantInt::get(Context, APInt::getLowBitsSet(InWidth, TD->getPointerSizeInBits())); Input = Context.getConstantExprAnd(Input, Mask); } @@ -420,7 +420,7 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy, AT->getNumElements()))) { Constant *Index[] = { Context.getNullValue(CE->getType()), - Context.getConstantInt(ElemIdx) + ConstantInt::get(Context, ElemIdx) }; return Context.getConstantExprGetElementPtr(GV, &Index[0], 2); @@ -801,13 +801,13 @@ llvm::ConstantFoldCall(Function *F, } } else if (ConstantInt *Op = dyn_cast<ConstantInt>(Operands[0])) { if (Len > 11 && !memcmp(Str, "llvm.bswap", 10)) - return Context.getConstantInt(Op->getValue().byteSwap()); + return ConstantInt::get(Context, Op->getValue().byteSwap()); else if (Len > 11 && !memcmp(Str, "llvm.ctpop", 10)) - return Context.getConstantInt(Ty, Op->getValue().countPopulation()); + return ConstantInt::get(Ty, Op->getValue().countPopulation()); else if (Len > 10 && !memcmp(Str, "llvm.cttz", 9)) - return Context.getConstantInt(Ty, Op->getValue().countTrailingZeros()); + return ConstantInt::get(Ty, Op->getValue().countTrailingZeros()); else if (Len > 10 && !memcmp(Str, "llvm.ctlz", 9)) - return Context.getConstantInt(Ty, Op->getValue().countLeadingZeros()); + return ConstantInt::get(Ty, Op->getValue().countLeadingZeros()); } } else if (NumOperands == 2) { if (ConstantFP *Op1 = dyn_cast<ConstantFP>(Operands[0])) { |