[gcc(refs/users/omachota/heads/rtl-ssa-dce)] rtl-ssa-dce: improve prelive conditions (USE, TRAP_IF)
Ondrej Machota
omachota@gcc.gnu.org
Tue Mar 18 19:40:53 GMT 2025
https://gcc.gnu.org/g:a9bdb2c0c422b9d8d054c8dfe33892b85d01bcd3
commit a9bdb2c0c422b9d8d054c8dfe33892b85d01bcd3
Author: Ondřej Machota <ondrejmachota@gmail.com>
Date: Tue Mar 18 20:40:21 2025 +0100
rtl-ssa-dce: improve prelive conditions (USE, TRAP_IF)
Diff:
---
gcc/dce.cc | 31 +++++++++----------------------
1 file changed, 9 insertions(+), 22 deletions(-)
diff --git a/gcc/dce.cc b/gcc/dce.cc
index 74c1a6f8a879..6152b985ca31 100644
--- a/gcc/dce.cc
+++ b/gcc/dce.cc
@@ -1314,6 +1314,8 @@ bool sets_global_register(const_rtx rtx) {
// We should mark stack registers
// use HARD_FRAME_POINTER_REGNUM, REGNO_PTR_FRAME_P
+// muzeme mit parallel, ktery ma napr. dva single sety, nebo asm statement
+// pouzit note_pattern_stores nebo note_stores
bool sets_global_register(rtx_insn* insn) {
rtx set = single_set(insn);
if (!set)
@@ -1334,25 +1336,6 @@ bool sets_global_register(rtx_insn* insn) {
return false;
}
-bool is_control_flow(rtx_code code) {
- // What about BARRIERs?
- switch (code) {
- case JUMP_INSN:
- case JUMP_TABLE_DATA: // Be careful with Table jump addresses - ADDR_VEC, ADDR_DIFF_VEC, PREFETCH
- case TRAP_IF:
- case IF_THEN_ELSE: // Also COMPARE?
- case COND_EXEC: // We might want to check the operation that is under this?
- case RETURN:
- case SIMPLE_RETURN:
- case EH_RETURN:
- case LABEL_REF:
- return true;
-
- default:
- return false;
- }
-}
-
bool side_effects_with_mem (const_rtx x)
{
const RTX_CODE code = GET_CODE (x);
@@ -1393,8 +1376,8 @@ bool side_effects_with_mem (const_rtx x)
return true;
// This should rather by RTX_BODY in is_rtx_insn_prelive - like global clobber
- case USE:
- return true;
+ // case USE:
+ // return true;
default:
break;
@@ -1475,6 +1458,9 @@ bool is_rtx_insn_prelive(rtx_insn *insn) {
if (GET_CODE(body) == PREFETCH)
return true;
+ if (GET_CODE(body) == USE || GET_CODE(body) == TRAP_IF || GET_CODE(body) == UNSPEC)
+ 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
@@ -1482,7 +1468,8 @@ bool is_rtx_insn_prelive(rtx_insn *insn) {
// TODO : debug the testcase
// It seems that the issue was due to trap_if rtl insn and fixed with may_trap_or_fault_p
// What about can_throw_internal?
- if (side_effects_with_mem(body) || can_throw_internal(body) || may_trap_or_fault_p(body))
+ // || can_throw_internal(body) - testy na ntb prochazi
+ if (side_effects_with_mem(body)) // || may_trap_or_fault_p(body))
return true;
return false;
More information about the Gcc-cvs
mailing list