Files
swift-mirror/test/DebugInfo/linetable-do.swift
Andrew Trick 4eb7351f4d Disable MandatoryCopyPropagation.
Mandatory copy propagation was primarily a stop-gap until lexcial
lifetimes were implemented. It supposedly made variables lifetimes
more consistent between -O and -Onone builds. Now that lexical
lifetimes are enabled, it is no longer needed for that purpose (and
will never satisfactorily meet that goal anyway).

Mandatory copy propagation may be enabled again later as a -Onone "
optimization. But that requires a more careful audit of the effect on
debug information.

For now, it should be disabled.
2022-02-18 17:29:04 -08:00

46 lines
1.3 KiB
Swift

// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-ir -g -o - | %FileCheck %s
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck --check-prefixes=CHECK-SIL %s
import StdlibUnittest
class Obj {}
func foo (_ a : Int64) throws -> Void {
_blackHole(a)
}
// CHECK-SIL: // main.testDoStmt() throws -> ()
func testDoStmt() throws -> Void {
_blackHole(23)
// CHECK-NOT: !DILocation(line: [[@LINE+1]]
do {
let obj = Obj()
_blackHole(obj)
// The poison debug_value takes the location of the original decl.
try foo(100)
// CHECK-SIL: bb{{.*}}(%{{[0-9]+}} : $()):
// CHECK-SIL-NEXT: strong_release {{.*}}: $Obj{{.*}} line:[[@LINE+1]]:3:cleanup
}
// CHECK-SIL-NEXT: = tuple ()
// CHECK-SIL-NEXT: return {{.*}} line:[[@LINE+1]]
}
try testDoStmt()
// CHECK-SIL: // main.testDoWhileStmt() -> ()
func testDoWhileStmt() -> Void {
// CHECK-NOT: !DILocation(line: [[@LINE+1]]
do {
try foo(100)
// CHECK-SIL: bb{{.*}}(%{{[0-9]+}} : $()):
// CHECK-SIL-NEXT: br [[RETURN_BB:bb[0-9]+]]{{.*}} line:[[@LINE+1]]:3:cleanup
}
// CHECK-SIL: [[RETURN_BB]]:
// CHECK-SIL-NEXT: = tuple ()
// CHECK-SIL-NEXT: return
catch (let e) {
_blackHole(e)
}
}