From patchwork Mon Jun 11 18:09:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164233 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 72A90B6FD7 for ; Tue, 12 Jun 2012 04:09:56 +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=1340042997; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=afKeJ3SOBqqOxxvQ4NsLmd0ypC4=; b=HmCwl/UVkDn4oSb Kw32GjIUN9dAWUHAg/oj7sKOWVniaPCniJsmVzucgexlhbgfkpWXO/gX/vq23hfU ASue9v1H6R6ZP5fkPDpUtDm5Cn8crWQvgG5BPLKthP7gKLi/IxyUKzouY8wwHSNH 78cek13Pev9bTASksLyRD4e08ilI= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NNE9Wtl+UlgHckgqxvbGIXNX0BaemZ5+dVgqM+tV0lPCFtMaGVPtDaFfqdtWiV DvLfAirvVDdS01lSgfxFSE+3eV8HQYasS02JYxOzidA2DYXEt38rHYc4QCJIWzOH 6fDZ1oLJc+eQZFxVwKwBTq4JY9T3sT0MCHHDyQQgRnr6U=; Received: (qmail 7004 invoked by alias); 11 Jun 2012 18:09:50 -0000 Received: (qmail 6988 invoked by uid 22791); 11 Jun 2012 18:09:48 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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; Mon, 11 Jun 2012 18:09:32 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5BI9SCJ031372 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 11 Jun 2012 14:09:28 -0400 Received: from pebble.twiddle.home (vpn-10-127.rdu.redhat.com [10.11.10.127]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5BI9RVm007071; Mon, 11 Jun 2012 14:09:27 -0400 Message-ID: <4FD63454.6090000@redhat.com> Date: Mon, 11 Jun 2012 11:09:24 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Chung-Lin Tang CC: gcc-patches Subject: Re: [PATCH 1/2] SH epilogue unwind, dwarf2 pass changes References: <4FB628F9.7010901@codesourcery.com> <4FBBD0F4.60104@redhat.com> <4FC89850.8050400@codesourcery.com> <4FD5ADAB.1080609@codesourcery.com> In-Reply-To: <4FD5ADAB.1080609@codesourcery.com> X-IsSubscribed: yes 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 2012-06-11 01:34, Chung-Lin Tang wrote: > Ping? > > On 2012/6/1 06:24 PM, Chung-Lin Tang wrote: >> On 12/5/23 1:46 AM, Richard Henderson wrote: >>> On 05/18/12 03:48, Chung-Lin Tang wrote: >>>> @@ -2401,6 +2401,7 @@ scan_trace (dw_trace_info *trace) >>>> { >>>> /* Propagate across fallthru edges. */ >>>> dwarf2out_flush_queued_reg_saves (); >>>> + def_cfa_1 (&this_cfa); >>>> maybe_record_trace_start (insn, NULL); >>>> break; >>>> } >>>> @@ -2455,6 +2456,18 @@ scan_trace (dw_trace_info *trace) >>>> cur_cfa = &this_cfa; >>>> continue; >>>> } >>>> + else >>>> + { >>>> + /* If ELT is a annulled branch-taken instruction (i.e. executed >>>> + only when branch is not taken), the args_size and CFA should >>>> + not change through the jump. */ >>>> + create_trace_edges (control); >>>> + >>>> + /* Update and continue with the trace. */ >>>> + add_cfi_insn = insn; >>>> + scan_insn_after (elt); >>>> + continue; >>>> + } >>> >>> I think the def_cfa_1 is misplaced. It should be immediately before >>> that last continue. That mirrors the sort of flow you get via the >>> other paths through the loop. >> >> Or possibly moved before the dwarf2out_flush_queued_reg_saves () call in >> the patch? (in the save_point_p () break case) Note I'm only saying >> this based on overall ordering of those two routine calls in the loop. >> >> Attached is a testcase (adapted from libgomp) that, with the SH epilogue >> unwind patch applied alone, produces the ICE I'm seeing (-O2 >> -funwind-tables). >> >> This dwarf2 patch, with any of the three new def_cfa_1() call sites >> seems to solve it, though you might want to comment on which call site >> seems "correct" I've committed the following, after a --enable-languages=c,c++ --target=sh-elf build and check-gcc with your patch 2/2 applied. I eyeballed the resulting debug info and it looked correct. Given the test case was extracted from libgomp I didn't commit that, trusting that the real testing will continue to happen during a build. r~ * dwarf2cfi.c (scan_trace): Handle annulled branch-taken delay slots. diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index bf2d802f..3edb6e1 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -2429,18 +2429,20 @@ scan_trace (dw_trace_info *trace) elt = XVECEXP (pat, 0, 1); - /* If ELT is an instruction from target of an annulled branch, - the effects are for the target only and so the args_size - and CFA along the current path shouldn't change. */ if (INSN_FROM_TARGET_P (elt)) { HOST_WIDE_INT restore_args_size; cfi_vec save_row_reg_save; + /* If ELT is an instruction from target of an annulled + branch, the effects are for the target only and so + the args_size and CFA along the current path + shouldn't change. */ add_cfi_insn = NULL; restore_args_size = cur_trace->end_true_args_size; cur_cfa = &cur_row->cfa; - save_row_reg_save = VEC_copy (dw_cfi_ref, gc, cur_row->reg_save); + save_row_reg_save + = VEC_copy (dw_cfi_ref, gc, cur_row->reg_save); scan_insn_after (elt); @@ -2453,8 +2455,20 @@ scan_trace (dw_trace_info *trace) cur_row->cfa = this_cfa; cur_row->reg_save = save_row_reg_save; cur_cfa = &this_cfa; - continue; } + else + { + /* If ELT is a annulled branch-taken instruction (i.e. + executed only when branch is not taken), the args_size + and CFA should not change through the jump. */ + create_trace_edges (control); + + /* Update and continue with the trace. */ + add_cfi_insn = insn; + scan_insn_after (elt); + def_cfa_1 (&this_cfa); + } + continue; } /* The insns in the delay slot should all be considered to happen