Now that we have contexts on types, convert some more internals to use contexts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75866 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2009-07-16 00:03:07 +00:00
parent 36129dba4f
commit 6687990ca8

View File

@ -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 the PHI node is dead, because it has zero entries, nuke it now.
if (NumOps == 2 && DeletePHIIfEmpty) { if (NumOps == 2 && DeletePHIIfEmpty) {
// If anyone is using this PHI, make them use a dummy value instead... // If anyone is using this PHI, make them use a dummy value instead...
replaceAllUsesWith(UndefValue::get(getType())); replaceAllUsesWith(getType()->getContext().getUndef(getType()));
eraseFromParent(); eraseFromParent();
} }
return Removed; return Removed;
@ -231,7 +231,8 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
if (getIncomingValue(0) != this) // not X = phi X if (getIncomingValue(0) != this) // not X = phi X
return getIncomingValue(0); return getIncomingValue(0);
else else
return UndefValue::get(getType()); // Self cycle is dead. return
getType()->getContext().getUndef(getType()); // Self cycle is dead.
} }
// Otherwise if all of the incoming values are the same for the PHI, replace // Otherwise if all of the incoming values are the same for the PHI, replace
@ -253,7 +254,7 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
// that only has entries for itself. In this case, there is no entry into the // that only has entries for itself. In this case, there is no entry into the
// loop, so kill the PHI. // loop, so kill the PHI.
// //
if (InVal == 0) InVal = UndefValue::get(getType()); if (InVal == 0) InVal = getType()->getContext().getUndef(getType());
// If we have a PHI node like phi(X, undef, X), where X is defined by some // 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 // instruction, we cannot always return X as the result of the PHI node. Only
@ -1045,8 +1046,8 @@ GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI)
GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx, GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
const std::string &Name, Instruction *InBe) const std::string &Name, Instruction *InBe)
: Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)), : Instruction(Ptr->getType()->getContext().getPointerType(
retrieveAddrSpace(Ptr)), checkType(getIndexedType(Ptr->getType(),Idx)), retrieveAddrSpace(Ptr)),
GetElementPtr, GetElementPtr,
OperandTraits<GetElementPtrInst>::op_end(this) - 2, OperandTraits<GetElementPtrInst>::op_end(this) - 2,
2, InBe) { 2, InBe) {
@ -1055,8 +1056,9 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx, GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
const std::string &Name, BasicBlock *IAE) const std::string &Name, BasicBlock *IAE)
: Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)), : Instruction(Ptr->getType()->getContext().getPointerType(
retrieveAddrSpace(Ptr)), checkType(getIndexedType(Ptr->getType(),Idx)),
retrieveAddrSpace(Ptr)),
GetElementPtr, GetElementPtr,
OperandTraits<GetElementPtrInst>::op_end(this) - 2, OperandTraits<GetElementPtrInst>::op_end(this) - 2,
2, IAE) { 2, IAE) {
@ -1268,7 +1270,8 @@ ShuffleVectorInst::ShuffleVectorInst(const ShuffleVectorInst &SV)
ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const std::string &Name, const std::string &Name,
Instruction *InsertBefore) Instruction *InsertBefore)
: Instruction(VectorType::get(cast<VectorType>(V1->getType())->getElementType(), : Instruction(V1->getType()->getContext().getVectorType(
cast<VectorType>(V1->getType())->getElementType(),
cast<VectorType>(Mask->getType())->getNumElements()), cast<VectorType>(Mask->getType())->getNumElements()),
ShuffleVector, ShuffleVector,
OperandTraits<ShuffleVectorInst>::op_begin(this), OperandTraits<ShuffleVectorInst>::op_begin(this),