Skip to content

Commit ea3a0f2

Browse files
committed
Feedback
1 parent 96b4a39 commit ea3a0f2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ void VectorDialect::initialize() {
437437
Operation *VectorDialect::materializeConstant(OpBuilder &builder,
438438
Attribute value, Type type,
439439
Location loc) {
440-
if (auto poisonAttr = dyn_cast<ub::PoisonAttrInterface>(value))
441-
return builder.create<ub::PoisonOp>(loc, type, poisonAttr);
440+
if (isa<ub::PoisonAttrInterface>(value))
441+
return value.getDialect().materializeConstant(builder, value, type, loc);
442442

443443
return arith::ConstantOp::materialize(builder, value, type, loc);
444444
}

mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,11 +1250,11 @@ func.func @extract_scalar_from_vec_1d_f32(%arg0: vector<16xf32>) -> f32 {
12501250

12511251
// -----
12521252

1253-
func.func @extract_poison_idx(%arg0: vector<16xf32>) -> f32 {
1253+
func.func @extract_scalar_from_vec_1d_f32_poison_idx(%arg0: vector<16xf32>) -> f32 {
12541254
%0 = vector.extract %arg0[-1]: f32 from vector<16xf32>
12551255
return %0 : f32
12561256
}
1257-
// CHECK-LABEL: @extract_poison_idx
1257+
// CHECK-LABEL: @extract_scalar_from_vec_1d_f32_poison_idx
12581258
// CHECK: %[[UB:.*]] = ub.poison : f32
12591259
// CHECK: return %[[UB]] : f32
12601260

@@ -1335,6 +1335,16 @@ func.func @extract_vec_2d_from_vec_3d_f32(%arg0: vector<4x3x16xf32>) -> vector<3
13351335

13361336
// -----
13371337

1338+
func.func @extract_vec_2d_from_vec_3d_f32_poison_idx(%arg0: vector<4x3x16xf32>) -> vector<3x16xf32> {
1339+
%0 = vector.extract %arg0[-1]: vector<3x16xf32> from vector<4x3x16xf32>
1340+
return %0 : vector<3x16xf32>
1341+
}
1342+
// CHECK-LABEL: @extract_vec_2d_from_vec_3d_f32_poison_idx
1343+
// CHECK: %[[UB:.*]] = ub.poison : vector<3x16xf32>
1344+
// CHECK: return %[[UB]] : vector<3x16xf32>
1345+
1346+
// -----
1347+
13381348
func.func @extract_vec_2d_from_vec_3d_f32_scalable(%arg0: vector<4x3x[16]xf32>) -> vector<3x[16]xf32> {
13391349
%0 = vector.extract %arg0[0]: vector<3x[16]xf32> from vector<4x3x[16]xf32>
13401350
return %0 : vector<3x[16]xf32>

0 commit comments

Comments
 (0)