[VectorCombine] scalarize compares with insertelement operand(s)
authorSanjay Patel <spatel@rotateright.com>
Tue, 16 Jun 2020 17:30:40 +0000 (13:30 -0400)
committerSanjay Patel <spatel@rotateright.com>
Tue, 16 Jun 2020 17:48:10 +0000 (13:48 -0400)
commited67f5e7ab59d378bb09153a0df132333c43c9cb
tree4d21c5941dfa14675ed45acdc5eb51a9e3f33f19
parent12b01ab7fa10939d67ac7cb2da1d3ca8a41b5fcd
[VectorCombine] scalarize compares with insertelement operand(s)

Generalize scalarization (recently enhanced with D80885)
to allow compares as well as binops.
Similar to binops, we are avoiding scalarization of a loaded
value because that could avoid a register transfer in codegen.
This requires 1 extra predicate that I am aware of: we do not
want to scalarize the condition value of a vector select. That
might also invert a transform that we do in instcombine that
prefers a vector condition operand for a vector select.

I think this is the final step in solving PR37463:
https://bugs.llvm.org/show_bug.cgi?id=37463

Differential Revision: https://reviews.llvm.org/D81661
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
llvm/test/Transforms/VectorCombine/X86/scalarize-cmp.ll