This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][i386]Fix PR 57756
- From: Sriraman Tallam <tmsriram at google dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, David Li <davidxl at google dot com>, Uros Bizjak <ubizjak at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 14 Aug 2013 10:39:23 -0700
- Subject: Re: [PATCH][i386]Fix PR 57756
- References: <CAAs8HmykvBN9u=69ZxEHpC5C1NDr6xAWsCrp2tRCiX+NgWf7GA at mail dot gmail dot com> <CAFiYyc14fviQxP3P7eYjsC6V7zgAp_F25agtBcxKeZ5-xPK+Yw at mail dot gmail dot com>
On Wed, Aug 14, 2013 at 3:38 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Wed, Aug 14, 2013 at 2:02 AM, Sriraman Tallam <tmsriram@google.com>
> wrote:
>>
>> Hi,
>>
>> I have attached a patch to fix PR57756. Description: The
>> following program,
>>
>> __attribute__((always_inline,target("sse4.2")))
>> __inline int callee ()
>> {
>> return 0;
>> }
>>
>> __attribute__((target("sse")))
>> __inline int caller ()
>> {
>> return callee();
>> }
>>
>> does not generate an error and callee is inlined into caller. This is
>> because callee has a higher target ISA. Interchanging the position of
>> caller and callee will generate the correct error. Also, removing the
>> target attribute from caller will generate the error.
>>
>> The reason for the bug is that when the caller's target options are
>> processed, global_options contain the ISA flags of the callee
>> (previously processed) and doing this in i386-common.c, where opts is
>> global_options:
>>
>> opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE_SET;
>>
>> is not changing global options. The fix is to reset global_options to
>> the default each time a new target option needs to be processed.
>
>
> Shouldn't ix86_valid_target_attribute_tree be refactored to work on a
> selected
> opt structure rather than global_options?
Yes, that would be the ideal fix. The code here seems hairy and many
functions set and use global_options directly (in the call chain of
ix86_valid_target_attribute_tree). I will take a stab at it.
Thanks
Sri
>
> Richard.
>
>>
>> Patch ok?
>>
>> Thanks
>> Sri
>
>