aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 08b4396307..368914652d 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -187,7 +187,7 @@ Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) {
// If the PHI node is dead, because it has zero entries, nuke it now.
if (NumOps == 2 && DeletePHIIfEmpty) {
// If anyone is using this PHI, make them use a dummy value instead...
- replaceAllUsesWith(getType()->getContext().getUndef(getType()));
+ replaceAllUsesWith(UndefValue::get(getType()));
eraseFromParent();
}
return Removed;
@@ -231,8 +231,7 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
if (getIncomingValue(0) != this) // not X = phi X
return getIncomingValue(0);
else
- return
- getType()->getContext().getUndef(getType()); // Self cycle is dead.
+ return UndefValue::get(getType()); // Self cycle is dead.
}
// Otherwise if all of the incoming values are the same for the PHI, replace
@@ -254,7 +253,7 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
// that only has entries for itself. In this case, there is no entry into the
// loop, so kill the PHI.
//
- if (InVal == 0) InVal = getType()->getContext().getUndef(getType());
+ if (InVal == 0) InVal = UndefValue::get(getType());
// If we have a PHI node like phi(X, undef, X), where X is defined by some
// instruction, we cannot always return X as the result of the PHI node. Only