When generating the IR for branch-on-boolean the branch instruction gets a debug location that is inherited from the condition’s context. It may get the same location as the instructions that precede the condition. This can lead to poor stepping behavior when the condition spans multiple lines, e.g.
If (a
&& b)
…
;
In gdb we step back to the if from b’s line before continuing on.
The patch proposes to attach the condition’s debug location to the branch instruction.