tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Return true for non-addressable...
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 7 Oct 2008 17:27:23 +0000 (17:27 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 7 Oct 2008 17:27:23 +0000 (17:27 +0000)
* tree-ssa-loop-ivopts.c (may_be_nonaddressable_p) <VIEW_CONVERT_EXPR>:
Return true for non-addressable GIMPLE operands.

From-SVN: r140941

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/loop_optimization4.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/loop_optimization4_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/loop_optimization4_pkg.ads [new file with mode: 0644]
gcc/tree-ssa-loop-ivopts.c

index c00e34a03a65341e778262c854d924bb9f9fed42..a2c1ae337b1ea776a8b024547c1da7c1b5a044c4 100644 (file)
@@ -1,3 +1,8 @@
+2008-10-07  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p) <VIEW_CONVERT_EXPR>:
+       Return true for non-addressable GIMPLE operands.
+
 2008-10-07  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/24765
index 3e13806fd1616468234512e79227f33e2eabec9e..4ad05b06a820ca7b47530bbd30512cc85a42588c 100644 (file)
@@ -1,3 +1,8 @@
+2008-10-07  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/loop_optimization4.adb: New test.
+       * gnat.dg/loop_optimization4_pkg.ad[sb]: New helper.
+
 2008-10-07  Bob Wilson  <bob.wilson@acm.org>
 
        * gcc.dg/compat/struct-layout-1_generate.c (dg_options): New.  Moved
diff --git a/gcc/testsuite/gnat.dg/loop_optimization4.adb b/gcc/testsuite/gnat.dg/loop_optimization4.adb
new file mode 100644 (file)
index 0000000..a6799f3
--- /dev/null
@@ -0,0 +1,9 @@
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with Loop_Optimization4_Pkg; use Loop_Optimization4_Pkg;
+
+procedure Loop_Optimization4 is
+begin
+  Add ("Nothing");
+end;
diff --git a/gcc/testsuite/gnat.dg/loop_optimization4_pkg.adb b/gcc/testsuite/gnat.dg/loop_optimization4_pkg.adb
new file mode 100644 (file)
index 0000000..ba372f6
--- /dev/null
@@ -0,0 +1,17 @@
+package body Loop_Optimization4_Pkg is
+
+   procedure Add (Phrase : String) is
+   begin
+      if Debug_Buffer_Len = Max_Debug_Buffer_Len then
+         return;
+      end if;
+      for I in Phrase'Range loop
+         Debug_Buffer_Len := Debug_Buffer_Len + 1;
+         Debug_Buffer (Debug_Buffer_Len) := Phrase (I);
+         if Debug_Buffer_Len = Max_Debug_Buffer_Len then
+            exit;
+         end if;
+      end loop;
+   end Add;
+
+end Loop_Optimization4_Pkg;
diff --git a/gcc/testsuite/gnat.dg/loop_optimization4_pkg.ads b/gcc/testsuite/gnat.dg/loop_optimization4_pkg.ads
new file mode 100644 (file)
index 0000000..a07c4e5
--- /dev/null
@@ -0,0 +1,9 @@
+package Loop_Optimization4_Pkg is
+
+   Max_Debug_Buffer_Len : Natural := 8 * 1024;
+   Debug_Buffer : String (1 .. Max_Debug_Buffer_Len);
+   Debug_Buffer_Len : Natural range 0 .. Max_Debug_Buffer_Len;
+
+   procedure Add (Phrase : String);
+
+end Loop_Optimization4_Pkg;
index 4639588a162b390aef008f0e90f71192d16f9c63..c924a7631db9a2b325644b11c28c12750a9d0212 100644 (file)
@@ -1558,7 +1558,7 @@ may_be_nonaddressable_p (tree expr)
         non-addressability may be uncovered again, causing ADDR_EXPRs
         of inappropriate objects to be built.  */
       if (is_gimple_reg (TREE_OPERAND (expr, 0))
-         || is_gimple_min_invariant (TREE_OPERAND (expr, 0)))
+         || !is_gimple_addressable (TREE_OPERAND (expr, 0)))
        return true;
 
       /* ... fall through ... */