If the merged instruction is call instruction, we need to set the scope to the closes common scope between 2 locations, otherwise it will cause trouble when the call is getting inlined.
Details
Diff Detail
- Build Status
Buildable 10736 Build 10736: arc lint + arc unit
Event Timeline
include/llvm/IR/DebugInfoMetadata.h | ||
---|---|---|
1434–1435 | Perhaps the API should change to be less error prone (so it's not the responsibility of the caller to know to pass the Instruction if it might be a call). Could this be "applyMergedLocation" and have it take the Instruction as the first parameter & modify its debug location in place? (are there callers that don't have the destination Instruction on-hand at the point where they want to make this call?) | |
lib/IR/DebugInfo.cpp | ||
680–687 | I'd expect to walk more than the inlined-at attributes, but the plain scopes too. Which should look something like "keep calling getScope until it returns null, then use getInlinedAt, then go back to walking scopes, etc, until getInlinedAt returns null". Probably not as important/necessary, but could still help smooth out debug_ranges which cost a bunch of debug info size. | |
test/Transforms/SimplifyCFG/remove-debug.ll | ||
4–5 | Might be worth checking the specific instructions that these lines apply to? |
Just wanted to say that I like the direction this is going and LGTM from my side once you sorted out the details David mentioned.
include/llvm/IR/DebugInfoMetadata.h | ||
---|---|---|
1434–1435 | Updated the API: MachineInstruction should use the original API | |
lib/IR/DebugInfo.cpp | ||
680–687 | Discussed offline with David. It is an overkill to add another level of complexity to traverse Scope chain because
|
Looks good, thanks!
Adrian - dunno what you think about the API changes here. Open to iterating (probably just post-commit) if you reckon this doesn't add enough, or have other ideas.
lib/Transforms/Utils/SimplifyCFG.cpp | ||
---|---|---|
1541 | This probably needs a similar assert/comment that I0 isn't a CallInst? |
include/llvm/IR/DebugInfoMetadata.h | ||
---|---|---|
1436 | Sorry, one more thing: Why is this a static function instead of a member? |
include/llvm/IR/DebugInfoMetadata.h | ||
---|---|---|
1436 | Moved the API to Instruction::applyMergedLocation. |
Looks mostly good now. One more inline comment.
include/llvm/IR/Instruction.h | ||
---|---|---|
391 | Should we document what happens to the debug location already attached to this? Or - looking at the use-cases - should it assert that the debugloc is empty? |
include/llvm/IR/Instruction.h | ||
---|---|---|
391 | Not sure if I understand this. this->debugloc will be either empty, or locA or locB. But it will be overwritten anyway, why do we care about its value? |
ping...
Adrian, please let me know if you have further concerns about this patch.
Thanks,
Dehao
LGTM, I would add one extra line to the comment of applyMergedLocation (see inline).
Thanks!
include/llvm/IR/DebugInfoMetadata.h | ||
---|---|---|
1428 | I think if we spell this as \p applyMergedLocation it gets turned into a link by Doxygen, might be worth trying. | |
include/llvm/IR/Instruction.h | ||
391 | I was thinking of adding an extra line like to make the behavior clear to the casual reader: |
I think if we spell this as \p applyMergedLocation it gets turned into a link by Doxygen, might be worth trying.