Files
swift-mirror/test/DebugInfo/async-local-var.swift
Adrian Prantl dfb17cd71e Remove an extra load that was generated for coro shadow copies.
This commit is similar to cbb89c78d, but for explosions.  emitShadowCopyIfNeeded()
has some extra code that was added when function arguments were moved out of the
async context to ensure that they are being lifetime-extended, and there is also
code that generates an incorrect load from the shadow copy. However,
emitShadowCopyIfNeeded is supposed return either an alloca or the value, and
IRGenDebugInfo knows to describe the value in the alloca already. The load is
counterproductive it's only valid until whatever register it ends up in is
clobbered, whereas the alloca is valid throughout the function.

This patch removes the load and updates the tests accordingly.

rdar://81565869
(cherry picked from commit b7e2b2a6e7)
2021-08-17 16:51:07 -07:00

23 lines
706 B
Swift

// RUN: %target-swift-frontend %s -emit-ir -g -o - \
// RUN: -module-name a -disable-availability-checking \
// RUN: | %FileCheck %s --check-prefix=CHECK
// REQUIRES: concurrency
func getString() async -> String {
return ""
}
func wait() async throws {}
public func makeDinner() async throws -> String {
let local_constant = 5
let local = await getString()
try await wait()
// CHECK-LABEL: define {{.*}} void @"$s1a10makeDinnerSSyYaKFTQ0_"
// CHECK-NEXT: entryresume.0:
// CHECK-NOT: {{ ret }}
// CHECK: call void @llvm.dbg.declare(metadata {{.*}}%0, metadata ![[LOCAL:[0-9]+]], {{.*}}!DIExpression(DW_OP_plus_uconst
// CHECK: ![[LOCAL]] = !DILocalVariable(name: "local"
return local
}