[PATCH] D158108: [CoroSplit][DebugInfo] Don't use entry_value in coroutine entry point
Felipe de Azevedo Piovezan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 17 06:15:45 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8aa038ab1709: [CoroSplit][DebugInfo] Don't use entry_value in coroutine entry point (authored by fdeazeve).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158108/new/
https://reviews.llvm.org/D158108
Files:
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/lib/Transforms/Coroutines/CoroInternal.h
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/test/Transforms/Coroutines/swift-async-dbg.ll
Index: llvm/test/Transforms/Coroutines/swift-async-dbg.ll
===================================================================
--- llvm/test/Transforms/Coroutines/swift-async-dbg.ll
+++ llvm/test/Transforms/Coroutines/swift-async-dbg.ll
@@ -19,9 +19,9 @@
; CHECK-LABEL: define {{.*}} @coroutineA(
; CHECK-SAME: ptr swiftasync %[[frame_ptr:.*]])
; CHECK: @llvm.dbg.declare(metadata 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_plus_uconst, 16, DW_OP_plus_uconst, 8)
; CHECK: @llvm.dbg.value(metadata ptr %[[frame_ptr]], {{.*}} !DIExpression(
-; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 16, DW_OP_deref)
+; CHECK-SAME: DW_OP_plus_uconst, 16, DW_OP_deref)
; CHECK: call {{.*}} @swift_task_switch
%i7 = call ptr @llvm.coro.async.resume(), !dbg !54
Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -702,7 +702,8 @@
collectDbgVariableIntrinsics(*NewF);
SmallDenseMap<Argument *, AllocaInst *, 4> ArgToAllocaMap;
for (DbgVariableIntrinsic *DVI : Worklist)
- coro::salvageDebugInfo(ArgToAllocaMap, DVI, Shape.OptimizeFrame);
+ coro::salvageDebugInfo(ArgToAllocaMap, DVI, Shape.OptimizeFrame,
+ false /*IsEntryPoint*/);
// Remove all salvaged dbg.declare intrinsics that became
// either unreachable or stale due to the CoroSplit transformation.
@@ -1995,7 +1996,8 @@
// coroutine funclets.
SmallDenseMap<Argument *, AllocaInst *, 4> ArgToAllocaMap;
for (auto *DDI : collectDbgVariableIntrinsics(F))
- coro::salvageDebugInfo(ArgToAllocaMap, DDI, Shape.OptimizeFrame);
+ coro::salvageDebugInfo(ArgToAllocaMap, DDI, Shape.OptimizeFrame,
+ true /*IsEntryPoint*/);
return Shape;
}
Index: llvm/lib/Transforms/Coroutines/CoroInternal.h
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroInternal.h
+++ llvm/lib/Transforms/Coroutines/CoroInternal.h
@@ -32,7 +32,7 @@
/// OptimizeFrame is false.
void salvageDebugInfo(
SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
- DbgVariableIntrinsic *DVI, bool OptimizeFrame);
+ DbgVariableIntrinsic *DVI, bool OptimizeFrame, bool IsEntryPoint);
// Keeps data and helper functions for lowering coroutine intrinsics.
struct LowererBase {
Index: llvm/lib/Transforms/Coroutines/CoroFrame.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -1882,7 +1882,8 @@
&*Builder.GetInsertPoint());
// This dbg.declare is for the main function entry point. It
// will be deleted in all coro-split functions.
- coro::salvageDebugInfo(ArgToAllocaMap, DDI, Shape.OptimizeFrame);
+ coro::salvageDebugInfo(ArgToAllocaMap, DDI, Shape.OptimizeFrame,
+ true /*IsEntryPoint*/);
}
}
@@ -2818,7 +2819,7 @@
void coro::salvageDebugInfo(
SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
- DbgVariableIntrinsic *DVI, bool OptimizeFrame) {
+ DbgVariableIntrinsic *DVI, bool OptimizeFrame, bool IsEntryPoint) {
Function *F = DVI->getFunction();
IRBuilder<> Builder(F->getContext());
auto InsertPt = F->getEntryBlock().getFirstInsertionPt();
@@ -2870,7 +2871,10 @@
// Swift async arguments are described by an entry value of the ABI-defined
// register containing the coroutine context.
- if (IsSwiftAsyncArg && !Expr->isEntryValue())
+ // For the EntryPoint funclet, don't use EntryValues. This funclet can be
+ // inlined, which would remove the guarantee that this intrinsic targets an
+ // Argument.
+ if (IsSwiftAsyncArg && !IsEntryPoint && !Expr->isEntryValue())
Expr = DIExpression::prepend(Expr, DIExpression::EntryValue);
// If the coroutine frame is an Argument, store it in an alloca to improve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158108.551108.patch
Type: text/x-patch
Size: 4270 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230817/6cc2c6cd/attachment.bin>
More information about the llvm-commits
mailing list