[PATCH] D113426: [DAGCombiner] add fold for vselect based on mask of signbit, part 3

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 06:03:41 PST 2021


spatel marked 3 inline comments as done.
spatel added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9591
+  }
   return SDValue();
 }
----------------
lebedev.ri wrote:
> lebedev.ri wrote:
> > Notice the symmetry, there's final 4'th pattern there: 
> > `(Cond0 s> -1) ? -1 : N1 --> ~(Cond0 s>> BW-1) | N1`
> > https://alive2.llvm.org/ce/z/ZefLue
> ... but we don't have a `hasOrNot()` hook, so only adding a comment should be fine i suppose.
Yes, there's a potential "part 4" to this series. I'll add the TODO comment. There are also swapped variants for all four of these patterns.

There are also several open questions of canonicalization in IR - and the interaction of rules for {preds, selects, constants, min/max} are complicated.

I got "part 2"  in this set wrong. I chose the swapped form that is currently not canonical:
https://alive2.llvm.org/ce/z/e4o96b

We probably want to match all of the swapped forms in SDAG to be more robust/consistent. I'm not sure what forms we'll end up favoring in IR, and we may not always be able to canonicalize if there are extra uses.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113426/new/

https://reviews.llvm.org/D113426



More information about the llvm-commits mailing list