[gcc(refs/users/omachota/heads/rtl-ssa-dce)] rtl-ssa-dce: add prefetch as prelive + clone on pass
Ondrej Machota
omachota@gcc.gnu.org
Mon Mar 17 22:30:44 GMT 2025
https://gcc.gnu.org/g:7ca7bf12324598cdfef53ed377082f1a8ee829e4
commit 7ca7bf12324598cdfef53ed377082f1a8ee829e4
Author: Ondřej Machota <ondrejmachota@gmail.com>
Date: Mon Mar 17 23:30:08 2025 +0100
rtl-ssa-dce: add prefetch as prelive + clone on pass
Diff:
---
gcc/dce.cc | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/gcc/dce.cc b/gcc/dce.cc
index 55aeb64269ca..74c1a6f8a879 100644
--- a/gcc/dce.cc
+++ b/gcc/dce.cc
@@ -1451,8 +1451,7 @@ bool is_rtx_insn_prelive(rtx_insn *insn) {
// return !find_call_stack_args (as_a <rtx_call_insn *> (insn), false, fast, arg_stores);
// Only rtx_insn should be handled here
- auto code = GET_CODE(insn);
- gcc_assert(code == INSN);
+ gcc_assert(GET_CODE(insn) == INSN);
/* Don't delete insns that may throw if we cannot do so. */
if (!(cfun->can_delete_dead_exceptions && can_alter_cfg) && !insn_nothrow_p (insn))
@@ -1473,6 +1472,11 @@ bool is_rtx_insn_prelive(rtx_insn *insn) {
if (GET_CODE(body) == CLOBBER) // gcc/gcc/testsuite/gcc.c-torture/compile/20000605-1.c
return true;
+ if (GET_CODE(body) == PREFETCH)
+ return true;
+
+ // See deletable_insn_p_1 for UNSPEC. TRAP_IF is caught by may_trap_or_fault_p
+
// may_trap_or_fault_p helps a lot to pass some tests from RUNTESTSFLAGS=execute.exp
// e. g. this one: testsuite/gcc.c-torture/execute/20020418-1.c
// TODO : debug the testcase
@@ -1481,10 +1485,6 @@ bool is_rtx_insn_prelive(rtx_insn *insn) {
if (side_effects_with_mem(body) || can_throw_internal(body) || may_trap_or_fault_p(body))
return true;
- // TODO : parallel, {pre,post}_{int,dec}, {pre,post}_modify, may_trap_or_fault_p
- // Parallel is handled by volatile_refs_p
-
-
return false;
}
@@ -1764,8 +1764,9 @@ namespace
public:
pass_rtl_ssa_dce(gcc::context *ctxt)
: rtl_opt_pass(pass_data_rtl_ssa_dce, ctxt)
- {
- }
+ {}
+
+ opt_pass * clone () final override { return new pass_rtl_ssa_dce (m_ctxt); }
/* opt_pass methods: */
bool gate(function *) final override { return optimize > 0 && flag_dce; }
More information about the Gcc-cvs
mailing list