diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-05-02 09:59:45 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-05-02 09:59:45 +0000 |
commit | 55e7098bbc363473c01229517097d2a04e04e9b0 (patch) | |
tree | c3b240028b5376b8032808b7a52d237f0175c72e /lib/Transforms/Scalar/Reassociate.cpp | |
parent | 0a552d611efe9d1070aff1d35c7f169dd1ab0be7 (diff) | |
download | llvm-55e7098bbc363473c01229517097d2a04e04e9b0.tar.gz llvm-55e7098bbc363473c01229517097d2a04e04e9b0.tar.bz2 llvm-55e7098bbc363473c01229517097d2a04e04e9b0.tar.xz |
The value held in the vector may be RAUW'ed by some of the canonicalization
methods. Use a weak value handle to keep up with this.
PR12245
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155984 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r-- | lib/Transforms/Scalar/Reassociate.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index c4079e37a1..a37cb7c581 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -605,7 +605,8 @@ static unsigned FindInOperandList(SmallVectorImpl<ValueEntry> &Ops, unsigned i, /// EmitAddTreeOfValues - Emit a tree of add instructions, summing Ops together /// and returning the result. Insert the tree before I. -static Value *EmitAddTreeOfValues(Instruction *I, SmallVectorImpl<Value*> &Ops){ +static Value *EmitAddTreeOfValues(Instruction *I, + SmallVectorImpl<WeakVH> &Ops){ if (Ops.size() == 1) return Ops.back(); Value *V1 = Ops.back(); @@ -879,7 +880,7 @@ Value *Reassociate::OptimizeAdd(Instruction *I, // from an expression will drop a use of maxocc, and this can cause // RemoveFactorFromExpression on successive values to behave differently. Instruction *DummyInst = BinaryOperator::CreateAdd(MaxOccVal, MaxOccVal); - SmallVector<Value*, 4> NewMulOps; + SmallVector<WeakVH, 4> NewMulOps; for (unsigned i = 0; i != Ops.size(); ++i) { // Only try to remove factors from expressions we're allowed to. BinaryOperator *BOp = dyn_cast<BinaryOperator>(Ops[i].Op); |