[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 25 14:19:14 PDT 2024
dyung wrote:
> Hi @dyung.
>
> The observed difference is due to the FP contraction turned off if optnone is specified. In O0 this optimization is still applied. As a result, the function with optnone contains separate fadd and fmul, while without this attribute the function contains combined operatin fmuladd.
>
> This optimization is turned off in `FPOption.setDisallowOptimizations` (introduced by this patch) by the call `setDisallowFPContract()`. If it is removed, I think, the output would be identical.
Thanks @spavloff. I can confirm that if I remove the call you mentioned the assembly generated is identical.
I am slightly confused why we are running FP contraction at O0. I would have thought no optimization at all be done at O0?
https://github.com/llvm/llvm-project/pull/85605
More information about the cfe-commits
mailing list