[llvm-branch-commits] [llvm] [FPEnv][SDAG] Implement FNEARBYINT with optional chain (PR #163081)
Serge Pavlov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Mar 26 21:51:38 PDT 2026
spavloff wrote:
> I don't understand why we need to have a novel optional chain idea, vs using a normal (mandatory) chain for all the FP ISD nodes?
If the solution developed from scratch, it probably would be an acceptable approach. However we already have much code that does not imply side effects in FP operation. Adding chain to such operations is not a good idea because:
1. We add side effects to operations that do not have it in the most used case, this is a bad design.
2. Operations with side effects are handled with additional restrictions, even if the side effect is fake. It would have negative impact on performance.
3. It requires changes everywhere, even in the targets, that do not have intension to produce strictfp code.
4. It must be done at once, in all places, where FP operations are lowered.
I don't believe this is realistic.
> And a helper function could take care of properly chaining a node. Easy.
Exactly! A user could lower FP operations as if they were pure functions, not even thinking about chains. The selector can detect that an FP operation without side effects is used in a strictfp function. In this case it simply adds proper chain argument and result.
https://github.com/llvm/llvm-project/pull/163081
More information about the llvm-branch-commits
mailing list