Skip to content

Commit 8e73eb2

Browse files
committed
SwiftCompilerSources: workaround a compiler crash on windows by disabling convert_function simplification
1 parent 1f1ea3f commit 8e73eb2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyConvertEscapeToNoEscape.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ private extension ConvertEscapeToNoEscapeInst {
2828
/// %3 = thin_to_thick_function %1 to $@noescape () -> ()
2929

3030
func tryCombineWithThinToThickOperand(_ context: SimplifyContext) {
31+
// compiling bridged.getFunctionTypeWithNoEscape crashes the 5.10 Windows compiler
32+
#if !os(Windows)
33+
// TODO: https://github.com/apple/swift/issues/73253
34+
3135
if let thinToThick = fromFunction as? ThinToThickFunctionInst {
3236
let builder = Builder(before: self, context)
3337
let noEscapeFnType = thinToThick.type.getFunctionType(withNoEscape: true)
@@ -36,5 +40,6 @@ private extension ConvertEscapeToNoEscapeInst {
3640
uses.replaceAll(with: newThinToThick, context)
3741
context.erase(instruction: self)
3842
}
43+
#endif
3944
}
4045
}

SwiftCompilerSources/Sources/SIL/Type.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,13 @@ public struct Type : CustomStringConvertible, NoReflectionChildren {
142142
return idx >= 0 ? idx : nil
143143
}
144144

145+
// compiling bridged.getFunctionTypeWithNoEscape crashes the 5.10 Windows compiler
146+
#if !os(Windows)
147+
// TODO: https://github.com/apple/swift/issues/73253
145148
public func getFunctionType(withNoEscape: Bool) -> Type {
146149
bridged.getFunctionTypeWithNoEscape(withNoEscape).type
147150
}
151+
#endif
148152

149153
public var description: String {
150154
String(taking: bridged.getDebugDescription())

test/SILOptimizer/simplify_convert_escape_to_noescape.sil

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
// REQUIRES: swift_in_compiler
44

5+
// https://github.com/apple/swift/issues/73253
6+
// UNSUPPORTED: OS=windows-msvc
7+
58
sil_stage canonical
69

710
import Builtin

0 commit comments

Comments
 (0)