aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-07-09 16:39:02 +0000
committerGabor Greif <ggreif@gmail.com>2010-07-09 16:39:02 +0000
commitf64f9cf7ec39ae91bca84dc6ad3c8fc3343b358a (patch)
treedfad2780661d4418b570852fb0aacc529b920489
parent02266e29f9250d74c5ec720aff23add3410ae920 (diff)
cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107988 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index 67b3f50e14..4a7b5f7ce5 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -30,9 +30,10 @@ Value *SCEVExpander::ReuseOrCreateCast(Value *V, const Type *Ty,
BasicBlock::iterator IP) {
// Check to see if there is already a cast!
for (Value::use_iterator UI = V->use_begin(), E = V->use_end();
- UI != E; ++UI)
- if ((*UI)->getType() == Ty)
- if (CastInst *CI = dyn_cast<CastInst>(cast<Instruction>(*UI)))
+ UI != E; ++UI) {
+ User *U = *UI;
+ if (U->getType() == Ty)
+ if (CastInst *CI = dyn_cast<CastInst>(cast<Instruction>(U)))
if (CI->getOpcode() == Op) {
// If the cast isn't where we want it, fix it.
if (BasicBlock::iterator(CI) != IP) {
@@ -49,6 +50,7 @@ Value *SCEVExpander::ReuseOrCreateCast(Value *V, const Type *Ty,
rememberInstruction(CI);
return CI;
}
+ }
// Create a new cast.
Instruction *I = CastInst::Create(Op, V, Ty, V->getName(), IP);