[PATCH] D158638: [CoroSplit][DebugInfo] Don't use entry_value for async args in 32-bit targets
Felipe de Azevedo Piovezan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 23 10:12:13 PDT 2023
fdeazeve created this revision.
fdeazeve added a reviewer: aprantl.
Herald added subscribers: ChuanqiXu, pengfei, hiraditya, kristof.beyls.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Only X86_64 and ARM64 have a reserved register for async arguments, and so the
debugger is only able to handle those targets. For other architectures, we use a
non-entry-value expression and let the debugger do its best with that.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158638
Files:
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
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
@@ -1,6 +1,10 @@
-; RUN: opt %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s
+; RUN: opt -mtriple='arm64-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s
+; RUN: opt -mtriple='x86_64' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s
+; RUN: opt -mtriple='i386-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s --check-prefix=NOENTRY
+; RUN: opt -mtriple='armv7-' %s -S -passes='module(coro-early),cgscc(coro-split,simplifycfg)' -o - | FileCheck %s --check-prefix=NOENTRY
+; NOENTRY-NOT: OP_llvm_entry_value
+
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
-target triple = "arm64-apple-macosx13.0.0"
; This coroutine has one split point and two variables defined by:
; %var_with_dbg_value, which has multiple dbg.value intrinsics associated with
Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -701,9 +701,12 @@
SmallVector<DbgVariableIntrinsic *, 8> Worklist =
collectDbgVariableIntrinsics(*NewF);
SmallDenseMap<Argument *, AllocaInst *, 4> ArgToAllocaMap;
+
+ bool UseEntryValue =
+ llvm::Triple(OrigF.getParent()->getTargetTriple()).isArch64Bit();
for (DbgVariableIntrinsic *DVI : Worklist)
coro::salvageDebugInfo(ArgToAllocaMap, DVI, Shape.OptimizeFrame,
- false /*IsEntryPoint*/);
+ UseEntryValue);
// Remove all salvaged dbg.declare intrinsics that became
// either unreachable or stale due to the CoroSplit transformation.
@@ -1997,7 +2000,7 @@
SmallDenseMap<Argument *, AllocaInst *, 4> ArgToAllocaMap;
for (auto *DDI : collectDbgVariableIntrinsics(F))
coro::salvageDebugInfo(ArgToAllocaMap, DDI, Shape.OptimizeFrame,
- true /*IsEntryPoint*/);
+ false /*UseEntryValue*/);
return Shape;
}
Index: llvm/lib/Transforms/Coroutines/CoroFrame.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -1883,7 +1883,7 @@
// 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,
- true /*IsEntryPoint*/);
+ false /*UseEntryValue*/);
}
}
@@ -2819,7 +2819,7 @@
void coro::salvageDebugInfo(
SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
- DbgVariableIntrinsic *DVI, bool OptimizeFrame, bool IsEntryPoint) {
+ DbgVariableIntrinsic *DVI, bool OptimizeFrame, bool UseEntryValue) {
Function *F = DVI->getFunction();
IRBuilder<> Builder(F->getContext());
auto InsertPt = F->getEntryBlock().getFirstInsertionPt();
@@ -2874,7 +2874,7 @@
// 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())
+ if (IsSwiftAsyncArg && UseEntryValue && !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: D158638.552782.patch
Type: text/x-patch
Size: 3793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230823/d3b3258f/attachment.bin>
More information about the llvm-commits
mailing list