------- Additional Comments From amylaar at gcc dot gnu dot org  2005-06-20 
13:21 -------
P.S.: I realize now that the code in gcc/java/jcf-io.c is no longer miscompiled
for i686-pc-linux-gnu because the memory addresses contain stack pointer
references, and the stack pointer is a fixed register, i.e. call used, but not
invalidated by a call.  Hence with Pat Haugen's patch reversed, we falsely
conclude that addresses of the stack locations are not loop invariant.
Two wrongs don't make a right here, though.  The wider context of the
loop_invariant_p code is:

   case REG:
      if ((x == frame_pointer_rtx || x == hard_frame_pointer_rtx
           || x == arg_pointer_rtx || x == pic_offset_table_rtx)
          && ! current_function_has_nonlocal_goto)
        return 1;

      if (LOOP_INFO (loop)->has_call
          && REGNO (x) < FIRST_PSEUDO_REGISTER && call_used_regs[REGNO (x)])
        return 0;


I.e. if the libcall parameter values are addressed using an argument or
frame pointer instead of directly via the stack pointer, invalid hoisting of
the stores can still occur. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21848

Reply via email to