[PATCH] D53236: [SelectionDAG] swap select_cc operands to enable folding

Alexandros Lamprineas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 24 18:10:05 PDT 2018


labrinea added a comment.

In https://reviews.llvm.org/D53236#1265594, @spatel wrote:

> Is the motivating case integer or FP?
>  I'm asking because we have a canonicalization for integer cmp+sel for the IR in these tests, but we're missing the corresponding FP transform. 
>  If we add the FP canonicalization in IR, would there still be a need for this backend patch? Ie, is something generating this select code in the DAG itself?


Yes, the motivating example was floating point comparison. Indeed, I added the unordered predicates and modified InstCombine to handle fpcmp. It then swapped the operands and inverted the predicates for me. But what does "Canonical" actually mean? The backend still won't be able to do the transformation of the description for `select_cc(x, y, 0, 16, cc)` if cc is already canonical, assuming this is a reachable state in DAG.


https://reviews.llvm.org/D53236





More information about the llvm-commits mailing list