[Mlir-commits] [mlir] 10041de - [mlir] Use llvm::transformOptional (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Wed Dec 14 18:32:15 PST 2022
Author: Kazu Hirata
Date: 2022-12-14T18:32:09-08:00
New Revision: 10041de960622091ce9d0fdd7013a35c1a4ea196
URL: https://github.com/llvm/llvm-project/commit/10041de960622091ce9d0fdd7013a35c1a4ea196
DIFF: https://github.com/llvm/llvm-project/commit/10041de960622091ce9d0fdd7013a35c1a4ea196.diff
LOG: [mlir] Use llvm::transformOptional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Added:
Modified:
mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
mlir/unittests/Analysis/Presburger/Utils.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h b/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
index 772bcea6187cb..349c05e20a87f 100644
--- a/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
+++ b/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
@@ -493,7 +493,7 @@ class IntegerRelation {
*ub = getInt64Vec(ubMPInt);
if (boundFloorDivisor)
*boundFloorDivisor = int64_t(boundFloorDivisorMPInt);
- return result.transform(int64FromMPInt);
+ return llvm::transformOptional(result, int64FromMPInt);
}
/// Returns the constant bound for the pos^th variable if there is one;
@@ -502,7 +502,7 @@ class IntegerRelation {
/// The same, but casts to int64_t. This is unsafe and will assert-fail if the
/// value does not fit in an int64_t.
Optional<int64_t> getConstantBound64(BoundType type, unsigned pos) const {
- return getConstantBound(type, pos).transform(int64FromMPInt);
+ return llvm::transformOptional(getConstantBound(type, pos), int64FromMPInt);
}
/// Removes constraints that are independent of (i.e., do not have a
diff --git a/mlir/unittests/Analysis/Presburger/Utils.h b/mlir/unittests/Analysis/Presburger/Utils.h
index b100771021814..70ccb484bb427 100644
--- a/mlir/unittests/Analysis/Presburger/Utils.h
+++ b/mlir/unittests/Analysis/Presburger/Utils.h
@@ -67,9 +67,9 @@ inline void
expectComputedVolumeIsValidOverapprox(const Optional<MPInt> &computedVolume,
Optional<int64_t> trueVolume,
Optional<int64_t> resultBound) {
- expectComputedVolumeIsValidOverapprox(computedVolume,
- trueVolume.transform(mpintFromInt64),
- resultBound.transform(mpintFromInt64));
+ expectComputedVolumeIsValidOverapprox(
+ computedVolume, llvm::transformOptional(trueVolume, mpintFromInt64),
+ llvm::transformOptional(resultBound, mpintFromInt64));
}
} // namespace presburger
More information about the Mlir-commits
mailing list