diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index d7a57bb134c..ca25491f623 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/ConstantRange.cpp
@@ -505,7 +505,7 @@ ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const {
   assert(SrcTySize < DstTySize && "Not a value extension");
   if (isFullSet()) {
     return ConstantRange(APInt::getHighBitsSet(DstTySize,DstTySize-SrcTySize+1),
-                         APInt::getLowBitsSet(DstTySize, SrcTySize-1));
+                         APInt::getLowBitsSet(DstTySize, SrcTySize-1) + 1);
   }
 
   APInt L = Lower; L.sext(DstTySize);
diff --git a/unittests/Support/ConstantRangeTest.cpp b/unittests/Support/ConstantRangeTest.cpp
index 2b073d82039..f929425e547 100644
--- a/unittests/Support/ConstantRangeTest.cpp
+++ b/unittests/Support/ConstantRangeTest.cpp
@@ -175,7 +175,7 @@ TEST_F(ConstantRangeTest, SExt) {
   ConstantRange SSome = Some.signExtend(20);
   ConstantRange SWrap = Wrap.signExtend(20);
   EXPECT_EQ(SFull, ConstantRange(APInt(20, INT16_MIN, true),
-                                 APInt(20, INT16_MAX, true)));
+                                 APInt(20, INT16_MAX + 1, true)));
   EXPECT_TRUE(SEmpty.isEmptySet());
   EXPECT_EQ(SOne, ConstantRange(APInt(One.getLower()).sext(20),
                                 APInt(One.getUpper()).sext(20)));