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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to