Skip to content

Add DIExpression::foldConstantMath to CoroSplit #107933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2659,6 +2659,7 @@ salvageDebugInfoImpl(SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
Expr = DIExpression::prepend(Expr, DIExpression::DerefBefore);
}

Expr = Expr->foldConstantMath();
return {{*Storage, *Expr}};
}

Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/Coroutines/swift-async-dbg.ll
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ define swifttailcc void @coroutineA(ptr swiftasync %arg) !dbg !48 {
; CHECK-LABEL: define {{.*}} @coroutineA(
; CHECK-SAME: ptr swiftasync %[[frame_ptr:.*]])
; CHECK: #dbg_declare(ptr %[[frame_ptr]], {{.*}} !DIExpression(
; CHECK-SAME: DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 8)
; CHECK-SAME: DW_OP_plus_uconst, 24)
; CHECK: #dbg_value(ptr %[[frame_ptr]], {{.*}} !DIExpression(
; CHECK-SAME: DW_OP_plus_uconst, 16, DW_OP_deref)
; CHECK: call {{.*}} @swift_task_switch
Expand All @@ -49,7 +49,7 @@ define swifttailcc void @coroutineA(ptr swiftasync %arg) !dbg !48 {
; CHECK-LABEL: define {{.*}} @coroutineATY0_(
; CHECK-SAME: ptr swiftasync %[[frame_ptr:.*]])
; CHECK: #dbg_declare(ptr %[[frame_ptr]], {{.*}} !DIExpression(
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 8)
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 24)
; CHECK: #dbg_value(ptr %[[frame_ptr]], {{.*}} !DIExpression(
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 16, DW_OP_deref)
; CHECK: #dbg_value(!DIArgList(ptr %[[frame_ptr]], i32 %{{.*}}), {{.*}} !DIExpression(
Expand All @@ -70,7 +70,7 @@ define swifttailcc void @coroutineA(ptr swiftasync %arg) !dbg !48 {
; CHECK-SAME: ptr swiftasync %[[frame_ptr:.*]])
; Note the extra level of indirection that shows up here!
; CHECK: #dbg_declare(ptr %[[frame_ptr]], {{.*}} !DIExpression(
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_deref, DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 8)
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_deref, DW_OP_plus_uconst, 24)
; CHECK: #dbg_value(ptr %[[frame_ptr]], {{.*}} !DIExpression(
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_deref, DW_OP_plus_uconst, 16, DW_OP_deref)
; CHECK: call {{.*}} @swift_task_switch
Expand All @@ -85,7 +85,7 @@ define swifttailcc void @coroutineA(ptr swiftasync %arg) !dbg !48 {
; CHECK-LABEL: define {{.*}} @coroutineATY2_(
; CHECK-SAME: ptr swiftasync %[[frame_ptr:.*]])
; CHECK: #dbg_declare(ptr %[[frame_ptr]], {{.*}} !DIExpression(
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 8)
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 24)
}

; Everything from here on is just support code for the coroutines.
Expand Down
Loading