-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU] Fix incorrect stepping in gdb for amdgcn.end.cf intrinsic. #83010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,8 +336,12 @@ bool SIAnnotateControlFlow::closeControlFlow(BasicBlock *BB) { | |
// Split edge to make Def dominate Use | ||
FirstInsertionPt = SplitEdge(DefBB, BB, DT, LI)->getFirstInsertionPt(); | ||
} | ||
IRBuilder<>(FirstInsertionPt->getParent(), FirstInsertionPt) | ||
.CreateCall(EndCf, {Exec}); | ||
IRBuilder<> IRB(FirstInsertionPt->getParent(), FirstInsertionPt); | ||
// TODO: StructurizeCFG 'Flow' blocks have debug locations from the | ||
// condition, for now just avoid copying these DebugLocs so that stepping | ||
// out of the then/else block in a debugger doesn't step to the condition. | ||
IRB.SetCurrentDebugLocation(DebugLoc()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only DebugLoc that is causing GDB test failures, where control flow joins in the 'Flow' block. Could you remove the other changes in this PR? I think the other debug locations should all be correct. A comment might be nice here too, maybe something like: "StructurizeCFG 'Flow' blocks have debug locations from the condition, for now just avoid copying these DebugLocs so that stepping out of the then/else block in a debugger doesn't step to the condition."? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you Emma, done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I follow. Isn't the location we are now dropping with this patch associated with the return, not the condition? The locations in the
Where This change drops There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @slinder1 good point, probably this testcase doesn't reflect what's happening with the failing gdb test. I'm not the right person to work on this particular issue, I just tried to set dbg location on end.cf intrinsic because it's the next instruction after asan_report call and the call uses return address (that is end.cf intrinsic) to report faulting location. I have a workaround for this - insert dummy instruction with proper dbg loc between asan_report call and end.cf intrinsic. I suggest to submit this fix to restore original behaviour and continue to work on this later. Maybe it worth to edit the TODO comment. |
||
IRB.CreateCall(EndCf, {Exec}); | ||
} | ||
|
||
return true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should StructurizeCFG have not preserved these locations then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, but let's "revert" the change first and then what the structurizer should do there.