From 10041de960622091ce9d0fdd7013a35c1a4ea196 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 14 Dec 2022 18:32:09 -0800 Subject: [PATCH] [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 --- mlir/include/mlir/Analysis/Presburger/IntegerRelation.h | 4 ++-- mlir/unittests/Analysis/Presburger/Utils.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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 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 &computedVolume, Optional trueVolume, Optional resultBound) { - expectComputedVolumeIsValidOverapprox(computedVolume, - trueVolume.transform(mpintFromInt64), - resultBound.transform(mpintFromInt64)); + expectComputedVolumeIsValidOverapprox( + computedVolume, llvm::transformOptional(trueVolume, mpintFromInt64), + llvm::transformOptional(resultBound, mpintFromInt64)); } } // namespace presburger