[llvm] [AMDGPU] Fix incorrect stepping in gdb for amdgcn.end.cf intrinsic. (PR #83010)

Valery Pykhtin via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 08:18:32 PDT 2024


================
@@ -336,8 +342,9 @@ 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);
+    IRB.SetCurrentDebugLocation(DebugLoc());
----------------
vpykhtin wrote:

@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.

https://github.com/llvm/llvm-project/pull/83010


More information about the llvm-commits mailing list