[Mlir-commits] [mlir] 669df4d - [mlir][Presburger] Fix inlining failure for dynamicAPIntFromInt64 in debug builds (#194820)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Apr 29 04:23:17 PDT 2026
Author: lonely eagle
Date: 2026-04-29T19:23:12+08:00
New Revision: 669df4d18b8b196ba985df00dc2ae2165589bf56
URL: https://github.com/llvm/llvm-project/commit/669df4d18b8b196ba985df00dc2ae2165589bf56
DIFF: https://github.com/llvm/llvm-project/commit/669df4d18b8b196ba985df00dc2ae2165589bf56.diff
LOG: [mlir][Presburger] Fix inlining failure for dynamicAPIntFromInt64 in debug builds (#194820)
When `dynamicAPIntFromInt64` is passed as a function pointer to
`llvm::transform`, it becomes an indirect call. This causes the compiler
to fail to inline the function despite the
`LLVM_ATTRIBUTE_ALWAYS_INLINE` annotation, resulting in a compilation
error in debug builds:
```
error: inlining failed in call to 'always_inline' 'llvm::DynamicAPInt llvm::dynamicAPIntFromInt64(int64_t)': indirect function call with a yet undetermined callee
250 | LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt dynamicAPIntFromInt64(int64_t X) {
```
Fix this by wrapping `dynamicAPIntFromInt64` in a lambda, turning the
indirect call into a direct call that the compiler can inline at the
call site.
Added:
Modified:
mlir/lib/Analysis/Presburger/Utils.cpp
mlir/unittests/Analysis/Presburger/Utils.h
Removed:
################################################################################
diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp
index b06a8a1b9ccf8..a06a854fd1426 100644
--- a/mlir/lib/Analysis/Presburger/Utils.cpp
+++ b/mlir/lib/Analysis/Presburger/Utils.cpp
@@ -521,7 +521,10 @@ void DivisionRepr::dump() const { print(llvm::errs()); }
SmallVector<DynamicAPInt, 8>
presburger::getDynamicAPIntVec(ArrayRef<int64_t> range) {
SmallVector<DynamicAPInt, 8> result(range.size());
- llvm::transform(range, result.begin(), dynamicAPIntFromInt64);
+ // Wrapping dynamicAPIntFromInt64 in a lambda, turning the indirect call into
+ // a direct call that the compiler can inline at the call site.
+ llvm::transform(range, result.begin(),
+ [](int64_t x) { return dynamicAPIntFromInt64(x); });
return result;
}
diff --git a/mlir/unittests/Analysis/Presburger/Utils.h b/mlir/unittests/Analysis/Presburger/Utils.h
index 58b9267168540..ef4355f9e3805 100644
--- a/mlir/unittests/Analysis/Presburger/Utils.h
+++ b/mlir/unittests/Analysis/Presburger/Utils.h
@@ -153,10 +153,12 @@ inline void expectComputedVolumeIsValidOverapprox(
inline void expectComputedVolumeIsValidOverapprox(
const std::optional<DynamicAPInt> &computedVolume,
std::optional<int64_t> trueVolume, std::optional<int64_t> resultBound) {
+ // Wrapping dynamicAPIntFromInt64 in a lambda, turning the indirect call into
+ // a direct call that the compiler can inline at the call site.
+ auto getDynamicAPInt = [](int64_t x) { return dynamicAPIntFromInt64(x); };
expectComputedVolumeIsValidOverapprox(
- computedVolume,
- llvm::transformOptional(trueVolume, dynamicAPIntFromInt64),
- llvm::transformOptional(resultBound, dynamicAPIntFromInt64));
+ computedVolume, llvm::transformOptional(trueVolume, getDynamicAPInt),
+ llvm::transformOptional(resultBound, getDynamicAPInt));
}
} // namespace presburger
More information about the Mlir-commits
mailing list