[PATCH] D94892: [LV] Unconditionally branch from middle to scalar preheader if the scalar loop must execute

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 07:27:50 PDT 2021


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5919
 
 bool LoopVectorizationCostModel::isCandidateForEpilogueVectorization(
     const Loop &L, ElementCount VF) const {
----------------
Not sure if this may help with the reported failures, but if vectorizing a loop having multiple exits is not (yet) intended to work for epilog vectorization, perhaps return false here if OrigLoop has multiple exit blocks.
(Otherwise the CFG of https://llvm.org/docs/Vectorizers.html#epilogue-vectorization may be updated).

Another thought to try and reduce the effect of the patch temporarily, is to check
`  if (!LoopExitBlock)`
instead of
`  if (!Cost->requiresScalarEpilogue())`
leaving the suboptimal but currently working code for single exit loops that require scalar epilogue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94892/new/

https://reviews.llvm.org/D94892



More information about the llvm-commits mailing list