[PATCH] D97673: [RFC] [[Coroutine] [Debug] Salvage dbg.value at O2
Chuanqi Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 19 19:43:38 PDT 2021
ChuanqiXu added a comment.
In D97673#2697366 <https://reviews.llvm.org/D97673#2697366>, @lxfind wrote:
>> Previously all `dbg.value`s would be lost after CoroSplit pass. `dbg.value` is debug info compiler produced under optimization. This patch wants to remain as many `dbg.value` as possible while it don't want to change the layout of frame for debug info.
>
> Why would all `dbg.value`s be lost after CoroSplit pass? As long as they are in the resume code path, they would be kept in the .resume function, right?
> I also tried to run coro-split on coro-debug-dbg.values-O2.ll, I do see a ton of dbg.value in the generate functions even without this patch.
> Could you elaborate what is the exact problem, perhaps ideally with an example?
The problem here is when we collect values to be put on the frame and insert values to the frame, we didn't care about the `dbg.value`s.
Here is the example:
define void @f(i32 %i, i32 %j) {
; ...
; coro.suspend
call void @llvm.dbg.value(metadata i32 %i, metadata !1, metadata !DIExpression()) ; tell the value !1 from %i
call void @llvm.dbg.value(metadata i32 %j, metadata !2, metadata !DIExpression()) ; tell the value !2 from %j
}
Then in the .resume function:
define internal fastcc void @f.resume(%f.Frame* noalias nonnull align 16 dereferenceable(80) %FramePtr)
; ...
call void @llvm.dbg.value(metadata i32 %i, metadata !1, metadata !DIExpression())
call void @llvm.dbg.value(metadata i32 %j, metadata !2, metadata !DIExpression())
These two dbg.values are trying to tell values of !1 and !2 from values %i and %j. But wait, there is no definition for %I and %j in the resume function. So finally, the resume function would become:
define internal fastcc void @f.resume(%f.Frame* noalias nonnull align 16 dereferenceable(80) %FramePtr)
; ...
call void @llvm.dbg.value(metadata i32 undef, metadata !1, metadata !DIExpression())
call void @llvm.dbg.value(metadata i32 undef, metadata !2, metadata !DIExpression())
This patch wants to salvage the dbg.values whose first operand is in the frame already. The reason why you can find some `dbg.value`s in resume function is that their first operand is either constant or defined in the resume function (like alloca who wouldn't across suspend points).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97673/new/
https://reviews.llvm.org/D97673
More information about the llvm-commits
mailing list