This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: GCSE considers read only memory clobbered by function calls.





I want to add the below example as a regression test; the difference
between the success and failure is the position of a load operation. Is
there a possibility to check this using the scan-assembler?

Mostafa Hagog  wrote on 09/05/2005 17:45:24:
>
>
>
>
> It appears that GCSE considers "read only memory" as call clobbered,
which
> is not the case in CSE. I have took the test for read-only memory from
CSE
> and add it to GCSE where we compute the transparency. Here is a patch
that
> does so. This patch makes gcse eliminate redundant loads after stores for
> the following example. The difference is seen when we compile with the
> options:
> "-O3 --param max-gcse-passes=3" with/without "-fgcse-las" (on a
> powerpc-linux target). If this looks a reasonable change I will
> regression-test and bootstrap the patch and ask for commit.
>
> Example:
>
> #define CALL_FPTR(fptr) (*fptr)
> #define MY_FOO_CHECK() if (my_foo_var) my_foo_func()
>
> int my_foo_var;
>
> struct my_foo_struct {
>     int my_dummy_field;
>     int *(*ppaddr)(int);
> };
>
> struct my_foo_struct *my_foo_record;
>
> int my_main_foo(int n)
> {
>     while ((my_foo_record = CALL_FPTR(my_foo_record->ppaddr)(n))) {
>         MY_FOO_CHECK();
>     }
>
>     return 0;
> }
>
> The patch:
>
> 2005-05-09 Mostafa Hagog <mustafa@il.ibm.com>
>
>       * gcse.c (compute_transp): use MEM_READONLY_P in case of MEM.
>
> Index: gcse.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
> retrieving revision 1.340
> diff -c -p -r1.340 gcse.c
> *** gcse.c      23 Apr 2005 21:27:44 -0000      1.340
> --- gcse.c      5 May 2005 12:54:04 -0000
> *************** compute_transp (rtx x, int indx, sbitmap
> *** 2470,2479 ****
>            do any list walking for them.  */
>         EXECUTE_IF_SET_IN_BITMAP (blocks_with_calls, 0, bb_index, bi)
>           {
> !           if (set_p)
> !             SET_BIT (bmap[bb_index], indx);
> !           else
> !             RESET_BIT (bmap[bb_index], indx);
>           }
>
>         /* Now iterate over the blocks which have memory modifications
> --- 2470,2482 ----
>            do any list walking for them.  */
>         EXECUTE_IF_SET_IN_BITMAP (blocks_with_calls, 0, bb_index, bi)
>           {
> !             if (! MEM_READONLY_P (x))
> !               {
> !                 if (set_p)
> !                   SET_BIT (bmap[bb_index], indx);
> !                 else
> !                   RESET_BIT (bmap[bb_index], indx);
> !               }
>           }
>
>


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