SIGN_EXTEND from the same type as the dest is valid.
authorChris Lattner <sabre@nondot.org>
Mon, 15 Mar 2010 16:15:56 +0000 (16:15 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 15 Mar 2010 16:15:56 +0000 (16:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98548 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 5d38fdd5b9e64301c2100b10ced9e6e59a2faedc..480c0680880dd4497a59ca1ffe20e19ffcf0d940 100644 (file)
@@ -2332,7 +2332,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL,
     switch (Opcode) {
     default: break;
     case ISD::SIGN_EXTEND:
-      return getConstant(APInt(Val).sext(VT.getSizeInBits()), VT);
+      return getConstant(APInt(Val).sextOrTrunc(VT.getSizeInBits()), VT);
     case ISD::ANY_EXTEND:
     case ISD::ZERO_EXTEND:
     case ISD::TRUNCATE: