diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -118,6 +118,14 @@
     return get(Ty, V, true);
   }
 
+  /// Return a ConstantInt containing all ones for the specified type.
+  static ConstantInt *getAllOnes(IntegerType *Ty) {
+    return get(Ty, -1, true);
+  }
+  static Constant *getAllOnes(Type *Ty) {
+    return get(Ty, -1, true);
+  }
+
   /// 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.
   static ConstantInt *get(LLVMContext &Context, const APInt &V);
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -1610,7 +1610,7 @@
 
   Value *CreateLogicalOr(Value *Cond1, Value *Cond2, const Twine &Name = "") {
     assert(Cond2->getType()->isIntOrIntVectorTy(1));
-    return CreateSelect(Cond1, ConstantInt::getAllOnesValue(Cond2->getType()),
+    return CreateSelect(Cond1, ConstantInt::getAllOnes(Cond2->getType()),
                         Cond2, Name);
   }
 
@@ -1676,7 +1676,7 @@
   }
 
   Value *CreateNot(Value *V, const Twine &Name = "") {
-    return CreateXor(V, Constant::getAllOnesValue(V->getType()), Name);
+    return CreateXor(V, ConstantInt::getAllOnes(V->getType()), Name);
   }
 
   Value *CreateUnOp(Instruction::UnaryOps Opc,
@@ -2452,7 +2452,7 @@
 
   /// Return a boolean value testing if \p Arg > -1.
   Value *CreateIsNotNeg(Value *Arg, const Twine &Name = "") {
-    return CreateICmpSGT(Arg, ConstantInt::getAllOnesValue(Arg->getType()),
+    return CreateICmpSGT(Arg, ConstantInt::getAllOnes(Arg->getType()),
                          Name);
   }
 
diff --git a/llvm/lib/Analysis/IVDescriptors.cpp b/llvm/lib/Analysis/IVDescriptors.cpp
--- a/llvm/lib/Analysis/IVDescriptors.cpp
+++ b/llvm/lib/Analysis/IVDescriptors.cpp
@@ -1091,7 +1091,7 @@
     return ConstantInt::get(Tp, 1);
   case RecurKind::And:
     // AND-ing a number with an all-1 value does not change it.
-    return ConstantInt::get(Tp, -1, true);
+    return ConstantInt::getAllOnes(Tp);
   case RecurKind::FMul:
     // Multiplying a number by 1 does not change it.
     return ConstantFP::get(Tp, 1.0L);
@@ -1107,7 +1107,7 @@
       return ConstantFP::get(Tp, 0.0L);
     return ConstantFP::get(Tp, -0.0L);
   case RecurKind::UMin:
-    return ConstantInt::get(Tp, -1, true);
+    return ConstantInt::getAllOnes(Tp);
   case RecurKind::UMax:
     return ConstantInt::get(Tp, 0);
   case RecurKind::SMin:
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -2064,7 +2064,7 @@
       // (X + C) ^ (~C - X) --> (X + C) ^ ~(X + C) --> -1
       Type *Ty = Op0->getType();
       return Opcode == Instruction::And ? ConstantInt::getNullValue(Ty)
-                                        : ConstantInt::getAllOnesValue(Ty);
+                                        : ConstantInt::getAllOnes(Ty);
     }
   }
   return nullptr;
@@ -2286,11 +2286,11 @@
 
   // X | ~X --> -1
   if (match(Y, m_Not(m_Specific(X))))
-    return ConstantInt::getAllOnesValue(Ty);
+    return ConstantInt::getAllOnes(Ty);
 
   // X | ~(X & ?) = -1
   if (match(Y, m_Not(m_c_And(m_Specific(X), m_Value()))))
-    return ConstantInt::getAllOnesValue(Ty);
+    return ConstantInt::getAllOnes(Ty);
 
   // X | (X & ?) --> X
   if (match(Y, m_c_And(m_Specific(X), m_Value())))
@@ -2308,7 +2308,7 @@
   // ~(A ^ B) | (B | A) --> -1
   if (match(X, m_Not(m_Xor(m_Value(A), m_Value(B)))) &&
       match(Y, m_c_Or(m_Specific(A), m_Specific(B))))
-    return ConstantInt::getAllOnesValue(Ty);
+    return ConstantInt::getAllOnes(Ty);
 
   // (A & ~B) | (A ^ B) --> A ^ B
   // (~B & A) | (A ^ B) --> A ^ B
@@ -2332,7 +2332,7 @@
   // (B | ~A) | (B ^ A) --> -1
   if (match(X, m_c_Or(m_Not(m_Value(A)), m_Value(B))) &&
       match(Y, m_c_Xor(m_Specific(A), m_Specific(B))))
-    return ConstantInt::getAllOnesValue(Ty);
+    return ConstantInt::getAllOnes(Ty);
 
   // (~A & B) | ~(A | B) --> ~A
   // (~A & B) | ~(B | A) --> ~A
@@ -2386,7 +2386,7 @@
   // X | -1 = -1
   // Do not return Op1 because it may contain undef elements if it's a vector.
   if (Q.isUndefValue(Op1) || match(Op1, m_AllOnes()))
-    return Constant::getAllOnesValue(Op0->getType());
+    return ConstantInt::getAllOnes(Op0->getType());
 
   // X | X = X
   // X | 0 = X
@@ -2414,7 +2414,7 @@
     if ((match(X, m_Sub(m_APInt(C), m_Specific(Y))) ||
          match(Y, m_Sub(m_APInt(C), m_Specific(X)))) &&
         C->ule(X->getType()->getScalarSizeInBits())) {
-      return ConstantInt::getAllOnesValue(X->getType());
+      return ConstantInt::getAllOnes(X->getType());
     }
   }
 
@@ -2568,7 +2568,7 @@
 
   // A ^ ~A  =  ~A ^ A  =  -1
   if (match(Op0, m_Not(m_Specific(Op1))) || match(Op1, m_Not(m_Specific(Op0))))
-    return Constant::getAllOnesValue(Op0->getType());
+    return ConstantInt::getAllOnes(Op0->getType());
 
   auto foldAndOrNot = [](Value *X, Value *Y) -> Value * {
     Value *A, *B;
@@ -6469,7 +6469,7 @@
 
     // Rotating -1 by anything is -1.
     if (match(Op0, m_AllOnes()) && match(Op1, m_AllOnes()))
-      return ConstantInt::getAllOnesValue(F->getReturnType());
+      return ConstantInt::getAllOnes(F->getReturnType());
 
     return nullptr;
   }
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -649,7 +649,7 @@
       if (!isa<Constant>(SizeOffsetPair.first) ||
           !isa<Constant>(SizeOffsetPair.second))
         Builder.CreateAssumption(
-            Builder.CreateICmpNE(Ret, ConstantInt::get(ResultType, -1)));
+            Builder.CreateICmpNE(Ret, ConstantInt::getAllOnes(ResultType)));
 
       return Ret;
     }
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -9368,7 +9368,7 @@
     if (Known.isNonNegative())
       StableValue = ConstantInt::get(Ty, 0);
     else if (Known.isNegative())
-      StableValue = ConstantInt::get(Ty, -1, true);
+      StableValue = ConstantInt::getAllOnes(Ty);
     else
       return getCouldNotCompute();
 
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -1564,7 +1564,7 @@
   if (Pred == ICmpInst::ICMP_EQ && match(B, m_AllOnes()))
     B = ConstantInt::get(B->getType(), 1);
   else if (Pred == ICmpInst::ICMP_NE && match(B, m_ZeroInt()))
-    B = ConstantInt::get(B->getType(), -1);
+    B = ConstantInt::getAllOnes(B->getType());
   else
     return false;
 
diff --git a/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp b/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp
--- a/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp
+++ b/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp
@@ -122,8 +122,8 @@
       Builder.getIntN(BitWidth, 1), Builder.getIntN(BitWidth, FPMantissaWidth));
   Value *SignificandMask =
       Builder.CreateSub(ImplicitBit, Builder.getIntN(BitWidth, 1));
-  Value *NegOne = Builder.CreateSExt(
-      ConstantInt::getSigned(Builder.getInt32Ty(), -1), IntTy);
+  Value *NegOne =
+      Builder.CreateSExt(ConstantInt::getAllOnes(Builder.getInt32Ty()), IntTy);
   Value *NegInf =
       Builder.CreateShl(ConstantInt::getSigned(IntTy, 1),
                         ConstantInt::getSigned(IntTy, BitWidth - 1));
@@ -158,9 +158,9 @@
       Builder.CreateBitCast(FloatVal0, Builder.getIntNTy(FloatWidth));
   Value *ARep = Builder.CreateZExt(ARep0, FPToI->getType());
   Value *PosOrNeg = Builder.CreateICmpSGT(
-      ARep0, ConstantInt::getSigned(Builder.getIntNTy(FloatWidth), -1));
+      ARep0, ConstantInt::getAllOnes(Builder.getIntNTy(FloatWidth)));
   Value *Sign = Builder.CreateSelect(PosOrNeg, ConstantInt::getSigned(IntTy, 1),
-                                     ConstantInt::getSigned(IntTy, -1));
+                                     ConstantInt::getAllOnes(IntTy));
   Value *And =
       Builder.CreateLShr(ARep, Builder.getIntN(BitWidth, FPMantissaWidth));
   Value *And2 = Builder.CreateAnd(
@@ -401,7 +401,7 @@
       Builder.CreateAdd(FloatWidth == 128 ? Call : Cast,
                         Builder.getIntN(BitWidthNew, FPMantissaWidth + 3));
   Value *ShProm9 = Builder.CreateZExt(Sub8, IntTy);
-  Value *Shr9 = Builder.CreateLShr(ConstantInt::getSigned(IntTy, -1),
+  Value *Shr9 = Builder.CreateLShr(ConstantInt::getAllOnes(IntTy),
                                    FloatWidth == 128 ? Sub8 : ShProm9);
   Value *And = Builder.CreateAnd(Shr9, IsSigned ? Sub : IntVal);
   Value *Cmp10 = Builder.CreateICmpNE(And, Builder.getIntN(BitWidth, 0));
diff --git a/llvm/lib/CodeGen/ExpandReductions.cpp b/llvm/lib/CodeGen/ExpandReductions.cpp
--- a/llvm/lib/CodeGen/ExpandReductions.cpp
+++ b/llvm/lib/CodeGen/ExpandReductions.cpp
@@ -152,7 +152,7 @@
         Rdx = Builder.CreateBitCast(Vec, Builder.getIntNTy(NumElts));
         if (ID == Intrinsic::vector_reduce_and) {
           Rdx = Builder.CreateICmpEQ(
-              Rdx, ConstantInt::getAllOnesValue(Rdx->getType()));
+              Rdx, ConstantInt::getAllOnes(Rdx->getType()));
         } else {
           assert(ID == Intrinsic::vector_reduce_or && "Expected or reduction.");
           Rdx = Builder.CreateIsNotNull(Rdx);
diff --git a/llvm/lib/CodeGen/ExpandVectorPredication.cpp b/llvm/lib/CodeGen/ExpandVectorPredication.cpp
--- a/llvm/lib/CodeGen/ExpandVectorPredication.cpp
+++ b/llvm/lib/CodeGen/ExpandVectorPredication.cpp
@@ -287,7 +287,7 @@
     return ConstantInt::get(EltTy, 1, /*IsSigned*/ false);
   case Intrinsic::vp_reduce_and:
   case Intrinsic::vp_reduce_umin:
-    return ConstantInt::getAllOnesValue(EltTy);
+    return ConstantInt::getAllOnes(EltTy);
   case Intrinsic::vp_reduce_smin:
     return ConstantInt::get(EltTy->getContext(),
                             APInt::getSignedMaxValue(EltBits));
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -2380,7 +2380,7 @@
       Rep = Builder.CreateBitCast(Rep, Builder.getInt16Ty());
       Value *C;
       if (Name[14] == 'c')
-        C = ConstantInt::getAllOnesValue(Builder.getInt16Ty());
+        C = ConstantInt::getAllOnes(Builder.getInt16Ty());
       else
         C = ConstantInt::getNullValue(Builder.getInt16Ty());
       Rep = Builder.CreateICmpEQ(Rep, C);
diff --git a/llvm/lib/IR/VectorBuilder.cpp b/llvm/lib/IR/VectorBuilder.cpp
--- a/llvm/lib/IR/VectorBuilder.cpp
+++ b/llvm/lib/IR/VectorBuilder.cpp
@@ -34,7 +34,7 @@
 Value *VectorBuilder::getAllTrueMask() {
   auto *BoolTy = Builder.getInt1Ty();
   auto *MaskTy = VectorType::get(BoolTy, StaticVectorLength);
-  return ConstantInt::getAllOnesValue(MaskTy);
+  return ConstantInt::getAllOnes(MaskTy);
 }
 
 Value &VectorBuilder::requestMask() {
diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
--- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
@@ -1924,7 +1924,7 @@
 
 auto HexagonVectorCombine::getFullValue(Type *Ty) const -> Constant * {
   assert(Ty->isIntOrIntVectorTy());
-  auto Minus1 = ConstantInt::get(Ty->getScalarType(), -1);
+  auto Minus1 = ConstantInt::getAllOnes(Ty->getScalarType());
   if (auto *VecTy = dyn_cast<VectorType>(Ty))
     return ConstantVector::getSplat(VecTy->getElementCount(), Minus1);
   return Minus1;
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
--- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
@@ -1509,7 +1509,7 @@
   if (match(&I,
             m_Add(m_OneUse(m_c_And(m_Value(A), m_OneUse(m_Neg(m_Deferred(A))))),
                   m_AllOnes()))) {
-    Constant *AllOnes = ConstantInt::getAllOnesValue(RHS->getType());
+    Constant *AllOnes = ConstantInt::getAllOnes(RHS->getType());
     Value *Dec = Builder.CreateAdd(A, AllOnes);
     Value *Not = Builder.CreateXor(A, AllOnes);
     return BinaryOperator::CreateAnd(Dec, Not);
@@ -1526,7 +1526,7 @@
     Type *Ty = I.getType();
     Constant *NewMulC = ConstantInt::get(Ty, 1 - *C1);
     Value *NewMul = Builder.CreateMul(A, NewMulC);
-    return BinaryOperator::CreateAdd(NewMul, ConstantInt::getAllOnesValue(Ty));
+    return BinaryOperator::CreateAdd(NewMul, ConstantInt::getAllOnes(Ty));
   }
 
   // (A * -2**C) + B --> B - (A << C)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -3369,10 +3369,10 @@
   //       canonicalization?
   if (match(Op0, m_OneUse(m_SExt(m_Value(A)))) &&
       A->getType()->isIntOrIntVectorTy(1))
-    return SelectInst::Create(A, ConstantInt::getAllOnesValue(Ty), Op1);
+    return SelectInst::Create(A, ConstantInt::getAllOnes(Ty), Op1);
   if (match(Op1, m_OneUse(m_SExt(m_Value(A)))) &&
       A->getType()->isIntOrIntVectorTy(1))
-    return SelectInst::Create(A, ConstantInt::getAllOnesValue(Ty), Op0);
+    return SelectInst::Create(A, ConstantInt::getAllOnes(Ty), Op0);
 
   // Note: If we've gotten to the point of visiting the outer OR, then the
   // inner one couldn't be simplified.  If it was a constant, then it won't
@@ -3409,7 +3409,7 @@
                              m_SpecificInt(Ty->getScalarSizeInBits() - 1))),
                          m_Deferred(X)))) {
       Value *NewICmpInst = Builder.CreateICmpSGT(X, Y);
-      Value *AllOnes = ConstantInt::getAllOnesValue(Ty);
+      Value *AllOnes = ConstantInt::getAllOnes(Ty);
       return SelectInst::Create(NewICmpInst, AllOnes, X);
     }
   }
@@ -3703,7 +3703,7 @@
   if (D->hasOneUse() && match(M, m_Constant(C))) {
     // Propagating undef is unsafe. Clamp undef elements to -1.
     Type *EltTy = C->getType()->getScalarType();
-    C = Constant::replaceUndefsWith(C, ConstantInt::getAllOnesValue(EltTy));
+    C = Constant::replaceUndefsWith(C, ConstantInt::getAllOnes(EltTy));
     // Unfold.
     Value *LHS = Builder.CreateAnd(X, C);
     Value *NotC = Builder.CreateNot(C);
@@ -3974,7 +3974,7 @@
     // ~((-X) | Y) --> (X - 1) & (~Y)
     if (match(NotVal,
               m_OneUse(m_c_Or(m_OneUse(m_Neg(m_Value(X))), m_Value(Y))))) {
-      Value *DecX = Builder.CreateAdd(X, ConstantInt::getAllOnesValue(Ty));
+      Value *DecX = Builder.CreateAdd(X, ConstantInt::getAllOnes(Ty));
       Value *NotY = Builder.CreateNot(Y);
       return BinaryOperator::CreateAnd(DecX, NotY);
     }
@@ -4003,7 +4003,7 @@
       // We matched a negative constant, so propagating undef is unsafe.
       // Clamp undef elements to -1.
       Type *EltTy = Ty->getScalarType();
-      C = Constant::replaceUndefsWith(C, ConstantInt::getAllOnesValue(EltTy));
+      C = Constant::replaceUndefsWith(C, ConstantInt::getAllOnes(EltTy));
       return BinaryOperator::CreateLShr(ConstantExpr::getNot(C), Y);
     }
 
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2856,7 +2856,7 @@
               Vect, Builder.getIntNTy(FTy->getNumElements()));
           if (IID == Intrinsic::vector_reduce_and) {
             Res = Builder.CreateICmpEQ(
-                Res, ConstantInt::getAllOnesValue(Res->getType()));
+                Res, ConstantInt::getAllOnes(Res->getType()));
           } else {
             assert(IID == Intrinsic::vector_reduce_or &&
                    "Expected or reduction.");
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -1421,7 +1421,7 @@
         // If the icmp tests for a known zero bit we can constant fold it.
         if (!Op1C->isZero() && Op1C->getValue() != KnownZeroMask) {
           Value *V = Pred == ICmpInst::ICMP_NE ?
-                       ConstantInt::getAllOnesValue(Sext.getType()) :
+                       ConstantInt::getAllOnes(Sext.getType()) :
                        ConstantInt::getNullValue(Sext.getType());
           return replaceInstUsesWith(Sext, V);
         }
@@ -1438,7 +1438,7 @@
           // At this point "In" is either 1 or 0. Subtract 1 to turn
           // {1, 0} -> {0, -1}.
           In = Builder.CreateAdd(In,
-                                 ConstantInt::getAllOnesValue(In->getType()),
+                                 ConstantInt::getAllOnes(In->getType()),
                                  "sext");
         } else {
           // sext ((x & 2^n) != 0)   -> (x << bitwidth-n) a>> bitwidth-1
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -298,7 +298,7 @@
       DL.getTypeAllocSize(Init->getType()->getArrayElementType());
   auto MaskIdx = [&](Value *Idx) {
     if (!GEP->isInBounds() && llvm::countr_zero(ElementSize) != 0) {
-      Value *Mask = ConstantInt::get(Idx->getType(), -1);
+      Value *Mask = ConstantInt::getAllOnes(Idx->getType());
       Mask = Builder.CreateLShr(Mask, llvm::countr_zero(ElementSize));
       Idx = Builder.CreateAnd(Idx, Mask);
     }
@@ -1506,7 +1506,7 @@
     return TrueIfSigned ? new ICmpInst(ICmpInst::ICMP_SLT, ShOp,
                                        ConstantInt::getNullValue(SrcTy))
                         : new ICmpInst(ICmpInst::ICMP_SGT, ShOp,
-                                       ConstantInt::getAllOnesValue(SrcTy));
+                                       ConstantInt::getAllOnes(SrcTy));
   }
 
   return nullptr;
@@ -1539,7 +1539,7 @@
     // Emit the opposite comparison.
     if (TrueIfSigned)
       return new ICmpInst(ICmpInst::ICMP_SGT, X,
-                          ConstantInt::getAllOnesValue(X->getType()));
+                          ConstantInt::getAllOnes(X->getType()));
     else
       return new ICmpInst(ICmpInst::ICMP_SLT, X,
                           ConstantInt::getNullValue(X->getType()));
@@ -2356,7 +2356,7 @@
       }
       if (Pred == CmpInst::ICMP_ULT) {
         return new ICmpInst(CmpInst::ICMP_SGT, X,
-                            ConstantInt::getAllOnesValue(ShrTy));
+                            ConstantInt::getAllOnes(ShrTy));
       }
     }
   } else {
@@ -3007,7 +3007,7 @@
       // icmp sgt (bitcast (sitofp X)), -1 --> icmp sgt X, -1
       if (Pred == ICmpInst::ICMP_SGT && match(Op1, m_AllOnes()))
         return new ICmpInst(Pred, X,
-                            ConstantInt::getAllOnesValue(X->getType()));
+                            ConstantInt::getAllOnes(X->getType()));
     }
 
     // Zero-equality checks are preserved through unsigned floating-point casts:
@@ -3042,7 +3042,7 @@
                                 ConstantInt::getNullValue(NewType));
           else
             return new ICmpInst(ICmpInst::ICMP_SGT, NewBitcast,
-                                ConstantInt::getAllOnesValue(NewType));
+                                ConstantInt::getAllOnes(NewType));
         }
       }
     }
@@ -3488,11 +3488,11 @@
     Value *X = II->getArgOperand(0);
     if (C == BitWidth - 1 && Pred == ICmpInst::ICMP_UGT)
       return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ, X,
-                             ConstantInt::getAllOnesValue(Ty));
+                             ConstantInt::getAllOnes(Ty));
     // (ctpop X < BitWidth) --> X != -1
     if (C == BitWidth && Pred == ICmpInst::ICMP_ULT)
       return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE, X,
-                             ConstantInt::getAllOnesValue(Ty));
+                             ConstantInt::getAllOnes(Ty));
     break;
   }
   case Intrinsic::ctlz: {
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -1280,7 +1280,7 @@
   }
   // Op0 / (sext i1 X) --> zext (Op0 == -1) (if X is 0, the div is undefined)
   if (match(Op1, m_SExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)) {
-    Value *Cmp = Builder.CreateICmpEQ(Op0, ConstantInt::getAllOnesValue(Ty));
+    Value *Cmp = Builder.CreateICmpEQ(Op0, ConstantInt::getAllOnes(Ty));
     return CastInst::CreateZExtOrBitCast(Cmp, Ty);
   }
 
@@ -1413,7 +1413,7 @@
                     m_Deferred(X)))) {
     Value *Cond = Builder.CreateIsNotNeg(X);
     return SelectInst::Create(Cond, ConstantInt::get(Ty, 1),
-                              ConstantInt::getAllOnesValue(Ty));
+                              ConstantInt::getAllOnes(Ty));
   }
 
   KnownBits KnownDividend = computeKnownBits(Op0, 0, &I);
@@ -1859,7 +1859,7 @@
   // urem Op0, (sext i1 X) --> (Op0 == -1) ? 0 : Op0
   Value *X;
   if (match(Op1, m_SExt(m_Value(X))) && X->getType()->isIntOrIntVectorTy(1)) {
-    Value *Cmp = Builder.CreateICmpEQ(Op0, ConstantInt::getAllOnesValue(Ty));
+    Value *Cmp = Builder.CreateICmpEQ(Op0, ConstantInt::getAllOnes(Ty));
     return SelectInst::Create(Cmp, ConstantInt::getNullValue(Ty), Op0);
   }
 
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -1126,7 +1126,7 @@
   // Valid for any type of right-shift.
   Value *X;
   if (match(Op0, m_OneUse(m_Shr(m_Value(X), m_Specific(Op1))))) {
-    Constant *AllOnes = ConstantInt::getAllOnesValue(Ty);
+    Constant *AllOnes = ConstantInt::getAllOnes(Ty);
     Value *Mask = Builder.CreateShl(AllOnes, Op1);
     return BinaryOperator::CreateAnd(Mask, X);
   }
@@ -1423,7 +1423,7 @@
 
   // Transform  (x << y) >> y  to  x & (-1 >> y)
   if (match(Op0, m_OneUse(m_Shl(m_Value(X), m_Specific(Op1))))) {
-    Constant *AllOnes = ConstantInt::getAllOnesValue(Ty);
+    Constant *AllOnes = ConstantInt::getAllOnes(Ty);
     Value *Mask = Builder.CreateLShr(AllOnes, Op1);
     return BinaryOperator::CreateAnd(Mask, X);
   }
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -308,7 +308,7 @@
     if (match(I->getOperand(1), m_APInt(C)) && !C->isAllOnes()) {
       if ((*C | ~DemandedMask).isAllOnes()) {
         // Force bits to 1 to create a 'not' op.
-        I->setOperand(1, ConstantInt::getAllOnesValue(VTy));
+        I->setOperand(1, ConstantInt::getAllOnes(VTy));
         return I;
       }
       // If we can't turn this into a 'not', try to shrink the constant.
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -2054,7 +2054,7 @@
   case Instruction::Sub:
     // sub 0, X --> mul X, -1
     if (match(BO0, m_ZeroInt()))
-      return {Instruction::Mul, BO1, ConstantInt::getAllOnesValue(Ty)};
+      return {Instruction::Mul, BO1, ConstantInt::getAllOnes(Ty)};
     break;
   default:
     break;
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1019,7 +1019,7 @@
     return nullptr;
 
   // bo (sext i1 X), C --> select X, (bo -1, C), (bo 0, C)
-  Constant *Ones = ConstantInt::getAllOnesValue(BO.getType());
+  Constant *Ones = ConstantInt::getAllOnes(BO.getType());
   Constant *Zero = ConstantInt::getNullValue(BO.getType());
   Value *TVal = Builder.CreateBinOp(BO.getOpcode(), Ones, C);
   Value *FVal = Builder.CreateBinOp(BO.getOpcode(), Zero, C);
@@ -3978,7 +3978,7 @@
     for (const auto *U : I.users()) {
       Constant *C = NullValue;
       if (match(U, m_Or(m_Value(), m_Value())))
-        C = ConstantInt::getAllOnesValue(Ty);
+        C = ConstantInt::getAllOnes(Ty);
       else if (match(U, m_Select(m_Specific(&I), m_Constant(), m_Value())))
         C = ConstantInt::getTrue(Ty);
 
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -2348,8 +2348,8 @@
 
     // ODR should not happen for local linkage.
     if (NewGlobal->hasLocalLinkage()) {
-      ODRIndicator = ConstantExpr::getIntToPtr(ConstantInt::get(IntptrTy, -1),
-                                               IRB.getInt8PtrTy());
+      ODRIndicator = ConstantExpr::getIntToPtr(
+          ConstantInt::getAllOnes(IntptrTy), IRB.getInt8PtrTy());
     } else if (UseOdrIndicator) {
       // With local aliases, we need to provide another externally visible
       // symbol __odr_asan_XXX to detect ODR violation.
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1236,7 +1236,7 @@
       // Runtime library makes sure not to use the highest bit.
       Value *WrapMask = IRB.CreateXor(
           IRB.CreateShl(IRB.CreateAShr(ThreadLong, 56), 12, "", true, true),
-          ConstantInt::get(IntptrTy, (uint64_t)-1));
+          ConstantInt::getAllOnes(IntptrTy));
       Value *ThreadLongNew = IRB.CreateAnd(
           IRB.CreateAdd(ThreadLong, ConstantInt::get(IntptrTy, 8)), WrapMask);
       IRB.CreateStore(ThreadLongNew, SlotPtr);
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
--- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -1083,7 +1083,7 @@
         if (CB->isIndirectCall()) {
           // TODO(navidem): handle indirect calls, for now mark its existence.
           CFs.push_back((Constant *)IRB.CreateIntToPtr(
-              ConstantInt::get(IntptrTy, -1), IntptrPtrTy));
+              ConstantInt::getAllOnes(IntptrTy), IntptrPtrTy));
         } else {
           auto CalledF = CB->getCalledFunction();
           if (CalledF && !CalledF->isIntrinsic())
diff --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
--- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -583,7 +583,7 @@
       addFact(CmpInst::ICMP_ULT, A, B, NumIn, NumOut, DFSInStack);
     break;
   case CmpInst::ICMP_SGT:
-    if (doesHold(CmpInst::ICMP_SGE, B, ConstantInt::get(B->getType(), -1)))
+    if (doesHold(CmpInst::ICMP_SGE, B, ConstantInt::getAllOnes(B->getType())))
       addFact(CmpInst::ICMP_UGE, A, ConstantInt::get(B->getType(), 0), NumIn,
               NumOut, DFSInStack);
     break;
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -455,7 +455,7 @@
       SmallVector<const SCEV *, 4> MyGood;
       SmallVector<const SCEV *, 4> MyBad;
       DoInitialMatch(NewMul, L, MyGood, MyBad, SE);
-      const SCEV *NegOne = SE.getSCEV(ConstantInt::getAllOnesValue(
+      const SCEV *NegOne = SE.getSCEV(ConstantInt::getAllOnes(
         SE.getEffectiveSCEVType(NewMul->getType())));
       for (const SCEV *S : MyGood)
         Good.push_back(SE.getMulExpr(NegOne, S));
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -280,8 +280,8 @@
   // FIXME: It's not safe to lower a unary FNeg into a FMul by -1.0.
   unsigned OpNo = isa<BinaryOperator>(Neg) ? 1 : 0;
   Type *Ty = Neg->getType();
-  Constant *NegOne = Ty->isIntOrIntVectorTy() ?
-    ConstantInt::getAllOnesValue(Ty) : ConstantFP::get(Ty, -1.0);
+  Constant *NegOne = Ty->isIntOrIntVectorTy() ? ConstantInt::getAllOnes(Ty)
+                                              : ConstantFP::get(Ty, -1.0);
 
   BinaryOperator *Res = CreateMul(Neg->getOperand(OpNo), NegOne, "", Neg, Neg);
   Neg->setOperand(OpNo, Constant::getNullValue(Ty)); // Drop use of op.
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -1092,7 +1092,7 @@
     Module *M, ArrayRef<Value *> LifetimesStart, ArrayRef<Value *> LifetimesEnd,
     CallInst *TheCall) {
   LLVMContext &Ctx = M->getContext();
-  auto NegativeOne = ConstantInt::getSigned(Type::getInt64Ty(Ctx), -1);
+  auto NegativeOne = ConstantInt::getAllOnes(Type::getInt64Ty(Ctx));
   Instruction *Term = TheCall->getParent()->getTerminator();
 
   // Emit lifetime markers for the pointers given in \p Objects. Insert the
diff --git a/llvm/lib/Transforms/Utils/IntegerDivision.cpp b/llvm/lib/Transforms/Utils/IntegerDivision.cpp
--- a/llvm/lib/Transforms/Utils/IntegerDivision.cpp
+++ b/llvm/lib/Transforms/Utils/IntegerDivision.cpp
@@ -150,7 +150,7 @@
 
   ConstantInt *Zero = ConstantInt::get(DivTy, 0);
   ConstantInt *One = ConstantInt::get(DivTy, 1);
-  ConstantInt *NegOne = ConstantInt::getSigned(DivTy, -1);
+  ConstantInt *NegOne = ConstantInt::getAllOnes(DivTy);
   ConstantInt *MSB = ConstantInt::get(DivTy, BitWidth - 1);
 
   ConstantInt *True = Builder.getTrue();
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
--- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
@@ -757,7 +757,7 @@
       !isGuaranteedNotToBeUndefOrPoison(TripCount, AC, PreHeaderBR, DT)) {
     TripCount = B.CreateFreeze(TripCount);
     BECount =
-        B.CreateAdd(TripCount, ConstantInt::get(TripCount->getType(), -1));
+        B.CreateAdd(TripCount, ConstantInt::getAllOnes(TripCount->getType()));
   } else {
     // If we don't need to freeze, use SCEVExpander for BECount as well, to
     // allow slightly better value reuse.
diff --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp
--- a/llvm/tools/llvm-stress/llvm-stress.cpp
+++ b/llvm/tools/llvm-stress/llvm-stress.cpp
@@ -217,7 +217,7 @@
   Constant *getRandomConstant(Type *Tp) {
     if (Tp->isIntegerTy()) {
       if (getRandom() & 1)
-        return ConstantInt::getAllOnesValue(Tp);
+        return ConstantInt::getAllOnes(Tp);
       return ConstantInt::getNullValue(Tp);
     } else if (Tp->isFloatingPointTy()) {
       if (getRandom() & 1)
@@ -239,7 +239,7 @@
     // If the requested type was not found, generate a constant value.
     if (Tp->isIntegerTy()) {
       if (getRandom() & 1)
-        return ConstantInt::getAllOnesValue(Tp);
+        return ConstantInt::getAllOnes(Tp);
       return ConstantInt::getNullValue(Tp);
     } else if (Tp->isFloatingPointTy()) {
       if (getRandom() & 1)
diff --git a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
--- a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
+++ b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
@@ -694,8 +694,8 @@
     else
       NextBB = EndBB;
     BranchInst::Create(IncBB, NextBB, Cmp, CondBB);
-    auto *Dec = BinaryOperator::CreateNSWAdd(
-        PN, ConstantInt::get(Context, APInt(64, -1)), "dec", IncBB);
+    auto *Dec = BinaryOperator::CreateNSWAdd(PN, ConstantInt::getAllOnes(I64Ty),
+                                             "dec", IncBB);
     PN->addIncoming(Dec, IncBB);
     BranchInst::Create(CondBB, IncBB);
 
diff --git a/llvm/unittests/IR/PatternMatch.cpp b/llvm/unittests/IR/PatternMatch.cpp
--- a/llvm/unittests/IR/PatternMatch.cpp
+++ b/llvm/unittests/IR/PatternMatch.cpp
@@ -71,7 +71,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_TRUE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, 0))
@@ -110,7 +110,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_FALSE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, 0))
@@ -149,7 +149,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_FALSE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, 0))
@@ -187,7 +187,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_TRUE(m_Negative().match(NegOne));
   EXPECT_FALSE(m_NonNegative().match(NegOne));
@@ -211,7 +211,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_TRUE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, 0))
@@ -250,7 +250,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_FALSE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, 0))
@@ -289,7 +289,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_TRUE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, 0))
@@ -328,7 +328,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_FALSE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, 0))
@@ -367,7 +367,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_TRUE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, 0))
@@ -406,7 +406,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_FALSE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, 0))
@@ -445,7 +445,7 @@
 
   Value *Zero = ConstantInt::get(IntTy, 0);
   Value *One = ConstantInt::get(IntTy, 1);
-  Value *NegOne = ConstantInt::get(IntTy, -1);
+  Value *NegOne = ConstantInt::getAllOnes(IntTy);
 
   EXPECT_TRUE(
       m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, 0))