diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 50fc56f..2ff1db6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2015-10-29 Jeff Law + + * tree-ssa-scopedtables.h (const_and_copies): Remove invalidate + method. + * tree-ssa-scopedtables.h (const_and_copies::invalidate): Remove. + * tree-ssa-threadedge.c + (record_temporary_equivalences_from_stmts_at_dest): Remove + backedge_seen argument and associated code which invalidated + equivalences based on the value of that argument. + (thread_through_normal_block): Corresponding changes. + 2015-10-29 Segher Boessenkool * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Move this diff --git a/gcc/tree-ssa-scopedtables.c b/gcc/tree-ssa-scopedtables.c index db3f954..ae5acc2 100644 --- a/gcc/tree-ssa-scopedtables.c +++ b/gcc/tree-ssa-scopedtables.c @@ -669,45 +669,6 @@ const_and_copies::record_const_or_copy (tree x, tree y, tree prev_x) m_stack.quick_push (x); } -/* A new value has been assigned to LHS. If necessary, invalidate any - equivalences that are no longer valid. This includes invaliding - LHS and any objects that are currently equivalent to LHS. - - Finding the objects that are currently marked as equivalent to LHS - is a bit tricky. We could walk the ssa names and see if any have - SSA_NAME_VALUE that is the same as LHS. That's expensive. - - However, it's far more efficient to look at the unwinding stack as - that will have all context sensitive equivalences which are the only - ones that we really have to worry about here. */ -void -const_and_copies::invalidate (tree lhs) -{ - - /* The stack is an unwinding stack. If the current element is NULL - then it's a "stop unwinding" marker. Else the current marker is - the SSA_NAME with an equivalence and the prior entry in the stack - is what the current element is equivalent to. */ - for (int i = m_stack.length() - 1; i >= 0; i--) - { - /* Ignore the stop unwinding markers. */ - if ((m_stack)[i] == NULL) - continue; - - /* We want to check the current value of stack[i] to see if - it matches LHS. If so, then invalidate. */ - if (SSA_NAME_VALUE ((m_stack)[i]) == lhs) - record_const_or_copy ((m_stack)[i], NULL_TREE); - - /* Remember, we're dealing with two elements in this case. */ - i--; - } - - /* And invalidate any known value for LHS itself. */ - if (SSA_NAME_VALUE (lhs)) - record_const_or_copy (lhs, NULL_TREE); -} - bool expr_elt_hasher::equal (const value_type &p1, const compare_type &p2) { diff --git a/gcc/tree-ssa-scopedtables.h b/gcc/tree-ssa-scopedtables.h index 52bcb6f..1e6b46c 100644 --- a/gcc/tree-ssa-scopedtables.h +++ b/gcc/tree-ssa-scopedtables.h @@ -168,12 +168,6 @@ class const_and_copies value for the first argument. Try to get rid of this in the future. */ void record_const_or_copy (tree, tree, tree); - /* When threading we need to invalidate certain equivalences after - following a loop backedge. The entries we need to invalidate will - always be in this unwindable stack. This entry point handles - finding and invalidating those entries. */ - void invalidate (tree); - private: vec m_stack; const_and_copies& operator= (const const_and_copies&); diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index ddd5061..9379198 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -215,8 +215,7 @@ static gimple * record_temporary_equivalences_from_stmts_at_dest (edge e, const_and_copies *const_and_copies, avail_exprs_stack *avail_exprs_stack, - pfn_simplify simplify, - bool backedge_seen) + pfn_simplify simplify) { gimple *stmt = NULL; gimple_stmt_iterator gsi; @@ -268,22 +267,7 @@ record_temporary_equivalences_from_stmts_at_dest (edge e, && (gimple_code (stmt) != GIMPLE_CALL || gimple_call_lhs (stmt) == NULL_TREE || TREE_CODE (gimple_call_lhs (stmt)) != SSA_NAME)) - { - /* STMT might still have DEFS and we need to invalidate any known - equivalences for them. - - Consider if STMT is a GIMPLE_ASM with one or more outputs that - feeds a conditional inside a loop. We might derive an equivalence - due to the conditional. */ - tree op; - ssa_op_iter iter; - - if (backedge_seen) - FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF) - const_and_copies->invalidate (op); - - continue; - } + continue; /* The result of __builtin_object_size depends on all the arguments of a phi node. Temporarily using only one edge produces invalid @@ -316,14 +300,7 @@ record_temporary_equivalences_from_stmts_at_dest (edge e, if (fndecl && (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_OBJECT_SIZE || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CONSTANT_P)) - { - if (backedge_seen) - { - tree lhs = gimple_get_lhs (stmt); - const_and_copies->invalidate (lhs); - } - continue; - } + continue; } /* At this point we have a statement which assigns an RHS to an @@ -389,19 +366,12 @@ record_temporary_equivalences_from_stmts_at_dest (edge e, } /* Record the context sensitive equivalence if we were able - to simplify this statement. - - If we have traversed a backedge at some point during threading, - then always enter something here. Either a real equivalence, - or a NULL_TREE equivalence which is effectively invalidation of - prior equivalences. */ + to simplify this statement. */ if (cached_lhs && (TREE_CODE (cached_lhs) == SSA_NAME || is_gimple_min_invariant (cached_lhs))) const_and_copies->record_const_or_copy (gimple_get_lhs (stmt), cached_lhs); - else if (backedge_seen) - const_and_copies->invalidate (gimple_get_lhs (stmt)); } return stmt; } @@ -925,8 +895,7 @@ thread_through_normal_block (edge e, gimple *stmt = record_temporary_equivalences_from_stmts_at_dest (e, const_and_copies, avail_exprs_stack, - simplify, - *backedge_seen_p); + simplify); /* There's two reasons STMT might be null, and distinguishing between them is important.