On 12/4/21 00:23, Peter Bergner wrote:
On 12/2/21 9:46 PM, Kewen.Lin via Gcc-patches wrote:
on 2021/11/30 上午12:57, Segher Boessenkool wrote:
On Wed, Sep 01, 2021 at 02:55:51PM +0800, Kewen.Lin wrote:
This patch is to fix the inconsistent behaviors for non-LTO mode
and LTO mode. As Martin pointed out, currently the function
rs6000_can_inline_p simply makes it inlinable if callee_tree is
NULL, but it's wrong, we should use the command line options
from target_option_default_node as default.
This is not documented.
Yeah, but according to the document for the target attribute [1],
"Multiple target back ends implement the target attribute to specify
that a function is to be compiled with different target options than
specified on the command line. The original target command-line options
are ignored. ", it seems to say the function without any target
attribute/pragma will be compiled with target options specified on the
command line. I think it's a normal expectation for users.
Excepting for the inconsistent behaviors between LTO and non-LTO,
it can also make the below case different.
I thought Martin and richi mentioned that target attribute options
are treated as if they are appended to the end of the command line
options, so they can potentially override earlier options, but they
don't actually ignore them?
No, the described behavior is true for optimize attribute:
optimize (string, …)
...
The optimize attribute arguments of a function behave behave as if appended to
the command-line.
but:
target (string, …)
...
The original target command-line options are ignored.
As seen here:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
Cheers,
Martin
Peter