[PATCH] D111450: [FPEnv][InstSimplify] Fold fadd X, 0 ==> X, when we know X is not -0

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 10:05:54 PDT 2021


kpn added inline comments.


================
Comment at: llvm/test/Transforms/InstSimplify/strictfp-fadd.ll:287
 ;
   %add = call nsz nnan float @llvm.experimental.constrained.fadd.f32(float %a, float 0.0, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
   ret float %add
----------------
spatel wrote:
> Don't we want a test without `nnan` where exceptions are ignored but is not the default FP env?
> 
> Ie, this should fold?
>   %add = call nsz float @llvm.experimental.constrained.fadd.f32(float %a, float 0.0, metadata !"round.downward", metadata !"fpexcept.ignore") #0
> 
Yes, that's a good idea. And, yes, I believe we do want this to fold. The "nsz" flag means (I think) that if "x" is zero the sign of "0 - 0" is insignificant. I think that's what that means, anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111450



More information about the llvm-commits mailing list