https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80463
Andrey Belevantsev <abel at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |abel at gcc dot gnu.org --- Comment #3 from Andrey Belevantsev <abel at gcc dot gnu.org> --- I've debugged this one a bit on a revision with an ICE. We fail to move up a bookkeeping copy of a debug insn because of a piece of code in sched-deps.c: 3094 /* Quite often, a debug insn will refer to stuff in the 3095 previous instruction, but the reason we want this 3096 dependency here is to make sure the scheduler doesn't 3097 gratuitously move a debug insn ahead. This could dirty 3098 DF flags and cause additional analysis that wouldn't have 3099 occurred in compilation without debug insns, and such 3100 additional analysis can modify the generated code. */ 3101 prev = PREV_INSN (insn); 3102 3103 if (prev && NONDEBUG_INSN_P (prev) 3104 add_dependence (insn, prev, REG_DEP_ANTI); The initial insn didn't have this dependence because it was the first in block. We could either switch off this conditional completely for selective scheduling or pass there the insn through which we try to move our debug insn to be used as prev instead of completely bogus prev insn. The former is much simple because var-tracking doesn't play well with sel-sched anyways. However, while experimenting with these I have found an issue with the scheduler creating bookkeeping blocks such that the hot/cold partitioning breaks. This one should be fixed first hopefully after some discussions with Honza at the cauldron.