[PATCH] D117450: [LoopInterchange] Support loop interchange with floating point reductions

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 22:34:28 PST 2022


congzhe added a comment.

In D117450#3281892 <https://reviews.llvm.org/D117450#3281892>, @Meinersbur wrote:

> I suggest this in findInnerReductionPhi:
>
>   if (RecurrenceDescriptor::isReductionPHI(PHI, L, RD)) {
>     if (RD.needsExactFPMath())
>       return nullptr;
>     return PHI;
>   }

Thanks, I've updated the patch accordingly. I used `RD.getExactFPMathInst()` instead, since `needsExactFPMath()` does not belong to `RecurrenceDescriptor`.

> It might be more fine-grained using `RD.getFastMathFlags()` and check against compiler flags (if `RecurrenceDescriptor` did not already take them into account). LoopVectorize has additional hints/compiler flags that act like -ffast-math just for vectorization.

I do agree that it would be more fine-grained using `RD.getFastMathFlags()` and check against flags. I see SLP checks `noNaNs()` for `FMax/Fmin`, and loop vectorizer relies on `getExactFPMathInst()` and additional hints. I'm thinking maybe at the moment we could just rely on `RD.getFastMathFlags()` to be safe, and we could make it finer-grained later. I'd appreciate it if you could let me know your thoughts.


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

https://reviews.llvm.org/D117450



More information about the llvm-commits mailing list