File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -6009,6 +6009,10 @@ OpFoldResult vector::TransposeOp::fold(FoldAdaptor adaptor) {
6009
6009
if (attr.isSplat ())
6010
6010
return attr.reshape (getResultVectorType ());
6011
6011
6012
+ // Eliminate poison transpose ops.
6013
+ if (llvm::dyn_cast_if_present<ub::PoisonAttr>(adaptor.getVector ()))
6014
+ return ub::PoisonAttr::get (getContext ());
6015
+
6012
6016
// Eliminate identity transpose ops. This happens when the dimensions of the
6013
6017
// input vector remain in their original order after the transpose operation.
6014
6018
ArrayRef<int64_t > perm = getPermutation ();
Original file line number Diff line number Diff line change @@ -2240,6 +2240,17 @@ func.func @transpose_splat2(%arg : f32) -> vector<3x4xf32> {
2240
2240
2241
2241
// -----
2242
2242
2243
+ // CHECK-LABEL: transpose_poison
2244
+ // CHECK: %[[POISON:.*]] = ub.poison : vector<4x6xi8>
2245
+ // CHECK: return %[[POISON]] : vector<4x6xi8>
2246
+ func.func @transpose_poison () -> vector <4 x6 xi8 > {
2247
+ %poison = ub.poison : vector <6 x4 xi8 >
2248
+ %transpose = vector.transpose %poison , [1 , 0 ] : vector <6 x4 xi8 > to vector <4 x6 xi8 >
2249
+ return %transpose : vector <4 x6 xi8 >
2250
+ }
2251
+
2252
+ // -----
2253
+
2243
2254
// CHECK-LABEL: func.func @insert_1d_constant
2244
2255
// CHECK-DAG: %[[ACST:.*]] = arith.constant dense<[9, 1, 2]> : vector<3xi32>
2245
2256
// CHECK-DAG: %[[BCST:.*]] = arith.constant dense<[0, 9, 2]> : vector<3xi32>
You can’t perform that action at this time.
0 commit comments