[PATCH] D96604: [LoopVectorizer] Require no-signed-zeros-fp-math=true for fmin/fmax

Kerry McLaughlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 09:27:57 PST 2021


kmclaughlin added inline comments.


================
Comment at: llvm/lib/Analysis/IVDescriptors.cpp:597-599
     if (!isIntMinMaxRecurrenceKind(Kind) &&
-        (!HasFunNoNaNAttr || !isFPMinMaxRecurrenceKind(Kind)))
+        (!(FMF.noNaNs() && FMF.noSignedZeros()) ||
+         !isFPMinMaxRecurrenceKind(Kind)))
----------------
spatel wrote:
> That logic is hard to follow. How about inverting the condition, so we are positively identifying a min/max candidate?
> 
> I'm thinking:
> 
> ```
>     if (isIntMinMaxRecurrenceKind(Kind) ||
>         (FMF.noNans() && FMF.noSignedZeros() && 
>          isFPMinMaxRecurrenceKind(Kind)))
>       return isMinMaxSelectCmpPattern(I, Prev);
> ```
Thanks for the suggestion, this is much easier to follow


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

https://reviews.llvm.org/D96604



More information about the llvm-commits mailing list