From patchwork Mon Jul 24 08:42:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu X-Patchwork-Id: 792684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-458752-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ei+AZtjH"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xGFPv6f7cz9s74 for ; Mon, 24 Jul 2017 18:48:03 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=h/oODZLvc1LD2/X/ 8XFJWApTm8qM3dfD5ivKhC5JDGqrUT9S3NEtH6MW6yoF7g34dhNT9R/PJmNG0AGp YZ4GksjRQi+wyprYUZeQA8qGzpypNpDr1K3Z/V0vLSv3mAiZJSOP3g7dAljDWlXS oGpVsEYbsCU1q18yYiOpLHzFJ7g= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=hkNA8vNegeCFU0oXm9qncV 57r2U=; b=ei+AZtjH/q4vZs1gefq0OmgoW+I+b+9hmArTPTtXeOtb5Y5TbNmUfm 5joiZDQJmMG+ecIaJW9E5mG2Qmz0LmT82m4TkmioPYPy91vgMA++3rdWLTtcmM89 Lji0wBIuaa4/Cwjstws2hKAQ8+V8AtxyMZX3qejw7Qpctc4/6qGko= Received: (qmail 54772 invoked by alias); 24 Jul 2017 08:46:41 -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 54346 invoked by uid 89); 24 Jul 2017 08:46:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: smtprelay.synopsys.com Received: from smtprelay2.synopsys.com (HELO smtprelay.synopsys.com) (198.182.60.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Jul 2017 08:46:31 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 827E210C1406; Mon, 24 Jul 2017 01:46:30 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 6460F4CB; Mon, 24 Jul 2017 01:46:30 -0700 (PDT) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 54AB54C8; Mon, 24 Jul 2017 01:46:30 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 24 Jul 2017 01:46:30 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 24 Jul 2017 14:16:27 +0530 Received: from nl20droid1.internal.synopsys.com (10.100.24.228) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 24 Jul 2017 14:16:26 +0530 From: Claudiu Zissulescu To: CC: , , , Subject: [PATCH 7/7] [ARC] Fix errors in arc_ifcvt. Date: Mon, 24 Jul 2017 10:42:59 +0200 Message-ID: <1500885779-12930-8-git-send-email-claziss@synopsys.com> In-Reply-To: <1500885779-12930-1-git-send-email-claziss@synopsys.com> References: <1500885779-12930-1-git-send-email-claziss@synopsys.com> MIME-Version: 1.0 From: claziss The arc_ifcvt procedure is removing a label even when it is used by another jump. This patch fixes dg.exp/pr31507-1.c. gcc/ 2017-07-10 Claudiu Zissulescu * config/arc/arc.c (arc_ifcvt): Remove use of merge_blocks call. (arc_ccfsm_advance): Fix checking for delay slots. (arc_reorg): Add rtl dump after each call to arc_ifcvt --- gcc/config/arc/arc.c | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 0f9b553..f7a2b61 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -4429,12 +4429,10 @@ arc_ccfsm_advance (rtx_insn *insn, struct arc_ccfsm *state) /* If this is a non-annulled branch with a delay slot, there is no need to conditionalize the delay slot. */ - if (NEXT_INSN (PREV_INSN (insn)) != insn + if ((GET_CODE (PATTERN (NEXT_INSN (PREV_INSN (insn)))) == SEQUENCE) && state->state == 0 && !INSN_ANNULLED_BRANCH_P (insn)) { this_insn = NEXT_INSN (this_insn); - gcc_assert (NEXT_INSN (NEXT_INSN (PREV_INSN (start_insn))) - == NEXT_INSN (this_insn)); } /* See how many insns this branch skips, and what kind of insns. If all insns are okay, and the label or unconditional branch to the same @@ -7547,6 +7545,12 @@ arc_reorg (void) arc_ifcvt (); unsigned int flags = pass_data_arc_ifcvt.todo_flags_finish; df_finish_pass ((flags & TODO_df_verify) != 0); + + if (dump_file) + { + fprintf (dump_file, ";; After if conversion:\n\n"); + print_rtl (dump_file, get_insns ()); + } } /* Call shorten_branches to calculate the insn lengths. */ @@ -8998,7 +9002,6 @@ static unsigned arc_ifcvt (void) { struct arc_ccfsm *statep = &cfun->machine->ccfsm_current; - basic_block merge_bb = 0; memset (statep, 0, sizeof *statep); for (rtx_insn *insn = get_insns (); insn; insn = next_insn (insn)) @@ -9008,20 +9011,14 @@ arc_ifcvt (void) switch (statep->state) { case 0: - if (JUMP_P (insn)) - merge_bb = 0; break; case 1: case 2: { /* Deleted branch. */ - gcc_assert (!merge_bb); - merge_bb = BLOCK_FOR_INSN (insn); - basic_block succ_bb - = BLOCK_FOR_INSN (NEXT_INSN (NEXT_INSN (PREV_INSN (insn)))); arc_ccfsm_post_advance (insn, statep); gcc_assert (!IN_RANGE (statep->state, 1, 2)); rtx_insn *seq = NEXT_INSN (PREV_INSN (insn)); - if (seq != insn) + if (GET_CODE (PATTERN (seq)) == SEQUENCE) { rtx slot = XVECEXP (PATTERN (seq), 0, 1); rtx pat = PATTERN (slot); @@ -9035,18 +9032,10 @@ arc_ifcvt (void) gcc_unreachable (); PUT_CODE (slot, NOTE); NOTE_KIND (slot) = NOTE_INSN_DELETED; - if (merge_bb && succ_bb) - merge_blocks (merge_bb, succ_bb); - } - else if (merge_bb && succ_bb) - { - set_insn_deleted (insn); - merge_blocks (merge_bb, succ_bb); } else { - PUT_CODE (insn, NOTE); - NOTE_KIND (insn) = NOTE_INSN_DELETED; + set_insn_deleted (insn); } continue; } @@ -9055,17 +9044,8 @@ arc_ifcvt (void) && statep->target_label == CODE_LABEL_NUMBER (insn)) { arc_ccfsm_post_advance (insn, statep); - basic_block succ_bb = BLOCK_FOR_INSN (insn); - if (merge_bb && succ_bb) - merge_blocks (merge_bb, succ_bb); - else if (--LABEL_NUSES (insn) == 0) - { - const char *name = LABEL_NAME (insn); - PUT_CODE (insn, NOTE); - NOTE_KIND (insn) = NOTE_INSN_DELETED_LABEL; - NOTE_DELETED_LABEL_NAME (insn) = name; - } - merge_bb = 0; + if (--LABEL_NUSES (insn) == 0) + delete_insn (insn); continue; } /* Fall through. */