[PATCH] D43142: Experimental pass to convert all floating point operations to the equivalent constrained intrinsics

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 2 12:28:20 PDT 2018


cameron.mcinally added a comment.

In https://reviews.llvm.org/D43142#1285825, @andrew.w.kaylor wrote:

> Well, yes and no. In a region defined as FENV_ACCESS off the user has granted the compiler explicit permission to ignore FP status bits and exception behavior. Depending on how we optimize these regions the FP status bits may come out differently and exceptions may or may not be raised, but the user has promised not to unmask exceptions or look at status bits in that region. So if that part of the behavior of the code changes depending on whether or not we inline that's OK because that's what the user signed up for. In that sense the behavior hasn't changed any more than it does between -O0 and -O3.


That's well put. I agree with that. I was probably overreaching in my last comment.

> Now maybe someone might have code that calls an FENV_ACCESS OFF function from an FENV_ACCESS ON function and then looks at FP status bits after the call returns, but the standard explicitly says that when controls transfers from a scope with FENV_ACCESS off to a scope with FENV_ACCESS on the state of the FP status flags is undefined.
> 
> So, yes, technically the behavior may change, but that's OK.

I think we both agree that it's undefined behavior. If that's correct, then it doesn't really matter what we do after we hit it. So any solution is acceptable...


https://reviews.llvm.org/D43142





More information about the llvm-commits mailing list