diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-05-28 19:04:21 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-05-28 19:04:21 +0000 |
commit | 272d70c3665f1fdc57ddab2d555c0bec6944f966 (patch) | |
tree | 64845377e5542083624ec6dd430bf7fcc93394f7 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 2941eb68643885612b1cc305f878dd255156a59a (diff) | |
download | bcm5719-llvm-272d70c3665f1fdc57ddab2d555c0bec6944f966.tar.gz bcm5719-llvm-272d70c3665f1fdc57ddab2d555c0bec6944f966.zip |
Revert DAGCombine "hoist binop with const" folds
Appear to introduce test-suite compile-time hang.
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/22825
This reverts r361852,r361853,r361854,r361855,r361856
llvm-svn: 361865
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index efac27a1b69..d53ee3134d5 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2303,13 +2303,6 @@ SDValue DAGCombiner::visitADDLike(SDNode *N) { } } - // (x - y) + -1 -> add (xor y, -1), x - if (N0.hasOneUse() && N0.getOpcode() == ISD::SUB && - 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)); - } - if (SDValue Combined = visitADDLikeCommutative(N0, N1, N)) return Combined; @@ -2461,14 +2454,6 @@ SDValue DAGCombiner::visitADDLikeCommutative(SDValue N0, SDValue N1, if (SDValue V = foldAddSubMasked1(true, N0, N1, DAG, DL)) return V; - // Hoist one-use subtraction by constant: (x - C) + y -> (x + y) - C - // This is necessary because SUB(X,C) -> ADD(X,-C) doesn't work for vectors. - if (N0.hasOneUse() && N0.getOpcode() == ISD::SUB && - isConstantOrConstantVector(N0.getOperand(1))) { - SDValue Add = DAG.getNode(ISD::ADD, DL, VT, N0.getOperand(0), N1); - return DAG.getNode(ISD::SUB, DL, VT, Add, N0.getOperand(1)); - } - // If the target's bool is represented as 0/1, prefer to make this 'sub 0/1' // rather than 'add 0/-1' (the zext should get folded). // add (sext i1 Y), X --> sub X, (zext i1 Y) @@ -2938,33 +2923,6 @@ SDValue DAGCombiner::visitSUB(SDNode *N) { if (SDValue V = foldAddSubMasked1(false, N0, N1, DAG, SDLoc(N))) return V; - // (x - y) - 1 -> add (xor y, -1), x - if (N0.hasOneUse() && N0.getOpcode() == ISD::SUB && isOneOrOneSplat(N1)) { - SDValue Xor = DAG.getNode(ISD::XOR, DL, VT, N0.getOperand(1), - DAG.getAllOnesConstant(DL, VT)); - return DAG.getNode(ISD::ADD, DL, VT, Xor, N0.getOperand(0)); - } - - // Hoist one-use addition by constant: (x + C) - y -> (x - y) + C - if (N0.hasOneUse() && N0.getOpcode() == ISD::ADD && - isConstantOrConstantVector(N0.getOperand(1))) { - SDValue Sub = DAG.getNode(ISD::SUB, DL, VT, N0.getOperand(0), N1); - return DAG.getNode(ISD::ADD, DL, VT, Sub, N0.getOperand(1)); - } - // y - (x + C) -> (y - x) - C - if (N1.hasOneUse() && N1.getOpcode() == ISD::ADD && - isConstantOrConstantVector(N1.getOperand(1))) { - SDValue Sub = DAG.getNode(ISD::SUB, DL, VT, N0, N1.getOperand(0)); - return DAG.getNode(ISD::SUB, DL, VT, Sub, N1.getOperand(1)); - } - // (x - C) - y -> (x - y) - C - // This is necessary because SUB(X,C) -> ADD(X,-C) doesn't work for vectors. - if (N0.hasOneUse() && N0.getOpcode() == ISD::SUB && - isConstantOrConstantVector(N0.getOperand(1))) { - SDValue Sub = DAG.getNode(ISD::SUB, DL, VT, N0.getOperand(0), N1); - return DAG.getNode(ISD::SUB, DL, VT, Sub, N0.getOperand(1)); - } - // If the target's bool is represented as 0/-1, prefer to make this 'add 0/-1' // rather than 'sub 0/1' (the sext should get folded). // sub X, (zext i1 Y) --> add X, (sext i1 Y) |