[PATCH] D69272: Restricted variant of '#pragma STDC FENV_ACCESS'

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 20 12:01:46 PST 2019


rjmccall added a comment.

In D69272#1792928 <https://reviews.llvm.org/D69272#1792928>, @sepavloff wrote:

> In D69272#1792877 <https://reviews.llvm.org/D69272#1792877>, @kpn wrote:
>
> > My understanding of this patch is that it only allows the #pragma at the top of each function. It doesn't allow it in blocks inside the function. So if a function has a block inside it that uses strict FP the patch doesn't change the rest of the function to use constrained FP with the settings like you said. And my question was asking if there was a way forward with this patch to a full implementation.
>
>
> @hfinkel proposed to use outlining to extract a block with the #pragma to separate function. It could be a basis for a full implementation.


I don't think outlining is a reasonable approach.  Outlining has a *lot* of other performance consequences, and we'd have to support arbitrary control flow (e.g. `goto`) in and out of the outlined function, which adds a lot of frontend complexity in pursuit of something that ought be handled at the optimizer level.

If a function has any blocks with the `#pragma`, we just need to emit the whole function as strictfp.  I believe the constrained FP intrinsics can take arguments that make them semantically equivalent to the default rule.  If we don't emit code outside of those blocks as efficiently as we would've before, well, that's seems like a solvable optimization problem.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69272





More information about the cfe-commits mailing list