[PATCH] D102672: [ConstantFolding] Use APFloat for constant folding. NFC

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 10:10:22 PDT 2021


sepavloff added a comment.

In D102672#2766312 <https://reviews.llvm.org/D102672#2766312>, @efriedma wrote:

> It looks like this is just refactoring, besides the changes to the floating-point compares.  That's okay, but not really consistent with the commit message; do you have some future work planned?

The patch D102673 <https://reviews.llvm.org/D102673> implements folding of constrained intrinsics, which are used in the case of non-default environment.



================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:2146
     case LibFunc_logf_finite:
-      if (V > 0.0 && TLI->has(Func))
-        return ConstantFoldFP(log, V, Ty);
+      if (!APF.isNegative() && !APF.isZero() && TLI->has(Func))
+        return ConstantFoldFP(log, APF, Ty);
----------------
efriedma wrote:
> This isn't precisely equivalent to the existing code.
Could you please point out the case when this code behaves differently from the existing one?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102672



More information about the llvm-commits mailing list