Do not fold (zero_ext (sign_ext V)) -> (sign_ext V), they are not the same.
authorChris Lattner <sabre@nondot.org>
Wed, 12 Jan 2005 18:51:15 +0000 (18:51 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 12 Jan 2005 18:51:15 +0000 (18:51 +0000)
This fixes llvm-test/SingleSource/Regression/C/casts.c

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

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 3f598fd8b323eaec19d19a442a591fd719507421..2b5604fec2ac1855a9d3a4bafdf5afce55697d70 100644 (file)
@@ -511,8 +511,8 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
     break;
   case ISD::ZERO_EXTEND:
     if (Operand.getValueType() == VT) return Operand;   // noop extension
-    if (OpOpcode == ISD::SIGN_EXTEND || OpOpcode == ISD::ZERO_EXTEND)
-      return getNode(OpOpcode, VT, Operand.Val->getOperand(0));
+    if (OpOpcode == ISD::ZERO_EXTEND)
+      return getNode(ISD::ZERO_EXTEND, VT, Operand.Val->getOperand(0));
     break;
   case ISD::TRUNCATE:
     if (Operand.getValueType() == VT) return Operand;   // noop truncate