[PATCH] D97673: [RFC] [[Coroutine] [Debug] Salvage dbg.values
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 2 18:47:47 PST 2021
hoy added a comment.
In D97673#3168739 <https://reviews.llvm.org/D97673#3168739>, @ChuanqiXu wrote:
> In D97673#3168737 <https://reviews.llvm.org/D97673#3168737>, @hoy wrote:
>
>> In D97673#3168709 <https://reviews.llvm.org/D97673#3168709>, @ChuanqiXu wrote:
>>
>>> @hoy The rationale here is that the dbg.declare intrinsics might be lost due to coroutine split. So we move the dbg.declare intrinsics to the place where the Storage is just created. So if it caused crash, I think we could skip the kind of case. Or it would be better to insert dbg.declare to the start of successor blocks in the case of invoke. (Would any other terminator return a value?)
>>> BTW, there is nothing in your repro link.
>>
>> An invoke instruction is a call instruction that can throw exceptions. It is a block terminator and can return a value. Looks like dbg.declare can only appear once so maybe we could only move it to one of the successors, or just skip this case.
>>
>> There is a test file in my repro link. The file is probably too large (40MB) to be rendered. Sorry for not being able to get a smaller repro case.
>
> Got it. I would try to fix this. Thanks for reporting this.
Thanks. I'm pasting the problematic code snippet in case my link doesn't work for you, but please let me know so that I'll find another way to share with you.
%660 = invoke noalias nonnull i8* @_Znwm(i64 120) #20
to label %.noexc unwind label %702, !dbg !304801
.noexc: ; preds = %653
call void @llvm.dbg.value(metadata %"class.std::allocator.6883"* undef, metadata !304802, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg !304803
call void @llvm.dbg.value(metadata i8* %660, metadata !304802, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !304803
call void @llvm.dbg.value(metadata i8* %660, metadata !304804, metadata !DIExpression()), !dbg !304803
call void @llvm.dbg.value(metadata i8* %660, metadata !303143, metadata !DIExpression()), !dbg !304805
%661 = bitcast i8* %660 to %"class.std::_Sp_counted_base"*, !dbg !304808
call void @_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EEC2Ev(%"class.std::_Sp_counted_base"* nonnull dereferenceable(16) %661) #15, !dbg !304809
%662 = bitcast i8* %660 to i32 (...)***, !dbg !304808
store i32 (...)** bitcast (i8** getelementptr inbounds ({ [7 x i8*] }, { [7 x i8*] }* @_ZTVSt23_Sp_counted_ptr_inplaceIN7scribex17ScribeReadFlavourESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %662, align 8, !dbg !304808, !tbaa !302581
call void @llvm.dbg.value(metadata i8* %660, metadata !303156, metadata !DIExpression()), !dbg !304810
....
call void @llvm.dbg.declare(metadata i8* %660, metadata !303236, metadata !DIExpression(DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 8)), !dbg !304825
The last dbg.declare will be moved to right after the first invoke instruction.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97673/new/
https://reviews.llvm.org/D97673
More information about the llvm-commits
mailing list