From patchwork Fri Oct 21 02:16:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 120924 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 4179EB70BE for ; Fri, 21 Oct 2011 13:17:17 +1100 (EST) Received: (qmail 15169 invoked by alias); 21 Oct 2011 02:17:14 -0000 Received: (qmail 15158 invoked by uid 22791); 21 Oct 2011 02:17:13 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from qmta09.emeryville.ca.mail.comcast.net (HELO qmta09.emeryville.ca.mail.comcast.net) (76.96.30.96) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Oct 2011 02:16:43 +0000 Received: from omta07.emeryville.ca.mail.comcast.net ([76.96.30.59]) by qmta09.emeryville.ca.mail.comcast.net with comcast id nEGQ1h0021GXsucA9EGcRa; Fri, 21 Oct 2011 02:16:36 +0000 Received: from up.mrs.kithrup.com ([24.4.193.8]) by omta07.emeryville.ca.mail.comcast.net with comcast id nEAo1h00q0BKwT48UEApSH; Fri, 21 Oct 2011 02:10:49 +0000 Subject: Re: regcprop.c bug fix Mime-Version: 1.0 (Apple Message framework v1084) From: Mike Stump In-Reply-To: <4EA020A9.60904@codesourcery.com> Date: Thu, 20 Oct 2011 19:16:41 -0700 Cc: GCC Patches Message-Id: <2C4421AE-E505-414B-8123-4DE9E0B785D8@comcast.net> References: <4EA020A9.60904@codesourcery.com> To: Bernd Schmidt 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 Oct 20, 2011, at 6:22 AM, Bernd Schmidt wrote: > I found that maximally confusing, so let me try to rephrase it to see if > I understood you. The two calls to validate_change clobber the > recog_data even if they fail. In case they failed, we want to continue > looking at data from the original insn, so we must recompute it. Yes, exactly. > diagnosis. Better to move the recomputation into the if statement that > contains the validate_change calls and possibly add a comment about the > effect of that function; otherwise OK. Ok, I've updated the code and added some comments and finished testing and checked it in. Thanks. 2011-10-20 Mike Stump * regcprop.c (copyprop_hardreg_forward_1): Update recog_data after validate_change wipes it out. Index: regcprop.c =================================================================== --- regcprop.c (revision 180265) +++ regcprop.c (working copy) @@ -840,6 +840,12 @@ copyprop_hardreg_forward_1 (basic_block changed = true; goto did_replacement; } + /* We need to re-extract as validate_change clobbers + recog_data. */ + extract_insn (insn); + if (! constrain_operands (1)) + fatal_insn_not_found (insn); + preprocess_constraints (); } /* Otherwise, try all valid registers and see if its valid. */ @@ -862,6 +868,12 @@ copyprop_hardreg_forward_1 (basic_block changed = true; goto did_replacement; } + /* We need to re-extract as validate_change clobbers + recog_data. */ + extract_insn (insn); + if (! constrain_operands (1)) + fatal_insn_not_found (insn); + preprocess_constraints (); } } }