[PATCH] D151163: ValueTracking: Ignore -0 for nsz sqrt with UseInstrInfo in computeKnownFPClass

Joshua Cranmer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 14:51:11 PDT 2023


jcranmer-intel accepted this revision.
jcranmer-intel added a comment.
This revision is now accepted and ready to land.

>> In D151163#4363911 <https://reviews.llvm.org/D151163#4363911>, @foad wrote:
>>
>>> Looks OK but shouldn't the nsz flag be applied more generally to the result of every computeKnownFPClass call?
>>
>> No because of nsz’s bizarre definition. It doesn’t mean no -0 appears, it means you don’t care about the sign of zero.
>
> This might be too strong as it is since it implies poison for -0, but I’m guessing that’s what the UseInstrInfo is for. Otherwise we would need another flag for stronger nsz interpretation

I think the user intent of `nsz` is primarily to allow optimizations that are legal for every value except -0.0, and the use case here seems to me to be clearly that (sqrt(x) has sign=0 for every x but -0.0). It's not immediately clear to me that you can generalize handling of `nsz` for all cases in `computeKnownFPClass`.


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

https://reviews.llvm.org/D151163



More information about the llvm-commits mailing list