diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-05-06 13:44:42 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-05-06 13:44:42 +0000 |
commit | 2c15447f99665aac1e1c5bb3d6bbe177b532e660 (patch) | |
tree | d9e81d3715ee0bf1e11bb4718a30488d0b9457a6 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 2a8f6f843ffe27db6e796797fc7a2d476b1a17a3 (diff) | |
download | bcm5719-llvm-2c15447f99665aac1e1c5bb3d6bbe177b532e660.tar.gz bcm5719-llvm-2c15447f99665aac1e1c5bb3d6bbe177b532e660.zip |
[DAGCombiner] If ISD::ABS is legal/custom, use it directly instead of canonicalizing first.
Remove an extra canonicalization step if ISD::ABS is going to be used anyway.
Updated x86 abs combine to check that we are lowering from both canonicalizations.
llvm-svn: 302337
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index c2be9f3f058..c77046fdfaf 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -6688,6 +6688,9 @@ SDValue DAGCombiner::visitVSELECT(SDNode *N) { if (isAbs) { EVT VT = LHS.getValueType(); + if (TLI.isOperationLegalOrCustom(ISD::ABS, VT)) + return DAG.getNode(ISD::ABS, DL, VT, LHS); + SDValue Shift = DAG.getNode( ISD::SRA, DL, VT, LHS, DAG.getConstant(VT.getScalarSizeInBits() - 1, DL, VT)); |