dwarf2out.c (compute_barrier_args_size): Set barrier_args_size for labels for which...
authorJakub Jelinek <jakub@redhat.com>
Fri, 1 Aug 2008 20:30:09 +0000 (22:30 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 1 Aug 2008 20:30:09 +0000 (22:30 +0200)
* dwarf2out.c (compute_barrier_args_size): Set barrier_args_size
for labels for which it hasn't been set yet.  If it has been set,
stop walking insns and continue with next worklist item.
(dwarf2out_stack_adjust): Don't call compute_barrier_args_size
if the only BARRIER is at the very end of a function.

From-SVN: r138537

gcc/ChangeLog
gcc/dwarf2out.c

index 8ce1e66..fec4488 100644 (file)
@@ -1,3 +1,11 @@
+2008-08-01  Jakub Jelinek  <jakub@redhat.com>
+
+       * dwarf2out.c (compute_barrier_args_size): Set barrier_args_size
+       for labels for which it hasn't been set yet.  If it has been set,
+       stop walking insns and continue with next worklist item.
+       (dwarf2out_stack_adjust): Don't call compute_barrier_args_size
+       if the only BARRIER is at the very end of a function.
+
 2008-08-01  H.J. Lu  <hongjiu.lu@intel.com>
 
        * cfgexpand.c (expand_stack_alignment): Assert that
index 7e29d2a..e5128d4 100644 (file)
@@ -1256,10 +1256,10 @@ compute_barrier_args_size (void)
     {
       while (!VEC_empty (rtx, worklist))
        {
-         rtx prev, body;
+         rtx prev, body, first_insn;
          HOST_WIDE_INT cur_args_size;
 
-         insn = VEC_pop (rtx, worklist);
+         first_insn = insn = VEC_pop (rtx, worklist);
          cur_args_size = barrier_args_size[INSN_UID (insn)];
          prev = prev_nonnote_insn (insn);
          if (prev && BARRIER_P (prev))
@@ -1274,10 +1274,21 @@ compute_barrier_args_size (void)
 
              if (LABEL_P (insn))
                {
-                 gcc_assert (barrier_args_size[INSN_UID (insn)] < 0
-                             || barrier_args_size[INSN_UID (insn)]
+                 if (insn == first_insn)
+                   continue;
+                 else if (barrier_args_size[INSN_UID (insn)] < 0)
+                   {
+                     barrier_args_size[INSN_UID (insn)] = cur_args_size;
+                     continue;
+                   }
+                 else
+                   {
+                     /* The insns starting with this label have been
+                        already scanned or are in the worklist.  */
+                     gcc_assert (barrier_args_size[INSN_UID (insn)]
                                  == cur_args_size);
-                 continue;
+                     break;
+                   }
                }
 
              body = PATTERN (insn);
@@ -1356,11 +1367,18 @@ dwarf2out_stack_adjust (rtx insn, bool after_p)
     }
   else if (BARRIER_P (insn))
     {
-      if (barrier_args_size == NULL)
+      /* Don't call compute_barrier_args_size () if the only
+        BARRIER is at the end of function.  */
+      if (barrier_args_size == NULL && next_nonnote_insn (insn))
        compute_barrier_args_size ();
-      offset = barrier_args_size[INSN_UID (insn)];
-      if (offset < 0)
+      if (barrier_args_size == NULL)
        offset = 0;
+      else
+       {
+         offset = barrier_args_size[INSN_UID (insn)];
+         if (offset < 0)
+           offset = 0;
+       }
 
       offset -= args_size;
 #ifndef STACK_GROWS_DOWNWARD