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) {
60096009 if (attr.isSplat ())
60106010 return attr.reshape (getResultVectorType ());
60116011
6012+ // Eliminate poison transpose ops.
6013+ if (llvm::dyn_cast_if_present<ub::PoisonAttr>(adaptor.getVector ()))
6014+ return ub::PoisonAttr::get (getContext ());
6015+
60126016 // Eliminate identity transpose ops. This happens when the dimensions of the
60136017 // input vector remain in their original order after the transpose operation.
60146018 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> {
22402240
22412241// -----
22422242
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+
22432254// CHECK-LABEL: func.func @insert_1d_constant
22442255// CHECK-DAG: %[[ACST:.*]] = arith.constant dense<[9, 1, 2]> : vector<3xi32>
22452256// CHECK-DAG: %[[BCST:.*]] = arith.constant dense<[0, 9, 2]> : vector<3xi32>
You can’t perform that action at this time.
0 commit comments