[clang] [CIR] Reject the empty fenv attribute (PR #236704)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 13:52:49 PST 2026


https://github.com/andykaylor commented:

In LLVM IR, there is a requirement that if constrained intrinsics are used anywhere in the function, they have to be used for all FP operations in the function. This was necessary to prevent code motion of non-constrained operations relative to constrained operations. After inlining, an operation that previously had no FP constraints has to be represented using a constrained operation with the default rounding mode and exception behavior.

We need to handle the same situation in some way in CIR. This is essentially a memory effect. Floating-point operations always read the FP control state and write the FP exception status, but we usually model them as if they don't so that code motion isn't constrained when it doesn't need to be.

I intended for an empty `fenv<>` attribute to model this state of "use the defaults, but respect FP control and status memory effects."

https://github.com/llvm/llvm-project/pull/236704


More information about the cfe-commits mailing list