mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
PredictableMemoryAccessOptimizations has become unmaintainable as-is. RedundantLoadElimination does (almost) the same thing as PredictableMemoryAccessOptimizations. It's not as powerful but good enough because PredictableMemoryAccessOptimizations is actually only needed for promoting integer values for mandatory constant propagation. And most importantly: RedundantLoadElimination does not insert additional copies which was a big problem in PredictableMemoryAccessOptimizations. Fixes rdar://142814676
21 lines
632 B
Swift
21 lines
632 B
Swift
// RUN: %target-swift-frontend -Xllvm -sil-print-types -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: store %[[A]] to %0 : $*MyStruct,
|
|
// CHECK-SAME: loc {{.*}}:11:10, scope [[S]]
|
|
use(a.a)
|
|
}
|