Files
swift-mirror/test/SILOptimizer/definite_init_hang.swift
Michael Gottesman 46432404f3 [ownership] Remove dead option: enable-ownership-stripping-after-serialization.
We always lower ownership now after the diagnostic passes (what this option
actually controlled). So remove it.

NFC.
2020-06-16 10:52:02 -07:00

62 lines
1.8 KiB
Swift

// RUN: %target-swift-frontend -emit-sil %s -parse-as-library -o /dev/null -verify
// RUN: %target-swift-frontend -emit-sil %s -parse-as-library -o /dev/null -verify
var gg: Bool = false
var rg: Int = 0
func f1() { }
func f2() { }
// The old implementation of the LifetimeChecker in DefiniteInitialization had
// an exponential computation complexity in some cases.
// This test should finish in almost no time. With the old implementation it
// took about 8 minutes.
func testit() {
var tp: (a: Int, b: Int, c: Int) // expected-note {{variable defined here}}
tp.a = 1
while gg {
if gg {
rg = tp.a
rg = tp.b // expected-error {{variable 'tp.b' used before being initialized}}
tp.c = 27
}
// Create some control flow.
// With the old implementation each line doubles the computation time.
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
if gg { f1() } else { f2() }
}
}