From patchwork Thu Oct 4 04:31:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 189016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 5174D2C032F for ; Thu, 4 Oct 2012 14:31:44 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1349929905; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:From:To:Cc:Subject:References:Date: In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=1GpBg/SpdUdDNdKVwNP9 WX8TihY=; b=s4zmfYqzJ3bzAkg4jbqMN9Ipi83rbfB3WEjcQV007gdwJV7PEjP0 kObRJv8TkscNUhAkJS9qC2LPbefiwREGUn0VnuBzPOft3hvKsDHWE9KxMLnGz0kT /8z+aupfeCrB9qJrnIPdAALt5RNizyUt1BtGl1/vrA5D/+NJuHIA4Dk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Ddp9QqAYYu0FU4olbHWYHng/AI3rVBM3E5Lf7re3uAxYjX54Rlg/tUcP8lCR+p lLpBLVQQumnqJPUmQANjbrKZmPsUJBvuMfuc/dgKvuJ9c2eGFnjKqo1yB8a/W3/8 c/Jjj2r90wrbQkKoq/qSBZwyiVTkW+S6LsrWXRvkyFuow=; Received: (qmail 32294 invoked by alias); 4 Oct 2012 04:31:32 -0000 Received: (qmail 32272 invoked by uid 22791); 4 Oct 2012 04:31:27 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Oct 2012 04:31:16 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q944VFtd000710 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Oct 2012 00:31:15 -0400 Received: from freie (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q944VDs9002021 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 4 Oct 2012 00:31:14 -0400 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie (8.14.5/8.14.5) with ESMTP id q944VA60031130; Thu, 4 Oct 2012 01:31:10 -0300 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id q944V9Yf025967; Thu, 4 Oct 2012 01:31:09 -0300 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id q944V84K025965; Thu, 4 Oct 2012 01:31:08 -0300 From: Alexandre Oliva To: Jakub Jelinek Cc: Richard Guenther , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Improve debug info for partial inlining (PR debug/54519, take 2) References: <20120911135956.GP22619@tucnak.redhat.com> <20121003124804.GR1787@tucnak.redhat.com> Date: Thu, 04 Oct 2012 01:31:08 -0300 In-Reply-To: <20121003124804.GR1787@tucnak.redhat.com> (Jakub Jelinek's message of "Wed, 3 Oct 2012 14:48:04 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Oct 3, 2012, Jakub Jelinek wrote: > basically there is a non-addressable parameter in stack slot, and > vt_canon_true_dep -> canon_true_dependence thinks an argument push > insn might alias with it, because it doesn't have a MEM_EXPR and > ao_ref_from_mem fails. I have a pending (still unreviewed) patch that might address :-), so to speak, this problem. for gcc/ChangeLog from Alexandre Oliva PR debug/53671 PR debug/49888 * var-tracking.c (attrs_list_by_loc_eq): New. (track_stack_pointer): New. (dataflow_set_merge): Use it. (vt_initialize): Record the initial stack pointer in the dataflow set. Index: gcc/var-tracking.c =================================================================== --- gcc/var-tracking.c.orig 2012-06-26 17:33:12.991323578 -0300 +++ gcc/var-tracking.c 2012-06-26 17:51:55.316453808 -0300 @@ -1462,6 +1462,17 @@ attrs_list_member (attrs list, decl_or_v return NULL; } +/* Return the entry whose LOC field equals LOC. */ + +static attrs +attrs_list_by_loc_eq (attrs list, rtx loc) +{ + for (; list; list = list->next) + if (list->loc == loc) + return list; + return NULL; +} + /* Insert the triplet DECL, OFFSET, LOC to the list *LISTP. */ static void @@ -4028,6 +4039,86 @@ variable_merge_over_src (variable s2var, return 1; } +/* Add to DST any needed binding for the canonicalization of the stack + pointer to yield the same expression as in SRC1 and SRC2, if they + both yield the same expression. + + Return TRUE iff we found an equivalence. + + ??? The return value, that was useful during testing, ended up + unused, but this single-use static function will be inlined, and + then the return value computation will be optimized out, so I'm + leaving it in. + + ??? We use this kludge to avoid accidental aliasing between + incoming arguments and register-saving or outgoing-args pushes. We + shouldn't have to add explicit stack pointer tracking for that: + intersect_loc_chains ought to be able to take information from the + static cselib table and recognize additional equivalences, but we + don't have a sufficiently efficient algorithm to do that yet. */ + +static bool +track_stack_pointer (dataflow_set *dst, dataflow_set *src1, dataflow_set *src2) +{ + attrs dattr, s1attr, s2attr; + rtx daddr, s1addr, s2addr; + decl_or_value dv; + + for (dattr = dst->regs[STACK_POINTER_REGNUM]; + (dattr = attrs_list_by_loc_eq (dattr, stack_pointer_rtx)) + && (dattr->offset || !dv_is_value_p (dattr->dv)); + dattr = dattr->next) + ; + + for (s1attr = src1->regs[STACK_POINTER_REGNUM]; + (s1attr = attrs_list_by_loc_eq (s1attr, stack_pointer_rtx)) + && (s1attr->offset || !dv_is_value_p (s1attr->dv)); + s1attr = s1attr->next) + ; + if (!s1attr) + return false; + + for (s2attr = src2->regs[STACK_POINTER_REGNUM]; + (s2attr = attrs_list_by_loc_eq (s2attr, stack_pointer_rtx)) + && (s2attr->offset || !dv_is_value_p (s2attr->dv)); + s2attr = s2attr->next) + ; + if (!s2attr) + return false; + + if (dattr) + daddr = vt_canonicalize_addr (dst, dv_as_value (dattr->dv)); + else + daddr = NULL; + s1addr = vt_canonicalize_addr (src1, dv_as_value (s1attr->dv)); + s2addr = vt_canonicalize_addr (src2, dv_as_value (s2attr->dv)); + + if (!rtx_equal_p (s1addr, s2addr)) + return false; + + if (daddr && rtx_equal_p (daddr, s1addr)) + return true; + + dst_can_be_shared = false; + if (daddr) + dv = dattr->dv; + else if (vt_get_canonicalize_base (s1addr) + != (cfa_base_rtx ? cfa_base_rtx : arg_pointer_rtx)) + return false; + else + { + cselib_val *val = cselib_lookup (s1addr, GET_MODE (s1addr), 1, VOIDmode); + cselib_preserve_value (val); + dv = dv_from_value (val->val_rtx); + } + + var_reg_decl_set (dst, stack_pointer_rtx, + VAR_INIT_STATUS_INITIALIZED, + dv, 0, NULL_RTX, INSERT); + + return true; +} + /* Combine dataflow set information from SRC2 into DST, using PDST to carry over information across passes. */ @@ -4066,6 +4157,8 @@ dataflow_set_merge (dataflow_set *dst, d FOR_EACH_HTAB_ELEMENT (shared_hash_htab (dsm.cur->vars), var, variable, hi) variable_merge_over_cur (var, &dsm); + track_stack_pointer (dst, src1, src2); + if (dsm.src_onepart_cnt) dst_can_be_shared = false; @@ -9682,6 +9775,18 @@ vt_initialize (void) expr = plus_constant (GET_MODE (reg), reg, ofst); cselib_add_permanent_equiv (val, expr, get_insns ()); } + + /* VAL below will generally be the one set within the + conditional block, but if OFST happens to be zero, we'll be + happy to use the one corresponding to REG. + + ??? We shouldn't need this any more once dataflow merges + start using equivalences from the cselib table in addition to + those in dataflow sets. */ + var_reg_decl_set (&VTI (ENTRY_BLOCK_PTR)->out, + stack_pointer_rtx, VAR_INIT_STATUS_INITIALIZED, + dv_from_value (val->val_rtx), 0, NULL_RTX, + INSERT); } /* In order to factor out the adjustments made to the stack pointer or to