aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp14
-rw-r--r--lib/Transforms/Scalar/DCE.cpp4
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp2
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp2
4 files changed, 10 insertions, 12 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index a73b4616f6..181ff70657 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -386,7 +386,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
ValueHandle IHandle(VMC, I); // Prevent I from being removed!
- Constant *Dummy = Constant::getNullConstant(Ty);
+ Constant *Dummy = Constant::getNullValue(Ty);
switch (I->getOpcode()) {
case Instruction::Cast:
@@ -415,7 +415,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
LoadInst *LI = cast<LoadInst>(I);
assert(!LI->hasIndices() || AllIndicesZero(LI));
- Res = new LoadInst(Constant::getNullConstant(PointerType::get(Ty)), Name);
+ Res = new LoadInst(Constant::getNullValue(PointerType::get(Ty)), Name);
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(LI->getPointerOperand(),
PointerType::get(Ty), VMC));
@@ -499,7 +499,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
Indices, &It);
if (ElTy) {
assert(ElTy == PVTy && "Internal error, setup wrong!");
- Res = new GetElementPtrInst(Constant::getNullConstant(NewSrcTy),
+ Res = new GetElementPtrInst(Constant::getNullValue(NewSrcTy),
Indices, Name);
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),
@@ -514,7 +514,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
//
if (Res == 0) {
const PointerType *NewSrcTy = PointerType::get(PVTy);
- Res = new GetElementPtrInst(Constant::getNullConstant(NewSrcTy),
+ Res = new GetElementPtrInst(Constant::getNullValue(NewSrcTy),
GEP->copyIndices(), Name);
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),
@@ -925,7 +925,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
const Type *NewTy = NewVal->getType();
Constant *Dummy = (NewTy != Type::VoidTy) ?
- Constant::getNullConstant(NewTy) : 0;
+ Constant::getNullValue(NewTy) : 0;
switch (I->getOpcode()) {
case Instruction::Cast:
@@ -1001,7 +1001,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
case Instruction::Store: {
if (I->getOperand(0) == OldVal) { // Replace the source value
const PointerType *NewPT = PointerType::get(NewTy);
- Res = new StoreInst(NewVal, Constant::getNullConstant(NewPT));
+ Res = new StoreInst(NewVal, Constant::getNullValue(NewPT));
VMC.ExprMap[I] = Res;
Res->setOperand(1, ConvertExpressionToType(I->getOperand(1), NewPT, VMC));
} else { // Replace the source pointer
@@ -1015,7 +1015,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
assert(Offset == 0 && ValTy);
}
- Res = new StoreInst(Constant::getNullConstant(ValTy), NewVal, Indices);
+ Res = new StoreInst(Constant::getNullValue(ValTy), NewVal, Indices);
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0), ValTy, VMC));
}
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index c48fa2f3f7..6169730ce8 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -108,10 +108,8 @@ static bool RemoveSingularPHIs(BasicBlock *BB) {
}
static void ReplaceUsesWithConstant(Instruction *I) {
- Constant *CPV = Constant::getNullConstant(I->getType());
-
// Make all users of this instruction reference the constant instead
- I->replaceAllUsesWith(CPV);
+ I->replaceAllUsesWith(Constant::getNullValue(I->getType()));
}
// PropogatePredecessors - This gets "Succ" ready to have the predecessors from
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index e852452d75..a388025531 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -101,7 +101,7 @@ static bool TransformLoop(cfg::LoopInfo *Loops, cfg::Loop *Loop) {
assert(PI == pred_end(Header) && "Loop headers should have 2 preds!");
// Add incoming values for the PHI node...
- PN->addIncoming(Constant::getNullConstant(Type::UIntTy), Incoming);
+ PN->addIncoming(Constant::getNullValue(Type::UIntTy), Incoming);
PN->addIncoming(Add, BackEdgeBlock);
// Analyze the new induction variable...
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 311ceae441..c2fa84c21f 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -123,7 +123,7 @@ Instruction *InstCombiner::visitSub(BinaryOperator *I) {
//
if (Constant *Op2 = dyn_cast<Constant>(I->getOperand(1)))
// Calculate 0 - RHS
- if (Constant *RHS = *Constant::getNullConstant(I->getType()) - *Op2) {
+ if (Constant *RHS = *Constant::getNullValue(I->getType()) - *Op2) {
return BinaryOperator::create(Instruction::Add, I->getOperand(0), RHS,
I->getName());
}