[PATCH] D111077: [LV] Support converting FP add to integer reductions.

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 00:06:37 PDT 2021


david-arm added a comment.

>> Should we be doing this more generally, outside the vectorizing reductions?
>
> I think it might be worthwhile to convert such reductions outside the vectorizer in some cases. My motivation for starting in LV is that it should be clearly profitable if it allows vectorization. For general loops without vectorization, it might not be profitable I think, e.g. for loops that only execute once, due to the conversion overhead.

This is an interesting patch @fhahn! I haven't looked at it yet, but the principle sounds goods! I think we can also do this at -O3 for FP induction variables, i.e.

  float f = 0;
  for (int i = 0; i < n; i++)
  {
    dst[i] = f;
    f += 2.0;
  }

provided we know the conversion between float and integer is guaranteed to be lossless for every iteration. This can be done by versioning the loop with runtime SCEV checks I think, right? Or if we know the trip count at runtime we don't even need runtime checks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111077



More information about the llvm-commits mailing list