From patchwork Mon Oct 28 09:24:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 286422 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1F99D2C00BB for ; Mon, 28 Oct 2013 20:24:52 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=tDJUqxwaFTbMVPwNe ltCBT35krBfUgtlHEV/9WvGTIFzkO84yLbxFlK4g+sv1pPFADRGDYGEHkQZfbXex Ggt18+F8sZAMvcqMzatA57odIUitZVdT8OR2mHnwgpXdG3Zu5acqJAeclSiNnYSM 8VwxyGtBUHr/mu5hRM2RriM03Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=/WJaD52IAAf3ve2W1aUtL6o KmUY=; b=teKWxleI7GxBuUycXfcPEibGBJdR5/LgGKSObJU8N7UJ8NQ+C1kIXkX qIQYihdrRzdC1vX5zyz4pHcUMXoGMV+2cnozsMyfzncwTX5Og0AidIjKjme2C0sw yLi+fnKmXkOTIYVeV4o8OGXczn+v2VyaNpCV1j7YlwDvRgDA9GVg= Received: (qmail 6127 invoked by alias); 28 Oct 2013 09:24:47 -0000 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 Received: (qmail 6117 invoked by uid 89); 28 Oct 2013 09:24:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Oct 2013 09:24:45 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Vaj3w-00038u-64 from Tom_deVries@mentor.com ; Mon, 28 Oct 2013 02:24:40 -0700 Received: from SVR-IES-FEM-03.mgc.mentorg.com ([137.202.0.108]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 28 Oct 2013 02:24:40 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-03.mgc.mentorg.com (137.202.0.108) with Microsoft SMTP Server id 14.2.247.3; Mon, 28 Oct 2013 09:24:37 +0000 Message-ID: <526E2D4A.9030108@mentor.com> Date: Mon, 28 Oct 2013 10:24:26 +0100 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-Version: 1.0 To: Eric Botcazou CC: , Richard Earnshaw , Ulrich Weigand , Jakub Jelinek Subject: Re: [PATCH, ARM] Fix line number data for PIC register setup code References: <525B1BDD.2000306@mentor.com> <2103131.fAnzg95i8L@polaris> In-Reply-To: <2103131.fAnzg95i8L@polaris> On 27/10/13 17:04, Eric Botcazou wrote: >> The PIC register setup code is emitted after NOTE_INSNS_FUNCTION_BEG, >> because it uses the insert_insn_on_edge mechanism, and the corresponding >> insertion in cfgexpand.c:gimple_expand_cfg takes care to insert the code >> after the parm_birth_insn: >> ... >> /* Avoid putting insns before parm_birth_insn. */ >> if (e->src == ENTRY_BLOCK_PTR >> && single_succ_p (ENTRY_BLOCK_PTR) >> && parm_birth_insn) >> { >> rtx insns = e->insns.r; >> e->insns.r = NULL_RTX; >> emit_insn_after_noloc (insns, parm_birth_insn, e->dest); >> } >> ... >> And in the case for this test-case, parm_birth_insn is the >> NOTE_INSNS_FUNCTION_BEG. > > So this means that parm_birth_insn can never be null, right? > Yes, AFAICT parm_birth_insn is never NULL at this point. >> 2013-10-13 Tom de Vries >> >> * cfgexpand.c (gimple_expand_cfg): Don't commit insertions after >> NOTE_INSN_FUNCTION_BEG. >> >> * gcc.target/arm/require-pic-register-loc.c: New test. > > OK if you also remove the test on parm_birth_insn. > Updated patch, re-bootstrapped on x86_64 and committed to trunk. Also applied to 4.7 and 4.8 branches, the same problem is present there. Thanks, - Tom 2013-10-28 Tom de Vries * cfgexpand.c (gimple_expand_cfg): Remove test for parm_birth_insn. Don't commit insertions after NOTE_INSN_FUNCTION_BEG. * gcc.target/arm/require-pic-register-loc.c: New test. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index ba4c0e6..9705036 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -4789,14 +4789,18 @@ gimple_expand_cfg (void) if (e->insns.r) { rebuild_jump_labels_chain (e->insns.r); - /* Avoid putting insns before parm_birth_insn. */ + /* Put insns after parm birth, but before + NOTE_INSNS_FUNCTION_BEG. */ if (e->src == ENTRY_BLOCK_PTR - && single_succ_p (ENTRY_BLOCK_PTR) - && parm_birth_insn) + && single_succ_p (ENTRY_BLOCK_PTR)) { rtx insns = e->insns.r; e->insns.r = NULL_RTX; - emit_insn_after_noloc (insns, parm_birth_insn, e->dest); + if (NOTE_P (parm_birth_insn) + && NOTE_KIND (parm_birth_insn) == NOTE_INSN_FUNCTION_BEG) + emit_insn_before_noloc (insns, parm_birth_insn, e->dest); + else + emit_insn_after_noloc (insns, parm_birth_insn, e->dest); } else commit_one_edge_insertion (e); 2013-10-27 Tobias Burnus PR other/33426 diff --git a/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c b/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c new file mode 100644 index 0000000..bd85e86 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-g -fPIC" } */ + +void *v; +void a (void *x) { } +void b (void) { } + /* line 7. */ +int /* line 8. */ +main (int argc) /* line 9. */ +{ /* line 10. */ + if (argc == 12345) /* line 11. */ + { + a (v); + return 1; + } + b (); + + return 0; +} + +/* { dg-final { scan-assembler-not "\.loc 1 7 0" } } */ +/* { dg-final { scan-assembler-not "\.loc 1 8 0" } } */ +/* { dg-final { scan-assembler-not "\.loc 1 9 0" } } */ + +/* The loc at the start of the prologue. */ +/* { dg-final { scan-assembler-times "\.loc 1 10 0" 1 } } */ + +/* The loc at the end of the prologue, with the first user line. */ +/* { dg-final { scan-assembler-times "\.loc 1 11 0" 1 } } */