[NFC][LoopVectorize] Remove setBestPlan in favour of getBestPlanFor
authorDavid Sherwood <david.sherwood@arm.com>
Mon, 4 Oct 2021 16:31:35 +0000 (17:31 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Wed, 27 Oct 2021 08:38:27 +0000 (09:38 +0100)
commit3d706c20f8e69795835d68b7a5ac63966027f1c1
treed48765c54255a7bec58378790ea743f154ae0074
parent5b98e4ed163b3712fc96a995717129256562f8df
[NFC][LoopVectorize] Remove setBestPlan in favour of getBestPlanFor

I have removed LoopVectorizationPlanner::setBestPlan, since this
function is quite aggressive because it deletes all other plans
except the one containing the <VF,UF> pair required. The code is
currently written to assume that all <VF,UF> pairs will live in the
same vplan. This is overly restrictive, since scalable VFs live in
different plans to fixed-width VFS. When we add support for
vectorising epilogue loops when the main loop uses scalable vectors
then we will the vplan for the main loop will be different to the
epilogue.

Instead I have added a new function called

  LoopVectorizationPlanner::getBestPlanFor

that returns the best vplan for the <VF,UF> pair requested and leaves
all the vplans untouched. We then pass this best vplan to

  LoopVectorizationPlanner::executePlan

which now takes an additional VPlanPtr argument.

Differential revision: https://reviews.llvm.org/D111125
llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/PowerPC/reg-usage.ll