make gcse.c respect -fno-gcse-lm

Message ID CABu31nPKUkhm3BprYx=V_TQCjLwRg9RwaT1O89e6FJM3GBNu8A@mail.gmail.com
State New
Headers show

Commit Message

Steven Bosscher March 10, 2013, 11:17 p.m.
Hello,

RTL PRE has an option to disable load motion. This option works fine,
except that all analysis for load motion is still performed.

This patch stops gcse.c from recording memory sets for -fno-gcse-lm,
and conservatively returns true in oprs_unchanged_p for any MEM.

Bootstrapped&tested on {x86_64,powerpc64}-unknown-linux-gnu. OK?

Ciao!
Steven


        * gcse.c (oprs_unchanged_p): Respect flag_gcse_lm.
        (record_last_mem_set_info): Likewise.

Comments

Richard Biener March 11, 2013, 9:10 a.m. | #1
On Mon, Mar 11, 2013 at 12:17 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> RTL PRE has an option to disable load motion. This option works fine,
> except that all analysis for load motion is still performed.
>
> This patch stops gcse.c from recording memory sets for -fno-gcse-lm,
> and conservatively returns true in oprs_unchanged_p for any MEM.
>
> Bootstrapped&tested on {x86_64,powerpc64}-unknown-linux-gnu. OK?

Ok.

Thanks,
Richard.

> Ciao!
> Steven
>
>
>         * gcse.c (oprs_unchanged_p): Respect flag_gcse_lm.
>         (record_last_mem_set_info): Likewise.
>
> Index: gcse.c
> ===================================================================
> --- gcse.c      (revision 196576)
> +++ gcse.c      (working copy)
> @@ -890,8 +890,9 @@ oprs_unchanged_p (const_rtx x, const_rtx
>        }
>
>      case MEM:
> -      if (load_killed_in_block_p (current_bb, DF_INSN_LUID (insn),
> -                                 x, avail_p))
> +      if (! flag_gcse_lm
> +         || load_killed_in_block_p (current_bb, DF_INSN_LUID (insn),
> +                                    x, avail_p))
>         return 0;
>        else
>         return oprs_unchanged_p (XEXP (x, 0), insn, avail_p);
> @@ -1471,10 +1472,14 @@ canon_list_insert (rtx dest ATTRIBUTE_UN
>  static void
>  record_last_mem_set_info (rtx insn)
>  {
> -  int bb = BLOCK_FOR_INSN (insn)->index;
> +  int bb;
> +
> +  if (! flag_gcse_lm)
> +    return;
>
>    /* load_killed_in_block_p will handle the case of calls clobbering
>       everything.  */
> +  bb = BLOCK_FOR_INSN (insn)->index;
>    modify_mem_list[bb].safe_push (insn);
>    bitmap_set_bit (modify_mem_list_set, bb);

Patch

Index: gcse.c
===================================================================
--- gcse.c      (revision 196576)
+++ gcse.c      (working copy)
@@ -890,8 +890,9 @@  oprs_unchanged_p (const_rtx x, const_rtx
       }

     case MEM:
-      if (load_killed_in_block_p (current_bb, DF_INSN_LUID (insn),
-                                 x, avail_p))
+      if (! flag_gcse_lm
+         || load_killed_in_block_p (current_bb, DF_INSN_LUID (insn),
+                                    x, avail_p))
        return 0;
       else
        return oprs_unchanged_p (XEXP (x, 0), insn, avail_p);
@@ -1471,10 +1472,14 @@  canon_list_insert (rtx dest ATTRIBUTE_UN
 static void
 record_last_mem_set_info (rtx insn)
 {
-  int bb = BLOCK_FOR_INSN (insn)->index;
+  int bb;
+
+  if (! flag_gcse_lm)
+    return;

   /* load_killed_in_block_p will handle the case of calls clobbering
      everything.  */
+  bb = BLOCK_FOR_INSN (insn)->index;
   modify_mem_list[bb].safe_push (insn);
   bitmap_set_bit (modify_mem_list_set, bb);