summaryrefslogtreecommitdiff
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 8559883088..1a650cc5e1 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -568,7 +568,7 @@ bool ConstantInt::isValueValidForType(const Type *Ty, int64_t Val) {
unsigned NumBits = cast<IntegerType>(Ty)->getBitWidth(); // assert okay
assert(NumBits <= 64 && "Not implemented: integers > 64-bits");
if (Ty == Type::Int1Ty)
- return Val == 0 || Val == 1;
+ return Val == 0 || Val == 1 || Val == -1;
if (NumBits == 64)
return true; // always true, has to fit in largest type
int64_t Min = -(1ll << (NumBits-1));
@@ -849,7 +849,7 @@ ConstantInt *ConstantInt::get(const Type *Ty, int64_t V) {
return getTrue();
else
return getFalse();
- return IntConstants->getOrCreate(Ty, V & Ty->getIntegerTypeMask());
+ return IntConstants->getOrCreate(Ty, V & cast<IntegerType>(Ty)->getBitMask());
}
//---- ConstantFP::get() implementation...