Allow ConstantInt::get(Ty, uint64_t) to interpret the 64-bit values as a
authorReid Spencer <rspencer@reidspencer.com>
Mon, 19 Mar 2007 20:39:08 +0000 (20:39 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 19 Mar 2007 20:39:08 +0000 (20:39 +0000)
negative number. This is needed to fix test/Assembler/2007-03-19-NegValue.ll

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

include/llvm/Constants.h
lib/VMCore/Constants.cpp

index 988b53a284cc0d5c13f2bd5e1cf49ecb3460d1f9..c307356247ce6840f16d5b02f10d48c9db698405 100644 (file)
@@ -94,7 +94,7 @@ public:
   /// either getSExtValue() or getZExtValue() will yield a correctly sized and
   /// signed value for the type Ty.
   /// @brief Get a ConstantInt for a specific value.
-  static ConstantInt *get(const Type *Ty, uint64_t V);
+  static ConstantInt *get(const Type *Ty, uint64_t V, bool isSigned = false);
 
   /// Return a ConstantInt with the specified value and an implied Type. The
   /// type is the integer type that corresponds to the bit width of the value.
index 1685923e4338cb436b31a46ddc751a45f8e946ec..e5417f524564d25043711b4896a423fb20633d7b 100644 (file)
@@ -203,9 +203,9 @@ typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt*,
                  DenseMapAPIntKeyInfo> IntMapTy;
 static ManagedStatic<IntMapTy> IntConstants;
 
-ConstantInt *ConstantInt::get(const Type *Ty, uint64_t V) {
+ConstantInt *ConstantInt::get(const Type *Ty, uint64_t V, bool isSigned) {
   const IntegerType *ITy = cast<IntegerType>(Ty);
-  return get(APInt(ITy->getBitWidth(), V));
+  return get(APInt(ITy->getBitWidth(), V, isSigned));
 }
 
 // Get a ConstantInt from an APInt. Note that the value stored in the DenseMap