aboutsummaryrefslogtreecommitdiff
path: root/gcc/df.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2024-07-03 09:17:42 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2024-07-03 09:17:42 +0100
commit47ea6bddd15a568cedc5d7026d2cc9d5599e6e01 (patch)
treedfc40aea9c1cca7c0be128c19955cc616ab1400b /gcc/df.h
parent239ad907b1fc08874042f8bea5f61eaf3ba2877d (diff)
downloadgcc-47ea6bddd15a568cedc5d7026d2cc9d5599e6e01.zip
gcc-47ea6bddd15a568cedc5d7026d2cc9d5599e6e01.tar.gz
gcc-47ea6bddd15a568cedc5d7026d2cc9d5599e6e01.tar.bz2
Give fast DCE a separate dirty flag
Thomas pointed out that we sometimes failed to eliminate some dead code (specifically clobbers of otherwise unused registers) on nvptx when late-combine is enabled. This happens because: - combine is able to optimise the function in a way that exposes dead code. This leaves the df information in a "dirty" state. - late_combine calls df_analyze without DF_LR_RUN_DCE run set. This updates the df information and clears the "dirty" state. - late_combine doesn't find any extra optimisations, and so leaves the df information up-to-date. - if_after_combine (ce2) calls df_analyze with DF_LR_RUN_DCE set. Because the df information is already up-to-date, fast DCE is not run. The upshot is that running late-combine has the effect of suppressing a DCE opportunity that would have been noticed without late_combine. I think this shows that we should track the state of the DCE separately from the LR problem. Every pass updates the latter, but not all passes update the former. gcc/ * df.h (DF_LR_DCE): New df_problem_id. (df_lr_dce): New macro. * df-core.cc (rest_of_handle_df_finish): Check for a null free_fun. * df-problems.cc (df_lr_finalize): Split out fast DCE handling to... (df_lr_dce_finalize): ...this new function. (problem_LR_DCE): New df_problem. (df_lr_add_problem): Register LR_DCE rather than LR itself. * dce.cc (fast_dce): Clear df_lr_dce->solutions_dirty.
Diffstat (limited to 'gcc/df.h')
-rw-r--r--gcc/df.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/df.h b/gcc/df.h
index c4e690b..bbb4f29 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -47,6 +47,7 @@ enum df_problem_id
{
DF_SCAN,
DF_LR, /* Live Registers backward. */
+ DF_LR_DCE, /* Dead code elimination post-pass for LR. */
DF_LIVE, /* Live Registers & Uninitialized Registers */
DF_RD, /* Reaching Defs. */
DF_CHAIN, /* Def-Use and/or Use-Def Chains. */
@@ -940,6 +941,7 @@ extern class df_d *df;
#define df_scan (df->problems_by_index[DF_SCAN])
#define df_rd (df->problems_by_index[DF_RD])
#define df_lr (df->problems_by_index[DF_LR])
+#define df_lr_dce (df->problems_by_index[DF_LR_DCE])
#define df_live (df->problems_by_index[DF_LIVE])
#define df_chain (df->problems_by_index[DF_CHAIN])
#define df_word_lr (df->problems_by_index[DF_WORD_LR])