Skip to content

Commit 5d0a4a1

Browse files
authored
[mlir][spirv] Emit error when block to be unlinked has uses after structurization (#163942)
This fixes the bug where deserializer would fail, with as assert, during the control flow structurization when a block to be removed still had uses. This indicates that the block that was sunk still is being referenced outside the region as the control flow is not structured. closes #163099
1 parent 8fd558d commit 5d0a4a1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,6 +2619,11 @@ LogicalResult ControlFlowStructurizer::structurize() {
26192619
// region. We cannot handle such cases given that once a value is sinked into
26202620
// the SelectionOp/LoopOp's region, there is no escape for it.
26212621
for (auto *block : constructBlocks) {
2622+
if (!block->use_empty())
2623+
return emitError(block->getParent()->getLoc(),
2624+
"failed control flow structurization: "
2625+
"block has uses outside of the "
2626+
"enclosing selection/loop construct");
26222627
for (Operation &op : *block)
26232628
if (!op.use_empty())
26242629
return op.emitOpError("failed control flow structurization: value has "

0 commit comments

Comments
 (0)