[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)
Paul T Robinson via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 26 06:45:04 PDT 2024
pogo59 wrote:
> `optnone` is a very strange attribute; it's a directive to the compiler with no clear semantics.
In an ideal world, an `optnone` function would be compiled as-if the entire compilation unit had `-O0`. At `-O0`, Clang attaches `optnone` to every function, implying that this equivalence is the exact intent. Clang does this so that `-O0 -flto` will not lose the `-O0` semantic during LTO.
When we devised `optnone`, there was an argument that this goal was not practical, and so the description could not imply that it was in fact equivalent to `-O0`. Thus, the description is fuzzy. Perhaps that was a mistake, and we should revise the description to include the goal, even if the goal is not 100% attainable.
With that goal in mind, having `optnone` and `-O0` be deliberately different here makes no sense.
https://github.com/llvm/llvm-project/pull/85605
More information about the cfe-commits
mailing list