aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadbackward.c
AgeCommit message (Collapse)AuthorFilesLines
2016-09-18passes.def (pass_early_thread_jumps): Schedule after forwprop.Jan Hubicka1-17/+83
* passes.def (pass_early_thread_jumps): Schedule after forwprop. * tree-pass.h (make_pass_early_thread_jumps): Declare. * tree-ssa-threadbackward.c (fsm_find_thread_path, fsm_find_thread_path, profitable_jump_thread_path, fsm_find_control_statement_thread_paths, find_jump_threads_backwards): Add speed_p parameter. (pass_data_early_thread_jumps): New pass. (make_pass_early_thread_jumps): New function. * g++.dg/predict-loop-exit-1.C: Disable early jump threading. * g++.dg/predict-loop-exit-2.C: Disable early jump threading. * g++.dg/predict-loop-exit-3.C: Disable early jump threading. * gcc.dg/tree-ssa/pr69196-1.c: Disable early jump threading. * gcc.dg/tree-ssa/vrp01.c: Disable early jump threading. * gcc.dg/tree-ssa/ssa-dom-thread-2b.c: Disable early jump threading. * gcc.dg/tree-ssa/pr68198.c: Scan ethread dump. * gcc.dg/tree-ssa/ssa-thread-13.c: Scan ethread dump. * gcc.dg/tree-ssa/vrp56.c: Scan ethread dump. * gcc.dg/tree-ssa/vrp92.c: Scan ethread dump. * gcc.dg/uninit-15.c: Swap xfailed and non-xfailed alternative. From-SVN: r240221
2016-08-11tree-ssa-threadbackward.c (pass_data_thread_jumps): Remove unconditional ↵Richard Biener1-3/+7
TODO_cleanup_cfg. 2016-08-11 Richard Biener <rguenther@suse.de> * tree-ssa-threadbackward.c (pass_data_thread_jumps): Remove unconditional TODO_cleanup_cfg. (pass_thread_jumps::execute): Initialize loops, perform a CFG cleanup only if we threaded a jump. * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust. From-SVN: r239355
2016-08-09tree-ssa-threadbackward.c (profitable_jump_thread_path): Treat same SSA ↵Richard Biener1-2/+3
names related. 2016-08-09 Richard Biener <rguenther@suse.de> * tree-ssa-threadbackward.c (profitable_jump_thread_path): Treat same SSA names related. From-SVN: r239276
2016-08-07tree-ssa-threadbackward.c: Include tree-inline.hJan Hubicka1-13/+23
* tree-ssa-threadbackward.c: Include tree-inline.h (profitable_jump_thread_path): Use estimate_num_insns to estimate size of copied block; for cold paths reduce duplication. (find_jump_threads_backwards): Remove redundant tests. (pass_thread_jumps::gate): Enable for -Os. * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Update testcase. From-SVN: r239219
2016-06-13re PR tree-optimization/71403 (wrong code (segfault) at -O3 on x86_64-linux-gnu)Jeff Law1-7/+19
PR tree-optimization/71403 * tree-ssa-threadbackward.c (convert_and_register_jump_thread_path): No longer accept reference to path. Do not pop items off the path anymore. (fsm_find_control_statement_thread_paths): Do not allow threading to a deeper loop nest. Pop the last item off the path here rather than in convert_and_register_jump_thread_path. PR tree-optimization/71403 * c-c++-common/ubsan/pr71403-1.c: New test. * c-c++-common/ubsan/pr71403-2.c: New test. * c-c++-common/ubsan/pr71403-3.c: New test. From-SVN: r237403
2016-06-10re PR tree-optimization/71335 (wrong code at -O2 and -O3 in 32-bit and ↵Jeff Law1-22/+22
64-bit modes on x86_64-linux-gnu) PR tree-optimization/71335 * tree-ssa-threadbackward.c (profitable_jump_thread_path): Filter out zero length paths here. (convert_and_register_jump_thread_path): Remove hacks related to duplicated blocks in the jump thread path. (fsm_find_control_statement_thread_paths): Avoid putting the same block on the thread path twice, but ensure the thread path is unchanged from the caller's point of view. PR tree-optimization/71335 * gcc.c-torture/execute/pr71335.c: New test. From-SVN: r237312
2016-05-27tree-ssa-threadedge.c: Remove include of tree-ssa-threadbackward.h.Jeff Law1-6/+63
* tree-ssa-threadedge.c: Remove include of tree-ssa-threadbackward.h. (thread_across_edge): Remove calls to find_jump_threads_backwards. * passes.def: Add jump threading passes before DOM/VRP. * tree-ssa-threadbackward.c (find_jump_threads_backwards): Change argument to a basic block from an edge. Remove tests which are handled elsewhere. (pass_data_thread_jumps, class pass_thread_jumps): New. (pass_thread_jumps::gate, pass_thread_jumps::execute): New. (make_pass_thread_jumps): Likewise. * tree-pass.h (make_pass_thread_jumps): Declare. * gcc.dg/tree-ssa/pr21417.c: Update expected output. * gcc.dg/tree-ssa/pr66752-3.c: Likewise. * gcc.dg/tree-ssa/pr68198.c: Likewise. * gcc.dg/tree-ssa/pr69196-1.c: Likewise. * gcc.dg/tree-ssa/pr69270-3.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-2b.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-2g.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-2h.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-6.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-12.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-13.c: Likewise. * gcc.dg/tree-ssa/vrp56.c: Likewise. From-SVN: r236831
2016-05-25re PR tree-optimization/71272 (internal compiler error: in operator[], ↵Jeff Law1-0/+20
through tree-ssa-threadupdate.c:1981) PR tree-optimization/71272 * tree-ssa-threadbackward.c (convert_and_register_jump_thread_path): Update comments. Add test for empty path. PR tree-optimization/71272 * gcc.c-torture/compile/pr71272.c: new test. From-SVN: r236755
2016-05-24tree-ssa-threadbackwards.c (convert_and_register_jump_thread_path): New ↵Jeff Law1-33/+68
function, extracted from... * tree-ssa-threadbackwards.c (convert_and_register_jump_thread_path): New function, extracted from... (fsm_find_control_statement_thread_paths): Here. Use the new function. Allow simple copies and constant initializations in the SSA chain. From-SVN: r236653
2016-05-23tree-ssa-threadbackward.c (profitable_jump_thread_path): New function ↵Jeff Law1-262/+288
extracted from ... * tree-ssa-threadbackward.c (profitable_jump_thread_path): New function extracted from ... (fsm_find_control_statement_thread_paths): Call it. From-SVN: r236599
2016-03-22re PR target/70232 (excessive stack usage with -O2)Jeff Law1-1/+1
PR target/70232 tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Correctly distinguish between old style jump threads vs FSM jump threads. PR target/70232 * gcc.dg/tree-ssa/pr70232.c: New test. From-SVN: r234409
2016-03-11re PR tree-optimization/70190 (ICE (segfault) at -O2 and -O3 on ↵Jeff Law1-0/+10
x86_64-linux-gnu) PR tree-optimization/70190 * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Handle cases where we can not extract the taken edge, even though we found a constant value. PR tree-optimization/70190 * gcc.c-torture/compile/pr70190.c: New test. From-SVN: r234151
2016-03-04re PR tree-optimization/69196 (code size regression with jump threading at -O2)Jeff Law1-1/+5
PR tree-optimization/69196 * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): If the both SSA_NAMEs are anonymous, then consider them unassociated and include the PHI in the statement count. From-SVN: r233999
2016-03-01re PR tree-optimization/69196 (code size regression with jump threading at -O2)Jeff Law1-0/+20
PR tree-optimization/69196 * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Appropriately clamp the number of statements to copy when the thread path does not traverse a loop backedge. PR tree-optimization/69196 * gcc.dg/tree-ssa/pr69196.c: New test. From-SVN: r233870
2016-03-01re PR tree-optimization/69196 (code size regression with jump threading at -O2)Jeff Law1-18/+36
PR tree-optimization/69196 * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Do count some PHIs in the thread path against the insn count. Decrease final statement count by one as the control statement in the last block will get removed. Remove special cased code for handling PHIs in the last block. PR tree-optimization/69196 * gcc.dg/tree-ssa/vrp46.c: Twiddle threading params to keep it from duplicating code and spoiling the expected output. From-SVN: r233866
2016-02-01re PR testsuite/68580 (FAIL: c-c++-common/tsan/pr65400-1.c -O0 execution test)Jeff Law1-214/+222
PR tree-optimization/68580 * params.def (FSM_MAXIMUM_PHI_ARGUMENTS): New param. * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Do not try to walk through large PHI nodes. From-SVN: r233053
2016-01-27re PR tree-optimization/68398 (coremark regression due to r229685)Jeff Law1-21/+33
PR tree-optimization/68398 * params.def (PARAM_FSM_SCALE_PATH_STMTS): New parameter. (PARAM_FSM_SCALE_PATH_BLOCKS): Likewise. * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Only count PHIs in the last block in the path. The others will const/copy propagate away. Add heuristic to allow more irreducible subloops to be created when it is likely profitable to do so. * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Fix typo in comment. Use gsi_after_labels and remove the GIMPLE_LABEL check from within the loop. Use gsi_next_nondebug rather than gsi_next. PR tree-optimization/68398 * gcc.dg/tree-ssa/pr66752-3.c: Update expected output. * gcc.dg/tree-ssa/ssa-dom-thread-2c.c: Add extra statements on thread path to avoid new heuristic allowing more irreducible regions * gcc.dg/tree-ssa/ssa-dom-thread-2d.c: Likewise. * gcc.dg/tree-ssa/vrp46.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Update expected output. * gcc.dg/tree-ssa/ssa-dom-thread-2g.c: New test. * gcc.dg/tree-ssa/ssa-dom-thread-2h.c: Likewise. From-SVN: r232897
2016-01-25re PR tree-optimization/69196 (code size regression with jump threading at -O2)Jeff Law1-29/+124
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
2016-01-21[PATCH] [PR tree-optimization/69347] Fix memory consumption in threader & ↵Jeff Law1-2/+2
minor speed improvement PR middle-end/69347 * tree-ssa-dom.c (dom_opt_dom_walker::thread_across_edge): Avoid useless call to record_temporary_equivalences. * tree-ssa-threadbackward.c (find_jump_threads_backwards): Just allocate 10 slots in the bb_path vector and let it grow as needed. (fsm_find_control_statement_thread_paths): Similarly for the next_path vector. From-SVN: r232711
2016-01-19re PR tree-optimization/69347 (excessive compile time with -O2)Jeff Law1-0/+5
PR middle-end/69347 * tree-ssa-threadbackwards.c (fsm_find_control_statement_thread_paths): Do not try to lookup FSM paths for SSA_NAMEs appearing in abnormal PHIs. From-SVN: r232593
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-10-29[PATCH][PR tree-optimization/67892] Use FSM threader to handle backedgesJeff Law1-7/+38
PR tree-optimization/67892 * tree-ssa-threadedge.c (simplify_controL_stmt_condition): Fix typo in comment. (thread_through_normal_block): If we have seen a backedge, then do nothing. No longer call find_jump_threads_backwards here. (thread_across_edge): Use find_jump_threads_backwards to find jump threads if the old style threader was not successful. * tree-ssa-threadbackward.c (get_gimple_control_stmt): Use gsi_last_nondebug_bb. Return NULL if the block does not end with a control statement. (find_jump_threads_backwards): Setup code moved here from tree-ssa-threadedge.c::thread_through_normal_block. Accept single edge argument instead of name & block. * tree-ssa-threadbackward.h (find_jump_threads_backwards): Update prototype. PR tree-optimization/67892 * gcc.dg/tree-ssa/pr21417: Update expected output. * gcc.dg/tree-ssa/ssa-dom-thread-2b.c: Likewise. From-SVN: r229538
2015-10-26[PATCH] [PR tree-optimization/68013] Make sure first block in FSM pathJeff Law1-0/+5
is in VISITED_BBs PR tree-optimization/68013 * tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Make sure the first block in the path is in VISITED_BBs. PR tree-optimization/68013 * gcc.c-torture/compile/pr68013.c: New test. From-SVN: r229375
2015-10-13[PATCH] Allow FSM to thread single block cases tooJeff Law1-4/+0
* tree-ssa-threadbackward.c (fsm_find_control_statement_thread_paths): Allow single block jump threading paths. * gcc.dg/tree-ssa/ssa-thread-13.c: New test. From-SVN: r228757
2015-10-12[PATCH] Allow FSM threader to thread more complex conditionsJeff Law1-3/+33
* tree-ssa-threadbackward.c (get_gimple_control_stmt): New function. (fsm_find_control_stmt_paths): Change name of first argument to more accurately relfect what it really is. Handle simplification of GIMPLE_COND after finding a thread path for NAME. * tree-ssa-threadedge.c (simplify_control_stmt_condition): Allow nontrivial conditions to be handled by FSM threader. (thread_through_normal_block): Extract the name to looup via FSM threader from COND_EXPR. * gcc.dg/tree-ssa/ssa-thread-12.c: New test. * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Update expected output. * gcc.dg/tree-ssa/ssa-thread-11.c: Renamed from ssa-dom-thread-11.c. From-SVN: r228739
2015-10-12[PATCH] Improve FSM threader to handle compiler temporaries tooJeff Law1-3/+2
* tree-ssa-threadbackward.c (fsm_find_thread_path): Remove restriction that traced SSA_NAME is a user variable. * gcc.dg/tree-ssa/ssa-dom-thread-11.c: New test. From-SVN: r228727
2015-10-11[PATCH] Refactoring FSM bits into their own fileJeff Law1-0/+325
[PATCH] Refactoring FSM bits into their own file * tree-ssa-threadedge.c (fsm_find_thread_path): Moved from here into tree-ssa-threadbackward.c. (fsm_find_control_statement_thread_paths): Likewise. (thread_through_normal_block): Break out FSM bits and move them into a new function in tree-ssa-threadbackward.c. Call new function instead. Minimize header file usage. * tree-ssa-threadbackward.h: New file. * tree-ssa-threadbackward.c: Likewise. * Makefile.in (OBJS): Add tree-ssa-threadbackward.o From-SVN: r228700