aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadbackward.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2015-10-26 09:36:04 -0600
committerJeff Law <law@gcc.gnu.org>2015-10-26 09:36:04 -0600
commitc67e5194634c5c3dfd16580e862fb9d4a4552bc9 (patch)
treea68e04085366e1abc4cc40f951f5ad25faa89a6e /gcc/tree-ssa-threadbackward.c
parent335dde2981e5680619d25bf934527c9549959569 (diff)
downloadgcc-c67e5194634c5c3dfd16580e862fb9d4a4552bc9.zip
gcc-c67e5194634c5c3dfd16580e862fb9d4a4552bc9.tar.gz
gcc-c67e5194634c5c3dfd16580e862fb9d4a4552bc9.tar.bz2
[PATCH] [PR tree-optimization/68013] Make sure first block in FSM path
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
Diffstat (limited to 'gcc/tree-ssa-threadbackward.c')
-rw-r--r--gcc/tree-ssa-threadbackward.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c
index 9128094..cfb4ace 100644
--- a/gcc/tree-ssa-threadbackward.c
+++ b/gcc/tree-ssa-threadbackward.c
@@ -136,6 +136,11 @@ fsm_find_control_statement_thread_paths (tree name,
vec<basic_block, va_gc> *next_path;
vec_alloc (next_path, n_basic_blocks_for_fn (cfun));
+ /* When VAR_BB == LAST_BB_IN_PATH, then the first block in the path
+ will already be in VISITED_BBS. When they are not equal, then we
+ must ensure that first block is accounted for to ensure we do not
+ create bogus jump threading paths. */
+ visited_bbs->add ((*path)[0]);
FOR_EACH_EDGE (e, ei, last_bb_in_path->preds)
{
hash_set<basic_block> *visited_bbs = new hash_set<basic_block>;