This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
IA64 loop optimization patch (Linux and HP-UX)
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Jan 2002 13:41:40 -0800 (PST)
- Subject: IA64 loop optimization patch (Linux and HP-UX)
- Reply-to: sje at cup dot hp dot com
Could someone take a good look at this patch and see if it is right and
check it in if it is? I found that on HP-UX and Linux IA64 platforms
(where PIC_OFFSET_TABLE_REG_CALL_CLOBBERED is set) that we are not
moving "const" functions or library calls (like integer division) that
have loop invariant arguments out of loops because of the save/restore
of the PIC register that is done. This change fixes that problem.
I believe that it is OK to check pic_offset_table_rtx even if
PIC_OFFSET_TABLE_REG_CALL_CLOBBERED is not set though those platforms
will probably not ever set/restore the PIC register in a loop.
Tested on HP-UX IA64.
Steve Ellcey
sje@cup.hp.com
2002-01-30 Steve Ellcey <sje@cup.hp.com>
* loop.c (loop_invariant_p): frame and arg pointers are
recognized as special cases of loop invarient values,
pic_offset_table_rtx needs to be handled in the same way or
platforms that set PIC_OFFSET_TABLE_REG_CALL_CLOBBERED will not
move loop invariant functions.
*** gcc.orig/gcc/loop.c Wed Jan 30 13:27:21 2002
--- gcc/gcc/loop.c Wed Jan 30 13:28:44 2002
*************** loop_invariant_p (loop, x)
*** 3227,3233 ****
since the reg might be set by initialization within the loop. */
if ((x == frame_pointer_rtx || x == hard_frame_pointer_rtx
! || x == arg_pointer_rtx)
&& ! current_function_has_nonlocal_goto)
return 1;
--- 3227,3233 ----
since the reg might be set by initialization within the loop. */
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;