For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 7e802ba..359766d 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -163,14 +163,15 @@
         default:
           break;
       }
-    } else if (ConstantUInt *Op = dyn_cast<ConstantUInt>(Operands[0])) {
-      uint64_t V = Op->getValue();
+    } else if (ConstantInt *Op = dyn_cast<ConstantInt>(Operands[0])) {
+      assert(Op->getType()->isUnsigned() && "bswap args must be unsigned");
+      uint64_t V = Op->getZExtValue();
       if (Name == "llvm.bswap.i16")
-        return ConstantUInt::get(Ty, ByteSwap_16(V));
+        return ConstantInt::get(Ty, ByteSwap_16(V));
       else if (Name == "llvm.bswap.i32")
-        return ConstantUInt::get(Ty, ByteSwap_32(V));
+        return ConstantInt::get(Ty, ByteSwap_32(V));
       else if (Name == "llvm.bswap.i64")
-        return ConstantUInt::get(Ty, ByteSwap_64(V));
+        return ConstantInt::get(Ty, ByteSwap_64(V));
     }
   } else if (Operands.size() == 2) {
     if (ConstantFP *Op1 = dyn_cast<ConstantFP>(Operands[0])) {