summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-17 08:10:24 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-17 08:10:24 +0000
commit7e0311aec8e6ab97a323f24623f2d0da6bb2d779 (patch)
tree7157094906e2791038cab066565c2c9b9c4e3104 /gcc/testsuite/gcc.dg
parent0561623326dda191b9fc4f21bfb6f4148a5ddde8 (diff)
downloadgcc-7e0311aec8e6ab97a323f24623f2d0da6bb2d779.tar.gz
* tree-vrp.c (finalize_jump_threads): Do not care about dominance info.
(execute_vrp): Preserve loops through jump threading. * tree-ssa-threadupdate.c (thread_single_edge, dbds_continue_enumeration_p, determine_bb_domination_status, thread_through_loop_header): New functions. (create_edge_and_update_destination_phis, create_edge_and_update_destination_phis): Set loops for the new blocks. (prune_undesirable_thread_requests): Removed. (redirect_edges): Do not pretend that redirect_edge_and_branch can create new blocks. (thread_block): Do not call prune_undesirable_thread_requests. Update loops. (mark_threaded_blocks): Select edges to thread here. (thread_through_all_blocks): Take may_peel_loop_headers argument. Thread edges through loop headers independently. * cfgloopmanip.c (create_preheader, mfb_keep_just): Export. * tree-pass.h (TODO_mark_first_instance): New. (first_pass_instance): Declare. * cfghooks.c (duplicate_block): Put the block to the original loop if copy is not specified. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Preserve loops through jump threading. Pass may_peel_loop_headers to thread_through_all_blocks according to first_pass_instance. * cfgloop.h (create_preheader): Declare. * tree-flow.h (thread_through_all_blocks): Declaration changed. * basic-block.h (mfb_keep_just, mfb_kj_edge): Declare. * passes.c (first_pass_instance): New variable. (next_pass_1): Set TODO_mark_first_instance. (execute_todo): Set first_pass_instance. * gcc.dg/tree-ssa/ssa-dom-thread-2.c: New test. * gcc.dg/vect/vect-102.c, gcc.dg/vect/vect-103.c, gcc.dg/vect/vect-104.c: Use more complex construction to prevent vectorizing. * gcc.dg/tree-ssa/pr21559.c: Update outcome. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124786 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21559.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2.c119
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-102.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-103.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-104.c4
5 files changed, 131 insertions, 8 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
index 6ffcfa1973a..402c102d259 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
@@ -35,11 +35,9 @@ void foo (void)
/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */
/* Second, we should thread the edge out of the loop via the break
- statement. */
-/* { dg-final { scan-tree-dump-times "Threaded jump" 1 "vrp1" } } */
-
-/* Now if we were really good, we'd realize that the final bytes == 0
- test is totally useless. That's not likely to happen anytime soon. */
+ statement. We also realize that the final bytes == 0 test is useless,
+ and thread over it. */
+/* { dg-final { scan-tree-dump-times "Threaded jump" 2 "vrp1" } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2.c
new file mode 100644
index 00000000000..6aaea8ecb38
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2.c
@@ -0,0 +1,119 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1-stats -fdump-tree-dom1-stats" } */
+
+void foo();
+void bla();
+void bar();
+
+/* In the following two cases, we should be able to thread edge through
+ the loop header. */
+
+void thread_entry_through_header (void)
+{
+ int i;
+
+ for (i = 0; i < 170; i++)
+ bla ();
+}
+
+void thread_latch_through_header (void)
+{
+ int i = 0;
+ int first = 1;
+
+ do
+ {
+ if (first)
+ foo ();
+
+ first = 0;
+ bla ();
+ } while (i++ < 100);
+}
+
+/* This is a TODO -- it is correct to thread both entry and latch edge through
+ the header, but we do not handle this case yet. */
+
+void dont_thread_1 (void)
+{
+ int i = 0;
+ int first = 1;
+
+ do
+ {
+ if (first)
+ foo ();
+ else
+ bar ();
+
+ first = 0;
+ bla ();
+ } while (i++ < 100);
+}
+
+/* Avoid threading in the following two cases, to prevent creating subloops. */
+
+void dont_thread_2 (int first)
+{
+ int i = 0;
+
+ do
+ {
+ if (first)
+ foo ();
+ else
+ bar ();
+
+ first = 0;
+ bla ();
+ } while (i++ < 100);
+}
+
+void dont_thread_3 (int nfirst)
+{
+ int i = 0;
+ int first = 0;
+
+ do
+ {
+ if (first)
+ foo ();
+ else
+ bar ();
+
+ first = nfirst;
+ bla ();
+ } while (i++ < 100);
+}
+
+/* Avoid threading in this case, in order to avoid creating loop with
+ multiple entries. */
+
+void dont_thread_4 (int a, int nfirst)
+{
+ int i = 0;
+ int first;
+
+ if (a)
+ first = 0;
+ else
+ first = 1;
+
+ do
+ {
+ if (first)
+ foo ();
+ else
+ bar ();
+
+ first = nfirst;
+ bla ();
+ } while (i++ < 100);
+}
+
+/* { dg-final { scan-tree-dump-times "Jumps threaded: 1" 1 "vrp1"} } */
+/* { dg-final { scan-tree-dump-times "Jumps threaded: 2" 0 "vrp1"} } */
+/* { dg-final { scan-tree-dump-times "Jumps threaded: 1" 0 "dom1"} } */
+/* { dg-final { scan-tree-dump-times "Jumps threaded: 2" 1 "dom1"} } */
+/* { dg-final { cleanup-tree-dump "dom1" } } */
+/* { dg-final { cleanup-tree-dump "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-102.c b/gcc/testsuite/gcc.dg/vect/vect-102.c
index af3261d01f8..49df4f9bc90 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-102.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-102.c
@@ -14,6 +14,7 @@ struct extraction
static int a[N] = {1,2,3,4,5,6,7,8,9};
static int b[N] = {2,3,4,5,6,7,8,9,9};
+volatile int foo;
int main1 (int x, int y) {
int i;
@@ -23,7 +24,7 @@ int main1 (int x, int y) {
for (i = 0; i < N; i++)
{
p->a[i] = a[i];
- if (x == 135)
+ if (foo == 135)
abort (); /* to avoid vectorization */
}
@@ -46,6 +47,7 @@ int main (void)
{
check_vect ();
+ foo = 0;
return main1 (0, N);
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-103.c b/gcc/testsuite/gcc.dg/vect/vect-103.c
index effa97e15ed..da1b69e5626 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-103.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-103.c
@@ -15,6 +15,7 @@ struct extraction
static int a[N] = {1,2,3,4,5,6,7,8,9};
static int b[N] = {17,24,7,0,2,3,4,31,82};
static int c[N] = {9,17,24,7,0,2,3,4,31};
+volatile int foo;
int main1 (int x, int y) {
int i;
@@ -25,7 +26,7 @@ int main1 (int x, int y) {
{
p->a[i] = a[i];
p->b[i] = b[i];
- if (x == 135)
+ if (foo == 135)
abort (); /* to avoid vectorization */
}
@@ -48,6 +49,7 @@ int main (void)
{
check_vect ();
+ foo = 0;
return main1 (0, N);
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-104.c b/gcc/testsuite/gcc.dg/vect/vect-104.c
index 6d16da6b32e..6ab0f23acf8 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-104.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-104.c
@@ -15,6 +15,7 @@ struct extraction
static int a[N][N] = {{1,2,3},{4,5,6},{7,8,9}};
static int b[N][N] = {{17,24,7},{0,2,3},{4,31,82}};
static int c[N][N] = {{1,2,3},{4,6,8},{8,9,9}};
+volatile int foo;
int main1 (int x) {
int i,j;
@@ -27,7 +28,7 @@ int main1 (int x) {
{
p->a[i][j] = a[i][j];
p->b[i][j] = b[i][j];
- if (x == 135)
+ if (foo == 135)
abort (); /* to avoid vectorization */
}
}
@@ -57,6 +58,7 @@ int main (void)
{
check_vect ();
+ foo = 0;
return main1 (N);
}