diff options
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r-- | gcc/tree-ssa-dce.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 90b3f4d..17a8d5e 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -115,6 +115,14 @@ static bool cfg_altered; static int *bb_postorder; +/* True if we should treat any stmt with a vdef as necessary. */ + +static inline bool +keep_all_vdefs_p () +{ + return optimize_debug; +} + /* If STMT is not already marked necessary, mark it, and add it to the worklist if ADD_TO_WORKLIST is true. */ @@ -317,6 +325,12 @@ mark_stmt_if_obviously_necessary (gimple *stmt, bool aggressive) return; } + if (gimple_vdef (stmt) && keep_all_vdefs_p ()) + { + mark_stmt_necessary (stmt, true); + return; + } + return; } @@ -532,6 +546,9 @@ mark_aliased_reaching_defs_necessary_1 (ao_ref *ref, tree vdef, void *data) static void mark_aliased_reaching_defs_necessary (gimple *stmt, tree ref) { + /* Should have been caught before calling this function. */ + gcc_checking_assert (!keep_all_vdefs_p ()); + unsigned int chain; ao_ref refd; gcc_assert (!chain_ovfl); @@ -610,6 +627,8 @@ mark_all_reaching_defs_necessary_1 (ao_ref *ref ATTRIBUTE_UNUSED, static void mark_all_reaching_defs_necessary (gimple *stmt) { + /* Should have been caught before calling this function. */ + gcc_checking_assert (!keep_all_vdefs_p ()); walk_aliased_vdefs (NULL, gimple_vuse (stmt), mark_all_reaching_defs_necessary_1, NULL, &visited); } @@ -813,6 +832,10 @@ propagate_necessity (bool aggressive) if (!use) continue; + /* No need to search for vdefs if we intrinsicly keep them all. */ + if (keep_all_vdefs_p ()) + continue; + /* If we dropped to simple mode make all immediately reachable definitions necessary. */ if (chain_ovfl) |