[PATCH] D149587: InstSimplify: Simplifications for ldexp

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 03:58:53 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:6103
+  if (!IsStrict) {
+    // ldexp(undef, x) -> nan
+    if (Q.isUndefValue(Op0))
----------------
arsenm wrote:
> arsenm wrote:
> > foad wrote:
> > > I still don't understand why this one isn't strictfp-safe, if you simplify -> qnan.
> > if undef could be anything, it could have been a signaling nan that would demand quieting
> Plus we evidently don't have agreement on how nan payload bits are supposed to work
> it could have been a signaling nan
That's like saying "it could have been 99.9". The point is we are *choosing* a particular value to refine it to, so why not choose a quiet nan?

> Plus we evidently don't have agreement on how nan payload bits are supposed to work
OK, if we are unable to make a quiet nan because we don't know what bits to put in the payload, that seems like a good reason - but please add a comment to that effect since it is massively non-obvious. (Also if that is true then how does `C->makeQuiet()` below work??)


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

https://reviews.llvm.org/D149587



More information about the llvm-commits mailing list