From: Gabor Greif Date: Fri, 9 Jul 2010 12:23:50 +0000 (+0000) Subject: do not repeatedly dereference use_iterator X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=b654435712f3e1345cc40aff99724de9300e5de0;p=oota-llvm.git do not repeatedly dereference use_iterator git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107962 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index c533d6e5e5f..946c3ee0c78 100644 --- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -365,10 +365,11 @@ DbgDeclareInst *InstCombiner::hasOneUsePlusDeclare(Value *V) { return 0; for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) { - if (DbgDeclareInst *DI = dyn_cast(UI)) + User *U = *UI; + if (DbgDeclareInst *DI = dyn_cast(U)) return DI; - if (isa(UI) && UI->hasOneUse()) { - if (DbgDeclareInst *DI = dyn_cast(UI->use_begin())) + if (isa(U) && U->hasOneUse()) { + if (DbgDeclareInst *DI = dyn_cast(U->use_begin())) return DI; } }