From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128828 invoked by alias); 23 Sep 2016 08:22:32 -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 128785 invoked by uid 89); 23 Sep 2016 08:22:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=joining, endless X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Sep 2016 08:22:22 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 9C7031C0674; Fri, 23 Sep 2016 08:22:20 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: law@redhat.com, dje.gcc@gmail.com, Segher Boessenkool Subject: [PATCH 2/5] dce: Don't dead-code delete separately wrapped restores Date: Fri, 23 Sep 2016 08:22:00 -0000 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg01648.txt.bz2 If there is a separately wrapped register restore on some path that is dead (say, control goes into an endless loop after it), then we cannot delete that restore because that would confuse the DWARF CFI (if there is another path joining after this). This happens with gcc.dg/torture/pr53168.c, for example. 2016-09-23 Segher Boessenkool * dce.c (delete_unmarked_insns): Don't delete instructions with a REG_CFA_RESTORE note. --- gcc/dce.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/dce.c b/gcc/dce.c index ea3fb00..d510287 100644 --- a/gcc/dce.c +++ b/gcc/dce.c @@ -587,6 +587,15 @@ delete_unmarked_insns (void) if (!dbg_cnt (dce)) continue; + if (crtl->shrink_wrapped_separate + && find_reg_note (insn, REG_CFA_RESTORE, NULL)) + { + if (dump_file) + fprintf (dump_file, "DCE: NOT deleting insn %d, it's a " + "callee-save restore\n", INSN_UID (insn)); + continue; + } + if (dump_file) fprintf (dump_file, "DCE: Deleting insn %d\n", INSN_UID (insn)); -- 1.9.3