re PR middle-end/11767 (different code behaviour with -fnon-call-exceptions -fprofile...
authorRichard Henderson <rth@redhat.com>
Wed, 3 Mar 2004 00:46:06 +0000 (16:46 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 3 Mar 2004 00:46:06 +0000 (16:46 -0800)
        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.
        * g++.dg/other/profile1.C: New.

From-SVN: r78805

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

index 1a8e3331442a2e07b752fc91c4660404886eb8e5..ebcd2ec39d66b0380c545283b3828b6e8515d69d 100644 (file)
@@ -1,3 +1,10 @@
+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
index 6d6f3b8b36fa7ebcaf7293fb0ef05ecc3931ef2d..d045d79358cc0ab8ec5f271437ecc89c919d4255 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 cf3099b35239c9c98ef0ca2cd410f43362b74f8a..0826782473f111bc037a4d0e43b9c5bdc2cefddd 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))