diff options
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r-- | gcc/tree-ssa-dce.c | 76 |
1 files changed, 3 insertions, 73 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 16b9d480a49..69408e8cd7d 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -277,8 +277,6 @@ mark_operand_necessary (tree op, bool phionly) static void mark_stmt_if_obviously_necessary (tree stmt, bool aggressive) { - v_may_def_optype v_may_defs; - v_must_def_optype v_must_defs; stmt_ann_t ann; tree op, def; ssa_op_iter iter; @@ -368,78 +366,10 @@ mark_stmt_if_obviously_necessary (tree stmt, bool aggressive) return; } } - - /* Check virtual definitions. If we get here, the only virtual - definitions we should see are those generated by assignment - statements. */ - v_may_defs = V_MAY_DEF_OPS (ann); - v_must_defs = V_MUST_DEF_OPS (ann); - if (NUM_V_MAY_DEFS (v_may_defs) > 0 || NUM_V_MUST_DEFS (v_must_defs) > 0) + if (is_hidden_global_store (stmt)) { - tree lhs; - - gcc_assert (TREE_CODE (stmt) == MODIFY_EXPR); - - /* Note that we must not check the individual virtual operands - here. In particular, if this is an aliased store, we could - end up with something like the following (SSA notation - redacted for brevity): - - foo (int *p, int i) - { - int x; - p_1 = (i_2 > 3) ? &x : p_1; - - # x_4 = V_MAY_DEF <x_3> - *p_1 = 5; - - return 2; - } - - Notice that the store to '*p_1' should be preserved, if we - were to check the virtual definitions in that store, we would - not mark it needed. This is because 'x' is not a global - variable. - - Therefore, we check the base address of the LHS. If the - address is a pointer, we check if its name tag or type tag is - a global variable. Otherwise, we check if the base variable - is a global. */ - lhs = TREE_OPERAND (stmt, 0); - if (REFERENCE_CLASS_P (lhs)) - lhs = get_base_address (lhs); - - if (lhs == NULL_TREE) - { - /* If LHS is NULL, it means that we couldn't get the base - address of the reference. In which case, we should not - remove this store. */ - mark_stmt_necessary (stmt, true); - } - else if (DECL_P (lhs)) - { - /* If the store is to a global symbol, we need to keep it. */ - if (is_global_var (lhs)) - mark_stmt_necessary (stmt, true); - } - else if (INDIRECT_REF_P (lhs)) - { - tree ptr = TREE_OPERAND (lhs, 0); - struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr); - tree nmt = (pi) ? pi->name_mem_tag : NULL_TREE; - tree tmt = var_ann (SSA_NAME_VAR (ptr))->type_mem_tag; - - /* If either the name tag or the type tag for PTR is a - global variable, then the store is necessary. */ - if ((nmt && is_global_var (nmt)) - || (tmt && is_global_var (tmt))) - { - mark_stmt_necessary (stmt, true); - return; - } - } - else - gcc_unreachable (); + mark_stmt_necessary (stmt, true); + return; } return; |