Hello,

as discussed in the PR, this fixes a wrong-code reload bug in the
following situation in push_reload:

  /* If this is an input reload and the operand contains a register that
     dies in this insn and is used nowhere else, see if it is the right class
     to be used for this reload.  Use it if so.

The check "is used nowhere else" neglected to check for the possibility
that the current insn is a CALL_INSN and the register is used as argument
register in its CALL_INSN_FUNCTION_USAGE.

The patch below adds the missing check, fixing the PR.

Tested on x86_64-linux, committed to mainline.

Bye,
Ulrich


ChangeLog:

        PR rtl-optimization/64010
        * reload.c (push_reload): Before reusing a register contained
        in an operand as input reload register, ensure that it is not
        used in CALL_INSN_FUNCTION_USAGE.

Index: gcc/reload.c
===================================================================
--- gcc/reload.c        (revision 218272)
+++ gcc/reload.c        (working copy)
@@ -1625,6 +1625,7 @@ push_reload (rtx in, rtx out, rtx *inloc
                                               end_hard_regno (rel_mode,
                                                               regno),
                                               PATTERN (this_insn), inloc)
+           && ! find_reg_fusage (this_insn, USE, XEXP (note, 0))
            /* If this is also an output reload, IN cannot be used as
               the reload register if it is set in this insn unless IN
               is also OUT.  */
-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  ulrich.weig...@de.ibm.com

Reply via email to