https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109910
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2023-08-04 00:00:00 |2026-9-12
--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
What also doesn't work is to scan through DF_REG_DEF_CHAIN (regno) and find the
insns that change regno, and then conclude that regs for which there is no
recorded insn that changes it will only be set because a parameter is passed
there:
df_ref def = DF_REG_DEF_CHAIN (regno);
for (int n = 0; def; def = DF_REF_NEXT_REG (def), ++n)
{
if (DF_REF_INSN_INFO (def)
&& DF_REF_INSN (def)
&& NONDEBUG_INSN_P (DF_REF_INSN (def)))
// Found an insn that changes regno.
return true;
// Avoid circular lists that may occur for uninitialized variables.
if (n > 5)
return true;
}
// No insn is changing regno.
return false;
}
The reason why this doesn't work is because RA doesn't record the insn(s) that
change a reg when setting of the reg materialized only in RA, e.g.:
* A value is loaded into a reg (e.g. from arg pointer) that is otherwise
unused.
* A reg that is set from a hard-register constraint.
What RA does is to just set df_regs_ever_live_p without caring for essential
details.