postreload.c (reload_combine): Mark reg_state as invalid at volatile insns if there...
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>
Tue, 22 Nov 2011 19:52:34 +0000 (19:52 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Tue, 22 Nov 2011 19:52:34 +0000 (19:52 +0000)
2011-11-22  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

* postreload.c (reload_combine): Mark reg_state as invalid at
volatile insns if there has been a use already.

From-SVN: r181631

gcc/ChangeLog
gcc/postreload.c

index ba48cc1f2cb9f8f44f077aac24497ac3ab6f2bd8..700e833677b65e67dbaa2d5d786896d540e06a9d 100644 (file)
@@ -1,3 +1,8 @@
+2011-11-22  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+
+       * postreload.c (reload_combine): Mark reg_state as invalid at
+       volatile insns if there has been a use already.
+
 2011-11-21  Aldy Hernandez  <aldyh@redhat.com>
 
        * opts.c (finish_options): Do not fail for -fgnu-tm.
index 886d024926cd582fc69377293b3e86a37f4a2f0c..5c1891294458959877a4ddbf59e85a93a4746b1a 100644 (file)
@@ -1312,11 +1312,21 @@ reload_combine (void)
         is and then later disable any optimization that would cross it.  */
       if (LABEL_P (insn))
        last_label_ruid = reload_combine_ruid;
-      else if (BARRIER_P (insn)
-              || (INSN_P (insn) && volatile_insn_p (PATTERN (insn))))
-       for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
-         if (! fixed_regs[r])
+      else if (BARRIER_P (insn))
+       {
+         /* Crossing a barrier resets all the use information.  */
+         for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
+           if (! fixed_regs[r])
              reg_state[r].use_index = RELOAD_COMBINE_MAX_USES;
+       }
+      else if (INSN_P (insn) && volatile_insn_p (PATTERN (insn)))
+       /* Optimizations across insns being marked as volatile must be
+          prevented.  All the usage information is invalidated
+          here.  */
+       for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
+         if (! fixed_regs[r]
+             && reg_state[r].use_index != RELOAD_COMBINE_MAX_USES)
+           reg_state[r].use_index = -1;
 
       if (! NONDEBUG_INSN_P (insn))
        continue;