Skip to content

Commit

Permalink
[mlir] Use llvm::transformOptional (NFC)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kazutakahirata committed Dec 15, 2022
1 parent c8942c6 commit 10041de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
Expand Up @@ -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;
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions mlir/unittests/Analysis/Presburger/Utils.h
Expand Up @@ -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
Expand Down

0 comments on commit 10041de

Please sign in to comment.