[LV] Logical and/or select costs
authorDavid Green <david.green@arm.com>
Thu, 8 Apr 2021 09:39:47 +0000 (10:39 +0100)
committerDavid Green <david.green@arm.com>
Thu, 8 Apr 2021 09:39:47 +0000 (10:39 +0100)
commit8675ef100f8cbf59f2e90f4836fb92db83b6062e
treed7a9bad13410b61913dc802b9f604d7c4ef8c666
parent1a4d3d0bca2beda5bdfb3261547a97af70cffb47
[LV] Logical and/or select costs

D99674 stopped the folding of certain select operations into and/or, due
to incorrect folding in the presence of poison. D97360 added some costs
to attempt to account for the change, but only worked at the getUserCost
level, not the getCmpSelInstrCost that the vectorizer will use directly.
This adds similar logic into the vectorizer to handle these logical
and/or selects, treating them like and/or directly.

This fixes 60% performance regressions from code like the attached test
case.

Differential Revision: https://reviews.llvm.org/D99884
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/ARM/mve-selectandorcost.ll