PR middle-end/11767
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Mar 2004 00:46:06 +0000 (00:46 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Mar 2004 00:46:06 +0000 (00:46 +0000)
        * coverage.c (coverage_counter_ref): Set MEM_NOTRAP_P.
        * optabs.c (prepare_cmp_insn): Force trapping memories to registers
        before the compare, if flag_non_call_exceptions.
        * g++.dg/other/profile1.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78805 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/coverage.c
gcc/optabs.c

index 1a8e333..ebcd2ec 100644 (file)
@@ -1,5 +1,12 @@
 2004-03-02  Richard Henderson  <rth@redhat.com>
 
+        PR middle-end/11767
+        * coverage.c (coverage_counter_ref): Set MEM_NOTRAP_P.
+        * optabs.c (prepare_cmp_insn): Force trapping memories to registers
+        before the compare, if flag_non_call_exceptions.
+
+2004-03-02  Richard Henderson  <rth@redhat.com>
+
        PR middle-end/14327
        * stmt.c (expand_computed_goto): Do do_pending_stack_adjust before
        emitting the label, not after.
index 6d6f3b8..d045d79 100644 (file)
@@ -399,6 +399,7 @@ coverage_counter_ref (unsigned counter, unsigned no)
   ref = plus_constant (ctr_labels[counter], gcov_size / BITS_PER_UNIT * no);
   ref = gen_rtx_MEM (mode, ref);
   set_mem_alias_set (ref, new_alias_set ());
+  MEM_NOTRAP_P (ref) = 1;
 
   return ref;
 }
index cf3099b..0826782 100644 (file)
@@ -3650,6 +3650,16 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size,
       return;
     }
 
+  /* Don't allow operands to the compare to trap, as that can put the
+     compare and branch in different basic blocks.  */
+  if (flag_non_call_exceptions)
+    {
+      if (may_trap_p (x))
+       x = force_reg (mode, x);
+      if (may_trap_p (y))
+       y = force_reg (mode, y);
+    }
+
   *px = x;
   *py = y;
   if (can_compare_p (*pcomparison, mode, purpose))