mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-01 12:43:47 +00:00
[mlir] avoid crash in transform.sequence verifier (#66756)
The verifier was unconditionally accessing the body block terminator, but it's not guaranteed that the block has one in general.
This commit is contained in:
parent
73c2cb5999
commit
a2a1dbb518
@ -2188,6 +2188,9 @@ LogicalResult transform::SequenceOp::verify() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!getBodyBlock()->hasTerminator())
|
||||
return emitOpError() << "expects to have a terminator in the body";
|
||||
|
||||
if (getBodyBlock()->getTerminator()->getOperandTypes() !=
|
||||
getOperation()->getResultTypes()) {
|
||||
InFlightDiagnostic diag = emitOpError()
|
||||
|
@ -22,6 +22,16 @@ transform.sequence failures(propagate) {
|
||||
}
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
// expected-error @below {{expects to have a terminator in the body}}
|
||||
"transform.sequence"() <{failure_propagation_mode = 1 : i32, operandSegmentSizes = array<i32: 0, 0>}> ({
|
||||
^bb0(%arg0: !transform.any_op):
|
||||
transform.apply_patterns to %arg0 {
|
||||
} : !transform.any_op
|
||||
}) : () -> ()
|
||||
|
||||
|
||||
// -----
|
||||
|
||||
// expected-error @below {{'transform.sequence' op expects trailing entry block arguments to be of type implementing TransformHandleTypeInterface, TransformValueHandleTypeInterface or TransformParamTypeInterface}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user