[mlir] Use llvm::make_pointer_range (NFC)#167833
Merged
kazutakahirata merged 1 commit intollvm:mainfrom Nov 13, 2025
Merged
Conversation
llvm::map_range(..., [](OpOperand &o) { return &o; })
is equivalent to llvm::make_pointer_range, and the latter is shorter.
Member
|
@llvm/pr-subscribers-mlir-linalg Author: Kazu Hirata (kazutakahirata) Changesllvm::map_range(..., [](OpOperand &o) { return &o; }) is equivalent to llvm::make_pointer_range, and the latter is shorter. Full diff: https://github.com/llvm/llvm-project/pull/167833.diff 1 Files Affected:
diff --git a/mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp b/mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp
index 9974ccd8ae79e..cbd63576619b6 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp
@@ -200,10 +200,10 @@ static void populateOpPayload(
SmallVector<OpOperand *> newInputOperands = newOp.getDpsInputOperands();
updateReplacements(origInputOperands, newInputOperands, origInsToNewInsPos);
- SmallVector<OpOperand *> origOutputOperands = llvm::to_vector(llvm::map_range(
- genericOp.getDpsInitsMutable(), [](OpOperand &o) { return &o; }));
- SmallVector<OpOperand *> newOutputOperands = llvm::to_vector(llvm::map_range(
- newOp.getDpsInitsMutable(), [](OpOperand &o) { return &o; }));
+ SmallVector<OpOperand *> origOutputOperands =
+ llvm::to_vector(llvm::make_pointer_range(genericOp.getDpsInitsMutable()));
+ SmallVector<OpOperand *> newOutputOperands =
+ llvm::to_vector(llvm::make_pointer_range(newOp.getDpsInitsMutable()));
updateReplacements(origOutputOperands, newOutputOperands,
origOutsToNewOutsPos);
|
Member
|
@llvm/pr-subscribers-mlir Author: Kazu Hirata (kazutakahirata) Changesllvm::map_range(..., [](OpOperand &o) { return &o; }) is equivalent to llvm::make_pointer_range, and the latter is shorter. Full diff: https://github.com/llvm/llvm-project/pull/167833.diff 1 Files Affected:
diff --git a/mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp b/mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp
index 9974ccd8ae79e..cbd63576619b6 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/EraseUnusedOperandsAndResults.cpp
@@ -200,10 +200,10 @@ static void populateOpPayload(
SmallVector<OpOperand *> newInputOperands = newOp.getDpsInputOperands();
updateReplacements(origInputOperands, newInputOperands, origInsToNewInsPos);
- SmallVector<OpOperand *> origOutputOperands = llvm::to_vector(llvm::map_range(
- genericOp.getDpsInitsMutable(), [](OpOperand &o) { return &o; }));
- SmallVector<OpOperand *> newOutputOperands = llvm::to_vector(llvm::map_range(
- newOp.getDpsInitsMutable(), [](OpOperand &o) { return &o; }));
+ SmallVector<OpOperand *> origOutputOperands =
+ llvm::to_vector(llvm::make_pointer_range(genericOp.getDpsInitsMutable()));
+ SmallVector<OpOperand *> newOutputOperands =
+ llvm::to_vector(llvm::make_pointer_range(newOp.getDpsInitsMutable()));
updateReplacements(origOutputOperands, newOutputOperands,
origOutsToNewOutsPos);
|
tgymnich
approved these changes
Nov 13, 2025
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
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.
llvm::map_range(..., [](OpOperand &o) { return &o; })
is equivalent to llvm::make_pointer_range, and the latter is shorter.