llvm-project
2291d0ab - [DAGCombiner] Turn `(neg (max x, (neg x)))` into `(min x, (neg x))` (#120666)

Commit
344 days ago
[DAGCombiner] Turn `(neg (max x, (neg x)))` into `(min x, (neg x))` (#120666) This pattern was originally spotted in 429.mcf by @topperc. We already have a DAGCombiner pattern to turn `(neg (abs x))` into `(min x, (neg x))`. But in some cases `(neg (max x, (neg x)))` is formed by an expanded `abs` followed by a `neg` that is generated only after the `abs` expansion. This patch adds a separate pattern to match cases like this, as well as its inverse pattern: `(neg (min X, (neg X))) --> (max X, (neg X))`. This pattern is applicable to both signed and unsigned min/max.
Author
Parents
Loading