File tree Expand file tree Collapse file tree 2 files changed +1
-21
lines changed Expand file tree Collapse file tree 2 files changed +1
-21
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 <4 xf32 >) -> vector <2 x2 xf32 > {
980- %0 = vector.broadcast %arg0 : vector <4 xf32 > to vector <1 x1 x4 xf32 >
981- %1 = vector.shape_cast %0 : vector <1 x1 x4 xf32 > to vector <2 x2 xf32 >
982- return %1 : vector <2 x2 xf32 >
983- }
984-
985- // -----
986-
987975// CHECK-LABEL: func @canonicalize_broadcast_shapecast_scalar
988976// CHECK: vector.broadcast
989977// CHECK-NOT: vector.shape_cast
You can’t perform that action at this time.
0 commit comments