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

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 19 06:48:43 PST 2022


Meinersbur added a comment.

There is the function `findInnerReductionPhi` that calls `RecurrenceDescriptor::isReductionPHI` to determine whether an operation is a reduction and also already checks fast-math flags. Isn't that check already sufficient?

> Instead of using isFast(), I now use hasAllowReassoc().

I am not a floating-point-expert, so I was asking which flags are actually required. I think at least "nsz" would be necessary are well because `(+0) * (-0)` is (+0) but  `(-0) * (+0)` is (-0). See https://en.wikipedia.org/wiki/Signed_zero. Similar non-commutativity rules may apply to NaN/Inf. When in doubt, `isFast` should be the safe option.

> Regarding "unsafe-fp-math" VS "fast":

IIRC, the per-operation flags have superseded the per-function `unsafe-fp-math` and the latter only used for compatibility. Please look up a reference or how other passes handle this. See e.g. https://lists.llvm.org/pipermail/llvm-dev/2012-October/054980.html. Unfortunately it doesn't mention how to handle `unsafe-fp-math`.


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

https://reviews.llvm.org/D117450



More information about the llvm-commits mailing list