aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc
diff options
context:
space:
mode:
authorSebastian Pop <s.pop@samsung.com>2015-08-28 20:51:12 (GMT)
committerSebastian Pop <s.pop@samsung.com>2015-08-28 21:47:05 (GMT)
commit65f8bbbcc74a4777f0629190ea9121fc94a79257 (patch)
tree4fff0a4fcd02fcdc01c0fbc0b0435b4be334a002 /gcc-4.9/gcc
parentaa65e2d1e40e4dd0d936a275683c4aadfe8aa20f (diff)
downloadtoolchain_gcc-65f8bbbcc74a4777f0629190ea9121fc94a79257.zip
toolchain_gcc-65f8bbbcc74a4777f0629190ea9121fc94a79257.tar.gz
toolchain_gcc-65f8bbbcc74a4777f0629190ea9121fc94a79257.tar.bz2
backport fix for PR65735
PR tree-optimization/65735 * tree-ssa-threadedge.c (fsm_find_control_statement_thread_paths): Remove visited_phis argument, add visited_bbs, avoid recursing into the same bb rather than just into the same phi node. (thread_through_normal_block): Adjust caller. * gcc.c-torture/compile/pr65735.c: New test.
Diffstat (limited to 'gcc-4.9/gcc')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr65735.c21
-rw-r--r--gcc-4.9/gcc/tree-ssa-threadedge.c12
2 files changed, 27 insertions, 6 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr65735.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr65735.c
new file mode 100644
index 0000000..c30de8e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr65735.c
@@ -0,0 +1,21 @@
+/* PR tree-optimization/65735 */
+
+int foo (void);
+
+void
+bar (int a, int b, int c)
+{
+ while (!a)
+ {
+ c = foo ();
+ if (c == 7)
+ c = b;
+ switch (c)
+ {
+ case 1:
+ a = b++;
+ if (b)
+ b = 1;
+ }
+ }
+}
diff --git a/gcc-4.9/gcc/tree-ssa-threadedge.c b/gcc-4.9/gcc/tree-ssa-threadedge.c
index cad91ef..604123e 100644
--- a/gcc-4.9/gcc/tree-ssa-threadedge.c
+++ b/gcc-4.9/gcc/tree-ssa-threadedge.c
@@ -947,7 +947,7 @@ static int max_threaded_paths;
static void
fsm_find_control_statement_thread_paths (tree expr,
- pointer_set_t *visited_phis,
+ pointer_set_t *visited_bbs,
vec<basic_block, va_gc> *&path,
bool seen_loop_phi)
{
@@ -966,7 +966,7 @@ fsm_find_control_statement_thread_paths (tree expr,
return;
/* Avoid infinite recursion. */
- if (pointer_set_insert (visited_phis, def_stmt))
+ if (pointer_set_insert (visited_bbs, var_bb))
return;
int next_path_length = 0;
@@ -1040,7 +1040,7 @@ fsm_find_control_statement_thread_paths (tree expr,
{
vec_safe_push (path, bbi);
/* Recursively follow SSA_NAMEs looking for a constant definition. */
- fsm_find_control_statement_thread_paths (arg, visited_phis, path,
+ fsm_find_control_statement_thread_paths (arg, visited_bbs, path,
seen_loop_phi);
path->pop ();
@@ -1306,13 +1306,13 @@ thread_through_normal_block (edge e,
vec<basic_block, va_gc> *bb_path;
vec_alloc (bb_path, n_basic_blocks_for_fn (cfun));
vec_safe_push (bb_path, e->dest);
- pointer_set_t *visited_phis = pointer_set_create ();
+ pointer_set_t *visited_bbs = pointer_set_create ();
max_threaded_paths = PARAM_VALUE (PARAM_MAX_FSM_THREAD_PATHS);
- fsm_find_control_statement_thread_paths (cond, visited_phis, bb_path,
+ fsm_find_control_statement_thread_paths (cond, visited_bbs, bb_path,
false);
- pointer_set_destroy (visited_phis);
+ pointer_set_destroy (visited_bbs);
vec_free (bb_path);
}
return 0;