This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Insert loop.yield to IfOp regions only if it's void.
ClosedPublic

Authored by pifon2a on Mar 23 2020, 5:22 AM.

Diff Detail

Event Timeline

pifon2a created this revision.Mar 23 2020, 5:22 AM
nicolasvasilache accepted this revision.Mar 23 2020, 6:25 AM
This revision is now accepted and ready to land.Mar 23 2020, 6:25 AM
pifon2a updated this revision to Diff 252128.Mar 23 2020, 1:15 PM

Resolve merge conflicts.

pifon2a retitled this revision from [MLIR] Extend builder of `loop.if` op to support non-void ops. to [MLIR] Refactor builder of `loop.if` op with support of non-void ops..Mar 23 2020, 1:16 PM
pifon2a edited reviewers, added: nmostafa; removed: ftynse.
nmostafa added inline comments.Mar 23 2020, 1:57 PM
mlir/include/mlir/Dialect/LoopOps/LoopOps.td
227

Any reason for this refactoring ? I prefer to have results before uses to be consistent with tbl-gen'ed builders. Also, use TypeRange instead of ArrayRef.

235

Is the condition here reversed ? If we built a void IfOp, the YieldOp is auto-inserted, else it is missing, and we insert at end of block.

pifon2a updated this revision to Diff 252142.Mar 23 2020, 2:36 PM

Addressed the comments.

pifon2a updated this revision to Diff 252144.Mar 23 2020, 2:38 PM

Remove whitespace.

pifon2a retitled this revision from [MLIR] Refactor builder of `loop.if` op with support of non-void ops. to [MLIR] Insert loop.yield to IfOp regions only if it's void..Mar 23 2020, 2:39 PM
pifon2a marked 2 inline comments as done.Mar 23 2020, 2:42 PM

@nmostafa thank you!

mlir/include/mlir/Dialect/LoopOps/LoopOps.td
227

It became a refactoring after I rebased. I had a similar patch last week to add a builder for IfOp with results, but I did not send it out on Friday. Today I sent it out and then after rebasing I noticed your patch. I do not really care about order of resultTypes args. I care only about loop.yield not being inserted for non-void ifops.

235

thank you for noticing!

nmostafa accepted this revision.Mar 23 2020, 2:48 PM

LGTM. Thanks for fixing this !

mlir/include/mlir/Dialect/LoopOps/LoopOps.td
234

nit: extra space after "?" @ line 240 as well.

pifon2a updated this revision to Diff 252148.Mar 23 2020, 2:59 PM

Fixing stuff.

pifon2a updated this revision to Diff 252160.Mar 23 2020, 3:20 PM

remove more whitespaces

pifon2a marked 3 inline comments as done.Mar 23 2020, 3:22 PM
This revision was automatically updated to reflect the committed changes.