diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index c533d6e5e5f0dd7631024d72d77df953d63142b9..946c3ee0c7829277de4be16895ad9fd7470a0aaa 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/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; } }