Given an if of the form, simplify it by eliminating the not and swapping the regions
scf.if not(c) {
yield origTrue
} else {
yield origFalse
}
becomes
scf.if c {
yield origFalse
} else {
yield origTrue
}
Paths
| Differential D116990
[MLIR][SCF] Simplify scf.if by swapping regions if condition is a not ClosedPublic Authored by wsmoses on Jan 10 2022, 7:29 PM.
Details Summary Given an if of the form, simplify it by eliminating the not and swapping the regions scf.if not(c) { yield origTrue } else { yield origFalse } becomes scf.if c { yield origFalse } else { yield origTrue }
Diff Detail
Event TimelineHerald added subscribers: sdasgup3, wenzhicui, wrengr and 18 others. · View Herald TranscriptJan 10 2022, 7:29 PM
This revision is now accepted and ready to land.Jan 11 2022, 1:53 AM Closed by commit rG5443d2ed982d: [MLIR][SCF] Simplify scf.if by swapping regions if condition is a not (authored by wsmoses). · Explain WhyJan 11 2022, 9:57 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 398989 mlir/include/mlir/Dialect/SCF/SCFOps.td
mlir/lib/Dialect/SCF/SCF.cpp
mlir/test/Dialect/SCF/canonicalize.mlir
|
Can we early-return instead?