This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add canonicalization for cond_br that feed into a cond_br on the same condition
ClosedPublic

Authored by rriddle on Oct 16 2020, 5:00 PM.

Details

Summary
  ...
  cond_br %cond, ^bb1(...), ^bb2(...)
...
^bb1: // has single predecessor
  ...
  cond_br %cond, ^bb3(...), ^bb4(...)

->

  ...
  cond_br %cond, ^bb1(...), ^bb2(...)
...
^bb1: // has single predecessor
  ...
  br ^bb3(...)

Diff Detail

Event Timeline

rriddle created this revision.Oct 16 2020, 5:00 PM
rriddle requested review of this revision.Oct 16 2020, 5:00 PM
jpienaar accepted this revision.Oct 16 2020, 7:35 PM

Nice, micro nit: in description add ... as when I initially read it I thought there was requirement for empty block bb1

This revision is now accepted and ready to land.Oct 16 2020, 7:35 PM
mehdi_amini accepted this revision.Oct 16 2020, 9:04 PM
mehdi_amini added inline comments.
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1104

Trivial braces?

bondhugula added inline comments.
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1067

Consider adding a line on the simplification - the example below doesn't capture the fact that ^bb1 has only one predessor.

1076

Nit: please add `// has single predecessor```

1097

Nit: a -> an

rriddle edited the summary of this revision. (Show Details)Oct 18 2020, 1:32 PM
rriddle updated this revision to Diff 298901.Oct 18 2020, 1:43 PM
rriddle marked 4 inline comments as done.

Resolve comments

Thanks for the review!

This revision was landed with ongoing or failed builds.Oct 18 2020, 1:56 PM
This revision was automatically updated to reflect the committed changes.