[Mlir-commits] [mlir] [mlir][Presburger] Fix inlining failure for dynamicAPIntFromInt64 in debug builds (PR #194820)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Apr 29 02:10:04 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: lonely eagle (linuxlonelyeagle)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/194820.diff
2 Files Affected:
- (modified) mlir/lib/Analysis/Presburger/Utils.cpp (+3-1)
- (modified) mlir/unittests/Analysis/Presburger/Utils.h (+3-3)
``````````diff
diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp
index b06a8a1b9ccf8..493dcdadc727c 100644
--- a/mlir/lib/Analysis/Presburger/Utils.cpp
+++ b/mlir/lib/Analysis/Presburger/Utils.cpp
@@ -521,7 +521,9 @@ 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);
+ // llvm::transform(range, result.begin(), dynamicAPIntFromInt64);
+ 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..d92819119278a 100644
--- a/mlir/unittests/Analysis/Presburger/Utils.h
+++ b/mlir/unittests/Analysis/Presburger/Utils.h
@@ -153,10 +153,10 @@ inline void expectComputedVolumeIsValidOverapprox(
inline void expectComputedVolumeIsValidOverapprox(
const std::optional<DynamicAPInt> &computedVolume,
std::optional<int64_t> trueVolume, std::optional<int64_t> resultBound) {
+ 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/194820
More information about the Mlir-commits
mailing list