Skip to content

Commit 5ddc5b8

Browse files
authored
[mlir][emitc] Fix emitc.expression example (#84060)
Make it use and refer to `emitc.yield` and also fix type issues.
1 parent a9ff5c0 commit 5ddc5b8

File tree

1 file changed

+7
-7
lines changed
  • mlir/include/mlir/Dialect/EmitC/IR

1 file changed

+7
-7
lines changed

mlir/include/mlir/Dialect/EmitC/IR/EmitC.td

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,17 +389,17 @@ def EmitC_ExpressionOp : EmitC_Op<"expression",
389389

390390
As the operation is to be emitted as a C expression, the operations within
391391
its body must form a single Def-Use tree of emitc ops whose result is
392-
yielded by a terminating `yield`.
392+
yielded by a terminating `emitc.yield`.
393393

394394
Example:
395395

396396
```mlir
397-
%r = emitc.expression : () -> i32 {
397+
%r = emitc.expression : i32 {
398398
%0 = emitc.add %a, %b : (i32, i32) -> i32
399-
%1 = emitc.call "foo"(%0) : () -> i32
399+
%1 = emitc.call_opaque "foo"(%0) : (i32) -> i32
400400
%2 = emitc.add %c, %d : (i32, i32) -> i32
401401
%3 = emitc.mul %1, %2 : (i32, i32) -> i32
402-
yield %3
402+
emitc.yield %3 : i32
403403
}
404404
```
405405

@@ -409,9 +409,9 @@ def EmitC_ExpressionOp : EmitC_Op<"expression",
409409
int32_t v7 = foo(v1 + v2) * (v3 + v4);
410410
```
411411

412-
The operations allowed within expression body are emitc.add, emitc.apply,
413-
emitc.call, emitc.cast, emitc.cmp, emitc.div, emitc.mul, emitc.rem and
414-
emitc.sub.
412+
The operations allowed within expression body are `emitc.add`,
413+
`emitc.apply`, `emitc.call_opaque`, `emitc.cast`, `emitc.cmp`, `emitc.div`,
414+
`emitc.mul`, `emitc.rem`, and `emitc.sub`.
415415

416416
When specified, the optional `do_not_inline` indicates that the expression is
417417
to be emitted as seen above, i.e. as the rhs of an EmitC SSA value

0 commit comments

Comments
 (0)