Files
swift-mirror/validation-test/SILOptimizer/large_switch.gyb
Erik Eckstein b741aa0018 SILOptimizer: fix a stack overflow in DCE
For very large control flow graphs the markControllingTerminatorsLive can stack overflow.
Fix this by doing the work iteratively instead of recursively.

rdar://106198943
2023-03-08 12:20:45 +01:00

20 lines
484 B
Plaintext

// RUN: %empty-directory(%t)
// RUN: %gyb %s > %t/main.swift
// RUN: %target-swift-frontend -O -parse-as-library -sil-verify-none -emit-sil %t/main.swift -o /dev/null
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
// REQUIRES: long_test
// Check that the compiler does not crash in DCE due to a stack overflow.
// rdar://106198943
public func test(_ a: Int) -> Int {
switch (a) {
% for i in range(32000):
case ${i}: return ${i % 7}
% end
default: return -1
}
}