[PATCH] D149587: InstSimplify: Simplifications for ldexp

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 03:54:57 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:6084
+    if (Q.isUndefValue(Op0))
+      return ConstantFP::getNaN(Op0->getType());
+
----------------
foad wrote:
> Why is this not strictfp-safe?
If undef resolved to a signaling nan it wouldn't raise an exception


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:6106
+  if (C && C->isNaN())
+    return ConstantFP::get(Op0->getType(), C->makeQuiet());
+
----------------
foad wrote:
> Why is this not strictfp-safe?
> 
> Maybe I just need a good description of what strictfp implies. The description in the langref mentions rounding mode, status flags and trapping, but says nothing about quieting NaNs.
A signaling nan is supposed to raise an exception which quieting it would hide.

The [[https://llvm.org/docs/LangRef.html#floating-point-environment  | LangRef]] states signaling nans may not be quieted by non-constrained operations and constrained should handle them properly


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

https://reviews.llvm.org/D149587



More information about the llvm-commits mailing list