[PATCH] D67105: [TargetLowering] Fix another potential FPE in expandFP_TO_UINT

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 09:59:25 PDT 2019


kpn added a comment.

In D67105#1657765 <https://reviews.llvm.org/D67105#1657765>, @uweigand wrote:

> Ah, good point.  Currently, constrained floating-point intrinsics are never constant-folded.  In general, this would likely be wrong anyway, since we might not know the current rounding mode that applies.
>
> However, in the specific case of a fptoui, we don't depend on the current rounding mode (it's always round-to-zero even for the constrained case), so we actually could constant fold those in the cases where we the result is in range.
>
> @kpn -- the test cases you added specifically verify that constrained fptoui does **not** constant-fold but does the runtime conversion.  Should those be changed to use nonconstant arguments then?


Hmm, today? I'm leaning towards keeping it unchanged for now.

When constant folding of constrained intrinsics is implemented we'll certainly need to have tests for the various cases of NaNs, inexact cases, in-range exact constants, variables, and maybe other cases. Then there's the cases where we're using constrained intrinsics but with exceptions ignored, which would obviously change folding behavior. For now it may be enough to not bother with worrying about it and just leave the constant folding for another day.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67105





More information about the llvm-commits mailing list