[PATCH] D103700: [LV] Fix bug when unrolling (only) a loop with non-latch exit

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 24 14:43:09 PDT 2021


Ayal added a comment.

This was indeed what was suggested, thanks for following up! The patch correctly fixes the bug raised by the test case, right? I.e., the last iteration of the "vector" (unrolled) loop is peeled into UF(*VF) iterations of the scalar epilog.
While keeping even_load_static_tc test case of interleaved-accesses.ll **without** this peeling, when run with "-force-vector-width=1 -force-vector-interleave=4"; unlike the original patch. Suggest to include this test case "run" in the patch.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8322
   auto P =
-      Cost->requiresScalarEpilogue() ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_ULT;
+    Cost->requiresScalarEpilogue(VF) ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_ULT;
 
----------------
"VF" should be "`ForEpilogue ? EPI.EpilogueVF : VF`" here, judging from VFactor above.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8466
   auto P =
-      Cost->requiresScalarEpilogue() ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_ULT;
+    Cost->requiresScalarEpilogue(VF) ? ICmpInst::ICMP_ULE : ICmpInst::ICMP_ULT;
 
----------------
"VF" should be EPI.EpilogueVF here.


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

https://reviews.llvm.org/D103700



More information about the llvm-commits mailing list