[llvm] [coro] Fix crash due to DILabel in `LineTableOnly` mode (PR #148095)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 10 18:17:09 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Adrian Vogelsgesang (vogelsgesang)
<details>
<summary>Changes</summary>
Since the recent commit de3c8410d8, the `CoroSplit` pass adds `DILabel`s to help find the location of a suspension point from its suspension point id. Those labels are added in both `DebugEmissionKind::FullDebug` and `DebugEmissionKind::LineTableOnly` mode. The idea was that this information is necessary to reconstruct async stack traces and should hence also be available for LineTableOnly.
Unfortunately, it turns out that the DWARF backend does not expect to find any DILabel debug metadata if the emission kind is set to LineTableOnly. The Dwarf backend simply runs into an assertion in that case.
This commit fixes the issue by only adding `DILabel` for FullDebug.
---
Full diff: https://github.com/llvm/llvm-project/pull/148095.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Coroutines/CoroSplit.cpp (+3-5)
``````````diff
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 077dbe697a87e..6e5a017238c20 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -1485,11 +1485,9 @@ struct SwitchCoroutineSplitter {
// without debug info. So we also don't generate debug info for the
// suspension points.
bool AddDebugLabels =
- (DIS && DIS->getUnit() &&
- (DIS->getUnit()->getEmissionKind() ==
- DICompileUnit::DebugEmissionKind::FullDebug ||
- DIS->getUnit()->getEmissionKind() ==
- DICompileUnit::DebugEmissionKind::LineTablesOnly));
+ DIS && DIS->getUnit() &&
+ (DIS->getUnit()->getEmissionKind() ==
+ DICompileUnit::DebugEmissionKind::FullDebug);
// resume.entry:
// %index.addr = getelementptr inbounds %f.Frame, %f.Frame* %FramePtr, i32
``````````
</details>
https://github.com/llvm/llvm-project/pull/148095
More information about the llvm-commits
mailing list