Change inferred casts to explicit casts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32165 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index 3475c44..309edb3 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/ConstantRange.cpp
@@ -293,14 +293,9 @@
 
   Constant *Lower = getLower();
   Constant *Upper = getUpper();
-  if (Lower->getType()->isInteger() && !Lower->getType()->isUnsigned()) {
-    // Ensure we are doing a ZERO extension even if the input range is signed.
-    Lower = ConstantExpr::getCast(Lower, Ty->getUnsignedVersion());
-    Upper = ConstantExpr::getCast(Upper, Ty->getUnsignedVersion());
-  }
 
-  return ConstantRange(ConstantExpr::getCast(Lower, Ty),
-                       ConstantExpr::getCast(Upper, Ty));
+  return ConstantRange(ConstantExpr::getCast(Instruction::ZExt, Lower, Ty),
+                       ConstantExpr::getCast(Instruction::ZExt, Upper, Ty));
 }
 
 /// truncate - Return a new range in the specified integer type, which must be
@@ -314,8 +309,9 @@
   if (isFullSet() || getSetSize() >= Size)
     return ConstantRange(getType());
 
-  return ConstantRange(ConstantExpr::getCast(getLower(), Ty),
-                       ConstantExpr::getCast(getUpper(), Ty));
+  return ConstantRange(
+      ConstantExpr::getCast(Instruction::Trunc, getLower(), Ty),
+      ConstantExpr::getCast(Instruction::Trunc, getUpper(), Ty));
 }