Page MenuHomePhabricator

[mlir][Standard] Add a canonicalization to simplify cond_br when the successors are identical

Authored by rriddle on Apr 22 2020, 3:45 PM.



This revision adds support for canonicalizing the following:

cond_br %cond, ^bb1(A, ..., N), ^bb1(A, ..., N)

br ^bb1(A, ..., N)

If the operands to the successor are different and the cond_br is the only predecessor, we emit selects for the branch operands.

cond_br %cond, ^bb1(A), ^bb1(B)

%select = select %cond, A, B
br ^bb1(%select)

Depends On D78681

Diff Detail

Event Timeline

rriddle created this revision.Apr 22 2020, 3:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2020, 3:45 PM
benvanik accepted this revision.Apr 22 2020, 6:07 PM
This revision is now accepted and ready to land.Apr 22 2020, 6:07 PM
This revision was automatically updated to reflect the committed changes.