If PrototypeValue is erased in the middle of using the SSAUpdator

then the SSAUpdator may access freed memory.  Instead, simply pass
in the type and name explicitly, which is all that was used anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112699 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands
2010-09-01 10:29:33 +00:00
parent 248e7592b5
commit 4d588bceb0
7 changed files with 25 additions and 25 deletions

View File

@@ -36,9 +36,11 @@ private:
//typedef DenseMap<BasicBlock*, Value*> AvailableValsTy;
void *AV;
/// PrototypeValue is an arbitrary representative value, which we derive names
/// and a type for PHI nodes.
Value *PrototypeValue;
/// ProtoType holds the type of the values being rewritten.
const Type *ProtoType;
// PHI nodes are given a name based on ProtoName.
std::string ProtoName;
/// InsertedPHIs - If this is non-null, the SSAUpdater adds all PHI nodes that
/// it creates to the vector.
@@ -51,8 +53,8 @@ public:
~SSAUpdater();
/// Initialize - Reset this object to get ready for a new set of SSA
/// updates. ProtoValue is the value used to name PHI nodes.
void Initialize(Value *ProtoValue);
/// updates with type 'Ty'. PHI nodes get a name based on 'Name'.
void Initialize(const Type *Ty, StringRef Name);
/// AddAvailableValue - Indicate that a rewritten value is available at the
/// end of the specified block with the specified value.