From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101352 invoked by alias); 6 Oct 2015 12:31:04 -0000 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 Received: (qmail 101342 invoked by uid 89); 6 Oct 2015 12:31:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_20,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f169.google.com Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 06 Oct 2015 12:31:02 +0000 Received: by wiclk2 with SMTP id lk2so164555655wic.0 for ; Tue, 06 Oct 2015 05:31:00 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.187.180 with SMTP id ft20mr17602065wic.78.1444134659860; Tue, 06 Oct 2015 05:30:59 -0700 (PDT) Received: by 10.28.37.130 with HTTP; Tue, 6 Oct 2015 05:30:59 -0700 (PDT) In-Reply-To: <20151006114313.GA11910@intel.com> References: <20151006114313.GA11910@intel.com> Date: Tue, 06 Oct 2015 12:31:00 -0000 Message-ID: Subject: Re: [PATCH] PR middle-end/67850: Wrong call_used_regs used in aggregate_value_p From: Richard Biener To: "H.J. Lu" Cc: GCC Patches , Jeff Law , Richard Biener Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00548.txt.bz2 On Tue, Oct 6, 2015 at 1:43 PM, H.J. Lu wrote: > Since targetm.expand_to_rtl_hook may be called to switch ABI, it should > be called for each function before expanding to RTL. Otherwise, we may > use the stale information from compilation of the previous function. > aggregate_value_p uses call_used_regs. aggregate_value_p is used by > IPA and return value optimization, which are called before > pass_expand::execute after RTL expansion starts. We need to call > targetm.expand_to_rtl_hook early enough in cgraph_node::expand to make > sure that everything is in sync when RTL expansion starts. > > Tested on Linux/x86-64. OK for trunk? Hmm, I think set_cfun hook should handle this. expand_to_rtl_hook shouldn't mess with per-function stuff. Richard. > > H.J. > --- > PR middle-end/67850 > * cfgexpand.c (pass_expand::execute): Don't call > targetm.expand_to_rtl_hook here. > * cgraphunit.c (cgraph_node::expand): Call > targetm.expand_to_rtl_hook here. > --- > gcc/cfgexpand.c | 1 - > gcc/cgraphunit.c | 3 +++ > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c > index 58e55d2..6891750 100644 > --- a/gcc/cfgexpand.c > +++ b/gcc/cfgexpand.c > @@ -6150,7 +6150,6 @@ pass_expand::execute (function *fun) > /* Mark arrays indexed with non-constant indices with TREE_ADDRESSABLE. */ > discover_nonconstant_array_refs (); > > - targetm.expand_to_rtl_hook (); > crtl->stack_alignment_needed = STACK_BOUNDARY; > crtl->max_used_stack_slot_alignment = STACK_BOUNDARY; > crtl->stack_alignment_estimated = 0; > diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c > index 04a4d3f..537a089 100644 > --- a/gcc/cgraphunit.c > +++ b/gcc/cgraphunit.c > @@ -1973,6 +1973,9 @@ cgraph_node::expand (void) > > bitmap_obstack_initialize (®_obstack); /* FIXME, only at RTL generation*/ > > + /* It may update call_used_regs, which is used by aggregate_value_p. */ > + targetm.expand_to_rtl_hook (); > + > execute_all_ipa_transforms (); > > /* Perform all tree transforms and optimizations. */ > -- > 2.4.3 >