aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/Reassociate.cpp
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-07-12 12:03:02 +0000
committerGabor Greif <ggreif@gmail.com>2010-07-12 12:03:02 +0000
commit110b75aa7572d3b59b308da7ec1d759e86788f97 (patch)
treebbe9c099f0d505a48b9ca8721606c10cee6d0efd /lib/Transforms/Scalar/Reassociate.cpp
parent639e9e47a2b626dbdb67920b21561a381c8d204d (diff)
downloadexternal_llvm-110b75aa7572d3b59b308da7ec1d759e86788f97.zip
external_llvm-110b75aa7572d3b59b308da7ec1d759e86788f97.tar.gz
external_llvm-110b75aa7572d3b59b308da7ec1d759e86788f97.tar.bz2
cache dereferenced iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108138 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 5aca9cd..98452f5 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -407,13 +407,14 @@ static Value *NegateValue(Value *V, Instruction *BI) {
// Okay, we need to materialize a negated version of V with an instruction.
// Scan the use lists of V to see if we have one already.
for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){
- if (!BinaryOperator::isNeg(*UI)) continue;
+ User *U = *UI;
+ if (!BinaryOperator::isNeg(U)) continue;
// We found one! Now we have to make sure that the definition dominates
// this use. We do this by moving it to the entry block (if it is a
// non-instruction value) or right after the definition. These negates will
// be zapped by reassociate later, so we don't need much finesse here.
- BinaryOperator *TheNeg = cast<BinaryOperator>(*UI);
+ BinaryOperator *TheNeg = cast<BinaryOperator>(U);
// Verify that the negate is in this function, V might be a constant expr.
if (TheNeg->getParent()->getParent() != BI->getParent()->getParent())