]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/11767 (different code behaviour with -fnon-call-exceptions -fprofile...
authorRichard Henderson <rth@redhat.com>
Wed, 3 Mar 2004 00:48:54 +0000 (16:48 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 3 Mar 2004 00:48:54 +0000 (16:48 -0800)
        PR middle-end/11767
        * 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: r78808

gcc/ChangeLog
gcc/optabs.c

index 139b25a35b5c516ad046efe59ef3e954eb4aff04..45a72b864047365e4d7505e15d9dc20dc19b474c 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-02  Richard Henderson  <rth@redhat.com>
+
+        PR middle-end/11767
+        * 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 d4eb640a71cbfc7fbc9e7d49d429d7467519edd1..9da601c4f84d651fcaa9aed17509d3e7b9b783f2 100644 (file)
@@ -3476,6 +3476,16 @@ prepare_cmp_insn (px, py, pcomparison, size, pmode, punsignedp, purpose)
       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))