[PATCH] D157766: [FPEnv] Make the strictfp attribute rules stricter.

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 16:09:42 PDT 2023


kpn created this revision.
kpn added reviewers: craig.topper, andrew.w.kaylor, efriedma, hfinkel, uweigand, arsenm, sepavloff.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
kpn requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

This is mostly a revert of D148138 <https://reviews.llvm.org/D148138> but with a twist. I discovered when working on tests so I can land Verifier changes from D146845 <https://reviews.llvm.org/D146845> that the rules as they are after D148138 <https://reviews.llvm.org/D148138> don't work.

Specifically, if a non-strictfp function calls a strictfp function, and we look through to the function being called for the strictfp attribute, then D146845 <https://reviews.llvm.org/D146845> will reject the compile because it thinks we are mixing strictfp and non-strictfp in the same function. By reverting to the rule that the strictfp attribute is required on every single call in a strictfp function we avoid the issue.

However, having duplicate information in every call to a constrained intrinsic doesn't seem worthwhile. So, I added the twist that calls to intrinsics with the strictfp attribute attached to the intrinsic don't need it again on the call instruction. This avoids duplicate information while solving the problem at the boundary between non-strictfp and strictfp code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157766

Files:
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -23759,9 +23759,9 @@
 constrained intrinsics to function correctly.
 
 All function *calls* done in a function that uses constrained floating
-point intrinsics must have the ``strictfp`` attribute either on the
-calling instruction or on the declaration or definition of the function
-being called.
+point intrinsics must have the ``strictfp`` attribute. Calls to intrinsics
+that are defined to have the ``strictfp`` are allowed to omit the attribute
+from the call site.
 
 All function *definitions* that use constrained floating point intrinsics
 must have the ``strictfp`` attribute.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157766.549541.patch
Type: text/x-patch
Size: 741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230811/b6e38f1c/attachment.bin>


More information about the llvm-commits mailing list