[LV] Fix scalar cost for tail predicated loops
authorDavid Green <david.green@arm.com>
Sat, 12 Dec 2020 14:21:40 +0000 (14:21 +0000)
committerDavid Green <david.green@arm.com>
Sat, 12 Dec 2020 14:21:40 +0000 (14:21 +0000)
commitab97c9bdb747c873cd35a18229e2694156a7607d
tree650099f8d0e3b9b175761f6032b7fa94b37246b0
parentd716eab197abec0b9aab4a76cd1a52b248b8c3b1
[LV] Fix scalar cost for tail predicated loops

When it comes to the scalar cost of any predicated block, the loop
vectorizer by default regards this predication as a sign that it is
looking at an if-conversion and divides the scalar cost of the block by
2, assuming it would only be executed half the time. This however makes
no sense if the predication has been introduced to tail predicate the
loop.

Original patch by Anna Welker

Differential Revision: https://reviews.llvm.org/D86452
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/ARM/scalar-block-cost.ll