Skip to content

Commit

Permalink
[LLHD] Verify empty processes (llvm#6801)
Browse files Browse the repository at this point in the history
  • Loading branch information
maerhart authored Mar 8, 2024
1 parent 95a2f94 commit a4a1eb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/circt/Dialect/LLHD/IR/StructureOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def LLHD_ProcOp : LLHD_Op<"proc", [
OptionalAttr<DictArrayAttr>:$arg_attrs,
OptionalAttr<DictArrayAttr>:$res_attrs
);
let regions = (region AnyRegion: $body);
let regions = (region MinSizedRegion<1>: $body);

let extraClassDeclaration = [{
/// Verify the type attribute of this function. Returns failure and emits
Expand Down
10 changes: 10 additions & 0 deletions test/Dialect/LLHD/IR/inst-errors.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,13 @@ llhd.entity @moduleTypeMismatch() -> (%arg0: !llhd.sig<i3>) {
// expected-error @+1 {{output type mismatch}}
llhd.inst "inst" @module() -> (%arg0) : () -> !llhd.sig<i3>
}

// -----

// expected-error @below {{region #0 ('body') failed to verify constraint: region with at least 1 blocks}}
llhd.proc @empty() -> () {}

// -----

// expected-error @below {{empty block: expect at least a terminator}}
llhd.proc @empty(%a: !llhd.sig<i1>) -> () {}

0 comments on commit a4a1eb6

Please sign in to comment.