diff options
| author | Gabor Greif <ggreif@gmail.com> | 2010-07-09 16:39:02 +0000 |
|---|---|---|
| committer | Gabor Greif <ggreif@gmail.com> | 2010-07-09 16:39:02 +0000 |
| commit | 3b740e90852664066c02c290823a94100e0f6434 (patch) | |
| tree | 97a82a30e627ece89a19048920798d3633da0da9 /llvm/lib | |
| parent | 6586e9b20308df5864bb0f9d1625b06a1cf6cf23 (diff) | |
| download | bcm5719-llvm-3b740e90852664066c02c290823a94100e0f6434.tar.gz bcm5719-llvm-3b740e90852664066c02c290823a94100e0f6434.zip | |
cache result of operator*
llvm-svn: 107988
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index 67b3f50e142..4a7b5f7ce5e 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/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); |

