Skip to content

Commit d546ab3

Browse files
committed
further dup removal
1 parent 6e68537 commit d546ab3

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

mlir/lib/Dialect/Vector/IR/VectorOps.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5769,10 +5769,7 @@ class ShapeCastCreateMaskFolderTrailingOneDim final
57695769
}
57705770
};
57715771

5772-
/// Pattern to rewrite Y = ShapeCast(Broadcast(X)) as either
5773-
/// i) Y = ShapeCast(X), or
5774-
/// ii) Y = Broadcast(X)
5775-
/// If both (i) and (ii) are possible, (i) is chosen.
5772+
/// Pattern to rewrite Y = ShapeCast(Broadcast(X)) as Y = Broadcast(X)
57765773
class ShapeCastBroadcastFolder final : public OpRewritePattern<ShapeCastOp> {
57775774
public:
57785775
using OpRewritePattern::OpRewritePattern;
@@ -5787,22 +5784,6 @@ class ShapeCastBroadcastFolder final : public OpRewritePattern<ShapeCastOp> {
57875784
auto srcVectorType = dyn_cast<VectorType>(broadcastOp.getSourceType());
57885785
bool srcIsScalar = !srcVectorType;
57895786

5790-
// Replace Y = ShapeCast(Broadcast(X)) with Y = ShapeCast(X).
5791-
// Example:
5792-
// %0 = vector.broadcast %in : vector<3x4xf32> to vector<1x3x4xf32>
5793-
// %1 = vector.shape_cast %0 : vector<1x3x4xf32> to vector<12xf32>
5794-
// to
5795-
// %1 = vector.shape_cast %in : vector<3x4xf32> to vector<12xf32>
5796-
if (srcVectorType) {
5797-
if (srcVectorType.getNumElements() ==
5798-
shapeCastOp.getResultVectorType().getNumElements()) {
5799-
rewriter.replaceOpWithNewOp<vector::ShapeCastOp>(
5800-
shapeCastOp, shapeCastOp.getResultVectorType(),
5801-
broadcastOp.getSource());
5802-
return success();
5803-
}
5804-
}
5805-
58065787
// Replace Y = ShapeCast(Broadcast(X)) with Y = Broadcast(X)
58075788
// Example
58085789
// %0 = vector.broadcast %in : vector<3xf32> to vector<2x4x3xf32>

0 commit comments

Comments
 (0)