diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-04-14 16:48:56 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-04-14 16:48:56 +0000 |
commit | 67894a3d02caa0b4628a942bef923907bbd97c47 (patch) | |
tree | d166a7a6be6f352364454fc559e3ecf185f59359 /lib/Transforms | |
parent | de4c0a7da7cfa1693ad9e6e09969003b610af08a (diff) |
performance: cache the dereferenced use_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/Reg2Mem.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/Reg2Mem.cpp b/lib/Transforms/Scalar/Reg2Mem.cpp index 7a6eec3d46..13222ac220 100644 --- a/lib/Transforms/Scalar/Reg2Mem.cpp +++ b/lib/Transforms/Scalar/Reg2Mem.cpp @@ -46,10 +46,11 @@ namespace { bool valueEscapes(const Instruction *Inst) const { const BasicBlock *BB = Inst->getParent(); for (Value::const_use_iterator UI = Inst->use_begin(),E = Inst->use_end(); - UI != E; ++UI) - if (cast<Instruction>(*UI)->getParent() != BB || - isa<PHINode>(*UI)) + UI != E; ++UI) { + const Instruction *I = cast<Instruction>(*UI); + if (I->getParent() != BB || isa<PHINode>(I)) return true; + } return false; } |