[PATCH] D97673: [RFC] [[Coroutine] [Debug] Salvage dbg.value at O2
Chuanqi Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 1 03:18:47 PST 2021
ChuanqiXu created this revision.
ChuanqiXu added reviewers: aprantl, lxfind, bruno, efriedma, junparser, dongAxis1944.
Herald added a subscriber: hiraditya.
ChuanqiXu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The previous implementation of coro-split didn't collect values used by dbg instructions into the spills which made a log debug info unavailable at O2 <https://reviews.llvm.org/owners/package/2/>.
This patch tries to collect these uses which are used by dbg.values. In this way, the debugbility of coroutine could be as powerful as normal functions at O2 <https://reviews.llvm.org/owners/package/2/>.
However, the coroutine frame may get larger after this patch. Consider following example:
%0 = bitcast %a to ...
call dbg.value(metadata %0, ...) // %0 is only used in this instruction
%0 would be put in the coroutine frame after this patch, which is obviously redundant. Considering O2 <https://reviews.llvm.org/owners/package/2/> would lose many debug information naturally, it makes no sense to weaken the speed/size for debug info. So maybe we need to add an option for this patch.
Further more, the example above shows an optimization chance when constructing coroutine frame: if we can calculate a value in the frame only by other values in the frame, then the first value isn't necessary. This idea resembles the process of rematerialization in register allocation. Although we have a lot of resources to build the frame, I think such optimization could be valuable.
Test-plan: check-llvm
https://reviews.llvm.org/D97673
Files:
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/lib/Transforms/Coroutines/CoroInternal.h
llvm/test/Transforms/Coroutines/coro-debug-dbg.values-O2.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97673.327065.patch
Type: text/x-patch
Size: 15343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210301/75aef288/attachment.bin>
More information about the llvm-commits
mailing list