https://gcc.gnu.org/g:4932c4eef80d9488dda9ea1d8cb90a417244a9b7

commit 4932c4eef80d9488dda9ea1d8cb90a417244a9b7
Author: Ondřej Machota <ondrejmach...@gmail.com>
Date:   Thu Mar 20 10:03:09 2025 +0100

    rtl-ssa-dce: mark REGNO (pic_offset_table_rtx) as prelive

Diff:
---
 gcc/dce.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/dce.cc b/gcc/dce.cc
index 5cc9f3129067..8573e50a66de 100644
--- a/gcc/dce.cc
+++ b/gcc/dce.cc
@@ -1497,7 +1497,11 @@ bool is_prelive(insn_info *insn)
     }
 
     // this ignore clobbers, which is probably fine
-    if (def->kind() == access_kind::SET && HARD_REGISTER_NUM_P(def->regno())) {
+    if (def->kind() == access_kind::SET 
+        && (HARD_REGISTER_NUM_P(def->regno())
+        || (def->regno() == REGNO (pic_offset_table_rtx)
+        && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER))
+      ) {
       // We might try to write something like def->regno() == REGNO 
(pic_offset_table_rtx) ...
       // TODO : else if (DF_REF_REG (def) == pic_offset_table_rtx && REGNO 
(pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER)
       // std::cerr << "hello, dear hard register! regno: " << def->regno() << 
"\n";

Reply via email to