Index: llvm/lib/Analysis/GuardUtils.cpp =================================================================== --- llvm/lib/Analysis/GuardUtils.cpp +++ llvm/lib/Analysis/GuardUtils.cpp @@ -118,17 +118,16 @@ template static void parseCondition(Value *Condition, CallbackType Callback) { - SmallVector Worklist(1, Condition); + SmallVector Worklist = {Condition}; SmallPtrSet Visited; - Visited.insert(Condition); do { Value *Check = Worklist.pop_back_val(); + if (!Visited.insert(Check).second) + continue; Value *LHS, *RHS; if (match(Check, m_And(m_Value(LHS), m_Value(RHS)))) { - if (Visited.insert(LHS).second) - Worklist.push_back(LHS); - if (Visited.insert(RHS).second) - Worklist.push_back(RHS); + Worklist.push_back(LHS); + Worklist.push_back(RHS); continue; } Callback(Check);