-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[MLIR] Fix dangling llvm::function_ref references #114950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-bufferization Author: Haojian Wu (hokein) ChangesFull diff: https://github.com/llvm/llvm-project/pull/114950.diff 3 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
index 72abb5b3f1f94e..ab9a48f3473c27 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
@@ -163,7 +163,7 @@ struct BufferResultsToOutParamsOpts {
// Filter function; returns true if the function should be converted.
// Defaults to true, i.e. all functions are converted.
- llvm::function_ref<bool(func::FuncOp *)> filterFn = [](func::FuncOp *func) {
+ std::function<bool(func::FuncOp *)> filterFn = [](func::FuncOp *func) {
return true;
};
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index 6678878215c11f..a07593be2fc5eb 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -1084,13 +1084,12 @@ struct ForOpTensorCastFolder : public OpRewritePattern<ForOp> {
continue;
// Create a new ForOp with that iter operand replaced.
- ValueTypeCastFnTy castFn = [](OpBuilder &b, Location loc, Type type,
- Value source) {
- return b.create<tensor::CastOp>(loc, type, source);
- };
rewriter.replaceOp(
- op, replaceAndCastForOpIterArg(rewriter, op, iterOpOperand,
- incomingCast.getSource(), castFn));
+ op, replaceAndCastForOpIterArg(
+ rewriter, op, iterOpOperand, incomingCast.getSource(),
+ [](OpBuilder &b, Location loc, Type type, Value source) {
+ return b.create<tensor::CastOp>(loc, type, source);
+ }));
return success();
}
return failure();
diff --git a/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp b/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp
index a2acf3e732adab..0639a1087a4a4f 100644
--- a/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp
+++ b/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp
@@ -319,7 +319,7 @@ ConstantIntRanges
mlir::intrange::inferCeilDivU(ArrayRef<ConstantIntRanges> argRanges) {
const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1];
- DivisionFixupFn ceilDivUIFix =
+ auto ceilDivUIFix =
[](const APInt &lhs, const APInt &rhs,
const APInt &result) -> std::optional<APInt> {
if (!lhs.urem(rhs).isZero()) {
@@ -368,7 +368,7 @@ ConstantIntRanges
mlir::intrange::inferCeilDivS(ArrayRef<ConstantIntRanges> argRanges) {
const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1];
- DivisionFixupFn ceilDivSIFix =
+ auto ceilDivSIFix =
[](const APInt &lhs, const APInt &rhs,
const APInt &result) -> std::optional<APInt> {
if (!lhs.srem(rhs).isZero() && lhs.isNonNegative() == rhs.isNonNegative()) {
@@ -386,7 +386,7 @@ ConstantIntRanges
mlir::intrange::inferFloorDivS(ArrayRef<ConstantIntRanges> argRanges) {
const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1];
- DivisionFixupFn floorDivSIFix =
+ auto floorDivSIFix =
[](const APInt &lhs, const APInt &rhs,
const APInt &result) -> std::optional<APInt> {
if (!lhs.srem(rhs).isZero() && lhs.isNonNegative() != rhs.isNonNegative()) {
@@ -603,7 +603,7 @@ ConstantIntRanges
mlir::intrange::inferShrS(ArrayRef<ConstantIntRanges> argRanges) {
const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1];
- ConstArithFn ashr = [](const APInt &l,
+ auto ashr = [](const APInt &l,
const APInt &r) -> std::optional<APInt> {
return r.uge(r.getBitWidth()) ? std::optional<APInt>() : l.ashr(r);
};
@@ -616,7 +616,7 @@ ConstantIntRanges
mlir::intrange::inferShrU(ArrayRef<ConstantIntRanges> argRanges) {
const ConstantIntRanges &lhs = argRanges[0], &rhs = argRanges[1];
- ConstArithFn lshr = [](const APInt &l,
+ auto lshr = [](const APInt &l,
const APInt &r) -> std::optional<APInt> {
return r.uge(r.getBitWidth()) ? std::optional<APInt>() : l.lshr(r);
};
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
joker-eph
reviewed
Nov 5, 2024
joker-eph
approved these changes
Nov 5, 2024
Thanks for the fixes! Please just run |
PhilippRados
pushed a commit
to PhilippRados/llvm-project
that referenced
this pull request
Nov 6, 2024
hokein
added a commit
that referenced
this pull request
Nov 7, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.