From patchwork Fri Oct 21 02:16:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: regcprop.c bug fix Date: Thu, 20 Oct 2011 16:16:41 -0000 From: Mike Stump X-Patchwork-Id: 120924 Message-Id: <2C4421AE-E505-414B-8123-4DE9E0B785D8@comcast.net> To: Bernd Schmidt Cc: GCC Patches 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 (); } } }