[LV] Pass compare predicate to getCmpSelInstrCost.
authorSander de Smalen <sander.desmalen@arm.com>
Mon, 6 Dec 2021 11:14:27 +0000 (11:14 +0000)
committerSander de Smalen <sander.desmalen@arm.com>
Mon, 6 Dec 2021 11:41:27 +0000 (11:41 +0000)
commit3d549dddf75b6ff9e0ec8c053677750bde4226ea
tree2fdb1cc60422b90dbadc7022841cd4598af98ca2
parentab31d003e16e483bff298ea2f28fec0f23e8eb79
[LV] Pass compare predicate to getCmpSelInstrCost.

If the condition of a select is a compare, pass its predicate to
TTI::getCmpSelInstrCost to get a more accurate cost value instead
of passing BAD_ICMP_PREDICATE.

I noticed that the commit message from D90070 had a comment about the
vectorized select predicate possibly being composed of other compares with
different predicate values, but I wasn't able to construct an example
where this was an actual issue. If this is an issue, I guess we could
add another check that the block isn't predicated for any reason.

Reviewed By: dmgreen, fhahn

Differential Revision: https://reviews.llvm.org/D114646
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll