combine.c (can_combine_p): Include successor in volatile test.
authorCatherine Moore <clm@cygnus.com>
Mon, 6 Apr 1998 10:49:13 +0000 (10:49 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 6 Apr 1998 10:49:13 +0000 (03:49 -0700)
Mon Apr  6 07:17:52 1998  Catherine Moore  <clm@cygnus.com>
        * combine.c (can_combine_p):  Include successor in volatile test.

From-SVN: r19018

gcc/ChangeLog
gcc/combine.c

index ff58273ca53186d5ec23a788c87f3836927878f7..e74d6f395a1c09bf2fa167a60f874cddd84a90db 100644 (file)
@@ -1,3 +1,7 @@
+Mon Apr  6 07:17:52 1998  Catherine Moore  <clm@cygnus.com>
+
+        * combine.c (can_combine_p):  Include successor in volatile test.
+
 Mon Apr  6 14:16:33 1998  J"orn Rennecke <amylaar@cygnus.co.uk>
 
        * sh.h (CASE_VECTOR_SHORTEN_MODE): Fix logic when to set
index 8a03a3ded67ada1aae76afcc833e8e9fd979785c..c831be1052a84dc78fbc9bb569433707a0607a05 100644 (file)
@@ -1037,14 +1037,19 @@ can_combine_p (insn, i3, pred, succ, pdest, psrc)
        return 0;
 
   /* If INSN contains anything volatile, or is an `asm' (whether volatile
-     or not), reject, unless nothing volatile comes between it and I3,
-     with the exception of SUCC.  */
+     or not), reject, unless nothing volatile comes between it and I3 */
 
   if (GET_CODE (src) == ASM_OPERANDS || volatile_refs_p (src))
-    for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p))
-      if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
-         && p != succ && volatile_refs_p (PATTERN (p)))
-       return 0;
+    {
+      /* Make sure succ doesn't contain a volatile reference.  */
+      if (succ != 0 && volatile_refs_p (PATTERN (succ)))
+        return 0;
+  
+      for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p))
+        if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
+         && p != succ && volatile_refs_p (PATTERN (p)))
+       return 0;
+    }
 
   /* If INSN is an asm, and DEST is a hard register, reject, since it has
      to be an explicit register variable, and was chosen for a reason.  */