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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 7 09:32:00 PDT 2021


reames added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5919
 
 bool LoopVectorizationCostModel::isCandidateForEpilogueVectorization(
     const Loop &L, ElementCount VF) const {
----------------
Ayal wrote:
> 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.
> 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).
This seems to be a comment which applies to the future patch which enables multiple exit vectorization, not this one.  Unless I'm missing something?

Also, I would really expect a flag called *requires* scalar epilogue to override the epilogue vectorization setting, but I haven't stared at the code enough to know if that's really true.


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