Skip to content

Commit 3fa7590

Browse files
Merge pull request swiftlang#36539 from aschwaighofer/fix_constant_debug_info_async
IRGen: Fix debug_value emission for constants in async functions
2 parents 63ae196 + 414e6c7 commit 3fa7590

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ class IRGenSILFunction :
928928
// Mark variables in async functions that don't generate a shadow copy for
929929
// lifetime extension, so they get spilled into the async context.
930930
if (!IGM.IRGen.Opts.shouldOptimize() && CurSILFn->isAsync())
931-
if (isa<llvm::AllocaInst>(Storage) || isa<llvm::Constant>(Storage)) {
931+
if (isa<llvm::AllocaInst>(Storage)) {
932932
if (emitLifetimeExtendingUse(Storage))
933933
if (ValueVariables.insert(Storage).second)
934934
ValueDomPoints.push_back({Storage, getActiveDominancePoint()});
@@ -4718,8 +4718,8 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) {
47184718
return;
47194719

47204720
IndirectionKind Indirection = DirectValue;
4721-
if (CurSILFn->isAsync() &&
4722-
!i->getDebugScope()->InlinedCallSite) {
4721+
if (CurSILFn->isAsync() && !i->getDebugScope()->InlinedCallSite &&
4722+
(Copy.empty() || !isa<llvm::Constant>(Copy[0]))) {
47234723
Indirection = CoroDirectValue;
47244724
}
47254725

test/DebugInfo/async-local-var.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ func getString() async -> String {
1212
func wait() async throws {}
1313

1414
public func makeDinner() async throws -> String {
15+
let local_constant = 5
1516
let local = await getString()
1617
try await wait()
1718
// CHECK-LABEL: define {{.*}} void @"$s1a10makeDinnerSSyYKFTQ0_"

0 commit comments

Comments
 (0)