From: Eric Botcazou Date: Tue, 7 Oct 2008 17:27:23 +0000 (+0000) Subject: tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Return true for non-addressable... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cf9322ca65565fafdaf789132dd79f509b86ab87;p=gcc.git tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Return true for non-addressable GIMPLE operands. * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p) : Return true for non-addressable GIMPLE operands. From-SVN: r140941 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c00e34a03a6..a2c1ae337b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-10-07 Eric Botcazou + + * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p) : + Return true for non-addressable GIMPLE operands. + 2008-10-07 H.J. Lu PR target/24765 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3e13806fd16..4ad05b06a82 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-10-07 Eric Botcazou + + * gnat.dg/loop_optimization4.adb: New test. + * gnat.dg/loop_optimization4_pkg.ad[sb]: New helper. + 2008-10-07 Bob Wilson * 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 index 00000000000..a6799f393e7 --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization4.adb @@ -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 index 00000000000..ba372f6bddd --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization4_pkg.adb @@ -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 index 00000000000..a07c4e568c6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization4_pkg.ads @@ -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; diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 4639588a162..c924a7631db 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -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 ... */