https://gcc.gnu.org/g:3b4e36f6ef191a17e98ae566a96ef91c50302aac

commit r16-6165-g3b4e36f6ef191a17e98ae566a96ef91c50302aac
Author: Takayuki 'January June' Suwa <[email protected]>
Date:   Sun Dec 14 22:04:43 2025 +0900

    xtensa: Remove variables only used to pass the return of end_sequence()
    
    As a result of the automatic replacement by commit 
4dd13988c93c24ba3605f4b9cafc97515c34f2ac,
    there are several code fragments that receive the return value of
    end_sequence() and immediately use it as the return value of the function
    itself.
    
       rtx_insn *insn;
       ...
       insn = end_sequence ();
       return insn;
    
    It is clear that in such cases, it would be more natural to pass the return
    value of end_sequence() directly to the return statement without passing it
    through a variable.
    
    Applying this patch naturally does not change any functionality.
    
    gcc/ChangeLog:
    
            * config/xtensa/xtensa.cc
            (xtensa_expand_block_set_libcall,
            xtensa_expand_block_set_unrolled_loop,
            xtensa_expand_block_set_small_loop, xtensa_call_tls_desc):
            Change the return statement to pass the return value of
            end_sequence() directly without going through a variable, and
            remove the definition of that variable.

Diff:
---
 gcc/config/xtensa/xtensa.cc | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index f09123d5c330..43df10e4b63e 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -1425,7 +1425,6 @@ xtensa_expand_block_set_libcall (rtx dst_mem,
                                 HOST_WIDE_INT bytes)
 {
   rtx reg;
-  rtx_insn *seq;
 
   start_sequence ();
 
@@ -1439,9 +1438,7 @@ xtensa_expand_block_set_libcall (rtx dst_mem,
                     GEN_INT (value), SImode,
                     GEN_INT (bytes), SImode);
 
-  seq = end_sequence ();
-
-  return seq;
+  return end_sequence ();
 }
 
 /* Worker function for xtensa_expand_block_set().
@@ -1458,7 +1455,6 @@ xtensa_expand_block_set_unrolled_loop (rtx dst_mem,
 {
   rtx reg;
   int offset;
-  rtx_insn *seq;
 
   if (bytes > 64)
     return NULL;
@@ -1500,9 +1496,7 @@ xtensa_expand_block_set_unrolled_loop (rtx dst_mem,
     }
   while (bytes > 0);
 
-  seq = end_sequence ();
-
-  return seq;
+  return end_sequence ();
 }
 
 /* Worker function for xtensa_expand_block_set(),
@@ -1520,7 +1514,6 @@ xtensa_expand_block_set_small_loop (rtx dst_mem,
   rtx reg, dst, end;
   machine_mode unit_mode;
   rtx_code_label *label;
-  rtx_insn *seq;
 
   /* Totally-aligned block only.  */
   if (bytes % align != 0)
@@ -1581,9 +1574,7 @@ xtensa_expand_block_set_small_loop (rtx dst_mem,
   emit_insn (gen_addsi3 (dst, dst, GEN_INT (align)));
   emit_cmp_and_jump_insns (dst, end, NE, const0_rtx, SImode, true, label);
 
-  seq = end_sequence ();
-
-  return seq;
+  return end_sequence ();
 }
 
 
@@ -2247,7 +2238,7 @@ static rtx_insn *
 xtensa_call_tls_desc (rtx sym, rtx *retp)
 {
   rtx fn, arg, a_io;
-  rtx_insn *call_insn, *insns;
+  rtx_insn *call_insn;
 
   start_sequence ();
   fn = gen_reg_rtx (Pmode);
@@ -2259,10 +2250,9 @@ xtensa_call_tls_desc (rtx sym, rtx *retp)
   emit_move_insn (a_io, arg);
   call_insn = emit_call_insn (gen_tls_call (a_io, fn, sym, const1_rtx));
   use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), a_io);
-  insns = end_sequence ();
 
   *retp = a_io;
-  return insns;
+  return end_sequence ();
 }

Reply via email to