diff options
author | Jeff Law <law@redhat.com> | 2017-03-17 09:01:56 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2017-03-17 09:01:56 -0600 |
commit | 7f166d94478f406bc59ed40d9ff24c9d98f30c90 (patch) | |
tree | bafecb847a08eb5bb194630c81535b709ace0748 /gcc/tree-vrp.c | |
parent | faec5f24736ac2550ef9c4080200edb20d2b1e22 (diff) | |
download | gcc-7f166d94478f406bc59ed40d9ff24c9d98f30c90.zip gcc-7f166d94478f406bc59ed40d9ff24c9d98f30c90.tar.gz gcc-7f166d94478f406bc59ed40d9ff24c9d98f30c90.tar.bz2 |
re PR tree-optimization/71437 (Performance regression after r235817)
PR tree-optimization/71437
* tree-vrp.c (simplify_stmt_for_jump_threading): Lookup the
conditional in the hash table first.
(vrp_dom_walker::before_dom_children): Extract condition from
ASSERT_EXPR. Record condition, its inverion and any implied
conditions as well.
PR tree-optimization/71437
* gcc.dg/tree-ssa/pr71437.c: New test.
* gcc.dg/tree-ssa/20040305-1.c: Test earlier dump.
* gcc.dg/tree-ssa/ssa-dom-thread-4.c: Adjust for jump threads
now caught by VRP, but which were previously caught by DOM.
From-SVN: r246225
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 4a09a57..26652e3 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -10783,6 +10783,11 @@ simplify_stmt_for_jump_threading (gimple *stmt, gimple *within_stmt, class avail_exprs_stack *avail_exprs_stack ATTRIBUTE_UNUSED, basic_block bb) { + /* First see if the conditional is in the hash table. */ + tree cached_lhs = avail_exprs_stack->lookup_avail_expr (stmt, false, true); + if (cached_lhs && is_gimple_min_invariant (cached_lhs)) + return cached_lhs; + if (gcond *cond_stmt = dyn_cast <gcond *> (stmt)) { tree op0 = gimple_cond_lhs (cond_stmt); @@ -10915,10 +10920,19 @@ vrp_dom_walker::before_dom_children (basic_block bb) if (gimple_assign_single_p (stmt) && TREE_CODE (gimple_assign_rhs1 (stmt)) == ASSERT_EXPR) { - tree lhs = gimple_assign_lhs (stmt); tree rhs1 = gimple_assign_rhs1 (stmt); + tree cond = TREE_OPERAND (rhs1, 1); + tree inverted = invert_truthvalue (cond); + vec<cond_equivalence> p; + p.create (3); + record_conditions (&p, cond, inverted); + for (unsigned int i = 0; i < p.length (); i++) + m_avail_exprs_stack->record_cond (&p[i]); + + tree lhs = gimple_assign_lhs (stmt); m_const_and_copies->record_const_or_copy (lhs, TREE_OPERAND (rhs1, 0)); + p.release (); continue; } break; |