From patchwork Thu Oct 6 22:23:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 118175 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 F0CEEB70B7 for ; Fri, 7 Oct 2011 09:23:59 +1100 (EST) Received: (qmail 18098 invoked by alias); 6 Oct 2011 22:23:57 -0000 Received: (qmail 18081 invoked by uid 22791); 6 Oct 2011 22:23:56 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS 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, 06 Oct 2011 22:23:43 +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 p96MNhSM013773 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 6 Oct 2011 18:23:43 -0400 Received: from anchor.twiddle.net (vpn-236-148.phx2.redhat.com [10.3.236.148]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p96MNgYM001865 for ; Thu, 6 Oct 2011 18:23:43 -0400 Message-ID: <4E8E2A6E.6010007@redhat.com> Date: Thu, 06 Oct 2011 15:23:42 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: GCC Patches Subject: Fix pr 50632 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 We lost a REG_ARGS_SIZE note, leading to the incorrect unwind info, and the verification ICE. r~ * combine-stack-adjust.c (maybe_move_args_size_note): Add after parameter; use it to decide whether to merge two notes. (combine_stack_adjustments_for_block): Use maybe_move_args_size_note for the deallocation case as well. diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c index bca0784..3cffd66 100644 --- a/gcc/combine-stack-adj.c +++ b/gcc/combine-stack-adj.c @@ -296,10 +296,11 @@ record_stack_refs (rtx *xp, void *data) return 0; } -/* If INSN has a REG_ARGS_SIZE note, move it to LAST. */ +/* If INSN has a REG_ARGS_SIZE note, move it to LAST. + AFTER is true iff LAST follows INSN in the instruction stream. */ static void -maybe_move_args_size_note (rtx last, rtx insn) +maybe_move_args_size_note (rtx last, rtx insn, bool after) { rtx note, last_note; @@ -309,7 +310,12 @@ maybe_move_args_size_note (rtx last, rtx insn) last_note = find_reg_note (last, REG_ARGS_SIZE, NULL_RTX); if (last_note) - XEXP (last_note, 0) = XEXP (note, 0); + { + /* The ARGS_SIZE notes are *not* cumulative. They represent an + absolute value, and the "most recent" note wins. */ + if (!after) + XEXP (last_note, 0) = XEXP (note, 0); + } else add_reg_note (last, REG_ARGS_SIZE, XEXP (note, 0)); } @@ -385,7 +391,7 @@ combine_stack_adjustments_for_block (basic_block bb) last_sp_adjust + this_adjust, this_adjust)) { - maybe_move_args_size_note (last_sp_set, insn); + maybe_move_args_size_note (last_sp_set, insn, false); /* It worked! */ delete_insn (insn); @@ -403,6 +409,8 @@ combine_stack_adjustments_for_block (basic_block bb) last_sp_adjust + this_adjust, -last_sp_adjust)) { + maybe_move_args_size_note (insn, last_sp_set, true); + /* It worked! */ delete_insn (last_sp_set); last_sp_set = insn;