[llvm] a82e6ee - Revert "[ConstantInt] Disable implicit truncation in ConstantInt::get() (#171456)"

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 5 02:36:55 PST 2026


Author: Nikita Popov
Date: 2026-01-05T11:36:23+01:00
New Revision: a82e6eeff793d2facda43a951c003cb6ff284ef4

URL: https://github.com/llvm/llvm-project/commit/a82e6eeff793d2facda43a951c003cb6ff284ef4
DIFF: https://github.com/llvm/llvm-project/commit/a82e6eeff793d2facda43a951c003cb6ff284ef4.diff

LOG: Revert "[ConstantInt] Disable implicit truncation in ConstantInt::get() (#171456)"

This reverts commit 47fc1dd90ed4fa7c806795fada77e8c7cdfd6760.

Causes assertion failures while building sanitizer libraries on
some buildbots.

Added: 
    

Modified: 
    llvm/include/llvm/IR/Constants.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
index dc279221733d5..3bb2fa28cced8 100644
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -113,8 +113,9 @@ class ConstantInt final : public ConstantData {
   /// If Ty is a vector type, return a Constant with a splat of the given
   /// value. Otherwise return a ConstantInt for the given value.
   /// \param ImplicitTrunc Whether to allow implicit truncation of the value.
+  // TODO: Make ImplicitTrunc default to false.
   LLVM_ABI static Constant *get(Type *Ty, uint64_t V, bool IsSigned = false,
-                                bool ImplicitTrunc = false);
+                                bool ImplicitTrunc = true);
 
   /// Return a ConstantInt with the specified integer value for the specified
   /// type. If the type is wider than 64 bits, the value will be zero-extended
@@ -122,9 +123,10 @@ class ConstantInt final : public ConstantData {
   /// be interpreted as a 64-bit signed integer and sign-extended to fit
   /// the type.
   /// \param ImplicitTrunc Whether to allow implicit truncation of the value.
+  // TODO: Make ImplicitTrunc default to false.
   LLVM_ABI static ConstantInt *get(IntegerType *Ty, uint64_t V,
                                    bool IsSigned = false,
-                                   bool ImplicitTrunc = false);
+                                   bool ImplicitTrunc = true);
 
   /// Return a ConstantInt with the specified value for the specified type. The
   /// value V will be canonicalized to an unsigned APInt. Accessing it with
@@ -132,11 +134,12 @@ class ConstantInt final : public ConstantData {
   /// signed value for the type Ty.
   /// Get a ConstantInt for a specific signed value.
   /// \param ImplicitTrunc Whether to allow implicit truncation of the value.
+  // TODO: Make ImplicitTrunc default to false.
   static ConstantInt *getSigned(IntegerType *Ty, int64_t V,
-                                bool ImplicitTrunc = false) {
+                                bool ImplicitTrunc = true) {
     return get(Ty, V, /*IsSigned=*/true, ImplicitTrunc);
   }
-  static Constant *getSigned(Type *Ty, int64_t V, bool ImplicitTrunc = false) {
+  static Constant *getSigned(Type *Ty, int64_t V, bool ImplicitTrunc = true) {
     return get(Ty, V, /*IsSigned=*/true, ImplicitTrunc);
   }
 


        


More information about the llvm-commits mailing list