]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/60280 (gcc.target/arm/ivopts.c and gcc.target/arm/ivopts...
authorBin Cheng <bin.cheng@arm.com>
Wed, 26 Feb 2014 01:49:35 +0000 (01:49 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Wed, 26 Feb 2014 01:49:35 +0000 (01:49 +0000)
PR target/60280
* tree-cfgcleanup.c (tree_forwarder_block_p): Protect loop
preheaders and latches only if requested.  Fix latch if it
is removed.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Set
LOOPS_HAVE_PREHEADERS.

PR target/60280
* gnat.dg/renaming5.adb: Change to two expected gotos.
* gcc.dg/tree-ssa/pr21559.c: Change back to three expected
jump threads.
* gcc.dg/tree-prof/update-loopch.c: Check two "Invalid sum"
messages for removed basic block.
* gcc.dg/tree-ssa/ivopt_1.c: Fix unreliable scanning string.
* gcc.dg/tree-ssa/ivopt_2.c: Ditto.
* gcc.dg/tree-ssa/ivopt_3.c: Ditto.
* gcc.dg/tree-ssa/ivopt_4.c: Ditto.

From-SVN: r208165

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-prof/update-loopch.c
gcc/testsuite/gcc.dg/tree-ssa/ivopt_1.c
gcc/testsuite/gcc.dg/tree-ssa/ivopt_2.c
gcc/testsuite/gcc.dg/tree-ssa/ivopt_3.c
gcc/testsuite/gcc.dg/tree-ssa/ivopt_4.c
gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
gcc/testsuite/gnat.dg/renaming5.adb
gcc/tree-cfgcleanup.c
gcc/tree-ssa-dom.c

index 713baf4fddc6e0dea6b01280ef6cc8076eba0b46..3b4c2b97487b87da946e156243c08cc0a386edd0 100644 (file)
@@ -1,3 +1,12 @@
+2014-02-26  Bin Cheng  <bin.cheng@arm.com>
+
+       PR target/60280
+       * tree-cfgcleanup.c (tree_forwarder_block_p): Protect loop
+       preheaders and latches only if requested.  Fix latch if it
+       is removed.
+       * tree-ssa-dom.c (tree_ssa_dominator_optimize): Set
+       LOOPS_HAVE_PREHEADERS.
+
 2014-02-25  Andrew Pinski  <apinski@cavium.com>
 
        * builtins.c (expand_builtin_thread_pointer): Create a new target
index e245784652f33a183d2da56060f48deaedb5c8f8..830d722d1540d76639505953ba6cae26da776a13 100644 (file)
@@ -1,3 +1,16 @@
+2014-02-26  Bin Cheng  <bin.cheng@arm.com>
+
+       PR target/60280
+       * gnat.dg/renaming5.adb: Change to two expected gotos.
+       * gcc.dg/tree-ssa/pr21559.c: Change back to three expected
+       jump threads.
+       * gcc.dg/tree-prof/update-loopch.c: Check two "Invalid sum"
+       messages for removed basic block.
+       * gcc.dg/tree-ssa/ivopt_1.c: Fix unreliable scanning string.
+       * gcc.dg/tree-ssa/ivopt_2.c: Ditto.
+       * gcc.dg/tree-ssa/ivopt_3.c: Ditto.
+       * gcc.dg/tree-ssa/ivopt_4.c: Ditto.
+
 2014-02-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * gcc.dg/vmx/ld-vsx.c: Don't use vec_all_eq.
index cc06ea7396bdb57ab8c727c3795853ae1c54ccd7..5297098fc91491b1c87bd1dd476cdea1b80a6e37 100644 (file)
@@ -16,6 +16,7 @@ main ()
    edge.  */
 /* { dg-final-use { scan-ipa-dump "loop depth 1, count 33334" "profile"} } */
 /* { dg-final-use { scan-tree-dump "loop depth 1, count 33332" "optimized"} } */
-/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
+/* { dg-final-use { scan-tree-dump-times "Removing basic block \[^\r\n\]*\[\\r\\n\]+\[^\r\n\]*\[\\r\\n\]+Invalid sum of\[^\r\n\]*\[\\r\\n\]+Invalid sum of" 1 "optimized"} } */
+/* { dg-final-use { scan-tree-dump-times "Invalid sum of" 2 "optimized"} } */
 /* { dg-final-use { cleanup-ipa-dump "profile" } } */
 /* { dg-final-use { cleanup-tree-dump "optimized" } } */
index 60baa4bd336be78171f5dcd7040edf4f821718e8..74b73da687572cb6e7d084be2c4f1e91f475f454 100644 (file)
@@ -14,5 +14,5 @@ void foo (int i_width, TYPE dst, TYPE src1, TYPE src2)
 }
 
 
-/* { dg-final { scan-tree-dump-times "PHI <ivtmp" 1 "ivopts"} } */
+/* { dg-final { scan-tree-dump-times "ivtmp.\[0-9_\]* = PHI <" 1 "ivopts"} } */
 /* { dg-final { cleanup-tree-dump "ivopts" } } */
index ba87b502cd35b1103170f529f1ad128a3e2044c5..f27b900729501bec79430e35c8ce0ff04ebd8984 100644 (file)
@@ -13,5 +13,5 @@ void foo (int i_width, TYPE dst, TYPE src1, TYPE src2)
        }
 }
 
-/* { dg-final { scan-tree-dump-times "PHI <ivtmp" 1 "ivopts"} } */
+/* { dg-final { scan-tree-dump-times "ivtmp.\[0-9_\]* = PHI <" 1 "ivopts"} } */
 /* { dg-final { cleanup-tree-dump "ivopts" } } */
index ae4185a7a71a0967dea41ede8cbe9ef30573a0d6..b548e8f0fb6af2e39271de1892af2e772622f328 100644 (file)
@@ -14,7 +14,7 @@ void foo (int i_width, char* dst, char* src1, char* src2)
           src1+=sizeof(TYPE);
           src2+=sizeof(TYPE);
        }
-} 
+}
 
-/* { dg-final { scan-tree-dump-times "PHI <ivtmp" 1 "ivopts"} } */
+/* { dg-final { scan-tree-dump-times "ivtmp.\[0-9_\]* = PHI <" 1 "ivopts"} } */
 /* { dg-final { cleanup-tree-dump "ivopts" } } */
index 570664c9228978d26223073eeb7ef342b3ff17a9..330b3bf53ed72bcf1be68d7a6bcf82e759299892 100644 (file)
@@ -15,5 +15,5 @@ void foo (int i_width, TYPE dst, TYPE src1, TYPE src2)
        }
 }
 
-/* { dg-final { scan-tree-dump-times "PHI <ivtmp" 1 "ivopts"} } */
+/* { dg-final { scan-tree-dump-times "ivtmp.\[0-9_\]* = PHI <" 1 "ivopts"} } */
 /* { dg-final { cleanup-tree-dump "ivopts" } } */
index 402c102d25922cac99644add8e83b3b357f37403..6378d1aa729c22766b3fd9d0bfe6e7cbafd0bf19 100644 (file)
@@ -36,8 +36,9 @@ void foo (void)
 
 /* Second, we should thread the edge out of the loop via the break
    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" } } */
+   and thread over it.  We also know that toread != 0 is useless when
+   entering while loop and thread over it.  */
+/* { dg-final { scan-tree-dump-times "Threaded jump" 3 "vrp1" } } */
 
 /* { dg-final { cleanup-tree-dump "vrp1" } } */
 
index 28f8c2c7128849f9f555dbf1f15175552b74406d..25374fe895c9313d65cffcc3b6aac2da131575aa 100644 (file)
@@ -26,5 +26,5 @@ package body Renaming5 is
 
 end Renaming5;
 
--- { dg-final { scan-tree-dump-times "goto" 3 "optimized" } }
+-- { dg-final { scan-tree-dump-times "goto" 2 "optimized" } }
 -- { dg-final { cleanup-tree-dump "optimized" } }
index 922ae0d82a6cf60c3ee4e0ace953a19cb67e3052..b5c384b902ca37566dd6c95d3ee69b678fd7995e 100644 (file)
@@ -308,14 +308,24 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted)
   if (current_loops)
     {
       basic_block dest;
-      /* Protect loop latches, headers and preheaders.  */
+      /* Protect loop headers.  */
       if (bb->loop_father->header == bb)
        return false;
-      dest = EDGE_SUCC (bb, 0)->dest;
 
+      dest = EDGE_SUCC (bb, 0)->dest;
+      /* Protect loop preheaders and latches if requested.  */
       if (dest->loop_father->header == dest)
-       return false;
+       {
+         if (loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS)
+             && bb->loop_father->header != dest)
+           return false;
+
+         if (loops_state_satisfies_p (LOOPS_HAVE_SIMPLE_LATCHES)
+             && bb->loop_father->header == dest)
+           return false;
+       }
     }
+
   return true;
 }
 
@@ -497,6 +507,11 @@ remove_forwarder_block (basic_block bb)
       set_immediate_dominator (CDI_DOMINATORS, dest, dom);
     }
 
+  /* Adjust latch infomation of BB's parent loop as otherwise
+     the cfg hook has a hard time not to kill the loop.  */
+  if (current_loops && bb->loop_father->latch == bb)
+    bb->loop_father->latch = dest;
+
   /* And kill the forwarder block.  */
   delete_basic_block (bb);
 
index 98cf60888ab583474aa9e38c0e201f6eafccaf52..91253dc05921334aa3fc0f9f45c25bb4da9be1bc 100644 (file)
@@ -849,8 +849,14 @@ tree_ssa_dominator_optimize (void)
   /* We need to know loop structures in order to avoid destroying them
      in jump threading.  Note that we still can e.g. thread through loop
      headers to an exit edge, or through loop header to the loop body, assuming
-     that we update the loop info.  */
-  loop_optimizer_init (LOOPS_HAVE_SIMPLE_LATCHES);
+     that we update the loop info.
+
+     TODO: We don't need to set LOOPS_HAVE_PREHEADERS generally, but due
+     to several overly conservative bail-outs in jump threading, case
+     gcc.dg/tree-ssa/pr21417.c can't be threaded if loop preheader is
+     missing.  We should improve jump threading in future then
+     LOOPS_HAVE_PREHEADERS won't be needed here.  */
+  loop_optimizer_init (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_SIMPLE_LATCHES);
 
   /* Initialize the value-handle array.  */
   threadedge_initialize_values ();