[llvm-dev] DebugLoc info is invalid after pass 'simplifycfg'
Jeremy Morse via llvm-dev
llvm-dev at lists.llvm.org
Wed Apr 24 03:38:28 PDT 2019
On Wed, Apr 24, 2019 at 12:14 AM Fangqing Du via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I'm not sure it's a bug or not.
> After pass 'simplifycfg', some DebugLoc info is changed, and become invalid.
> I use the bugpoint to reduce the case, and paste it here:
> And after pass 'simplifycfg', the DebugLoc info attached to the call instruction will be changed into '!7 = !DILocation(line: 0, scope: !3)', which is invalid.
The use of a zero line number here is deliberate, as implemented by
getMergedLocation . It signifies that the location is compiler
generated, and doesn't correspond to a specific line number in the
> So can we just keep the original DebugLoc info for the call instruction?
SimplifyCFG is merging two call instructions into one -- however they
have two different DebugLocs, so we would have to pick one of them. If
a debugger then breaks on that call instruction, the line number will
suggest to the developer that the branch condition was either true or
false, which would be misleading because the call instruction now
executes regardless of the branch condition. Using a zero line number
avoids misleading the developer; it isn't ideal, but avoids mistruths.
More information about the llvm-dev