aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadedge.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2015-07-23 14:42:15 -0600
committerJeff Law <law@gcc.gnu.org>2015-07-23 14:42:15 -0600
commitd37f946ace661906c628b482a0f9d5bfb40d3064 (patch)
treef793f0f4fb8a17c983a108854df187470be2fa61 /gcc/tree-ssa-threadedge.c
parent0f2be732d964ef89eb268114e4dd8d00130aa29b (diff)
downloadgcc-d37f946ace661906c628b482a0f9d5bfb40d3064.zip
gcc-d37f946ace661906c628b482a0f9d5bfb40d3064.tar.gz
gcc-d37f946ace661906c628b482a0f9d5bfb40d3064.tar.bz2
re PR lto/66752 (spec2000 255.vortex performance compiled with GCC is ~20% lower than with CLANG)
PR lto/66752 * tree-ssa-threadedge.c (simplify_conrol_stmt_condition): If we are unable to find X NE 0 in the tables, return X as the simplified condition. (fsm_find_control_statement_thread_paths): If nodes in NEXT_PATH are in VISISTED_BBS, then return failure. Else add nodes from NEXT_PATH to VISISTED_BBS. */ * tree-ssa-threadupdate.c (duplicate_thread_path): Fix up edge flags after removing the control flow statement and unnecessary edges. testsuite/ PR lto/66752 * gcc.dg/tree-ssa/pr66752-2.c: New test. * gcc.dg/torture/pr66752-1.c: New test * g++.dg/torture/pr66752-2.C: New test. From-SVN: r226125
Diffstat (limited to 'gcc/tree-ssa-threadedge.c')
-rw-r--r--gcc/tree-ssa-threadedge.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 7164122..5228951 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -553,6 +553,16 @@ simplify_control_stmt_condition (edge e,
|| !is_gimple_min_invariant (cached_lhs))
cached_lhs = (*simplify) (dummy_cond, stmt);
+ /* If we were just testing that an integral type was != 0, and that
+ failed, just return the first operand. This gives the FSM code a
+ chance to optimize the path. */
+ if (cached_lhs == NULL
+ && cond_code == NE_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (op0))
+ && TREE_CODE (op0) == SSA_NAME
+ && integer_zerop (op1))
+ return op0;
+
return cached_lhs;
}
@@ -974,6 +984,21 @@ fsm_find_control_statement_thread_paths (tree expr,
return;
}
+ /* Make sure we haven't already visited any of the nodes in
+ NEXT_PATH. Don't add them here to avoid pollution. */
+ for (unsigned int i = 0; i < next_path->length () - 1; i++)
+ {
+ if (visited_bbs->contains ((*next_path)[i]))
+ {
+ vec_free (next_path);
+ return;
+ }
+ }
+
+ /* Now add the nodes to VISISTED_BBS. */
+ for (unsigned int i = 0; i < next_path->length () - 1; i++)
+ visited_bbs->add ((*next_path)[i]);
+
/* Append all the nodes from NEXT_PATH to PATH. */
vec_safe_splice (path, next_path);
next_path_length = next_path->length ();