diff options
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 0ea0c0df7f37..a21b9acad7da 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2831,9 +2831,9 @@ SDValue DAGCombiner::visitADDLike(SDNode *N) { // (x - y) + -1 -> add (xor y, -1), x if (N0.getOpcode() == ISD::SUB && N0.hasOneUse() && - isAllOnesOrAllOnesSplat(N1)) { - SDValue Xor = DAG.getNode(ISD::XOR, DL, VT, N0.getOperand(1), N1); - return DAG.getNode(ISD::ADD, DL, VT, Xor, N0.getOperand(0)); + isAllOnesOrAllOnesSplat(N1, /*AllowUndefs=*/true)) { + SDValue Not = DAG.getNOT(DL, N0.getOperand(1), VT); + return DAG.getNode(ISD::ADD, DL, VT, Not, N0.getOperand(0)); } if (SDValue Combined = visitADDLikeCommutative(N0, N1, N)) |
