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  <mikest...@comcast.net>

        * 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 ();
                }
            }
        }

Reply via email to