If there are debug instructions before/after the stopping point,
we need to skip over them before checking for begin/end in order
to avoid having the debug instructions effect behavior.
Fixes PR43758.
Differential D69606
[MachineBasicBlock] Skip over debug instructions in computeRegisterLiveness before checking for begin/end. Authored by craig.topper on Oct 29 2019, 11:55 PM.
Details If there are debug instructions before/after the stopping point, Fixes PR43758.
Diff Detail
Event Timeline
Comment Actions Will it be better to use getFirstNonDebugInstr() instead of begin() on line 1475? // Did we get to the start of the block?
- if (I == begin()) {
+ if (I == getFirstNonDebugInstr()) {Comment Actions Not sure. I guess it depends on whether its more likely that there are debug instructions at the beginning of the block or the current iterator. If we use getFirstNonDebugInstr we're starting a separate scan from the beginning of the block. The code I have here starts from the current iterator.
Comment Actions Look at the debugging printf information, I found the begin() is the first instruction of the BasicBlock, but the end() is not the last instruction, it's something unknown or none flag.
| ||||||||||||||||||||||||
Does this code duplicated with the line: 1392-1394?
for (; I != end() && N > 0; ++I) { if (I->isDebugInstr()) continue;