[llvm] [FPEnv] Add strictfp attribute to the FP environment manipulation intrinsics (PR #96093)
Kevin P. Neal via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 07:04:11 PDT 2024
kpneal wrote:
To be clear on the IR Verifier issue:
- In functions with the strictfp attribute _present_ on the definition, the strictfp attribute is _required_ on all calls (or at least on the declaration/definition of the called function).
- In functions with the strictfp attribute _missing_ on the definition the strictfp attribute is _allowed_ on calls but is not required. So adding the strictfp attribute to get_rounding() won't trigger any Verifier failures.
This is because, when checking for the attribute at a call site, the attributes API doesn't distinguish between the call site and the declaration/definition of the function being called. It would be bad if non-strictfp functions were forbidden from calling strictfp functions because of how the attributes API works. For starters, we have at least one test in tree already that has a non-strictfp function calling a strictfp function. I had to loosen the rules to get that test to pass, and I believe that loosening the rules was (and is) correct. It would be weird if strictfp functions could call non-strictfp functions by adding the attribute at a call site, but non-strictfp functions were forbidden from calling strictfp functions.
Having the strictfp attribute not be in get_rounding()'s tablegen entry means strictfp functions would need the attribute added like almost all other function calls, and non-strictfp functions calling get_rounding() wouldn't have the attribute and wouldn't notice because no Verifier failure would happen.
As for the rest of your comment, I find myself coming around to @spavloff and @arsenm's position. Unless someone has a compelling argument in the other direction?
https://github.com/llvm/llvm-project/pull/96093
More information about the llvm-commits
mailing list