]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dse.c (group_info.base_mem, [...]): Use BLKmode to cover all the possible offsets...
authorOlivier Hainque <hainque@adacore.com>
Fri, 27 Aug 2010 10:48:32 +0000 (10:48 +0000)
committerOlivier Hainque <hainque@gcc.gnu.org>
Fri, 27 Aug 2010 10:48:32 +0000 (10:48 +0000)
        * dse.c (group_info.base_mem, get_group_info): Use BLKmode to
        cover all the possible offsets from this base.
        (scan_reads_nospill): Pass base_mem's mode to canon_true_dependence.

        testsuite/
        * gnat.dg/dse_step.ads, dse_step.adb, test_dse_step.adb: New test.

Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>
From-SVN: r163582

gcc/ChangeLog
gcc/dse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/dse_step.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/dse_step.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/test_dse_step.adb [new file with mode: 0644]

index 36097607bf92338dc0f36c1f7cb9e08465783c18..edd3c4c79a74d21a86122db301c8a625d149284f 100644 (file)
@@ -1,3 +1,10 @@
+2010-08-27  Olivier Hainque  <hainque@adacore.com>
+            Eric Botcazou  <ebotcazou@adacore.com>
+
+       * dse.c (group_info.base_mem, get_group_info): Use BLKmode to
+       cover all the possible offsets from this base.
+       (scan_reads_nospill): Pass base_mem's mode to canon_true_dependence.
+
 2010-08-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/44485
index 5dd7bd68bb6b07eef207549ec2bd1d98528c4ca5..1debafc385a9047150e26253d84a52e73df04f59 100644 (file)
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -473,8 +473,9 @@ struct group_info
      hard_frame_pointer.  */
   bool frame_related;
 
-  /* A mem wrapped around the base pointer for the group in order to
-     do read dependency.  */
+  /* A mem wrapped around the base pointer for the group in order to do
+     read dependency.  It must be given BLKmode in order to encompass all
+     the possible offsets from the base.  */
   rtx base_mem;
 
   /* Canonized version of base_mem's address.  */
@@ -705,7 +706,7 @@ get_group_info (rtx base)
       *slot = gi = (group_info_t) pool_alloc (rtx_group_info_pool);
       gi->rtx_base = base;
       gi->id = rtx_group_next_id++;
-      gi->base_mem = gen_rtx_MEM (QImode, base);
+      gi->base_mem = gen_rtx_MEM (BLKmode, base);
       gi->canon_base_addr = canon_rtx (base);
       gi->store1_n = BITMAP_ALLOC (NULL);
       gi->store1_p = BITMAP_ALLOC (NULL);
@@ -3118,7 +3119,7 @@ scan_reads_nospill (insn_info_t insn_info, bitmap gen, bitmap kill)
                     base.  */
                  if ((read_info->group_id < 0)
                      && canon_true_dependence (group->base_mem,
-                                               QImode,
+                                               GET_MODE (group->base_mem),
                                                group->canon_base_addr,
                                                read_info->mem, NULL_RTX,
                                                rtx_varies_p))
index 5da1f904b1ab8677c3ab0a8b3d3444207b38aa00..ebf60390f69691492c0d643d09efe0f9c0823443 100644 (file)
@@ -1,3 +1,7 @@
+2010-08-27  Olivier Hainque  <hainque@adacore.com>
+
+       * gnat.dg/dse_step.ads, dse_step.adb, test_dse_step.adb: New test.
+
 2010-08-26  Daniel Kraft  <d@domob.eu>
 
        PR fortran/38936
diff --git a/gcc/testsuite/gnat.dg/dse_step.adb b/gcc/testsuite/gnat.dg/dse_step.adb
new file mode 100644 (file)
index 0000000..040bcb7
--- /dev/null
@@ -0,0 +1,18 @@
+package body Dse_Step is
+
+   procedure Do_Step (This : in out Counter) is
+   begin
+      This.Value := This.Value + This.Step;
+   end;
+
+   procedure Step_From (Start : in My_Counter) is
+      Lc : My_Counter := Start;
+   begin
+      while Nsteps > 0 loop
+         Do_Step (Lc);
+         Nsteps := Nsteps - 1;
+      end loop;
+      Mv := Lc.Value;
+   end;
+
+end;
diff --git a/gcc/testsuite/gnat.dg/dse_step.ads b/gcc/testsuite/gnat.dg/dse_step.ads
new file mode 100644 (file)
index 0000000..8cf0c74
--- /dev/null
@@ -0,0 +1,19 @@
+package Dse_Step is
+
+   type Counter is record
+      Value : Natural;
+      Step  : Natural;
+   end record;
+   pragma Suppress_Initialization (Counter);
+
+   procedure Do_Step (This : in out Counter);
+   pragma Inline (Do_Step);
+
+   type My_Counter is new Counter;
+   pragma Suppress_Initialization (My_Counter);
+
+   procedure Step_From (Start : in My_Counter);
+
+   Nsteps : Natural := 12;
+   Mv : Natural;
+end;
diff --git a/gcc/testsuite/gnat.dg/test_dse_step.adb b/gcc/testsuite/gnat.dg/test_dse_step.adb
new file mode 100644 (file)
index 0000000..77652b4
--- /dev/null
@@ -0,0 +1,14 @@
+-- { dg-do compile }
+-- { dg-options "-O1 -gnatp -gnatn" }
+
+with Dse_Step; use Dse_Step;
+
+procedure Test_Dse_Step is
+   Start : My_Counter := (Value => 0, Step => 1);
+   Steps : Natural := Nsteps;
+begin
+   Step_From (Start);
+   if Mv /= Steps then
+      raise Program_Error;
+   end if;
+end;