From 67894a3d02caa0b4628a942bef923907bbd97c47 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Wed, 14 Apr 2010 16:48:56 +0000 Subject: [PATCH] performance: cache the dereferenced use_iterator git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101253 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/Reg2Mem.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/Scalar/Reg2Mem.cpp b/lib/Transforms/Scalar/Reg2Mem.cpp index 7a6eec3d46b..13222ac2200 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(*UI)->getParent() != BB || - isa(*UI)) + UI != E; ++UI) { + const Instruction *I = cast(*UI); + if (I->getParent() != BB || isa(I)) return true; + } return false; } -- 2.34.1