aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-31 20:28:14 +0000
committerOwen Anderson <resistor@mac.com>2009-07-31 20:28:14 +0000
commita7235ea7245028a0723e8ab7fd011386b3900777 (patch)
tree4d702ea3baaaeaeaeb5cf194e266a0911882c613 /lib/Analysis/ConstantFolding.cpp
parent2a29899d74476e2a14069af7231ab76d8322a157 (diff)
Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r--lib/Analysis/ConstantFolding.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 12ef0174e4..57e781615a 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -215,7 +215,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy,
SmallVector<Constant*, 32> Result;
if (NumDstElt < NumSrcElt) {
// Handle: bitcast (<4 x i32> <i32 0, i32 1, i32 2, i32 3> to <2 x i64>)
- Constant *Zero = Context.getNullValue(DstEltTy);
+ Constant *Zero = Constant::getNullValue(DstEltTy);
unsigned Ratio = NumSrcElt/NumDstElt;
unsigned SrcBitSize = SrcEltTy->getPrimitiveSizeInBits();
unsigned SrcElt = 0;
@@ -419,7 +419,7 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
if (ElemIdx.ult(APInt(ElemIdx.getBitWidth(),
AT->getNumElements()))) {
Constant *Index[] = {
- Context.getNullValue(CE->getType()),
+ Constant::getNullValue(CE->getType()),
ConstantInt::get(Context, ElemIdx)
};
return
@@ -486,7 +486,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,
// proper extension or truncation.
Constant *C = ConstantExpr::getIntegerCast(CE0->getOperand(0),
IntPtrTy, false);
- Constant *NewOps[] = { C, Context.getNullValue(C->getType()) };
+ Constant *NewOps[] = { C, Constant::getNullValue(C->getType()) };
return ConstantFoldCompareInstOperands(Predicate, NewOps, 2,
Context, TD);
}
@@ -496,7 +496,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,
if (CE0->getOpcode() == Instruction::PtrToInt &&
CE0->getType() == IntPtrTy) {
Constant *C = CE0->getOperand(0);
- Constant *NewOps[] = { C, Context.getNullValue(C->getType()) };
+ Constant *NewOps[] = { C, Constant::getNullValue(C->getType()) };
// FIXME!
return ConstantFoldCompareInstOperands(Predicate, NewOps, 2,
Context, TD);
@@ -543,7 +543,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,
Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
ConstantExpr *CE,
LLVMContext &Context) {
- if (CE->getOperand(1) != Context.getNullValue(CE->getOperand(1)->getType()))
+ if (CE->getOperand(1) != Constant::getNullValue(CE->getOperand(1)->getType()))
return 0; // Do not allow stepping over the value!
// Loop over all of the operands, tracking down which value we are
@@ -558,7 +558,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) {
C = CS->getOperand(El);
} else if (isa<ConstantAggregateZero>(C)) {
- C = Context.getNullValue(STy->getElementType(El));
+ C = Constant::getNullValue(STy->getElementType(El));
} else if (isa<UndefValue>(C)) {
C = UndefValue::get(STy->getElementType(El));
} else {
@@ -571,7 +571,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
if (ConstantArray *CA = dyn_cast<ConstantArray>(C))
C = CA->getOperand(CI->getZExtValue());
else if (isa<ConstantAggregateZero>(C))
- C = Context.getNullValue(ATy->getElementType());
+ C = Constant::getNullValue(ATy->getElementType());
else if (isa<UndefValue>(C))
C = UndefValue::get(ATy->getElementType());
else
@@ -582,7 +582,7 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
if (ConstantVector *CP = dyn_cast<ConstantVector>(C))
C = CP->getOperand(CI->getZExtValue());
else if (isa<ConstantAggregateZero>(C))
- C = Context.getNullValue(PTy->getElementType());
+ C = Constant::getNullValue(PTy->getElementType());
else if (isa<UndefValue>(C))
C = UndefValue::get(PTy->getElementType());
else
@@ -741,7 +741,7 @@ llvm::ConstantFoldCall(Function *F,
if (V >= -0.0)
return ConstantFoldFP(sqrt, V, Ty, Context);
else // Undefined
- return Context.getNullValue(Ty);
+ return Constant::getNullValue(Ty);
}
break;
case 's':