diff options
author | Amaury Sechet <deadalnix@gmail.com> | 2017-06-11 11:36:38 +0000 |
---|---|---|
committer | Amaury Sechet <deadalnix@gmail.com> | 2017-06-11 11:36:38 +0000 |
commit | 2127452ff7dd87bcff9f009600b9717bda364107 (patch) | |
tree | 0a9425c7f8e65eb865ab78e52258426fe8b35f5a /llvm/lib/CodeGen/SelectionDAG | |
parent | 0b103d92c148e2d12bb54832780138df1f07f338 (diff) | |
download | bcm5719-llvm-2127452ff7dd87bcff9f009600b9717bda364107.tar.gz bcm5719-llvm-2127452ff7dd87bcff9f009600b9717bda364107.zip |
[DAGCombine] Make sure we check the ResNo from UADDO before combining
Summary: UADDO has 2 result, and one must check the result no before doing any kind of combine. Without it, the transform is invalid.
Reviewers: joerg
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34088
llvm-svn: 305162
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index a0967f57400..68f3bf35493 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2217,7 +2217,8 @@ SDValue DAGCombiner::visitADDCARRYLike(SDValue N0, SDValue N1, SDValue CarryIn, SDNode *N) { // Iff the flag result is dead: // (addcarry (add|uaddo X, Y), 0, Carry) -> (addcarry X, Y, Carry) - if ((N0.getOpcode() == ISD::ADD || N0.getOpcode() == ISD::UADDO) && + if ((N0.getOpcode() == ISD::ADD || + (N0.getOpcode() == ISD::UADDO && N0.getResNo() == 0)) && isNullConstant(N1) && !N->hasAnyUseOfValue(1)) return DAG.getNode(ISD::ADDCARRY, SDLoc(N), N->getVTList(), N0.getOperand(0), N0.getOperand(1), CarryIn); |