From: Zdenek Dvorak Date: Tue, 14 Sep 2004 07:49:04 +0000 (+0200) Subject: tree-cfg.c (thread_jumps): Update dominators correctly in case destination of threade... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d840495b15862ef5d62af317e76be37d71948540;p=gcc.git tree-cfg.c (thread_jumps): Update dominators correctly in case destination of threaded edge dominates its... * tree-cfg.c (thread_jumps): Update dominators correctly in case destination of threaded edge dominates its source. From-SVN: r87486 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a6de7461d90..b666c83777d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-09-14 Zdenek Dvorak + + * tree-cfg.c (thread_jumps): Update dominators correctly in + case destination of threaded edge dominates its source. + 2004-09-14 Zdenek Dvorak * unroll.c: Removed. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e59e16fbcb..02953de7b63 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-09-14 Zdenek Dvorak + + * gcc.c-torture/compile/20040914-1.c: New test. + 2004-09-13 Mark Mitchell PR c++/16162 diff --git a/gcc/testsuite/gcc.c-torture/compile/20040914-1.c b/gcc/testsuite/gcc.c-torture/compile/20040914-1.c new file mode 100644 index 00000000000..824664c889b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040914-1.c @@ -0,0 +1,39 @@ +extern int clobber_k (int *); +extern int barrier (void); +int t, u; + +int +process_second_stream(void) +{ + int k; + int i = 0, j = 0, result; + + clobber_k (&k); + + while(t) + ; + + while(!j) + { + while(!j) + { + barrier (); + if (t == 0) + break; + else if(t == 1) + t = 2; + else + { + if(t < 0) + j=1; + if(u < 0) + k = i++; + } + } + + if(!j && u) + j=1; + } + + return 0; +} diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 8e9e5af64ac..6f21467ca10 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3970,9 +3970,11 @@ thread_jumps (void) set_immediate_dominator (CDI_DOMINATORS, old_dest, bb); /* Now proceed like if we forwarded just over one edge at a time. - Algorithm for forwarding over edge A --> B then is + Algorithm for forwarding edge S --> A over edge A --> B then + is - if (idom (B) == A) + if (idom (B) == A + && !dominated_by (S, B)) idom (B) = idom (A); recount_idom (A); */ @@ -3980,7 +3982,8 @@ thread_jumps (void) { tmp = old_dest->succ->dest; - if (get_immediate_dominator (CDI_DOMINATORS, tmp) == old_dest) + if (get_immediate_dominator (CDI_DOMINATORS, tmp) == old_dest + && !dominated_by_p (CDI_DOMINATORS, bb, tmp)) { dom = get_immediate_dominator (CDI_DOMINATORS, old_dest); set_immediate_dominator (CDI_DOMINATORS, tmp, dom);