[PATCH] D82602: [SelectionDAG] don't split branch on logic-of-vector-compares

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 05:24:38 PDT 2020


spatel added a comment.

In D82602#2115689 <https://reviews.llvm.org/D82602#2115689>, @efriedma wrote:

> Would it make sense to treat this as an SLP issue?  i.e. we should transform `and(extractelement(x,0), extractelement(x,1))` to `vector.reduce.and(x)`?  If we're not extracting two elements from the same vector, the transform doesn't look as good.


Yes - however, my attempt within SLP failed (D59710 <https://reviews.llvm.org/D59710>). We should now get this simplest case in VectorCombine.
I am still trying to solve another variation of the pattern more generally in VectorCombine with D82474 <https://reviews.llvm.org/D82474>. But cases like this may escape as shown in that patch description. If we don't account for the transform to use movmsk with a scalar compare + branch, the cost model may say it's not profitable. So we need to look at larger patterns to see what tricks codegen can perform, but that gets more and more complicated as we lengthen the match in IR.

I think it's fine to limit the bailout here by matching a common source vector, so I can add that clause.


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

https://reviews.llvm.org/D82602





More information about the llvm-commits mailing list