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.

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);

Reply via email to