https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124266

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |acoplan at gcc dot gnu.org,
                   |                            |rsandifo at gcc dot gnu.org

--- Comment #7 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
As mentioned in reply to Wilco's patch, I think the problem here is that
pair-fusion is dropping RTX_FRAME_RELATED_P when combining a REG_CFA_RESTORE
load with a non-frame-related load.  It is correctly preserving the notes
themselves though.

The following proof-of-concept patch fixes it for me:

diff --git a/gcc/pair-fusion.cc b/gcc/pair-fusion.cc
index 7aaf4fd6372..c5469993531 100644
--- a/gcc/pair-fusion.cc
+++ b/gcc/pair-fusion.cc
@@ -1645,6 +1645,8 @@ pair_fusion_bb_info::fuse_pair (bool load_p,
     PATTERN (first->rtl ()),
     PATTERN (second->rtl ())
   };
+  bool frame_related_p = (RTX_FRAME_RELATED_P (first->rtl ())
+                         || RTX_FRAME_RELATED_P (first->rtl ()));

   // Make copies of the patterns as we might need to refer to the original RTL
   // later, for example when updating debug uses (which is after we've updated
@@ -2027,6 +2029,8 @@ pair_fusion_bb_info::fuse_pair (bool load_p,
   for (auto uid : tombstone_uids)
     track_tombstone (uid);

+  RTX_FRAME_RELATED_P (pair_change->insn ()->rtl ()) = frame_related_p;
+
   return true;
 }

but I'm not sure that's the best way.

Reply via email to