Fold trunc(any_ext). This gives stuff like:
authorChris Lattner <sabre@nondot.org>
Fri, 5 May 2006 22:56:26 +0000 (22:56 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 5 May 2006 22:56:26 +0000 (22:56 +0000)
27,28c27
<       movzwl %di, %edi
<       movl %edi, %ebx
---
>       movw %di, %bx

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28137 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 1175f527acb1a46c70af0f7c1f4c2024a9a6d17d..b967855eeeb92c9ebbf020f7d35c9d5a8343fdf6 100644 (file)
@@ -2005,7 +2005,8 @@ SDOperand DAGCombiner::visitTRUNCATE(SDNode *N) {
   if (N0.getOpcode() == ISD::TRUNCATE)
     return DAG.getNode(ISD::TRUNCATE, VT, N0.getOperand(0));
   // fold (truncate (ext x)) -> (ext x) or (truncate x) or x
-  if (N0.getOpcode() == ISD::ZERO_EXTEND || N0.getOpcode() == ISD::SIGN_EXTEND){
+  if (N0.getOpcode() == ISD::ZERO_EXTEND || N0.getOpcode() == ISD::SIGN_EXTEND||
+      N0.getOpcode() == ISD::ANY_EXTEND) {
     if (N0.getValueType() < VT)
       // if the source is smaller than the dest, we still need an extend
       return DAG.getNode(N0.getOpcode(), VT, N0.getOperand(0));