diff options
author | Jeff Law <law@redhat.com> | 2016-01-25 12:19:09 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2016-01-25 12:19:09 -0700 |
commit | 2c89b952c7f02379c087e67998efc85d69310014 (patch) | |
tree | 39cff29e36960823dc612da3db132b0db43ab126 /gcc/tree-ssa-threadupdate.c | |
parent | 2944621e2c2dd73c3162eb052d9250ea4e15fda6 (diff) | |
download | gcc-2c89b952c7f02379c087e67998efc85d69310014.zip gcc-2c89b952c7f02379c087e67998efc85d69310014.tar.gz gcc-2c89b952c7f02379c087e67998efc85d69310014.tar.bz2 |
re PR tree-optimization/69196 (code size regression with jump threading at -O2)
PR tree-optimization/69196
PR tree-optimization/68398
* tree-ssa-threadupdate.h (enum bb_dom_status): Moved here from
tree-ssa-threadupdate.c.
(determine_bb_domination_status): Prototype
* tree-ssa-threadupdate.c (enum bb_dom_status): Remove
(determine_bb_domination_status): No longer static.
(valid_jump_thread_path): Remove code to detect characteristics
of the jump thread path not associated with correctness.
* tree-ssa-threadbackward.c (fsm_find_control_statment_thread_paths):
Correct test for thread path length. Count PHIs for real operands as
statements that need to be copied. Do not count ASSERT_EXPRs.
Look at all the blocks in the thread path. Compute and selectively
filter thread paths based on threading through the latch, threading
a multiway branch or crossing a multiway branch.
PR tree-optimization/69196
PR tree-optimization/68398
* gcc.dg/tree-ssa/pr66752-3.c: Update expected output
* gcc.dg/tree-ssa/pr68198.c: Likewise.
From-SVN: r232802
Diffstat (limited to 'gcc/tree-ssa-threadupdate.c')
-rw-r--r-- | gcc/tree-ssa-threadupdate.c | 71 |
1 files changed, 1 insertions, 70 deletions
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 4783c4b..620948c 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -1663,16 +1663,6 @@ dbds_continue_enumeration_p (const_basic_block bb, const void *stop) returns the state. */ enum bb_dom_status -{ - /* BB does not dominate latch of the LOOP. */ - DOMST_NONDOMINATING, - /* The LOOP is broken (there is no path from the header to its latch. */ - DOMST_LOOP_BROKEN, - /* BB dominates the latch of the LOOP. */ - DOMST_DOMINATING -}; - -static enum bb_dom_status determine_bb_domination_status (struct loop *loop, basic_block bb) { basic_block *bblocks; @@ -2389,73 +2379,14 @@ static bool valid_jump_thread_path (vec<jump_thread_edge *> *path) { unsigned len = path->length (); - bool threaded_multiway_branch = false; - bool multiway_branch_in_path = false; - bool threaded_through_latch = false; - /* Check that the path is connected and see if there's a multi-way - branch on the path and whether or not a multi-way branch - is threaded. */ + /* Check that the path is connected. */ for (unsigned int j = 0; j < len - 1; j++) { edge e = (*path)[j]->e; - struct loop *loop = e->dest->loop_father; - if (e->dest != (*path)[j+1]->e->src) return false; - - /* If we're threading through the loop latch back into the - same loop and the destination does not dominate the loop - latch, then this thread would create an irreducible loop. */ - if (loop->latch - && loop_latch_edge (loop) == e - && loop == path->last()->e->dest->loop_father - && (determine_bb_domination_status (loop, path->last ()->e->dest) - == DOMST_NONDOMINATING)) - threaded_through_latch = true; - - gimple *last = last_stmt (e->dest); - if (j == len - 2) - threaded_multiway_branch - |= (last && gimple_code (last) == GIMPLE_SWITCH); - else - multiway_branch_in_path - |= (last && gimple_code (last) == GIMPLE_SWITCH); } - - /* If we are trying to thread through the loop latch to a block in the - loop that does not dominate the loop latch, then that will create an - irreducible loop. We avoid that unless the jump thread has a multi-way - branch, in which case we have deemed it worth losing other - loop optimizations later if we can eliminate the multi-way branch. */ - if (!threaded_multiway_branch && threaded_through_latch) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, - "Thread through latch without threading a multiway " - "branch.\n"); - dump_jump_thread_path (dump_file, *path, false); - } - return false; - } - - /* When there is a multi-way branch on the path, then threading can - explode the CFG due to duplicating the edges for that multi-way - branch. So like above, only allow a multi-way branch on the path - if we actually thread a multi-way branch. */ - if (!threaded_multiway_branch && multiway_branch_in_path) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, - "Thread through multiway branch without threading " - "a multiway branch.\n"); - dump_jump_thread_path (dump_file, *path, false); - } - return false; - } - return true; } |