Hi, 

This patch follows up the problem outlined here:
http://gcc.gnu.org/ml/gcc/2013-11/msg00152.html

The patch attached prevents adding clobbers when LRA is running
in insn_invalid_p function and lra_in_progress variable is being set
just before check_rtl call. This should stop modification of insns stream
in cases where there is a insn match after adding clobbers. 

The patch was bootstrapped and regtested on x86_64-unknown-linux-gnu (revision 
204787).

Regards,
Robert

2013-11-13  Robert Suchanek  <robert.sucha...@imgtec.com>
    
        * lra.c (lra): Set lra_in_progress before check_rtl call.
        * recog.c (insn_invalid_p): Add !lra_in_progress to prevent
        adding clobber regs when LRA is running

diff --git a/gcc/lra.c b/gcc/lra.c
index 1aea599..83d45b6 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -2238,6 +2238,10 @@ lra (FILE *f)
 
   init_insn_recog_data ();
 
+  /* We can not set up reload_in_progress because it prevents new
+     pseudo creation.  */
+  lra_in_progress = 1;
+
 #ifdef ENABLE_CHECKING
   check_rtl (false);
 #endif
@@ -2248,10 +2252,6 @@ lra (FILE *f)
 
   setup_reg_spill_flag ();
 
-  /* We can not set up reload_in_progress because it prevents new
-     pseudo creation.  */
-  lra_in_progress = 1;
-
   /* Function remove_scratches can creates new pseudos for clobbers --
      so set up lra_constraint_new_regno_start before its call to
      permit changing reg classes for pseudos created by this
diff --git a/gcc/recog.c b/gcc/recog.c
index c8594bb..5c0ec16 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -314,7 +314,9 @@ insn_invalid_p (rtx insn, bool in_group)
      clobbers.  */
   int icode = recog (pat, insn,
                     (GET_CODE (pat) == SET
-                     && ! reload_completed && ! reload_in_progress)
+                     && ! reload_completed 
+                      && ! reload_in_progress
+                      && ! lra_in_progress)
                     ? &num_clobbers : 0);
   int is_asm = icode < 0 && asm_noperands (PATTERN (insn)) >= 0;


Reply via email to