diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-01-20 08:35:56 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-01-20 08:35:56 +0000 |
commit | 0c8607ba6a21578996a7532b9390afba13bd2087 (patch) | |
tree | 71f7605e9ff90372ea8159b6f7be62b3d1a03fe2 /lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | ec98d2ce5ec51148e442c024b77a7483c81eee6c (diff) |
Revert 172708.
The optimization handles esoteric cases but adds a lot of complexity both to the X86 backend and to other backends.
This optimization disables an important canonicalization of chains of SEXT nodes and makes SEXT and ZEXT asymmetrical.
Disabling the canonicalization of consecutive SEXT nodes into a single node disables other DAG optimizations that assume
that there is only one SEXT node. The AVX mask optimizations is one example. Additionally this optimization does not update the cost model.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172968 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 3e5a446e6e..a82410ae6a 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -4298,19 +4298,11 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) { if (isa<ConstantSDNode>(N0)) return DAG.getNode(ISD::SIGN_EXTEND, N->getDebugLoc(), VT, N0); - // Folding (sext (sext x)) is obvious, but we do it only after the type - // legalization phase. When the sequence is like {(T1->T2), (T2->T3)} and - // T1 or T3 (or the both) are illegal types, the TypeLegalizer may not - // give a good sequence for the (T1->T3) pair. - // So we give a chance to target specific combiner to optimize T1->T2 and T2->T3 - // separately and may be fold them in a preceding of subsequent instruction. - if (Level >= AfterLegalizeTypes) { - // fold (sext (sext x)) -> (sext x) - // fold (sext (aext x)) -> (sext x) - if (N0.getOpcode() == ISD::SIGN_EXTEND || N0.getOpcode() == ISD::ANY_EXTEND) - return DAG.getNode(ISD::SIGN_EXTEND, N->getDebugLoc(), VT, - N0.getOperand(0)); - } + // fold (sext (sext x)) -> (sext x) + // fold (sext (aext x)) -> (sext x) + if (N0.getOpcode() == ISD::SIGN_EXTEND || N0.getOpcode() == ISD::ANY_EXTEND) + return DAG.getNode(ISD::SIGN_EXTEND, N->getDebugLoc(), VT, + N0.getOperand(0)); if (N0.getOpcode() == ISD::TRUNCATE) { // fold (sext (truncate (load x))) -> (sext (smaller load x)) |