tree-cfg.c (thread_jumps): Update dominators correctly in case destination of threade...
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
Tue, 14 Sep 2004 07:49:04 +0000 (09:49 +0200)
committerZdenek Dvorak <rakdver@gcc.gnu.org>
Tue, 14 Sep 2004 07:49:04 +0000 (07:49 +0000)
* tree-cfg.c (thread_jumps): Update dominators correctly in
case destination of threaded edge dominates its source.

From-SVN: r87486

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20040914-1.c [new file with mode: 0644]
gcc/tree-cfg.c

index a6de7461d90c4831afaf0dd4a9bf403f4aa4e439..b666c83777dcbae22b28b07bdca081cecee2e104 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-14  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
+
+       * tree-cfg.c (thread_jumps): Update dominators correctly in
+       case destination of threaded edge dominates its source.
+
 2004-09-14  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
 
        * unroll.c: Removed.
index 4e59e16fbcb85b1916a481a9fda334ff15fd0928..02953de7b63dd4b4937cd5fa77ae3db9248551b7 100644 (file)
@@ -1,3 +1,7 @@
+2004-09-14  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
+
+       * gcc.c-torture/compile/20040914-1.c: New test.
+
 2004-09-13  Mark Mitchell  <mark@codesourcery.com>
 
        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 (file)
index 0000000..824664c
--- /dev/null
@@ -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; 
+} 
index 8e9e5af64ac4777935ce28db6464e483120a1530..6f21467ca10f37c640fe2a51aabea9693d01ca4c 100644 (file)
@@ -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);