Files
swift-mirror/test/SILOptimizer/predictable_memopt_locs.swift
Adrian Prantl 78e074dbf6 Fix the debug locations of inserted operations in AvailableValueAggregator.
This mandatory pass inserts struct_extract operations before earlier
stores to the aggregate but didn't set the debug location of those new
instructions to the location of the store, which caused unexpected
stepping behavior in the debugger.

Fixes a regression from e74367f2b3.
<rdar://problem/35459092>
2017-11-15 13:30:39 -08:00

23 lines
696 B
Swift

// RUN: %target-swift-frontend -emit-sil -Xllvm -sil-print-debuginfo %s \
// RUN: | %FileCheck %s
struct MyStruct {
var a = 12
}
public func use<T>(_ t : T){}
public func main() {
var a = MyStruct() // line 11
// Verify that the inserted struct_extract has the same location as the store.
// CHECK: %[[A:.*]] = apply {{.*}} -> MyStruct,
// CHECK-SAME: loc {{.*}}:11:10, scope [[S:[0-9]+]]
// CHECK-NEXT: %[[I:.*]] = struct_extract %[[A]]
// CHECK-SAME: loc {{.*}}:11:10, scope [[S]]
// CHECK-NEXT: struct_extract %[[I]]
// CHECK-SAME: loc {{.*}}:11:10, scope [[S]]
// CHECK: store %[[A]] to %0 : $*MyStruct,
// CHECK-SAME: loc {{.*}}:11:10, scope [[S]]
use(a.a)
}