[avr,applied] ad PR84211: fix dump with undefined m_insn

Message ID 1bd9f547-83c3-460c-ba67-007150685fc2@gjlay.de
State New
Headers
Series [avr,applied] ad PR84211: fix dump with undefined m_insn |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply

Commit Message

Georg-Johann Lay Dec. 4, 2024, 8:12 p.m. UTC
  Applied the following patch that fixed an ICE when
-fdump-rtl-avr-fuse-move is on, because when 2 insn have been
combined into a single one, then m_insn is undefined.
To date, m_insn is only used in dumps.

Applied as obvious.

Johann

--

AVR: ad target/84211 - Fix dumping INSN_UID for null insn.

gcc/
         PR target/84211
         * config/avr/avr-passes.cc (insninfo_t) <m_insn>: Preset to 0.
         (run_find_plies) [hamm=0, dump_file]: Don't print INSN_UID
         for a null m_insn.
  

Patch

    AVR: ad target/84211 - Fix dumping INSN_UID for null insn.
    
    gcc/
            PR target/84211
            * config/avr/avr-passes.cc (insninfo_t) <m_insn>: Preset to 0.
            (run_find_plies) [hamm=0, dump_file]: Don't print INSN_UID
            for a null m_insn.

diff --git a/gcc/config/avr/avr-passes.cc b/gcc/config/avr/avr-passes.cc
index 076d8cbe365..f89a534bcbd 100644
--- a/gcc/config/avr/avr-passes.cc
+++ b/gcc/config/avr/avr-passes.cc
@@ -979,12 +979,12 @@  struct insninfo_t
   // This is an insn that sets the m_size bytes of m_regno to either
   // - A compile time constant m_isrc (m_code = CONST_INT), or
   // - The contents of register number m_rsrc (m_code = REG).
-  int m_size;
+  int m_size = 0;
   int m_regno;
   int m_rsrc;
   rtx_code m_code;
   uint64_t m_isrc;
-  rtx_insn *m_insn;
+  rtx_insn *m_insn = nullptr;
   rtx m_set = NULL_RTX;
   rtx m_src = NULL_RTX;
   int m_scratch = 0; // 0 or the register number of a QImode scratch.
@@ -2466,7 +2466,8 @@  bbinfo_t::run_find_plies (const insninfo_t &ii, const memento_t &memo) const
 
   if (hamm == 0)
     {
-      avr_dump (";; Found redundant insn %d\n", INSN_UID (ii.m_insn));
+      avr_dump (";; Found redundant insn %d\n",
+		ii.m_insn ? INSN_UID (ii.m_insn) : 0);
       return true;
     }