[clang] [llvm] [IR] Allow non-constrained math intrinsics in strictfp functions (PR #188297)

Serge Pavlov via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 11:46:06 PDT 2026


spavloff wrote:

> If you're going to use that approach, though, why change IRBuilder?

IRBuilder methods `CreateCall` add memory effect attributes to the FP operation calls.

> It looks like this doesn't touch the reduction intrinsics; do you have a plan for them?

There are no strict DAG nodes for them. I want to enhance #163081 to avoid manual adding this nodes.

> Do we want to guard this under a flag until we've actually audited optimizations affecting the intrinsics in question to ensure they work in the new model? Do we have any idea what changes are required?

This change fixes the use case that is now not allowed. The existing strictfp implementation based on constrained functions is not changed. Clang does not use the proposed model for code generation. So these changes must be invisible to users.

The proposed model requires changes in the constant folding, I am working on this patch. Also the existing transformations should be examined for correctness in the strictfp function. There should not be much work, math function optimizations are not numerous. As for general algorithms, setting memory effects must be enough.

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


More information about the cfe-commits mailing list