Files
swift-mirror/test/SILOptimizer/stack_promotion_array_literal.swift
Erik Eckstein d9c71e8bd7 EscapeAnalysis: handle fix_lifetime instructions
This fixes wrong reported escapes of the self reference in destructors.

rdar://problem/31409766
2017-04-19 12:31:21 -07:00

20 lines
512 B
Swift

// RUN: %target-swift-frontend -parse-as-library -O -module-name=test %s -emit-sil | %FileCheck %s
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
// This is an end-to-end test to check if the array literal in the loop is
// stack promoted.
// CHECK-LABEL: sil @{{.*}}testit
// CHECK: alloc_ref [stack] [tail_elems
public func testit(_ N: Int) {
for _ in 0..<N {
for _ in 0..<10 {
var nums = [Int]()
for _ in 0..<40_000 {
nums += [1, 2, 3, 4, 5, 6, 7]
}
}
}
}