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

Scott Linder via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 14:50:14 PST 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());
----------------
slinder1 wrote:

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 `if_else` test are:

```
[[DBG13]] = !DILocation(line: 1, column: 1, scope: [[DBG5]])
[[DBG14]] = !DILocation(line: 2, column: 1, scope: [[DBG5]])
[[DBG15]] = !DILocation(line: 3, column: 1, scope: [[DBG5]])
[[DBG16]] = !DILocation(line: 4, column: 1, scope: [[DBG5]])
[[DBG17]] = !DILocation(line: 5, column: 1, scope: [[DBG5]])
[[DBG18]] = !DILocation(line: 6, column: 1, scope: [[DBG5]])
```

Where `DBG18` is associated with the `return` instruction.

This change drops `, !dbg [[DBG18:![0-9]+]]` from the `end.cf` call in the `exit` block. If the description in the comment applied wouldn't we have been emitting `, !dbg [[DBG13]]` or `, !dbg [[DBG14]]` before?

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


More information about the llvm-commits mailing list