Skip to content

Commit b528b97

Browse files
committed
remove new canonicalizer
1 parent 61f4e2e commit b528b97

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5554,18 +5554,10 @@ OpFoldResult ShapeCastOp::fold(FoldAdaptor adaptor) {
55545554
}
55555555

55565556
// Y = shape_cast(broadcast(X))
5557-
// -> X, if X and Y have same type, else
5558-
// -> shape_cast(X) if X is a vector and the broadcast preserves
5559-
// number of elements.
5557+
// -> X, if X and Y have same type
55605558
if (auto bcastOp = getSource().getDefiningOp<BroadcastOp>()) {
55615559
if (bcastOp.getSourceType() == resultType)
55625560
return bcastOp.getSource();
5563-
if (auto bcastSrcType = dyn_cast<VectorType>(bcastOp.getSourceType())) {
5564-
if (bcastSrcType.getNumElements() == resultType.getNumElements()) {
5565-
setOperand(bcastOp.getSource());
5566-
return getResult();
5567-
}
5568-
}
55695561
}
55705562

55715563
// shape_cast(constant) -> constant

mlir/test/Dialect/Vector/canonicalize.mlir

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -972,18 +972,6 @@ func.func @fold_broadcast_shapecast(%arg0: vector<4xf32>) -> vector<4xf32> {
972972

973973
// -----
974974

975-
// CHECK-LABEL: func @fold_count_preserving_broadcast_shapecast
976-
// CHECK-SAME: (%[[V:.+]]: vector<4xf32>)
977-
// CHECK: %[[SHAPECAST:.*]] = vector.shape_cast %[[V]] : vector<4xf32> to vector<2x2xf32>
978-
// CHECK: return %[[SHAPECAST]] : vector<2x2xf32>
979-
func.func @fold_count_preserving_broadcast_shapecast(%arg0: vector<4xf32>) -> vector<2x2xf32> {
980-
%0 = vector.broadcast %arg0 : vector<4xf32> to vector<1x1x4xf32>
981-
%1 = vector.shape_cast %0 : vector<1x1x4xf32> to vector<2x2xf32>
982-
return %1 : vector<2x2xf32>
983-
}
984-
985-
// -----
986-
987975
// CHECK-LABEL: func @canonicalize_broadcast_shapecast_scalar
988976
// CHECK: vector.broadcast
989977
// CHECK-NOT: vector.shape_cast

0 commit comments

Comments
 (0)