Files
swift-mirror/test/SILOptimizer/simplify-cfg-crash.swift
Erik Eckstein 6c85f267bf SimplifyCFG: fix a crash caused by an unreachable CFG cycles with block arguments.
When SimplifyCFG (temporarily) produces an unreachable CFG cycle, some other transformations in SimplifyCFG didn't deal with this situation correctly.

Unfortunately I couldn't create a SIL test case for this bug, so I just added a swift test case.

https://bugs.swift.org/browse/SR-13650
rdar://problem/69942431
2020-10-15 15:04:16 +02:00

24 lines
430 B
Swift

// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
// Check that the optimizer does not crash.
public class Base {
@inline(never)
final func next() -> Base? {
return self
}
}
public class Derived : Base {}
// CHECK: sil {{.*}}testit
public func testit(_ x: Base?) -> Derived? {
var i: Base? = x
while (i is Derived) == false && i != nil {
i = i?.next()
}
return i as? Derived
}