aboutsummaryrefslogtreecommitdiff
path: root/gcc/df.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-05-18 13:00:47 -0700
committerH.J. Lu <hjl.tools@gmail.com>2022-06-01 14:23:26 -0700
commita743a72714fc4a9d7036d28d0cacdf2a3621f629 (patch)
tree4a2da93e3ac20ae6f5be420e5792cc84a6f2f3ad /gcc/df.h
parente2e471d83d16449a325315c0f33dc52b90ce0fac (diff)
downloadgcc-a743a72714fc4a9d7036d28d0cacdf2a3621f629.zip
gcc-a743a72714fc4a9d7036d28d0cacdf2a3621f629.tar.gz
gcc-a743a72714fc4a9d7036d28d0cacdf2a3621f629.tar.bz2
DSE: Use the constant store source if possible
RTL DSE tracks redundant constant stores within a basic block. When RTL loop invariant motion hoists a constant initialization out of the loop into a separate basic block, the constant store value becomes unknown within the original basic block. When recording store for RTL DSE, check if the source register is set only once to a constant by a non-partial unconditional load. If yes, record the constant as the constant store source. It eliminates unrolled zero stores after memset 0 in a loop where a vector register is used as the zero store source. gcc/ PR rtl-optimization/105638 * df-core.cc (df_find_single_def_src): Moved and renamed from find_single_def_src in loop-iv.cc. Change the argument to rtx and use rtx_equal_p. Return null for partial or conditional defs. * df.h (df_find_single_def_src): New prototype. * dse.cc (record_store): Use the constant source if the source register is set only once. * loop-iv.cc (find_single_def_src): Moved to df-core.cc. (replace_single_def_regs): Replace find_single_def_src with df_find_single_def_src. gcc/testsuite/ PR rtl-optimization/105638 * g++.target/i386/pr105638.C: New test.
Diffstat (limited to 'gcc/df.h')
-rw-r--r--gcc/df.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/df.h b/gcc/df.h
index bd32920..71e249a 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -991,6 +991,7 @@ extern df_ref df_find_def (rtx_insn *, rtx);
extern bool df_reg_defined (rtx_insn *, rtx);
extern df_ref df_find_use (rtx_insn *, rtx);
extern bool df_reg_used (rtx_insn *, rtx);
+extern rtx df_find_single_def_src (rtx);
extern void df_worklist_dataflow (struct dataflow *,bitmap, int *, int);
extern void df_print_regset (FILE *file, const_bitmap r);
extern void df_print_word_regset (FILE *file, const_bitmap r);