From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25209 invoked by alias); 12 Feb 2013 16:30:36 -0000 Received: (qmail 25189 invoked by uid 22791); 12 Feb 2013 16:30:34 -0000 X-SWARE-Spam-Status: No, hits=-3.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-wi0-f174.google.com (HELO mail-wi0-f174.google.com) (209.85.212.174) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Feb 2013 16:30:29 +0000 Received: by mail-wi0-f174.google.com with SMTP id hi8so4640123wib.7 for ; Tue, 12 Feb 2013 08:30:28 -0800 (PST) X-Received: by 10.194.238.226 with SMTP id vn2mr32270396wjc.23.1360686624903; Tue, 12 Feb 2013 08:30:24 -0800 (PST) Received: from localhost ([2.26.176.154]) by mx.google.com with ESMTPS id fg6sm20992632wib.10.2013.02.12.08.30.23 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 12 Feb 2013 08:30:24 -0800 (PST) From: Richard Sandiford To: Jakub Jelinek Mail-Followup-To: Jakub Jelinek ,Aldy Hernandez , gcc-patches , rdsandiford@googlemail.com Cc: Aldy Hernandez , gcc-patches Subject: Re: PR target/52555: attribute optimize is overriding command line options References: <51198989.7090803@redhat.com> <20130212140503.GD4385@tucnak.redhat.com> Date: Tue, 12 Feb 2013 16:30:00 -0000 In-Reply-To: <20130212140503.GD4385@tucnak.redhat.com> (Jakub Jelinek's message of "Tue, 12 Feb 2013 15:05:03 +0100") Message-ID: <878v6twl42.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg00548.txt.bz2 Jakub Jelinek writes: > On Mon, Feb 11, 2013 at 06:15:05PM -0600, Aldy Hernandez wrote: >> How does this look? > > Looks good to me. > >> Jakub, what's this you mention in the PR about caching >> __optimize__((3))? You also mention I shouldn't compare against >> this_target_optabs, but default_target_optabs. But what if >> this_target_optabs has changed? (See patch). > > The reason for that is that this_target_optabs could at that point be > simply whatever optabs used the last parsed function. > this_target_optabs changes only either because of optimize attribute > (not sure if MIPS as the only switchable target? supports that), or > because of mips_set_mips16_mode. I think invoke_set_current_function_hook > invokes the target hook after the code you've changed, so I'd say it should > work fine even on MIPS. CCing Richard for that anyway. The target hook won't do anything for consecutive functions that have the same mode though. It expects this_target_optabs (and other this_target_* stuff) to stay the same. Rather than: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_target_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_target_optabs = &default_target_optabs; I think it'd be better to have: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_fn_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_fn_optabs = this_target_optabs; with genopinit.c updated to use this_fn_optabs instead of this_target_optabs. Richard