summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorZi Xuan Wu <wuzish@cn.ibm.com>2019-04-30 03:01:14 +0000
committerZi Xuan Wu <wuzish@cn.ibm.com>2019-04-30 03:01:14 +0000
commit49d60fdc2e8e0fd7d1e33e84322fbe2c674e4f1e (patch)
tree6361b73d85430f054bac49c12495cb85b8546f17 /llvm/lib
parentab7747b727d79c9cc67b0ffb75528bf9bb67d9e8 (diff)
downloadbcm5719-llvm-49d60fdc2e8e0fd7d1e33e84322fbe2c674e4f1e.tar.gz
bcm5719-llvm-49d60fdc2e8e0fd7d1e33e84322fbe2c674e4f1e.zip
[DAGCombiner] Do not generate ISD::ADDE node if adde is not legal for the target when combine ISD::TRUNC node
Do not combine (trunc adde(X, Y, Carry)) into (adde trunc(X), trunc(Y), Carry), if adde is not legal for the target. Even it's at type-legalize phase. Because adde is special and will not be legalized at operation-legalize phase later. This fixes: PR40922 https://bugs.llvm.org/show_bug.cgi?id=40922 Differential Revision: https://reviews.llvm.org//D60854 llvm-svn: 359532
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index df1929bf36b..aeab54d65a8 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -10257,7 +10257,9 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
// When the adde's carry is not used.
if ((N0.getOpcode() == ISD::ADDE || N0.getOpcode() == ISD::ADDCARRY) &&
N0.hasOneUse() && !N0.getNode()->hasAnyUseOfValue(1) &&
- (!LegalOperations || TLI.isOperationLegal(N0.getOpcode(), VT))) {
+ // We only do for addcarry before legalize operation
+ ((!LegalOperations && N0.getOpcode() == ISD::ADDCARRY) ||
+ TLI.isOperationLegal(N0.getOpcode(), VT))) {
SDLoc SL(N);
auto X = DAG.getNode(ISD::TRUNCATE, SL, VT, N0.getOperand(0));
auto Y = DAG.getNode(ISD::TRUNCATE, SL, VT, N0.getOperand(1));
OpenPOWER on IntegriCloud