https://gcc.gnu.org/g:be7d7f41e118a4e11a352bfa0c011aaae54d75e9

commit be7d7f41e118a4e11a352bfa0c011aaae54d75e9
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 62ab115455c0..bd70c9588497 100644
--- a/gcc/dce.cc
+++ b/gcc/dce.cc
@@ -1500,7 +1500,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