diff --git a/llvm/lib/Transforms/Utils/SCCPSolver.cpp b/llvm/lib/Transforms/Utils/SCCPSolver.cpp index 24d1a46cfd40f..de3626a24212c 100644 --- a/llvm/lib/Transforms/Utils/SCCPSolver.cpp +++ b/llvm/lib/Transforms/Utils/SCCPSolver.cpp @@ -838,9 +838,13 @@ bool SCCPInstVisitor::markBlockExecutable(BasicBlock *BB) { } void SCCPInstVisitor::pushToWorkList(ValueLatticeElement &IV, Value *V) { - if (IV.isOverdefined()) - return OverdefinedInstWorkList.push_back(V); - InstWorkList.push_back(V); + if (IV.isOverdefined()) { + if (OverdefinedInstWorkList.empty() || OverdefinedInstWorkList.back() != V) + OverdefinedInstWorkList.push_back(V); + return; + } + if (InstWorkList.empty() || InstWorkList.back() != V) + InstWorkList.push_back(V); } void SCCPInstVisitor::pushToWorkListMsg(ValueLatticeElement &IV, Value *V) {