This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug in if_convert


On Wed, May 03, 2000 at 07:09:14PM +0100, Richard Earnshaw wrote:
> That is, we have a simple if-then-else sequence with both arms setting x; 
> except that in this case the 'else' setter is a complex expression 
> involving the condition code register (this was generated by a previous 
> pass of if_convert, but cse has eliminated the comparison, since it was 
> identical to the earlier one).

Fixed thus.  Bootstrapped alpha-linux for sanity.


r~


        * ifcvt.c (noce_process_if_block): Fail if A or B modified
        between condition and jump.

Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ifcvt.c,v
retrieving revision 1.8
diff -c -p -d -r1.8 ifcvt.c
*** ifcvt.c	2000/05/03 11:16:35	1.8
--- ifcvt.c	2000/05/04 22:53:08
*************** noce_process_if_block (test_bb, then_bb,
*** 1054,1064 ****
    x = SET_DEST (set_a);
    a = SET_SRC (set_a);
  
-   /* X may not be mentioned between cond_earliest and the jump.  */
-   for (insn = jump; insn != if_info.cond_earliest; insn = PREV_INSN (insn))
-     if (INSN_P (insn) && reg_mentioned_p (x, insn))
-       return FALSE;
- 
    /* Look for the other potential set.  Make sure we've got equivalent
       destinations.  */
    /* ??? This is overconservative.  Storing to two different mems is
--- 1054,1059 ----
*************** noce_process_if_block (test_bb, then_bb,
*** 1087,1092 ****
--- 1082,1098 ----
  	insn_b = set_b = NULL_RTX;
      }
    b = (set_b ? SET_SRC (set_b) : x);
+ 
+   /* X may not be mentioned in the range (cond_earliest, jump].  */
+   for (insn = jump; insn != if_info.cond_earliest; insn = PREV_INSN (insn))
+     if (INSN_P (insn) && reg_mentioned_p (x, insn))
+       return FALSE;
+ 
+   /* A and B may not be modified in the range [cond_earliest, jump).  */
+   for (insn = if_info.cond_earliest; insn != jump; insn = NEXT_INSN (insn))
+     if (INSN_P (insn)
+ 	&& (modified_in_p (a, insn) || modified_in_p (b, insn)))
+       return FALSE;
  
    /* Only operate on register destinations, and even then avoid extending
       the lifetime of hard registers on small register class machines.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]