aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-19 20:39:08 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-19 20:39:08 +0000
commit7fc44c8c5fb0efd6c909f4e306ad516df88e93e1 (patch)
treef930dbc9fbd26b0b446c2781c1303d67e2eb8e95
parent3a341375487e4a296821edbcebafd289d55d119b (diff)
Allow ConstantInt::get(Ty, uint64_t) to interpret the 64-bit values as a
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
-rw-r--r--include/llvm/Constants.h2
-rw-r--r--lib/VMCore/Constants.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 988b53a284..c307356247 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -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.
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 1685923e43..e5417f5245 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -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