diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 713baf4fddc6..3b4c2b97487b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-02-26 Bin Cheng + + 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 * builtins.c (expand_builtin_thread_pointer): Create a new target diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e245784652f3..830d722d1540 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2014-02-26 Bin Cheng + + 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 * gcc.dg/vmx/ld-vsx.c: Don't use vec_all_eq. diff --git a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c index cc06ea7396bd..5297098fc914 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c +++ b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ivopt_1.c b/gcc/testsuite/gcc.dg/tree-ssa/ivopt_1.c index 60baa4bd336b..74b73da68757 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ivopt_1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ivopt_1.c @@ -14,5 +14,5 @@ void foo (int i_width, TYPE dst, TYPE src1, TYPE src2) } -/* { dg-final { scan-tree-dump-times "PHI 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); diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 98cf60888ab5..91253dc05921 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -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 ();