Index: dse.c =================================================================== --- dse.c (revision 192353) +++ dse.c (working copy) @@ -990,6 +990,7 @@ delete_dead_store_insn (insn_info_t insn } /* Check if EXPR can possibly escape the current function scope. */ + static bool can_escape (tree expr) { @@ -998,7 +999,10 @@ can_escape (tree expr) return true; base = get_base_address (expr); if (DECL_P (base) - && !may_be_aliased (base)) + && !may_be_aliased (base) + && !(cfun->gimple_df->escaped.vars + && bitmap_bit_p (cfun->gimple_df->escaped.vars, + DECL_PT_UID (base)))) return false; return true; } Index: gimplify.c =================================================================== --- gimplify.c (revision 192353) +++ gimplify.c (working copy) @@ -116,6 +116,26 @@ mark_addressable (tree x) && TREE_CODE (x) != RESULT_DECL) return; TREE_ADDRESSABLE (x) = 1; + + /* If this is a partitioned decl, we need to mark all the variables in the + partition as escaped. This is needed because a store into one of them + can be replaced with a store into another, and this may not change the + outcome of the escape analysis for DSE to work properly. */ + if (TREE_CODE (x) == VAR_DECL + && !TREE_STATIC (x) + && cfun->gimple_df != NULL + && cfun->gimple_df->decls_to_pointers != NULL) + { + void *namep + = pointer_map_contains (cfun->gimple_df->decls_to_pointers, x); + if (namep) + { + struct ptr_info_def *pi = get_ptr_info (*(tree *)namep); + if (cfun->gimple_df->escaped.vars == NULL) + cfun->gimple_df->escaped.vars = BITMAP_GGC_ALLOC (); + bitmap_ior_into (cfun->gimple_df->escaped.vars, pi->pt.vars); + } + } } /* Return a hash value for a formal temporary table entry. */