diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 00dc717e1e47..232c592af24a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5419,7 +5419,7 @@ UpdateNodeOperands(SDNode *N, ArrayRef Ops) { "Update with wrong number of operands"); // If no operands changed just return the input node. - if (!Ops.empty() && std::equal(Ops.begin(), Ops.end(), N->op_begin())) + if (Ops.empty() || std::equal(Ops.begin(), Ops.end(), N->op_begin())) return N; // See if the modified node already exists.