https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125932
--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to liu zhenyu from comment #4)
> A fix along these lines (copy the conversion sequence onto every outgoing
> edge of a JUMP_P def) fixes this testcase and the comment 0 testcase [...]
Thanks for the analysis, the root cause is spot on. However, I'd rather not
emit copies on every outgoing edge of an asm goto: it relies on
commit_edge_insertions splitting edges whose source is a JUMP_INSN, copy_insn
(PATTERN (i)) drops notes and locations, and edges whose successor never uses
the chain register get a pointless movd. Skipping STV for such chains is
simpler (and easier to backport), and the lost opportunity is negligible.
I am testing the following fix:
--- a/gcc/config/i386/i386-features.cc
+++ b/gcc/config/i386/i386-features.cc
@@ scalar_chain::analyze_register_chain
if (DF_REF_REG_DEF_P (chain->ref))
{
+ /* An asm goto with outputs defines them on all outgoing edges,
+ so a conversion copy can't be emitted after it. */
+ if (JUMP_P (DF_REF_INSN (chain->ref)))
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ " r%d def in jump insn %d, aborting chain\n",
+ DF_REF_REGNO (chain->ref), uid);
+ return false;
+ }
+
if (dump_file)
fprintf (dump_file, " r%d def in insn %d isn't convertible\n",
DF_REF_REGNO (chain->ref), uid);