aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@redhat.com>2005-02-23 05:08:32 +0000
committerDiego Novillo <dnovillo@gcc.gnu.org>2005-02-23 00:08:32 -0500
commit90c1d75a9bb8e25aa963da02f9c91f5f40143be1 (patch)
tree5ae2c9a5dd60102e5ee665ad3f8aaaba2450f32e /gcc/testsuite
parent397763d2af80316f05484a8668c3d0dddf2c9811 (diff)
downloadgcc-90c1d75a9bb8e25aa963da02f9c91f5f40143be1.zip
gcc-90c1d75a9bb8e25aa963da02f9c91f5f40143be1.tar.gz
gcc-90c1d75a9bb8e25aa963da02f9c91f5f40143be1.tar.bz2
re PR tree-optimization/20100 (LIM is pulling out a pure function even though there is something which can modify global memory)
PR tree-optimization/20100 PR tree-optimization/20115 * tree-optimize.c (init_tree_optimization_passes): Remove pass_maybe_create_global_var. * tree-pass.h (pass_maybe_create_global_var): Remove. * tree-ssa-alias.c (aliases_computed_p): Declare. (struct alias_info): Add field NUM_PURE_CONST_CALLS_FOUND. (count_calls_and_maybe_create_global_var): Remove. (pass_maybe_create_global_var): Remove. (init_alias_info): Do not declare aliases_computed_p. (maybe_create_global_var): If the function contains no call-clobbered variables and a mix of pure/const and regular function calls, create .GLOBAL_VAR. Mark all call-clobbered variables for renaming. (merge_pointed_to_info): Update comment. (add_pointed_to_var): Likewise. (is_escape_site): Likewise. Accept struct alias_info * instead of size_t *. Update all users. Update AI->NUM_CALLS_FOUND and AI->NUM_PURE_CONST_CALLS_FOUND as necessary. * tree-ssa-operands.c (get_call_expr_operands): If ALIASES_COMPUTED_P is false, do not add call-clobbering operands. * tree-ssa.c (init_tree_ssa): Set ALIASES_COMPUTED_P to false. (delete_tree_ssa): Likewise. testsuite/ChangeLog PR tree-optimization/20100 PR tree-optimization/20115 * gcc.dg/pr20115.c: New test. * gcc.dg/pr20115-1.c: New test. * gcc.dg/pr20100.c: New test. * gcc.dg/tree-ssa/20040517-1.c: Expect virtual operands for call-clobbered variables after alias1. From-SVN: r95437
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/gcc.dg/pr20100.c32
-rw-r--r--gcc/testsuite/gcc.dg/pr20115-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr20115.c28
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c5
5 files changed, 86 insertions, 3 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ddaa9cc..530d9a3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2005-02-22 Diego Novillo <dnovillo@redhat.com>
+
+ PR tree-optimization/20100
+ PR tree-optimization/20115
+ * gcc.dg/pr20115.c: New test.
+ * gcc.dg/pr20115-1.c: New test.
+ * gcc.dg/pr20100.c: New test.
+ * gcc.dg/tree-ssa/20040517-1.c: Expect virtual operands for
+ call-clobbered variables after alias1.
+
2005-02-22 Bud Davis <bdavis@gfortran.org>
* gfortran.dg/list_read_4.f90: new test.
diff --git a/gcc/testsuite/gcc.dg/pr20100.c b/gcc/testsuite/gcc.dg/pr20100.c
new file mode 100644
index 0000000..988fbda
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr20100.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+int func_pure (void) __attribute__ ((pure));
+void func_other (int);
+int global_int;
+void abort ();
+void func_other(int a)
+{
+ if (a != global_int)
+ abort ();
+ global_int++;
+}
+
+int func_pure(void)
+{
+ return global_int;
+}
+
+int
+func_loop (int arg)
+{
+ // global_int ++;
+ while (arg--)
+ func_other (func_pure ());
+}
+
+int main(void)
+{
+ func_loop(10);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr20115-1.c b/gcc/testsuite/gcc.dg/pr20115-1.c
new file mode 100644
index 0000000..d1c4066
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr20115-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-dom1" } */
+
+extern int foo (void) __attribute__((pure));
+
+int bar()
+{
+ int a = foo ();
+ a += foo ();
+ return a;
+}
+
+/* Check that we only have one call to foo. */
+/* { dg-final { scan-tree-dump-times "foo" 1 "dom1" } } */
diff --git a/gcc/testsuite/gcc.dg/pr20115.c b/gcc/testsuite/gcc.dg/pr20115.c
new file mode 100644
index 0000000..cea4b48
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr20115.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+int func_pure (void);
+void func_other (int);
+int global_int;
+int func_pure (void) { return global_int; }
+void func_other (int a)
+{
+ global_int = a + 1;
+}
+int f(void)
+{
+ int a;
+ a = func_pure();
+ func_other (a);
+ a = func_pure (); // We were removing this function call
+ return a;
+}
+void abort (void);
+
+int main(void)
+{
+ global_int = 10;
+ if (f() != 11)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c
index 5f99be2..4b09b53 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-ssa-vops" } */
+/* { dg-options "-O1 -fdump-tree-alias1-vops" } */
extern void abort (void);
int a;
@@ -17,5 +17,4 @@ void bar (void)
malloc functions may clobber global memory. Only the function result
does not alias any other pointer.
Hence, we must have a VDEF for a before and after the call to foo(). */
-/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "ssa"} } */
-
+/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "alias1"} } */