[PATCH] D61916: Teach InstSimplify transform -X + X --> 0.0 about unary FNeg

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 09:50:11 PDT 2019


spatel added a comment.

In D61916#1503222 <https://reviews.llvm.org/D61916#1503222>, @kpn wrote:

> If I recall, fneg is not a constrained intrinsic because an fneg will never itself trap.
>
> But a transform of -inf+inf to zero would be invalid by the standard, would it not? Section 7.2 paragraph d? Do we have a way of noting strict conformance to IEEE is required/desired without constrained intrinsics?


Correct on -inf+inf, and (assuming no logic bugs) we do have basic IEEE conformance w/o constrained intrinsics. We've ruled the inf case out by using fast-math-flags (nnan) on the fadd. See code comment :

  // With nnan: -X + X --> 0.0 (and commuted variant)
  // We don't have to explicitly exclude infinities (ninf): INF + -INF == NaN.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61916





More information about the llvm-commits mailing list