[llvm-dev] [Proposal][RFC] Epilog loop vectorization

Nema, Ashutosh via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 15 22:20:56 PDT 2017


I think this seems about right. We shouldn't re-compare the trip counts in the epilogue loop if the alias check is false anyway:
int start = 0;
if (n >= vf) {
  if (check) {
    for (...; start += vf)
      ...
  } else { goto scalar; }
} else { goto scalar; }

if (n - start >= vf2) {
  for (...; start += vf2)
  ...
}

scalar:
for (i = start; i < n; ++i) {
  …
}

 -Hal



This layout looks OK *only when alias check is required*, but what if alias check is not required in that case the layout probably will looks like this:


int start = 0;
if (n >= vf) {
  if (check) {
    for (...; start += vf)
      ...
  } else { goto scalar; }
} else { goto scalar; }

if (n - start >= vf2) {
  for (...; start += vf2)
  ...
}

scalar:
for (i = start; i < n; ++i) {
  …
}



For ‘n < vf’ it should try executing epilog vector loop but in this layout it will execute scalar loop.



Regards,

Ashutosh


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170316/57b9a47b/attachment.html>


More information about the llvm-dev mailing list