[LoopVectorize] Change PredicatedBBsAfterVectorization to be per VF
authorDavid Sherwood <david.sherwood@arm.com>
Tue, 21 Jun 2022 13:07:49 +0000 (14:07 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Tue, 12 Jul 2022 13:53:20 +0000 (14:53 +0100)
commit6b694d600aeaaf30780e48cac0b784b8bc755b56
tree874d56cf2bc8d68fdfb211a9ba46e358574ddf06
parentded62411f730278016274361e5ce4e5234cc2957
[LoopVectorize] Change PredicatedBBsAfterVectorization to be per VF

When calculating the cost of Instruction::Br in getInstructionCost
we query PredicatedBBsAfterVectorization to see if there is a
scalar predicated block. However, this meant that the decisions
being made for a given fixed-width VF were affecting the cost for a
scalable VF. As a result we were returning InstructionCost::Invalid
pointlessly for a scalable VF that should have a low cost. I
encountered this for some loops when enabling tail-folding for
scalable VFs.

Test added here:

  Transforms/LoopVectorize/AArch64/sve-tail-folding-cost.ll

Differential Revision: https://reviews.llvm.org/D128272
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-cost.ll [new file with mode: 0644]