https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105627
Kewen Lin <linkw at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |linkw at gcc dot gnu.org --- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> --- Thanks for reporting and triaging. Although loops in function rs6000_analyze_swaps only handles NONDEBUG_INSN_P insns, when doing unionfind_union it's still possible to union with debug insn, as some def reg of nondebug insn can be used in debug insn, it makes the unions become different unexpectedly. The below patch can fix the issue, I don't think we need the similar handling in union_defs as I feel it's impossible to have the case that one reg which is defined by debug insn but used in nondebug insn. diff --git a/gcc/config/rs6000/rs6000-p8swap.cc b/gcc/config/rs6000/rs6000-p8swap.cc index d301bc3fe59..3aa90034c29 100644 --- a/gcc/config/rs6000/rs6000-p8swap.cc +++ b/gcc/config/rs6000/rs6000-p8swap.cc @@ -242,8 +242,9 @@ union_uses (swap_web_entry *insn_entry, rtx insn, df_ref def) if (DF_REF_INSN_INFO (link->ref)) { rtx use_insn = DF_REF_INSN (link->ref); - (void)unionfind_union (insn_entry + INSN_UID (insn), - insn_entry + INSN_UID (use_insn)); + if (NONDEBUG_INSN_P (use_insn)) + (void) unionfind_union (insn_entry + INSN_UID (insn), + insn_entry + INSN_UID (use_insn)); }