[llvm] [ConstantFolding] Add flag to disable call folding (PR #140270)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri May 23 13:04:37 PDT 2025


efriedma-quic wrote:

I don't see why you'd use an inaccurate implementation to constant-fold something like nvvm.rsqrt.approx.f32.  It maps to some exact formula; likely a small table lookup plus linear interpolation.  (Unless it isn't consistent across targets?)

For the target-independent transcendental intrinsics, you can use a nobuiltin call to the actual implementation.  For non-transcendental intrinsics, you can control lowering with fast-math flags.  If you want to turn off optimizations for debugging, we have other tools for that, like opt-bisect-limit.

Disabling folding for everything, even cases where it's possible to fold deterministically, is a good indication to users that we don't expect them to use this flag in production.  So maybe this is okay.

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


More information about the llvm-commits mailing list