This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Do not yield values from an assuming op that are never used
ClosedPublic

Authored by frgossen on Apr 7 2021, 8:39 AM.

Diff Detail

Event Timeline

frgossen created this revision.Apr 7 2021, 8:39 AM
frgossen requested review of this revision.Apr 7 2021, 8:39 AM
jpienaar added inline comments.Apr 7 2021, 4:54 PM
mlir/lib/Dialect/Shape/IR/Shape.cpp
295

Why do we need to copy the body? Couldn't the body be taken over?

And here the only different op would be the yield & new return type correct?

frgossen updated this revision to Diff 336038.Apr 8 2021, 2:22 AM

Address comments

frgossen marked an inline comment as done.Apr 8 2021, 2:24 AM
frgossen added inline comments.
mlir/lib/Dialect/Shape/IR/Shape.cpp
295

Right :)

mstorsjo removed a subscriber: mstorsjo.Apr 8 2021, 2:25 AM
tpopp added inline comments.Apr 9 2021, 1:49 AM
mlir/lib/Dialect/Shape/IR/Shape.cpp
299–301

optional super nit: moving this before the yieldOp creation would remove one setInsertionPoint call

tpopp accepted this revision.Apr 9 2021, 1:49 AM

Nice code.

This revision is now accepted and ready to land.Apr 9 2021, 1:49 AM
frgossen marked 2 inline comments as done.Apr 9 2021, 2:03 AM
frgossen added inline comments.
mlir/lib/Dialect/Shape/IR/Shape.cpp
299–301

Had that first but you'd have to collect the return types somewhere earlier. (see newYieldOp->getOperandTypes())

This revision was automatically updated to reflect the committed changes.
frgossen marked an inline comment as done.