// 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;
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
// 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
return Res;
}
-BinaryOperator *BinaryOperator::CreateNeg(LLVMContext &Context,
- Value *Op, const Twine &Name,
+BinaryOperator *BinaryOperator::CreateNeg(Value *Op, const Twine &Name,
Instruction *InsertBefore) {
Value *zero = ConstantFP::getZeroValueForNegation(Op->getType());
return new BinaryOperator(Instruction::Sub,
Op->getType(), Name, InsertBefore);
}
-BinaryOperator *BinaryOperator::CreateNeg(LLVMContext &Context,
- Value *Op, const Twine &Name,
+BinaryOperator *BinaryOperator::CreateNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd) {
Value *zero = ConstantFP::getZeroValueForNegation(Op->getType());
return new BinaryOperator(Instruction::Sub,
Op->getType(), Name, InsertAtEnd);
}
-BinaryOperator *BinaryOperator::CreateFNeg(LLVMContext &Context,
- Value *Op, const Twine &Name,
+BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name,
Instruction *InsertBefore) {
Value *zero = ConstantFP::getZeroValueForNegation(Op->getType());
return new BinaryOperator(Instruction::FSub,
Op->getType(), Name, InsertBefore);
}
-BinaryOperator *BinaryOperator::CreateFNeg(LLVMContext &Context,
- Value *Op, const Twine &Name,
+BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd) {
Value *zero = ConstantFP::getZeroValueForNegation(Op->getType());
return new BinaryOperator(Instruction::FSub,
Op->getType(), Name, InsertAtEnd);
}
-BinaryOperator *BinaryOperator::CreateNot(LLVMContext &Context,
- Value *Op, const Twine &Name,
+BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
Instruction *InsertBefore) {
Constant *C;
if (const VectorType *PTy = dyn_cast<VectorType>(Op->getType())) {
- C = Context.getAllOnesValue(PTy->getElementType());
+ C = Constant::getAllOnesValue(PTy->getElementType());
C = ConstantVector::get(
std::vector<Constant*>(PTy->getNumElements(), C));
} else {
- C = Context.getAllOnesValue(Op->getType());
+ C = Constant::getAllOnesValue(Op->getType());
}
return new BinaryOperator(Instruction::Xor, Op, C,
Op->getType(), Name, InsertBefore);
}
-BinaryOperator *BinaryOperator::CreateNot(LLVMContext &Context,
- Value *Op, const Twine &Name,
+BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd) {
Constant *AllOnes;
if (const VectorType *PTy = dyn_cast<VectorType>(Op->getType())) {
// Create a vector of all ones values.
- Constant *Elt = Context.getAllOnesValue(PTy->getElementType());
+ Constant *Elt = Constant::getAllOnesValue(PTy->getElementType());
AllOnes = ConstantVector::get(
std::vector<Constant*>(PTy->getNumElements(), Elt));
} else {
- AllOnes = Context.getAllOnesValue(Op->getType());
+ AllOnes = Constant::getAllOnesValue(Op->getType());
}
return new BinaryOperator(Instruction::Xor, Op, AllOnes,