Page MenuHomePhabricator

[FPEnv] Teach the IRBuilder about correct use of the strictfp attribute.
ClosedPublic

Authored by kpn on Oct 22 2019, 10:23 AM.

Details

Summary

The IRBuilder needs to add the strictfp attribute to function definitions and calls when constrained floating point is enabled.

Since so far all front ends have had to do is flip the constrained switch, I've made this patch always add the required attributes when said constrained switch is enabled. This continues to keep changes to front ends minimal.

Diff Detail

Event Timeline

kpn created this revision.Oct 22 2019, 10:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 22 2019, 10:23 AM

What does the call attribute mean?

kpn added a comment.Oct 23 2019, 6:16 AM

What does the call attribute mean?

There's some description of it in D67839. From digging through my email archives I also found this:

On 31 August 2017 at 15:28, Kaylor, Andrew via cfe-dev <
cfe-dev@lists.llvm.org> wrote:

I would not that when I added the strictfp attribute, I intended that the
front end would attach this attribute to the callsite of all function calls
within a scope that required strict floating point semantics. It was
supposed to be a way of preventing calls to libm functions from being
optimized as LibFunc calls without the front end needing to know which
functions could be processed that way.

Plus, there's been some discussion of how strictfp on callsites would provide info needed when lowering architecture-specific intrinsics.

rjmccall accepted this revision.Oct 24 2019, 3:51 PM

Okay, that makes sense. LGTM.

This revision is now accepted and ready to land.Oct 24 2019, 3:51 PM
mibintc added inline comments.
llvm/include/llvm/IR/IRBuilder.h
262

F can be null which results in segfault, bug report here, https://bugs.llvm.org/show_bug.cgi?id=44048
The problem is only visible after wiring up -frounding-math in D62731
I'm working on a patch that adds a null check