summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SSAUpdater.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-09-01 17:29:10 +0000
committerEric Christopher <echristo@apple.com>2010-09-01 17:29:10 +0000
commita5d315c6651ce927fad4e39e873b117e4feb129f (patch)
tree3c4bc7cbc7de13d88503fabe04422a5b0394f0e8 /llvm/lib/Transforms/Utils/SSAUpdater.cpp
parent2bd4cee51646babc4c9f749b6c49bb0a2fdd8f98 (diff)
downloadbcm5719-llvm-a5d315c6651ce927fad4e39e873b117e4feb129f.tar.gz
bcm5719-llvm-a5d315c6651ce927fad4e39e873b117e4feb129f.zip
Speculatively revert 112699 and 112702, they seem to be causing
self host errors on clang-x86-64. llvm-svn: 112719
Diffstat (limited to 'llvm/lib/Transforms/Utils/SSAUpdater.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SSAUpdater.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
index c855988307e..9dc2a1ed38e 100644
--- a/llvm/lib/Transforms/Utils/SSAUpdater.cpp
+++ b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
@@ -29,21 +29,20 @@ static AvailableValsTy &getAvailableVals(void *AV) {
}
SSAUpdater::SSAUpdater(SmallVectorImpl<PHINode*> *NewPHI)
- : AV(0), ProtoType(0), ProtoName(), InsertedPHIs(NewPHI) {}
+ : AV(0), PrototypeValue(0), InsertedPHIs(NewPHI) {}
SSAUpdater::~SSAUpdater() {
delete &getAvailableVals(AV);
}
/// Initialize - Reset this object to get ready for a new set of SSA
-/// updates with type 'Ty'. PHI nodes get a name based on 'Name'.
-void SSAUpdater::Initialize(const Type *Ty, StringRef Name) {
+/// updates. ProtoValue is the value used to name PHI nodes.
+void SSAUpdater::Initialize(Value *ProtoValue) {
if (AV == 0)
AV = new AvailableValsTy();
else
getAvailableVals(AV).clear();
- ProtoType = Ty;
- ProtoName = Name;
+ PrototypeValue = ProtoValue;
}
/// HasValueForBlock - Return true if the SSAUpdater already has a value for
@@ -55,8 +54,8 @@ bool SSAUpdater::HasValueForBlock(BasicBlock *BB) const {
/// AddAvailableValue - Indicate that a rewritten value is available in the
/// specified block with the specified value.
void SSAUpdater::AddAvailableValue(BasicBlock *BB, Value *V) {
- assert(ProtoType != 0 && "Need to initialize SSAUpdater");
- assert(ProtoType == V->getType() &&
+ assert(PrototypeValue != 0 && "Need to initialize SSAUpdater");
+ assert(PrototypeValue->getType() == V->getType() &&
"All rewritten values must have the same type");
getAvailableVals(AV)[BB] = V;
}
@@ -149,7 +148,7 @@ Value *SSAUpdater::GetValueInMiddleOfBlock(BasicBlock *BB) {
// If there are no predecessors, just return undef.
if (PredValues.empty())
- return UndefValue::get(ProtoType);
+ return UndefValue::get(PrototypeValue->getType());
// Otherwise, if all the merged values are the same, just use it.
if (SingularValue != 0)
@@ -169,7 +168,9 @@ Value *SSAUpdater::GetValueInMiddleOfBlock(BasicBlock *BB) {
}
// Ok, we have no way out, insert a new one now.
- PHINode *InsertedPHI = PHINode::Create(ProtoType, ProtoName, &BB->front());
+ PHINode *InsertedPHI = PHINode::Create(PrototypeValue->getType(),
+ PrototypeValue->getName(),
+ &BB->front());
InsertedPHI->reserveOperandSpace(PredValues.size());
// Fill in all the predecessors of the PHI.
@@ -281,14 +282,15 @@ public:
/// GetUndefVal - Get an undefined value of the same type as the value
/// being handled.
static Value *GetUndefVal(BasicBlock *BB, SSAUpdater *Updater) {
- return UndefValue::get(Updater->ProtoType);
+ return UndefValue::get(Updater->PrototypeValue->getType());
}
/// CreateEmptyPHI - Create a new PHI instruction in the specified block.
/// Reserve space for the operands but do not fill them in yet.
static Value *CreateEmptyPHI(BasicBlock *BB, unsigned NumPreds,
SSAUpdater *Updater) {
- PHINode *PHI = PHINode::Create(Updater->ProtoType, Updater->ProtoName,
+ PHINode *PHI = PHINode::Create(Updater->PrototypeValue->getType(),
+ Updater->PrototypeValue->getName(),
&BB->front());
PHI->reserveOperandSpace(NumPreds);
return PHI;
OpenPOWER on IntegriCloud