Skip to content

Commit 8cfb716

Browse files
authored
[mlir][ArmSME] Replace use of isa with isa_and_present (#82798)
`op` can be null here, in which case this should just return a null value back.
1 parent cb2dd02 commit 8cfb716

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

mlir/lib/Dialect/ArmSME/Transforms/VectorLegalization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ struct LiftIllegalVectorTransposeToMemory
459459
}
460460

461461
static Value getExtensionSource(Operation *op) {
462-
if (isa<arith::ExtSIOp, arith::ExtUIOp, arith::ExtFOp>(op))
462+
if (isa_and_present<arith::ExtSIOp, arith::ExtUIOp, arith::ExtFOp>(op))
463463
return op->getOperand(0);
464464
return {};
465465
}

mlir/test/Dialect/ArmSME/vector-legalization.mlir

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,14 @@ func.func @lift_illegal_transpose_to_memory_with_in_bounds_attr(%a: index, %b: i
377377
%legalType = vector.transpose %illegalRead, [1, 0] : vector<[8]x4xf32> to vector<4x[8]xf32>
378378
return %legalType : vector<4x[8]xf32>
379379
}
380+
381+
// -----
382+
383+
// The pass should do nothing (and not crash).
384+
// CHECK-LABEL: @illegal_transpose_no_defining_source_op
385+
func.func @illegal_transpose_no_defining_source_op(%vec: vector<[4]x1xf32>) -> vector<1x[4]xf32>
386+
{
387+
// CHECK: vector.transpose
388+
%0 = vector.transpose %vec, [1, 0] : vector<[4]x1xf32> to vector<1x[4]xf32>
389+
return %0 : vector<1x[4]xf32>
390+
}

0 commit comments

Comments
 (0)