[Mlir-commits] [mlir] [mlir] Migrate away from a soft-deprecated constructor of APInt (NFC) (PR #166128)

Kazu Hirata llvmlistbot at llvm.org
Sun Nov 2 23:38:24 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/166128

We have:

/// Once all uses of this constructor are migrated to other constructors,
/// consider marking this overload ""= delete" to prevent calls from being
/// incorrectly bound to the APInt(unsigned, uint64_t, bool) constructor.
LLVM_ABI APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);

This patch migrates away from this soft-deprecated constructor.


>From 1207eda10f9fe822af9acfaf840f5bd7fa5a0696 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 2 Nov 2025 15:04:58 -0800
Subject: [PATCH] [mlir] Migrate away from a soft-deprecated constructor of
 APInt (NFC)

We have:

/// Once all uses of this constructor are migrated to other constructors,
/// consider marking this overload ""= delete" to prevent calls from being
/// incorrectly bound to the APInt(unsigned, uint64_t, bool) constructor.
LLVM_ABI APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);

This patch migrates away from this soft-deprecated constructor.
---
 mlir/lib/AsmParser/Parser.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/AsmParser/Parser.cpp b/mlir/lib/AsmParser/Parser.cpp
index 82bdb844480f1..6c1fde4b9542c 100644
--- a/mlir/lib/AsmParser/Parser.cpp
+++ b/mlir/lib/AsmParser/Parser.cpp
@@ -407,8 +407,8 @@ Parser::parseFloatFromIntegerLiteral(std::optional<APFloat> &result,
                      "hexadecimal float constant out of range for type");
   }
 
-  APInt truncatedValue(typeSizeInBits, intValue.getNumWords(),
-                       intValue.getRawData());
+  APInt truncatedValue(typeSizeInBits, llvm::ArrayRef(intValue.getRawData(),
+                                                      intValue.getNumWords()));
   result.emplace(semantics, truncatedValue);
   return success();
 }



More information about the Mlir-commits mailing list