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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |ebotcazou at gcc dot gnu.org
   Last reconfirmed|                            |2022-05-23
           Priority|P3                          |P2

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
@@ -67,31 +63,11 @@
   179: NOTE_INSN_BASIC_BLOCK 3
     9: NOTE_INSN_DELETED
   183: x2:DI=[sp:DI+0x40]
-  184: x0:DI=[sp:DI+0x48]
-      REG_UNUSED x0:DI
-  185: x0:DI=[sp:DI+0x50]
-      REG_UNUSED x0:DI
-      REG_EH_REGION 0x2
   217: NOTE_INSN_BASIC_BLOCK 4
-  186: x0:DI=[sp:DI+0x58]
-      REG_UNUSED x0:DI
-      REG_EH_REGION 0x2
   218: NOTE_INSN_BASIC_BLOCK 5
-  187: x0:DI=[sp:DI+0x60]
-      REG_UNUSED x0:DI
-      REG_EH_REGION 0x2
   219: NOTE_INSN_BASIC_BLOCK 6
-  188: x0:DI=[sp:DI+0x68]
-      REG_UNUSED x0:DI
-      REG_EH_REGION 0x2
   220: NOTE_INSN_BASIC_BLOCK 7
-  189: x0:DI=[sp:DI+0x70]
-      REG_UNUSED x0:DI
-      REG_EH_REGION 0x2
   221: NOTE_INSN_BASIC_BLOCK 8
-  190: x0:DI=[sp:DI+0x78]
-      REG_UNUSED x0:DI
-      REG_EH_REGION 0x2
   226: NOTE_INSN_BASIC_BLOCK 9
   228: pc=L227
   229: barrier

while there's nothing wrong with the transform, cprop-hardreg likely lacks
cleanup of EH side-effects / edges.

      /* Detect obviously dead sets (via REG_UNUSED notes) and remove them.  */
      if (set
          && !RTX_FRAME_RELATED_P (insn)
          && NONJUMP_INSN_P (insn)
          && !may_trap_p (set)
          && find_reg_note (insn, REG_UNUSED, SET_DEST (set))
          && !side_effects_p (SET_SRC (set))
          && !side_effects_p (SET_DEST (set)))
        {
          bool last = insn == BB_END (bb);
          delete_insn (insn);
          if (last)
            break;
          continue;

using delete_insn_and_edges here fixes it but reg_cprop doesn't schedule
a CFG cleanup so that isn't enough.

leaving to RTL maintainers.

Reply via email to