[PATCH] D150728: ValueTracking: Drop rounding mode check for constrained_sqrt in CannotBeNegativeZero

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 10:12:12 PDT 2023


arsenm marked an inline comment as done.
arsenm added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:3809
+      // sqrt(-0.0) = -0.0, no other negative results are possible.
+      // FIXME: Account for denormal-fp-math=preserve-sign denormal inputs
     case Intrinsic::canonicalize:
----------------
sepavloff wrote:
> arsenm wrote:
> > sepavloff wrote:
> > > Is this FIXME useful? How could denormal handling change this  behavior?
> > If you have preserve-sign inputs, another negative denormal could be implicitly treated as -0 and return -0. This is fixed in the new computeKnownFPClass  implementation 
> In this case `CannotBeNegativeZero(Call->getArgOperand(0)...)` returns false and logic of this code remains valid, no? 
No, because the current CannotBeNegativeZero doesn't consider the denormal mode at all. 


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

https://reviews.llvm.org/D150728



More information about the llvm-commits mailing list