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 | 274ba89d77c8dd1dd767be925b0a14de117e2003 (patch) | |
tree | 70499b052c9a9a9a8f118d80604ad11b3ebe35a4 /llvm/lib/Transforms | |
parent | 0fc56890bafbc244f8b48b81f2cd9d50326637e9 (diff) | |
download | bcm5719-llvm-274ba89d77c8dd1dd767be925b0a14de117e2003.tar.gz bcm5719-llvm-274ba89d77c8dd1dd767be925b0a14de117e2003.zip |
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
llvm-svn: 155984
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index c4079e37a11..a37cb7c581f 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/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); |