ifcvt.c (noce_process_if_block): Re-add check vs X being changed in no-else-block...
authorRichard Henderson <rth@redhat.com>
Fri, 24 Jan 2003 02:59:58 +0000 (18:59 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 24 Jan 2003 02:59:58 +0000 (18:59 -0800)
        * ifcvt.c (noce_process_if_block): Re-add check vs X being changed
        in no-else-block case.  Add commentary.

From-SVN: r61695

gcc/ChangeLog
gcc/ifcvt.c

index e937cf464b0be17720298a14478f40e9f3a71ce0..e71d35ea6aeb27b5ba237c957d448970cbcedfd2 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-23  Richard Henderson  <rth@redhat.com>
+
+        * ifcvt.c (noce_process_if_block): Re-add check vs X being changed
+        in no-else-block case.  Add commentary.
+
 2003-01-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * configure.in: Revert last change.
index 341e755982399df5ff4de1db10bc2f916a727aae..ed04aefed644258867ff908b5003b2db1b052dd6 100644 (file)
@@ -1802,15 +1802,22 @@ noce_process_if_block (ce_info)
   else
     {
       insn_b = prev_nonnote_insn (if_info.cond_earliest);
+      /* We're going to be moving the evaluation of B down from above
+        COND_EARLIEST to JUMP.  Make sure the relevant data is still
+        intact.  */
       if (! insn_b
          || GET_CODE (insn_b) != INSN
          || (set_b = single_set (insn_b)) == NULL_RTX
          || ! rtx_equal_p (x, SET_DEST (set_b))
-         || reg_overlap_mentioned_p (x, cond)
-         || reg_overlap_mentioned_p (x, a)
          || reg_overlap_mentioned_p (x, SET_SRC (set_b))
          || modified_between_p (SET_SRC (set_b),
-                                PREV_INSN (if_info.cond_earliest), jump))
+                                PREV_INSN (if_info.cond_earliest), jump)
+         /* Likewise with X.  In particular this can happen when
+            noce_get_condition looks farther back in the instruction
+            stream than one might expect.  */
+         || reg_overlap_mentioned_p (x, cond)
+         || reg_overlap_mentioned_p (x, a)
+         || modified_between_p (x, PREV_INSN (if_info.cond_earliest), jump))
        insn_b = set_b = NULL_RTX;
     }
   b = (set_b ? SET_SRC (set_b) : x);