diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-07-09 12:23:50 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-07-09 12:23:50 +0000 |
commit | b654435712f3e1345cc40aff99724de9300e5de0 (patch) | |
tree | a9345ca85d59843afff10a3097c29babbed9c2c8 /lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | |
parent | 8fe5ccc5850af3248992d182c5b7c079b50120fc (diff) |
do not repeatedly dereference use_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107962 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index c533d6e5e5..946c3ee0c7 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<DbgDeclareInst>(UI)) + User *U = *UI; + if (DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(U)) return DI; - if (isa<BitCastInst>(UI) && UI->hasOneUse()) { - if (DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(UI->use_begin())) + if (isa<BitCastInst>(U) && U->hasOneUse()) { + if (DbgDeclareInst *DI = dyn_cast<DbgDeclareInst>(U->use_begin())) return DI; } } |