Merge pull request #4201 from benrimmington/docs-text-output-streamable

[docs] Streamable => TextOutputStreamable, NFC
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index eca0ecc..a549804 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -48,10 +48,13 @@
         Platform     | Comment
         ------------ | -------------
         All supported platforms     | @swift-ci Please test
+        All supported platforms     | @swift-ci Please clean test
         All supported platforms     | @swift-ci Please test and merge
         OS X platform               | @swift-ci Please test OS X platform
+        OS X platform               | @swift-ci Please clean test OS X platform
         OS X platform               | @swift-ci Please benchmark
         Linux platform              | @swift-ci Please test Linux platform
+        Linux platform              | @swift-ci Please clean test Linux platform
 
 
 **Lint Testing**
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0dfcb0b..4893b0c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,24 @@
 Swift 3.0
 ---------
 
+* [SE-0045](https://github.com/apple/swift-evolution/blob/master/proposals/0045-scan-takewhile-dropwhile.md)
+
+  The `Sequence` protocol now includes two new members, `prefix(while:)` and
+  `drop(while:)`.  `prefix(while:)` is used to request the longest subsequence
+  satisfying a predicate.  `drop(while:)` is used to request the subsequence
+  remaining after dropping the longest subsequence satisfying a predicate.
+
+* [SE-0136](https://github.com/apple/swift-evolution/blob/master/proposals/0136-memory-layout-of-values.md) and [SE-0101](https://github.com/apple/swift-evolution/blob/master/proposals/0101-standardizing-sizeof-naming.md)
+
+  The functions `sizeof()`, `strideof()`, and `alignof()` have been removed.
+  Instead, these memory layout properties for a type `T` are now spelled
+  `MemoryLayout<T>.size`, `MemoryLayout<T>.stride`, and
+  `MemoryLayout<T>.alignment`, respectively.
+
+  The functions `sizeofValue()`, `strideofValue()`, and `alignofValue()` have
+  been renamed `MemoryLayout.size(ofValue:)`, `MemoryLayout.stride(ofValue:)`,
+  and `MemoryLayout.alignment(ofValue:)`.
+
 * [SE-125](https://github.com/apple/swift-evolution/blob/master/proposals/0125-remove-nonobjectivecbase.md)
 
   The functions `isUniquelyReferenced()` and `isUniquelyReferencedNonObjC()`
@@ -221,9 +239,9 @@
   The `hasPrefix` and `hasSuffix` functions now consider the empty string to be a
   prefix and suffix of all strings.
 
-* [SE-128](https://github.com/apple/swift-evolution/blob/master/proposals/0128-unicodescalar-failable-initializer.md)
+* [SE-0128](https://github.com/apple/swift-evolution/blob/master/proposals/0128-unicodescalar-failable-initializer.md)
 
-  Some UnicodeScalar initializers (ones that are non-failable) now returns an Optional, 
+  Some UnicodeScalar initializers (ones that are non-failable) now return an Optional, 
   i.e., in case a UnicodeScalar can not be constructed, nil is returned.
 
   ```swift
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ca9db7..4a309cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,10 @@
   cmake_policy(SET CMP0051 NEW)
 endif()
 
+if(POLICY CMP0054)
+  cmake_policy(SET CMP0054 NEW)
+endif()
+
 # Add path for custom CMake modules.
 list(APPEND CMAKE_MODULE_PATH
     "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
diff --git a/README.md b/README.md
index 094174d..d7b654c 100644
--- a/README.md
+++ b/README.md
@@ -25,9 +25,7 @@
 To read the documentation, start by installing the
 [Sphinx](http://sphinx-doc.org) documentation generator tool by running the command:
 
-`easy_install -U Sphinx==1.3.4`
-
-More recent versions are currently **not supported.**
+`easy_install -U Sphinx`
 
 Once complete, you can build the Swift documentation by changing directory into
 [docs](https://github.com/apple/swift/tree/master/docs) and typing `make`. This compiles the `.rst` files in the [docs](https://github.com/apple/swift/tree/master/docs) directory
@@ -58,7 +56,7 @@
 
 For Ubuntu, you'll need the following development dependencies:
 
-    sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev
+    sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev
 
 **Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
 with version 2 shipped with Ubuntu.
diff --git a/apinotes/CallKit.apinotes b/apinotes/CallKit.apinotes
index 4bc3f52..036b244 100644
--- a/apinotes/CallKit.apinotes
+++ b/apinotes/CallKit.apinotes
@@ -14,3 +14,9 @@
   NSErrorDomain: CXErrorDomainRequestTransaction
 - Name: CXErrorCodeCallDirectoryManagerError
   NSErrorDomain: CXErrorDomainCallDirectoryManager
+- Name: CXCallDirectoryEnabledStatus
+  SwiftName: CXCallDirectoryManager.EnabledStatus
+- Name: CXPlayDTMFCallActionType
+  SwiftName: CXPlayDTMFCallAction.ActionType
+- Name: CXHandleType
+  SwiftName: CXHandle.HandleType
diff --git a/apinotes/CoreGraphics.apinotes b/apinotes/CoreGraphics.apinotes
index 80222c8..42ffd87 100644
--- a/apinotes/CoreGraphics.apinotes
+++ b/apinotes/CoreGraphics.apinotes
@@ -408,7 +408,6 @@
 # These are hidden so we can improve them further in the SDK overlay
 - Name: CGGetLastMouseDelta
   # replaced by a version that returns CGVector instead of using out-pointers
-  SwiftName: __CGGetLastMouseDelta
   SwiftPrivate: true
   
 # CGEvent
diff --git a/apinotes/CryptoTokenKit.apinotes b/apinotes/CryptoTokenKit.apinotes
index 1fca179..ad8574e 100644
--- a/apinotes/CryptoTokenKit.apinotes
+++ b/apinotes/CryptoTokenKit.apinotes
@@ -33,10 +33,6 @@
     SwiftPrivate: true
 - Name: TKSmartCardATRInterfaceGroup
   SwiftName: TKSmartCardATR.InterfaceGroup
-- Name: TKTokenKeyAlgorithm
-  SwiftName: TKTokenSessionDelegate.KeyAlgorithm
-- Name: TKTokenKeyExchangeParameters
-  SwiftName: TKTokenSessionDelegate.KeyExchangeParameters
 Protocols:
 - Name: TKTokenSessionDelegate
   Methods:
diff --git a/apinotes/Metal.apinotes b/apinotes/Metal.apinotes
index 4e35bc4..c23df57 100644
--- a/apinotes/Metal.apinotes
+++ b/apinotes/Metal.apinotes
@@ -14,3 +14,515 @@
   SwiftName: shared
 - Name: MTLTextureUsageUnknown
   SwiftName: unknown
+- Name: MTLDataTypeUInt
+  SwiftName: uint
+- Name: MTLDataTypeUInt2
+  SwiftName: uint2
+- Name: MTLDataTypeUInt3
+  SwiftName: uint3
+- Name: MTLDataTypeUInt4
+  SwiftName: uint4
+- Name: MTLDataTypeUShort
+  SwiftName: ushort
+- Name: MTLDataTypeUShort2
+  SwiftName: ushort2
+- Name: MTLDataTypeUShort3
+  SwiftName: ushort3
+- Name: MTLDataTypeUShort4
+  SwiftName: ushort4
+- Name: MTLDataTypeUChar
+  SwiftName: uchar
+- Name: MTLDataTypeUChar2
+  SwiftName: uchar2
+- Name: MTLDataTypeUChar3
+  SwiftName: uchar3
+- Name: MTLDataTypeUChar4
+  SwiftName: uchar4
+- Name: MTLPixelFormatRGBA8Unorm_sRGB
+  SwiftName: rgba8Unorm_srgb
+- Name: MTLPixelFormatBGRA8Unorm_sRGB
+  SwiftName: bgra8Unorm_srgb
+- Name: MTLPixelFormatRGB10A2Unorm
+  SwiftName: rgb10a2Unorm
+- Name: MTLPixelFormatRGB10A2Uint
+  SwiftName: rgb10a2Uint
+- Name: MTLPixelFormatRG11B10Float
+  SwiftName: rg11b10Float
+- Name: MTLPixelFormatRGB9E5Float
+  SwiftName: rgb9e5Float
+- Name: MTLPixelFormatBC1_RGBA
+  SwiftName: bc1_rgba
+- Name: MTLPixelFormatBC1_RGBA_sRGB
+  SwiftName: bc1_rgba_srgb
+- Name: MTLPixelFormatBC2_RGBA
+  SwiftName: bc2_rgba
+- Name: MTLPixelFormatBC2_RGBA_sRGB
+  SwiftName: bc2_rgba_srgb
+- Name: MTLPixelFormatBC3_RGBA
+  SwiftName: bc3_rgba
+- Name: MTLPixelFormatBC3_RGBA_sRGB
+  SwiftName: bc3_rgba_srgb
+- Name: MTLPixelFormatBC4_RUnorm
+  SwiftName: bc4_rUnorm
+- Name: MTLPixelFormatBC4_RSnorm
+  SwiftName: bc4_rSnorm
+- Name: MTLPixelFormatBC5_RGUnorm
+  SwiftName: bc5_rgUnorm
+- Name: MTLPixelFormatBC5_RGSnorm
+  SwiftName: bc5_rgSnorm
+- Name: MTLPixelFormatBC6H_RGBFloat
+  SwiftName: bc6H_rgbFloat
+- Name: MTLPixelFormatBC6H_RGBUfloat
+  SwiftName: bc6H_rgbuFloat
+- Name: MTLPixelFormatBC7_RGBAUnorm
+  SwiftName: bc7_rgbaUnorm
+- Name: MTLPixelFormatBC7_RGBAUnorm_sRGB
+  SwiftName: bc7_rgbaUnorm_srgb
+- Name: MTLPixelFormatGBGR422
+  SwiftName: gbgr422
+- Name: MTLPixelFormatBGRG422
+  SwiftName: bgrg422
+- Name: MTLPixelFormatDepth24Unorm_Stencil8
+  SwiftName: depth24Unorm_stencil8
+- Name: MTLPixelFormatDepth32Float_Stencil8
+  SwiftName: depth32Float_stencil8
+- Name: MTLPixelFormatX32_Stencil8
+  SwiftName: x32_stencil8
+- Name: MTLPixelFormatX24_Stencil8
+  SwiftName: x24_stencil8
+- Name: MTLPixelFormatR8Unorm_sRGB
+  SwiftName: r8Unorm_srgb
+- Name: MTLPixelFormatRG8Unorm_sRGB
+  SwiftName: rg8Unorm_srgb
+- Name: MTLPixelFormatB5G6R5Unorm
+  SwiftName: b5g6r5Unorm
+- Name: MTLPixelFormatA1BGR5Unorm
+  SwiftName: a1bgr5Unorm
+- Name: MTLPixelFormatBGR10_XR
+  SwiftName: bgr10_xr
+- Name: MTLPixelFormatBGR10_XR_sRGB
+  SwiftName: bgr10_xr_srgb
+- Name: MTLPixelFormatPVRTC_RGB_2BPP
+  SwiftName: pvrtc_rgb_2bpp
+- Name: MTLPixelFormatPVRTC_RGB_2BPP_sRGB
+  SwiftName: pvrtc_rgb_2bpp_srgb
+- Name: MTLPixelFormatPVRTC_RGB_4BPP
+  SwiftName: pvrtc_rgb_4bpp
+- Name: MTLPixelFormatPVRTC_RGB_4BPP_sRGB
+  SwiftName: pvrtc_rgb_4bpp_srgb
+- Name: MTLPixelFormatPVRTC_RGBA_2BPP
+  SwiftName: pvrtc_rgba_2bpp
+- Name: MTLPixelFormatPVRTC_RGBA_2BPP_sRGB
+  SwiftName: pvrtc_rgba_2bpp_srgb
+- Name: MTLPixelFormatPVRTC_RGBA_4BPP
+  SwiftName: pvrtc_rgba_4bpp
+- Name: MTLPixelFormatPVRTC_RGBA_4BPP_sRGB
+  SwiftName: pvrtc_rgba_4bpp_srgb
+- Name: MTLPixelFormatEAC_R11Unorm
+  SwiftName: eac_r11Unorm
+- Name: MTLPixelFormatEAC_R11Snorm
+  SwiftName: eac_r11Snorm
+- Name: MTLPixelFormatEAC_RG11Unorm
+  SwiftName: eac_rg11Unorm
+- Name: MTLPixelFormatEAC_RG11Snorm
+  SwiftName: eac_rg11Snorm
+- Name: MTLPixelFormatEAC_RGBA8
+  SwiftName: eac_rgba8
+- Name: MTLPixelFormatEAC_RGBA8_sRGB
+  SwiftName: eac_rgba8_srgb
+- Name: MTLPixelFormatETC2_RGB8
+  SwiftName: etc2_rgb8
+- Name: MTLPixelFormatETC2_RGB8_sRGB
+  SwiftName: etc2_rgb8_srgb
+- Name: MTLPixelFormatETC2_RGB8A1
+  SwiftName: etc2_rgb8a1
+- Name: MTLPixelFormatETC2_RGB8A1_sRGB
+  SwiftName: etc2_rgb8a1_srgb
+- Name: MTLPixelFormatASTC_4x4_sRGB
+  SwiftName: astc_4x4_srgb
+- Name: MTLPixelFormatASTC_5x4_sRGB
+  SwiftName: astc_5x4_srgb
+- Name: MTLPixelFormatASTC_5x5_sRGB
+  SwiftName: astc_5x5_srgb
+- Name: MTLPixelFormatASTC_6x5_sRGB
+  SwiftName: astc_6x5_srgb
+- Name: MTLPixelFormatASTC_6x6_sRGB
+  SwiftName: astc_6x6_srgb
+- Name: MTLPixelFormatASTC_8x5_sRGB
+  SwiftName: astc_8x5_srgb
+- Name: MTLPixelFormatASTC_8x6_sRGB
+  SwiftName: astc_8x6_srgb
+- Name: MTLPixelFormatASTC_8x8_sRGB
+  SwiftName: astc_8x8_srgb
+- Name: MTLPixelFormatASTC_10x5_sRGB
+  SwiftName: astc_10x5_srgb
+- Name: MTLPixelFormatASTC_10x6_sRGB
+  SwiftName: astc_10x6_srgb
+- Name: MTLPixelFormatASTC_10x8_sRGB
+  SwiftName: astc_10x8_srgb
+- Name: MTLPixelFormatASTC_10x10_sRGB
+  SwiftName: astc_10x10_srgb
+- Name: MTLPixelFormatASTC_12x10_sRGB
+  SwiftName: astc_12x10_srgb
+- Name: MTLPixelFormatASTC_12x12_sRGB
+  SwiftName: astc_12x12_srgb
+- Name: MTLPixelFormatASTC_4x4_LDR
+  SwiftName: astc_4x4_ldr
+- Name: MTLPixelFormatASTC_5x4_LDR
+  SwiftName: astc_5x4_ldr
+- Name: MTLPixelFormatASTC_5x5_LDR
+  SwiftName: astc_5x5_ldr
+- Name: MTLPixelFormatASTC_6x5_LDR
+  SwiftName: astc_6x5_ldr
+- Name: MTLPixelFormatASTC_6x6_LDR
+  SwiftName: astc_6x6_ldr
+- Name: MTLPixelFormatASTC_8x5_LDR
+  SwiftName: astc_8x5_ldr
+- Name: MTLPixelFormatASTC_8x6_LDR
+  SwiftName: astc_8x6_ldr
+- Name: MTLPixelFormatASTC_8x8_LDR
+  SwiftName: astc_8x8_ldr
+- Name: MTLPixelFormatASTC_10x5_LDR
+  SwiftName: astc_10x5_ldr
+- Name: MTLPixelFormatASTC_10x6_LDR
+  SwiftName: astc_10x6_ldr
+- Name: MTLPixelFormatASTC_10x8_LDR
+  SwiftName: astc_10x8_ldr
+- Name: MTLPixelFormatASTC_10x10_LDR
+  SwiftName: astc_10x10_ldr
+- Name: MTLPixelFormatASTC_12x10_LDR
+  SwiftName: astc_12x10_ldr
+- Name: MTLPixelFormatASTC_12x12_LDR
+  SwiftName: astc_12x12_ldr
+- Name: MTLTessellationControlPointIndexTypeUInt16
+  SwiftName: uint16
+- Name: MTLTessellationControlPointIndexTypeUInt32
+  SwiftName: uint32
+- Name: MTLAttributeFormatUChar2
+  SwiftName: uchar2
+- Name: MTLAttributeFormatUChar3
+  SwiftName: uchar3
+- Name: MTLAttributeFormatUChar4
+  SwiftName: uchar4
+- Name: MTLAttributeFormatUChar2Normalized
+  SwiftName: uchar2Normalized
+- Name: MTLAttributeFormatUChar3Normalized
+  SwiftName: uchar3Normalized
+- Name: MTLAttributeFormatUChar4Normalized
+  SwiftName: uchar4Normalized
+- Name: MTLAttributeFormatUShort2
+  SwiftName: ushort2
+- Name: MTLAttributeFormatUShort3
+  SwiftName: ushort3
+- Name: MTLAttributeFormatUShort4
+  SwiftName: ushort4
+- Name: MTLAttributeFormatUShort2Normalized
+  SwiftName: ushort2Normalized
+- Name: MTLAttributeFormatUShort3Normalized
+  SwiftName: ushort3Normalized
+- Name: MTLAttributeFormatUShort4Normalized
+  SwiftName: ushort4Normalized
+- Name: MTLAttributeFormatUInt
+  SwiftName: uint
+- Name: MTLAttributeFormatUInt2
+  SwiftName: uint2
+- Name: MTLAttributeFormatUInt3
+  SwiftName: uint3
+- Name: MTLAttributeFormatUInt4
+  SwiftName: uint4
+- Name: MTLIndexTypeUInt16
+  SwiftName: uint16
+- Name: MTLIndexTypeUInt32
+  SwiftName: uint32
+- Name: MTLVertexFormatUChar2
+  SwiftName: uchar2
+- Name: MTLVertexFormatUChar3
+  SwiftName: uchar3
+- Name: MTLVertexFormatUChar4
+  SwiftName: uchar4
+- Name: MTLVertexFormatUChar2Normalized
+  SwiftName: uchar2Normalized
+- Name: MTLVertexFormatUChar3Normalized
+  SwiftName: uchar3Normalized
+- Name: MTLVertexFormatUChar4Normalized
+  SwiftName: uchar4Normalized
+- Name: MTLVertexFormatUShort2
+  SwiftName: ushort2
+- Name: MTLVertexFormatUShort3
+  SwiftName: ushort3
+- Name: MTLVertexFormatUShort4
+  SwiftName: ushort4
+- Name: MTLVertexFormatUShort2Normalized
+  SwiftName: ushort2Normalized
+- Name: MTLVertexFormatUShort3Normalized
+  SwiftName: ushort3Normalized
+- Name: MTLVertexFormatUShort4Normalized
+  SwiftName: ushort4Normalized
+- Name: MTLVertexFormatUInt
+  SwiftName: uint
+- Name: MTLVertexFormatUInt2
+  SwiftName: uint2
+- Name: MTLVertexFormatUInt3
+  SwiftName: uint3
+- Name: MTLVertexFormatUInt4
+  SwiftName: uint4
+- Name: MTLVertexFormatUInt1010102Normalized
+  SwiftName: uint1010102Normalized
+Classes:
+- Name: MTLStructType
+  Methods:
+  - Selector: 'memberByName:'
+    SwiftName: memberByName(_:)
+    MethodKind: Instance
+- Name: MTLTextureDescriptor
+  Methods:
+  - Selector: 'texture2DDescriptorWithPixelFormat:width:height:mipmapped:'
+    SwiftName: texture2DDescriptor(pixelFormat:width:height:mipmapped:)
+    MethodKind: Class
+  - Selector: 'textureCubeDescriptorWithPixelFormat:size:mipmapped:'
+    SwiftName: textureCubeDescriptor(pixelFormat:size:mipmapped:)
+    MethodKind: Class
+Protocols:
+- Name: MTLBlitCommandEncoder
+  Methods:
+  - Selector: 'synchronizeResource:'
+    SwiftName: synchronize(resource:)
+    MethodKind: Instance
+  - Selector: 'synchronizeTexture:slice:level:'
+    SwiftName: synchronize(texture:slice:level:)
+    MethodKind: Instance
+  - Selector: 'fillBuffer:range:value:'
+    SwiftName: fill(buffer:range:value:)
+    MethodKind: Instance
+  - Selector: 'updateFence:'
+    SwiftName: updateFence(_:)
+    MethodKind: Instance
+  - Selector: 'waitForFence:'
+    SwiftName: waitForFence(_:)
+    MethodKind: Instance
+- Name: MTLBuffer
+  Methods:
+  - Selector: 'newTextureWithDescriptor:offset:bytesPerRow:'
+    SwiftName: makeTexture(descriptor:offset:bytesPerRow:)
+    MethodKind: Instance
+- Name: MTLCommandBuffer
+  Methods:
+  - Selector: 'blitCommandEncoder'
+    SwiftName: makeBlitCommandEncoder()
+    MethodKind: Instance
+  - Selector: 'renderCommandEncoderWithDescriptor:'
+    SwiftName: makeRenderCommandEncoder(descriptor:)
+    MethodKind: Instance
+  - Selector: 'computeCommandEncoder'
+    SwiftName: makeComputeCommandEncoder()
+    MethodKind: Instance
+  - Selector: 'parallelRenderCommandEncoderWithDescriptor:'
+    SwiftName: makeParallelRenderCommandEncoder(descriptor:)
+    MethodKind: Instance
+- Name: MTLCommandQueue
+  Methods:
+  - Selector: 'commandBuffer'
+    SwiftName: makeCommandBuffer()
+    MethodKind: Instance
+  - Selector: 'commandBufferWithUnretainedReferences'
+    SwiftName: makeCommandBufferWithUnretainedReferences()
+    MethodKind: Instance
+- Name: MTLComputeCommandEncoder
+  Methods:
+  - Selector: 'setStageInRegion:'
+    SwiftName: setStageInRegion(_:)
+    MethodKind: Instance
+  - Selector: 'dispatchThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerThreadgroup:'
+    SwiftName: dispatchThreadgroups(indirectBuffer:indirectBufferOffset:threadsPerThreadgroup:)
+    MethodKind: Instance
+  - Selector: 'updateFence:'
+    SwiftName: updateFence(_:)
+    MethodKind: Instance
+  - Selector: 'waitForFence:'
+    SwiftName: waitForFence(_:)
+    MethodKind: Instance
+- Name: MTLDevice
+  Methods:
+  - Selector: 'newDefaultLibraryWithBundle:error:'
+    SwiftName: makeDefaultLibrary(bundle:)
+    MethodKind: Instance
+  - Selector: 'newDefaultLibrary'
+    SwiftName: makeDefaultLibrary
+    MethodKind: Instance
+  - Selector: 'newLibraryWithFile:error:'
+    SwiftName: makeLibrary(filepath:)
+    MethodKind: Instance
+  - Selector: 'newLibraryWithData:error:'
+    SwiftName: makeLibrary(data:)
+    MethodKind: Instance
+  - Selector: 'newLibraryWithSource:options:error:'
+    SwiftName: makeLibrary(source:options:)
+    MethodKind: Instance
+  - Selector: 'newLibraryWithSource:options:completionHandler:'
+    SwiftName: makeLibrary(source:options:completionHandler:)
+    MethodKind: Instance
+  - Selector: 'newRenderPipelineStateWithDescriptor:completionHandler:'
+    SwiftName: makeRenderPipelineState(descriptor:completionHandler:)
+    MethodKind: Instance
+  - Selector: 'newRenderPipelineStateWithDescriptor:options:completionHandler:'
+    SwiftName: makeRenderPipelineState(descriptor:options:completionHandler:)
+    MethodKind: Instance
+  - Selector: 'newRenderPipelineStateWithDescriptor:error:'
+    SwiftName: makeRenderPipelineState(descriptor:)
+    MethodKind: Instance
+  - Selector: 'newRenderPipelineStateWithDescriptor:options:reflection:error:'
+    SwiftName: makeRenderPipelineState(descriptor:options:reflection:)
+    MethodKind: Instance
+  - Selector: 'newComputePipelineStateWithFunction:completionHandler:'
+    SwiftName: makeComputePipelineState(function:completionHandler:)
+    MethodKind: Instance
+  - Selector: 'newComputePipelineStateWithFunction:options:completionHandler:'
+    SwiftName: makeComputePipelineState(function:options:completionHandler:)
+    MethodKind: Instance
+  - Selector: 'newComputePipelineStateWithFunction:error:'
+    SwiftName: makeComputePipelineState(function:)
+    MethodKind: Instance
+  - Selector: 'newComputePipelineStateWithFunction:options:reflection:error:'
+    SwiftName: makeComputePipelineState(function:options:reflection:)
+    MethodKind: Instance
+  - Selector: 'newComputePipelineStateWithDescriptor:options:completionHandler:'
+    SwiftName: makeComputePipelineState(descriptor:options:completionHandler:)
+    MethodKind: Instance
+  - Selector: 'newComputePipelineStateWithDescriptor:options:reflection:error:'
+    SwiftName: makeComputePipelineState(descriptor:options:reflection:)
+    MethodKind: Instance
+  - Selector: 'newCommandQueue'
+    SwiftName: makeCommandQueue()
+    MethodKind: Instance
+  - Selector: 'newCommandQueueWithMaxCommandBufferCount:'
+    SwiftName: makeCommandQueue(maxCommandBufferCount:)
+    MethodKind: Instance
+  - Selector: 'newBufferWithLength:options:'
+    SwiftName: makeBuffer(length:options:)
+    MethodKind: Instance
+  - Selector: 'newBufferWithBytes:length:options:'
+    SwiftName: makeBuffer(bytes:length:options:)
+    MethodKind: Instance
+  - Selector: 'newBufferWithBytesNoCopy:length:options:deallocator:'
+    SwiftName: makeBuffer(bytesNoCopy:length:options:deallocator:)
+    MethodKind: Instance
+  - Selector: 'newDepthStencilStateWithDescriptor:'
+    SwiftName: makeDepthStencilState(descriptor:)
+    MethodKind: Instance
+  - Selector: 'newTextureWithDescriptor:'
+    SwiftName: makeTexture(descriptor:)
+    MethodKind: Instance
+  - Selector: 'newTextureWithDescriptor:iosurface:plane:'
+    SwiftName: makeTexture(descriptor:iosurface:plane:)
+    MethodKind: Instance
+  - Selector: 'newHeapWithDescriptor:'
+    SwiftName: makeHeap(descriptor:)
+    MethodKind: Instance
+  - Selector: 'heapBufferSizeAndAlignWithLength:options:'
+    SwiftName: heapBufferSizeAndAlign(length:options:)
+    MethodKind: Instance
+  - Selector: 'heapTextureSizeAndAlignWithDescriptor:'
+    SwiftName: heapTextureSizeAndAlign(descriptor:)
+    MethodKind: Instance
+  - Selector: 'newFence'
+    SwiftName: makeFence()
+    MethodKind: Instance
+  - Selector: 'newSamplerStateWithDescriptor:'
+    SwiftName: makeSamplerState(descriptor:)
+    MethodKind: Instance
+- Name: MTLDrawable
+  Methods:
+  - Selector: 'presentAtTime:'
+    SwiftName: present(at:)
+    MethodKind: Instance
+- Name: MTLHeap
+  Methods:
+  - Selector: 'maxAvailableSizeWithAlignment:'
+    SwiftName: maxAvailableSize(alignment:)
+    MethodKind: Instance
+  - Selector: 'newBufferWithLength:options:'
+    SwiftName: makeBuffer(length:options:)
+    MethodKind: Instance
+  - Selector: 'newTextureWithDescriptor:'
+    SwiftName: makeTexture(descriptor:)
+    MethodKind: Instance
+- Name: MTLLibrary
+  Methods:
+  - Selector: 'newFunctionWithName:'
+    SwiftName: makeFunction(name:)
+    MethodKind: Instance
+  - Selector: 'newFunctionWithName:constantValues:completionHandler:'
+    SwiftName: makeFunction(name:constantValues:completionHandler:)
+    MethodKind: Instance
+  - Selector: 'newFunctionWithName:constantValues:error:'
+    SwiftName: makeFunction(name:constantValues:)
+    MethodKind: Instance
+- Name: MTLParallelRenderCommandEncoder
+  Methods:
+  - Selector: 'renderCommandEncoder'
+    SwiftName: makeRenderCommandEncoder()
+    MethodKind: Instance
+- Name: MTLRenderCommandEncoder
+  Methods:
+  - Selector: 'setBlendColorRed:green:blue:alpha:'
+    SwiftName: setBlendColor(red:green:blue:alpha:)
+    MethodKind: Instance
+  - Selector: 'setStencilFrontReferenceValue:backReferenceValue:'
+    SwiftName: setStencilReferenceValues(front:back:)
+    MethodKind: Instance
+  - Selector: 'drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:'
+    SwiftName: drawPatches(numberOfPatchControlPoints:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:)
+    MethodKind: Instance
+  - Selector: 'drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:'
+    SwiftName: drawPatches(numberOfPatchControlPoints:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:)
+    MethodKind: Instance
+  - Selector: 'drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:'
+    SwiftName: drawIndexedPatches(numberOfPatchControlPoints:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:)
+    MethodKind: Instance
+  - Selector: 'drawIndexedPatches:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:indirectBuffer:indirectBufferOffset:'
+    SwiftName: drawIndexedPatches(numberOfPatchControlPoints:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:indirectBuffer:indirectBufferOffset:)
+    MethodKind: Instance
+  - Selector: 'drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:'
+    SwiftName: drawPrimitives(type:vertexStart:vertexCount:instanceCount:baseInstance:)
+    MethodKind: Instance
+  - Selector: 'drawPrimitives:vertexStart:vertexCount:instanceCount:'
+    SwiftName: drawPrimitives(type:vertexStart:vertexCount:instanceCount:)
+    MethodKind: Instance
+  - Selector: 'drawPrimitives:vertexStart:vertexCount:'
+    SwiftName: drawPrimitives(type:vertexStart:vertexCount:)
+    MethodKind: Instance
+  - Selector: 'drawPrimitives:indirectBuffer:indirectBufferOffset:'
+    SwiftName: drawPrimitives(type:indirectBuffer:indirectBufferOffset:)
+    MethodKind: Instance
+  - Selector: 'drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:'
+    SwiftName: drawIndexedPrimitives(type:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:)
+    MethodKind: Instance
+  - Selector: 'drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:'
+    SwiftName: drawIndexedPrimitives(type:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:)
+    MethodKind: Instance
+  - Selector: 'drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:'
+    SwiftName: drawIndexedPrimitives(type:indexCount:indexType:indexBuffer:indexBufferOffset:)
+    MethodKind: Instance
+  - Selector: 'drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:'
+    SwiftName: drawIndexedPrimitives(type:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:)
+    MethodKind: Instance
+  - Selector: 'updateFence:afterStages:'
+    SwiftName: updateFence(after:)
+    MethodKind: Instance
+  - Selector: 'waitForFence:beforeStages:'
+    SwiftName: waitForFence(before:)
+    MethodKind: Instance
+- Name: MTLTexture
+  Methods:
+  - Selector: 'newTextureViewWithPixelFormat:'
+    SwiftName: makeTextureView(pixelFormat:)
+    MethodKind: Instance
+  - Selector: 'newTextureViewWithPixelFormat:textureType:levels:slices:'
+    SwiftName: makeTextureView(pixelFormat:textureType:levels:slices:)
+    MethodKind: Instance
+  - Selector: 'replaceRegion:mipmapLevel:withBytes:bytesPerRow:'
+    SwiftName: replace(region:mipmapLevel:withBytes:bytesPerRow:)
+    MethodKind: Instance
+  - Selector: 'replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage:'
+    SwiftName: replace(region:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage:)
+    MethodKind: Instance
diff --git a/apinotes/SceneKit.apinotes b/apinotes/SceneKit.apinotes
index c5ae512..075010a 100644
--- a/apinotes/SceneKit.apinotes
+++ b/apinotes/SceneKit.apinotes
@@ -64,52 +64,54 @@
   SwiftName: SCNHitTestOption.rootNode
 - Name: SCNHitTestIgnoreHiddenNodesKey
   SwiftName: SCNHitTestOption.ignoreHiddenNodes
+# FIXME: All of these are on nested types, which is not supported by swift_name
+# yet. Once it is, make these fully qualified
 - Name: SCNPhysicsShapeTypeKey
-  SwiftName: SCNPhysicsShape.Option.type
+  SwiftName: type
 - Name: SCNPhysicsShapeKeepAsCompoundKey
-  SwiftName: SCNPhysicsShape.Option.keepAsCompound
+  SwiftName: keepAsCompound
 - Name: SCNPhysicsShapeScaleKey
-  SwiftName: SCNPhysicsShape.Option.scale
+  SwiftName: scale
 - Name: SCNPhysicsTestCollisionBitMaskKey
-  SwiftName: SCNPhysicsWorld.TestOption.collisionBitMask
+  SwiftName: collisionBitMask
 - Name: SCNPhysicsTestSearchModeKey
-  SwiftName: SCNPhysicsWorld.TestOption.searchMode
+  SwiftName: searchMode
 - Name: SCNPhysicsTestBackfaceCullingKey
-  SwiftName: SCNPhysicsWorld.TestOption.backfaceCulling
+  SwiftName: backfaceCulling
 - Name: SCNSceneStartTimeAttributeKey
-  SwiftName: SCNScene.Attribute.startTime
+  SwiftName: startTime
 - Name: SCNSceneEndTimeAttributeKey
-  SwiftName: SCNScene.Attribute.endTime
+  SwiftName: endTime
 - Name: SCNSceneFrameRateAttributeKey
-  SwiftName: SCNScene.Attribute.frameRate
+  SwiftName: frameRate
 - Name: SCNSceneUpAxisAttributeKey
-  SwiftName: SCNScene.Attribute.upAxis
+  SwiftName: upAxis
 - Name: SCNSceneSourceCreateNormalsIfAbsentKey
-  SwiftName: SCNSceneSource.LoadingOption.createNormalsIfAbsent
+  SwiftName: createNormalsIfAbsent
 - Name: SCNSceneSourceCheckConsistencyKey
-  SwiftName: SCNSceneSource.LoadingOption.checkConsistency
+  SwiftName: checkConsistency
 - Name: SCNSceneSourceFlattenSceneKey
-  SwiftName: SCNSceneSource.LoadingOption.flattenScene
+  SwiftName: flattenScene
 - Name: SCNSceneSourceUseSafeModeKey
-  SwiftName: SCNSceneSource.LoadingOption.useSafeMode
+  SwiftName: useSafeMode
 - Name: SCNSceneSourceAssetDirectoryURLsKey
-  SwiftName: SCNSceneSource.LoadingOption.assetDirectoryURLs
+  SwiftName: assetDirectoryURLs
 - Name: SCNSceneSourceOverrideAssetURLsKey
-  SwiftName: SCNSceneSource.LoadingOption.overrideAssetURLs
+  SwiftName: overrideAssetURLs
 - Name: SCNSceneSourceStrictConformanceKey
-  SwiftName: SCNSceneSource.LoadingOption.strictConformance
+  SwiftName: strictConformance
 - Name: SCNSceneSourceConvertUnitsToMetersKey
-  SwiftName: SCNSceneSource.LoadingOption.convertUnitsToMeters
+  SwiftName: convertUnitsToMeters
 - Name: SCNSceneSourceConvertToYUpKey
-  SwiftName: SCNSceneSource.LoadingOption.convertToYUp
+  SwiftName: convertToYUp
 - Name: SCNSceneSourceAnimationImportPolicyKey
-  SwiftName: SCNSceneSource.LoadingOption.animationImportPolicy
+  SwiftName: animationImportPolicy
 - Name: SCNPreferredRenderingAPIKey
-  SwiftName: SCNView.Option.preferredRenderingAPI
+  SwiftName: preferredRenderingAPI
 - Name: SCNPreferredDeviceKey
-  SwiftName: SCNView.Option.preferredDevice
+  SwiftName: preferredDevice
 - Name: SCNPreferLowPowerDeviceKey
-  SwiftName: SCNView.Option.preferLowPowerDevice
+  SwiftName: preferLowPowerDevice
 
 #
 # API Renaming
diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake
index a73774b..849c129 100644
--- a/cmake/modules/AddSwift.cmake
+++ b/cmake/modules/AddSwift.cmake
@@ -403,7 +403,7 @@
 #     [LINK_LIBRARIES dep1 ...]
 #     [FRAMEWORK_DEPENDS dep1 ...]
 #     [FRAMEWORK_DEPENDS_WEAK dep1 ...]
-#     [COMPONENT_DEPENDS comp1 ...]
+#     [LLVM_COMPONENT_DEPENDS comp1 ...]
 #     [C_COMPILE_FLAGS flag1...]
 #     [SWIFT_COMPILE_FLAGS flag1...]
 #     [LINK_FLAGS flag1...]
@@ -447,7 +447,7 @@
 # FRAMEWORK_DEPENDS_WEAK
 #   System frameworks this library depends on that should be weakly-linked.
 #
-# COMPONENT_DEPENDS
+# LLVM_COMPONENT_DEPENDS
 #   LLVM components this library depends on.
 #
 # C_COMPILE_FLAGS
@@ -493,7 +493,7 @@
   cmake_parse_arguments(SWIFTLIB_SINGLE
     "${SWIFTLIB_SINGLE_options}"
     "SDK;ARCHITECTURE;INSTALL_IN_COMPONENT;DEPLOYMENT_VERSION_IOS"
-    "DEPENDS;LINK_LIBRARIES;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;COMPONENT_DEPENDS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES;FILE_DEPENDS"
+    "DEPENDS;LINK_LIBRARIES;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;LLVM_COMPONENT_DEPENDS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES;FILE_DEPENDS"
     ${ARGN})
 
   set(SWIFTLIB_SINGLE_SOURCES ${SWIFTLIB_SINGLE_UNPARSED_ARGUMENTS})
@@ -888,7 +888,7 @@
 
   if(NOT SWIFTLIB_SINGLE_TARGET_LIBRARY)
     # Call llvm_config() only for libraries that are part of the compiler.
-    swift_common_llvm_config("${target}" ${SWIFTLIB_SINGLE_COMPONENT_DEPENDS})
+    swift_common_llvm_config("${target}" ${SWIFTLIB_SINGLE_LLVM_COMPONENT_DEPENDS})
   endif()
 
   # Collect compile and link flags for the static and non-static targets.
@@ -1054,7 +1054,7 @@
 #     [SWIFT_MODULE_DEPENDS dep1 ...]
 #     [FRAMEWORK_DEPENDS dep1 ...]
 #     [FRAMEWORK_DEPENDS_WEAK dep1 ...]
-#     [COMPONENT_DEPENDS comp1 ...]
+#     [LLVM_COMPONENT_DEPENDS comp1 ...]
 #     [FILE_DEPENDS target1 ...]
 #     [TARGET_SDKS sdk1...]
 #     [C_COMPILE_FLAGS flag1...]
@@ -1113,7 +1113,7 @@
 # FRAMEWORK_DEPENDS_WEAK
 #   System frameworks this library depends on that should be weak-linked
 #
-# COMPONENT_DEPENDS
+# LLVM_COMPONENT_DEPENDS
 #   LLVM components this library depends on.
 #
 # FILE_DEPENDS
@@ -1171,7 +1171,7 @@
   cmake_parse_arguments(SWIFTLIB
     "${SWIFTLIB_options}"
     "INSTALL_IN_COMPONENT;DEPLOYMENT_VERSION_IOS"
-    "DEPENDS;LINK_LIBRARIES;SWIFT_MODULE_DEPENDS;SWIFT_MODULE_DEPENDS_OSX;SWIFT_MODULE_DEPENDS_IOS;SWIFT_MODULE_DEPENDS_TVOS;SWIFT_MODULE_DEPENDS_WATCHOS;SWIFT_MODULE_DEPENDS_FREEBSD;SWIFT_MODULE_DEPENDS_LINUX;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;FRAMEWORK_DEPENDS_OSX;FRAMEWORK_DEPENDS_IOS_TVOS;COMPONENT_DEPENDS;FILE_DEPENDS;TARGET_SDKS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS_OSX;SWIFT_COMPILE_FLAGS_IOS;SWIFT_COMPILE_FLAGS_TVOS;SWIFT_COMPILE_FLAGS_WATCHOS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES"
+    "DEPENDS;LINK_LIBRARIES;SWIFT_MODULE_DEPENDS;SWIFT_MODULE_DEPENDS_OSX;SWIFT_MODULE_DEPENDS_IOS;SWIFT_MODULE_DEPENDS_TVOS;SWIFT_MODULE_DEPENDS_WATCHOS;SWIFT_MODULE_DEPENDS_FREEBSD;SWIFT_MODULE_DEPENDS_LINUX;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;FRAMEWORK_DEPENDS_OSX;FRAMEWORK_DEPENDS_IOS_TVOS;LLVM_COMPONENT_DEPENDS;FILE_DEPENDS;TARGET_SDKS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS_OSX;SWIFT_COMPILE_FLAGS_IOS;SWIFT_COMPILE_FLAGS_TVOS;SWIFT_COMPILE_FLAGS_WATCHOS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES"
     ${ARGN})
   set(SWIFTLIB_SOURCES ${SWIFTLIB_UNPARSED_ARGUMENTS})
 
@@ -1369,7 +1369,7 @@
           LINK_LIBRARIES ${swiftlib_link_libraries}
           FRAMEWORK_DEPENDS ${swiftlib_framework_depends_flattened}
           FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
-          COMPONENT_DEPENDS ${SWIFTLIB_COMPONENT_DEPENDS}
+          LLVM_COMPONENT_DEPENDS ${SWIFTLIB_LLVM_COMPONENT_DEPENDS}
           FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS} ${swiftlib_module_dependency_targets}
           C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
           SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all}
@@ -1557,7 +1557,7 @@
       LINK_LIBRARIES ${SWIFTLIB_LINK_LIBRARIES}
       FRAMEWORK_DEPENDS ${SWIFTLIB_FRAMEWORK_DEPENDS}
       FRAMEWORK_DEPENDS_WEAK ${SWIFTLIB_FRAMEWORK_DEPENDS_WEAK}
-      COMPONENT_DEPENDS ${SWIFTLIB_COMPONENT_DEPENDS}
+      LLVM_COMPONENT_DEPENDS ${SWIFTLIB_LLVM_COMPONENT_DEPENDS}
       FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS}
       C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
       SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all}
@@ -1597,7 +1597,7 @@
   cmake_parse_arguments(SWIFTEXE_SINGLE
     "EXCLUDE_FROM_ALL;DONT_STRIP_NON_MAIN_SYMBOLS;DISABLE_ASLR"
     "SDK;ARCHITECTURE"
-    "DEPENDS;COMPONENT_DEPENDS;LINK_LIBRARIES;LINK_FAT_LIBRARIES"
+    "DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_LIBRARIES;LINK_FAT_LIBRARIES"
     ${ARGN})
 
   set(SWIFTEXE_SINGLE_SOURCES ${SWIFTEXE_SINGLE_UNPARSED_ARGUMENTS})
@@ -1710,7 +1710,7 @@
       LIBRARY_DIR ${SWIFT_LIBRARY_OUTPUT_INTDIR})
 
   target_link_libraries("${name}" ${SWIFTEXE_SINGLE_LINK_LIBRARIES} ${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES})
-  swift_common_llvm_config("${name}" ${SWIFTEXE_SINGLE_COMPONENT_DEPENDS})
+  swift_common_llvm_config("${name}" ${SWIFTEXE_SINGLE_LLVM_COMPONENT_DEPENDS})
 
   set_target_properties(${name}
       PROPERTIES FOLDER "Swift executables")
@@ -1729,7 +1729,7 @@
   cmake_parse_arguments(SWIFTEXE_TARGET
     "EXCLUDE_FROM_ALL;DONT_STRIP_NON_MAIN_SYMBOLS;DISABLE_ASLR;BUILD_WITH_STDLIB"
     ""
-    "DEPENDS;COMPONENT_DEPENDS;LINK_FAT_LIBRARIES"
+    "DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_FAT_LIBRARIES"
     ${ARGN})
 
   set(SWIFTEXE_TARGET_SOURCES ${SWIFTEXE_TARGET_UNPARSED_ARGUMENTS})
@@ -1781,7 +1781,7 @@
           ${VARIANT_NAME}
           ${SWIFTEXE_TARGET_SOURCES}
           DEPENDS ${SWIFTEXE_TARGET_DEPENDS_with_suffix}
-          COMPONENT_DEPENDS ${SWIFTEXE_TARGET_COMPONENT_DEPENDS}
+          LLVM_COMPONENT_DEPENDS ${SWIFTEXE_TARGET_LLVM_COMPONENT_DEPENDS}
           SDK "${sdk}"
           ARCHITECTURE "${arch}"
           LINK_FAT_LIBRARIES ${SWIFTEXE_TARGET_LINK_FAT_LIBRARIES}
@@ -1797,7 +1797,7 @@
 # Usage:
 #   add_swift_executable(name
 #     [DEPENDS dep1 ...]
-#     [COMPONENT_DEPENDS comp1 ...]
+#     [LLVM_COMPONENT_DEPENDS comp1 ...]
 #     [FILE_DEPENDS target1 ...]
 #     [LINK_LIBRARIES target1 ...]
 #     [EXCLUDE_FROM_ALL]
@@ -1811,7 +1811,7 @@
 #   LIBRARIES
 #     Libraries this executable depends on, without variant suffixes.
 #
-#   COMPONENT_DEPENDS
+#   LLVM_COMPONENT_DEPENDS
 #     LLVM components this executable depends on.
 #
 #   FILE_DEPENDS
@@ -1840,7 +1840,7 @@
   cmake_parse_arguments(SWIFTEXE
     "EXCLUDE_FROM_ALL;DONT_STRIP_NON_MAIN_SYMBOLS;DISABLE_ASLR"
     ""
-    "DEPENDS;COMPONENT_DEPENDS;LINK_LIBRARIES"
+    "DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_LIBRARIES"
     ${ARGN})
 
   translate_flag(${SWIFTEXE_EXCLUDE_FROM_ALL}
@@ -1859,7 +1859,7 @@
       ${name}
       ${SWIFTEXE_SOURCES}
       DEPENDS ${SWIFTEXE_DEPENDS}
-      COMPONENT_DEPENDS ${SWIFTEXE_COMPONENT_DEPENDS}
+      LLVM_COMPONENT_DEPENDS ${SWIFTEXE_LLVM_COMPONENT_DEPENDS}
       LINK_LIBRARIES ${SWIFTEXE_LINK_LIBRARIES}
       SDK ${SWIFT_HOST_VARIANT_SDK}
       ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
diff --git a/docs/ABI.rst b/docs/ABI.rst
index 65ad414..e2849f1 100644
--- a/docs/ABI.rst
+++ b/docs/ABI.rst
@@ -3,6 +3,8 @@
 .. @raise litre.TestsAreMissing
 .. _ABI:
 
+.. highlight:: none
+
 The Swift ABI
 =============
 
diff --git a/docs/ARCOptimization.rst b/docs/ARCOptimization.rst
index 43c5633..6d71dac 100644
--- a/docs/ARCOptimization.rst
+++ b/docs/ARCOptimization.rst
@@ -1,5 +1,7 @@
 :orphan:
 
+.. highlight:: sil
+
 ==========================
 ARC Optimization for Swift
 ==========================
diff --git a/docs/DebuggingTheCompiler.rst b/docs/DebuggingTheCompiler.rst
index 86e0fb8..f73bd82 100644
--- a/docs/DebuggingTheCompiler.rst
+++ b/docs/DebuggingTheCompiler.rst
@@ -1,5 +1,7 @@
 :orphan:
 
+.. highlight:: none
+
 Debugging the Swift Compiler
 ============================
 
diff --git a/docs/DriverParseableOutput.rst b/docs/DriverParseableOutput.rst
index a38e0f8..79d41ba 100644
--- a/docs/DriverParseableOutput.rst
+++ b/docs/DriverParseableOutput.rst
@@ -5,6 +5,8 @@
 .. contents::
    :local:
 
+.. highlight:: none
+
 Introduction
 ============
 
diff --git a/docs/ErrorHandling.rst b/docs/ErrorHandling.rst
index 7be0ba8..8f3ff71 100644
--- a/docs/ErrorHandling.rst
+++ b/docs/ErrorHandling.rst
@@ -52,7 +52,7 @@
 the same basic way, either by reporting the error to the user or
 passing the error back to their own clients.
 
-These errors will be the focus on this proposal.
+These errors will be the focus of this proposal.
 
 The final two classes of error are outside the scope of this proposal.
 A **universal error** is theoretically recoverable, but by its nature
@@ -305,7 +305,7 @@
 As with ``switch`` statements, Swift makes an effort to understand
 whether catch clauses are exhaustive.  If it can determine it is, then
 the compiler considers the error to be handled.  If not, the error
-automatically propagates out out of scope, either to a lexically
+automatically propagates out of scope, either to a lexically
 enclosing ``catch`` clause or out of the containing function (which must
 be marked ``throws``).
 
@@ -691,7 +691,7 @@
   }
 
 This marking feels redundant.  We want functions like
-``autoreleasepool`` to feel like statements, but marks inside builtin
+``autoreleasepool`` to feel like statements, but marks inside built-in
 statements like ``if`` don't require the outer statement to be marked.
 It would be better if the compiler didn't require the outer ``try``.
 
diff --git a/docs/ErrorHandlingRationale.rst b/docs/ErrorHandlingRationale.rst
index c0931ba..8828e3c 100644
--- a/docs/ErrorHandlingRationale.rst
+++ b/docs/ErrorHandlingRationale.rst
@@ -879,15 +879,19 @@
 propagation would.  However, we could optimize this for many common
 cases by causing clean-ups to be called automatically by the
 interpretation function.  That is, instead of a landing pad that looks
-notionally like this::
+notionally like this:
 
-  void *exception = ...;
+.. code-block:: objc++
+
+  void *exception = /*...*/;
   SomeCXXType::~SomeCXXType(&foo);
   objc_release(bar);
   objc_release(baz);
   _Unwind_Resume(exception);
 
-The unwind table would have a record that looks notionally like this::
+The unwind table would have a record that looks notionally like this:
+
+.. code-block:: objc++
 
   CALL_WITH_FRAME_ADDRESS(&SomeCXXType::~SomeCXXType, FRAME_OFFSET_OF(foo))
   CALL_WITH_FRAME_VALUE(&objc_release, FRAME_OFFSET_OF(bar))
diff --git a/docs/GitWorkflows.rst b/docs/GitWorkflows.rst
index 64d360b..fac51ea 100644
--- a/docs/GitWorkflows.rst
+++ b/docs/GitWorkflows.rst
@@ -1,5 +1,7 @@
 :orphan:
 
+.. highlight:: bash
+
 Git Workflows
 =============
 
diff --git a/docs/Lexicon.rst b/docs/Lexicon.rst
index 71db7b1..7589715 100644
--- a/docs/Lexicon.rst
+++ b/docs/Lexicon.rst
@@ -54,6 +54,13 @@
     
     __ https://developer.apple.com/swift/blog/?id=28
 
+  dup
+    From "duplicate". As a noun, refers to another filed issue that describes
+    the same bug ("I have a dup of this"); as a verb, the act of marking a bug
+    *as* a duplicate ("Please dup this to the underlying issue"). Sometimes
+    written "dupe". Pronounced the same way as the first syllable of
+    "duplicate", which for most American English speakers is "doop".
+
   existential
     A value whose type is a protocol composition (including a single protocol
     and *zero* protocols; the latter is the ``Any`` type).
@@ -89,6 +96,10 @@
     different order, or when header files are modified to use forward
     declarations instead of direct includes.
 
+  LGTM
+    "Looks good to me." Used in code review to indicate approval with no further
+    comments.
+
   main module
     The module for the file or files currently being compiled.
 
diff --git a/docs/LibraryEvolution.rst b/docs/LibraryEvolution.rst
index cbce118..55a4f9e 100644
--- a/docs/LibraryEvolution.rst
+++ b/docs/LibraryEvolution.rst
@@ -6,6 +6,13 @@
 :Author: Jordan Rose
 :Author: John McCall
 
+.. note::
+
+    This document uses some Sphinx-specific features which are not available on
+    GitHub. For proper rendering, download and build the docs yourself. Jordan
+    Rose also posts occasional snapshots at
+    https://jrose-apple.github.io/swift-library-evolution/.
+
 One of Swift's primary design goals is to allow efficient execution of code
 without sacrificing load-time abstraction of implementation.
 
@@ -121,7 +128,7 @@
 
     // Client code
     @available(Magician 1.5)
-    class CrystalBallView : MagicView { … }
+    class CrystalBallView : MagicView { /*…*/ }
 
 Library versions can also be checked dynamically using ``#available``, allowing
 for fallback behavior when the requested library version is not present::
@@ -167,7 +174,7 @@
 Publishing Versioned API
 ========================
 
-A library's API is already marked with the ``public`` attribute, but if a
+A library's API is already marked with the ``public`` modifier, but if a
 client wants to work with multiple releases of the library, the API needs
 versioning information as well. A *versioned entity* represents anything with a
 runtime presence that a client may rely on; its version records when the entity
@@ -182,9 +189,12 @@
   See `New Conformances`_, below.
 
 In a versioned library, any top-level public entity from the list above may not
-be made ``public`` without an appropriate version. A public entity declared
-within a versioned type (or an extension of a versioned type) will default to
-having the same version as the type.
+be made ``public`` (or ``open``) without an appropriate version. A public
+entity declared within a versioned type (or an extension of a versioned type)
+will default to having the same version as the type.
+
+In this document, the term "public" includes classes and members marked
+``open``.
 
 Code within a library may generally use all other entities declared within the
 library (barring their own availability checks), since the entire library is
@@ -286,8 +296,6 @@
 - Adding a default argument expression to a parameter.
 - Changing or removing a default argument is a `binary-compatible
   source-breaking change`.
-- The ``@noreturn`` attribute may be added to a function. ``@noreturn`` is a
-  `versioned attribute`.
 - The ``@discardableResult`` and ``@warn_unqualified_access`` attributes may
   be added to a function without any additional versioning information.
 
@@ -299,7 +307,6 @@
 - A versioned function may not add, remove, or reorder parameters, whether or
   not they have default arguments.
 - A versioned function that throws may not become non-throwing or vice versa.
-- ``@noreturn`` may not be removed from a function.
 - The ``@noescape`` attribute may not be added to or removed from a parameter.
   It is not a `versioned attribute` and so there is no way to guarantee that it
   is safe when a client deploys against older versions of the library.
@@ -351,7 +358,7 @@
 
     public struct Point2D {
       var x, y: Double
-      public init(x: Double, y: Double) { … }
+      public init(x: Double, y: Double) { /*…*/ }
     }
 
     extension Point2D {
@@ -368,7 +375,7 @@
 
     public struct Point2D {
       var r, theta: Double
-      public init(x: Double, y: Double) { … }
+      public init(x: Double, y: Double) { /*…*/ }
     }
 
 and the ``x`` and ``y`` properties have now disappeared. To avoid this, the
@@ -693,13 +700,13 @@
 We've considered two possible syntaxes for this::
 
     @available(1.1)
-    extension Wand : MagicType {…}
+    extension Wand : MagicType {/*…*/}
 
 and
 
 ::
 
-    extension Wand : @available(1.1) MagicType {…}
+    extension Wand : @available(1.1) MagicType {/*…*/}
 
 The former requires fewer changes to the language grammar, but the latter could
 also be used on the declaration of the type itself (i.e. the ``struct``
@@ -952,16 +959,17 @@
 little more restrictive than structs; they only allow the following changes:
 
 - Adding a new convenience initializer.
-- Adding a new designated initializer, if the class is not publicly
-  subclassable.
+- Adding a new designated initializer, if the class is not ``open``.
 - Adding a deinitializer.
 - Adding new, non-overriding method, subscript, or property.
-- Adding a new overriding member, though if the class is publicly-subclassable
-  the type of the member may not deviate from the member it overrides.
-  Changing the type could be incompatible with existing overrides in subclasses.
+- Adding a new overriding member, though if the class is ``open`` the type of
+  the member may not deviate from the member it overrides. Changing the type
+  could be incompatible with existing overrides in subclasses.
 
 Finally, classes allow the following changes that do not apply to structs:
 
+- A class may be marked ``open`` if it is not already marked ``final``.
+- A class may be marked ``final`` if it is not already marked ``open``.
 - Removing an explicit deinitializer. (A class with no declared deinitializer
   effectively has an implicit deinitializer.)
 - "Moving" a method, subscript, or property up to its superclass. The
@@ -972,8 +980,10 @@
   removed as long as the generic parameters, formal parameters, and return type
   *exactly* match the overridden declaration. Any existing callers should 
   automatically use the superclass implementation.
-- ``@noreturn`` may be only added to a method if it is not publicly
-  overridable.
+- Within an ``open`` class, any public method, subscript, or property may be
+  marked ``open`` if it is not already marked ``final``.
+- Any public method, subscript, or property may be marked ``final`` if it is not
+  already marked ``open``.
 - ``@IBOutlet``, ``@IBAction``, and ``@IBInspectable`` may be added to a member
   without providing any extra version information. Removing any of these is
   a `binary-compatible source-breaking change` if the member remains ``@objc``,
@@ -996,14 +1006,21 @@
     NSCollectionViewItem be a subclass of NSResponder or not? How would the
     compiler be able to enforce this?
 
+.. admonition:: TODO
+
+    Both ``final`` and ``open`` may be applied to a declaration after it has
+    been made public. However, these need to be treated as
+    `versioned attributes <versioned attribute>`. It's not clear what syntax
+    should be used for this.
+
 .. _NSCollectionViewItem: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSCollectionViewItem_Class/index.html
 
 Other than those detailed above, no other changes to a class or its members
 are permitted. In particular:
 
-- ``final`` may not be added to *or* removed from a class or any of its members.
-  The presence of ``final`` enables optimization; its absence means there may
-  be subclasses/overrides that would be broken by the change.
+- ``open`` may not be removed from a class or its members.
+- ``final`` may not be removed from a class or its members. (The presence of
+  ``final`` enables optimization.)
 - ``dynamic`` may not be added to *or* removed from any members. Existing
   clients would not know to invoke the member dynamically.
 - A ``final`` override of a member may *not* be removed, even if the type
@@ -1013,9 +1030,6 @@
   any existing members.
 - ``@NSManaged`` may not be added to or removed from any existing members.
 
-.. note:: These restrictions tie in with the ongoing discussions about
-  "``final``-by-default" and "non-publicly-subclassable-by-default".
-
 .. admonition:: TODO
 
     The ``@NSManaged`` attribute as it is in Swift 2 exposes implementation
@@ -1026,10 +1040,10 @@
 Initializers
 ------------
 
-New designated initializers may not be added to a publicly-subclassable class.
-This would change the inheritance of convenience initializers, which existing
-subclasses may depend on. A publicly-subclassable class also may not change
-a convenience initializer into a designated initializer or vice versa.
+New designated initializers may not be added to an ``open`` class. This would
+change the inheritance of convenience initializers, which existing subclasses
+may depend on. An ``open`` class also may not change a convenience initializer
+into a designated initializer or vice versa.
 
 A new ``required`` initializer may be added to a class only if it is a
 convenience initializer; that initializer may only call existing ``required``
@@ -1054,9 +1068,6 @@
 - Adding a default argument expression to a parameter.
 - Changing or removing a default argument is a `binary-compatible
   source-breaking change`.
-- The ``@noreturn`` attribute may be added to a public method only if it is
-  ``final`` or the class is not publicly subclassable. ``@noreturn`` is a
-  `versioned attribute`.
 - The ``@discardableResult`` and ``@warn_unqualified_access`` attributes may
   be added to a method without any additional versioning information.
 
@@ -1069,9 +1080,6 @@
 also be inlineable. Clients may only inline a method when they can devirtualize
 the call. (This does permit speculative devirtualization.)
 
-Any method that overrides a ``@noreturn`` method must also be marked
-``@noreturn``.
-
 
 Properties
 ----------
@@ -1080,8 +1088,7 @@
 struct properties, but the potential for overrides complicates things a little.
 Variable properties (those declared with ``var``) allow the following changes:
 
-- Adding (but not removing) a computed setter to a ``final`` property or a
-  property in a non-publicly-subclassable class.
+- Adding (but not removing) a computed setter to a non-``open`` property.
 - Adding or removing a non-public, non-versioned setter.
 - Changing from a stored property to a computed property, or vice versa, as
   long as a previously versioned setter is not removed.
@@ -1094,7 +1101,7 @@
 - Adding or removing ``unowned`` from a variable.
 - Adding or removing ``@NSCopying`` to/from a variable.
 
-Adding a public setter to a computed property that may be overridden is a
+Adding a public setter to an ``open`` property is a
 `binary-compatible source-breaking change`; any existing overrides will not
 know what to do with the setter and will likely not behave correctly.
 
@@ -1117,12 +1124,12 @@
 Subscripts behave much like properties; they inherit the rules of their struct
 counterparts with a few small changes:
 
-- Adding (but not removing) a public setter to a ``final`` subscript or a
-  subscript is permitted in a non-publicly-subclassable class.
+- Adding (but not removing) a public setter to a non-``open`` subscript is
+  permitted.
 - Adding or removing a non-public, non-versioned setter is permitted.
 - Changing the body of an accessor is permitted.
 
-Adding a public setter to a subscript that may be overridden is a
+Adding a public setter to an ``open`` subscript is a
 `binary-compatible source-breaking change`; any existing overrides will not
 know what to do with the setter and will likely not behave correctly.
 
@@ -1245,18 +1252,18 @@
 Versioning Internal Declarations
 ================================
 
-The initial discussion on versioning focused on ``public`` APIs, making sure
+The initial discussion on versioning focused on public APIs, making sure
 that a client knows what features they can use when a specific version of a
 library is present. Inlineable functions have much the same constraints, except
 the inlineable function is the client and the entities being used may not be
-``public``.
+public.
 
 Adding a versioning annotation to an ``internal`` entity promises that the
 entity will be available at link time in the containing module's binary. This
 makes it safe to refer to such an entity from an inlineable function. If the
-entity is ever made ``public``, its availability should not be changed; not
-only is it safe for new clients to rely on it, but *existing* clients require
-its presence as well.
+entity is ever made ``public`` or ``open``, its availability should not be
+changed; not only is it safe for new clients to rely on it, but *existing*
+clients require its presence as well.
 
 .. note::
 
@@ -1264,9 +1271,9 @@
     imply everything that ``public`` does, such as requiring overrides to be
     ``public``.
 
-Because a versioned class member may eventually be made ``public``, it must be
-assumed that new overrides may eventually appear from outside the module unless
-the member is marked ``final`` or the class is not publicly subclassable.
+Because a versioned class member may eventually be made ``open``, it must be
+assumed that new overrides may eventually appear from outside the module if the
+class is marked ``open`` unless the member is marked ``final``.
 
 Non-public conformances are never considered versioned, even if both the
 conforming type and the protocol are versioned. A conformance is considered
@@ -1611,8 +1618,8 @@
 there are incompatible associated types involved (because changing a member
 typealias is not a safe change).
 
-One solution is to disallow adding a conformance for an existing protocol to a
-publicly-subclassable class.
+One solution is to disallow adding a conformance for an existing protocol to an
+``open`` class.
 
 
 Recompiling changes a protocol's implementation
@@ -1689,10 +1696,10 @@
 
 - `SE-0030 Property Behaviors`_
 - (draft) `Overridable methods in extensions`_
-- (planned) Making classes "sealed" by default
+- `SE-0117 Allow Allow distinguishing between public access and public overridability <SE-0117>`_
 - (planned) Restricting retroactive modeling (protocol conformances for types you don't own)
 - (planned) Default implementations in protocols
-- (planned) Generalized existentials (values of protocol type)
+- (planned) `Generalized existentials (values of protocol type) <Generics>`_
 - (planned) Open and closed enums
 - (planned) Removing the "constant" guarantee for 'let' across module boundaries
 - (planned) Syntax for declaring "versioned" entities and their features
@@ -1705,6 +1712,8 @@
 
 .. _SE-0030 Property Behaviors: https://github.com/apple/swift-evolution/blob/master/proposals/0030-property-behavior-decls.md
 .. _Overridable methods in extensions: https://github.com/jrose-apple/swift-evolution/blob/overridable-members-in-extensions/proposals/nnnn-overridable-members-in-extensions.md
+.. _SE-0117: https://github.com/apple/swift-evolution/blob/master/proposals/0117-non-public-subclassable-by-default.md
+.. _Generics: https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#generalized-existentials
 
 This does not mean all of these proposals need to be accepted, only that their
 acceptance or rejection will affect this document.
@@ -1723,7 +1732,7 @@
   API
     An `entity` in a library that a `client` may use, or the collection of all
     such entities in a library. (If contrasting with `SPI`, only those entities
-    that are available to arbitrary clients.) Marked ``public`` in
+    that are available to arbitrary clients.) Marked ``public`` or ``open`` in
     Swift. Stands for "Application Programming Interface".
 
   availability context
diff --git a/docs/MutationModel.rst b/docs/MutationModel.rst
index 105661c..4ef9016 100644
--- a/docs/MutationModel.rst
+++ b/docs/MutationModel.rst
@@ -44,7 +44,7 @@
 argument, we detect this situation statically (hopefully one day we'll
 have a better error message): 
 
-::
+.. code-block:: swift-console
    
  <REPL Input>:1:9: error: expression does not type-check
  w.title += " (parenthesized remark)"
diff --git a/docs/PatternMatching.rst b/docs/PatternMatching.rst
index 25e493e..935a870 100644
--- a/docs/PatternMatching.rst
+++ b/docs/PatternMatching.rst
@@ -292,10 +292,10 @@
 
   switch (x)
   case .foo {
-    …
+    // …
   }
   case .bar {
-    …
+    // …
   }
   
 So instead, let's require the switch statement to have braces, and
@@ -303,9 +303,9 @@
 
   switch (x) {
   case .foo:
-    …
+    // …
   case .bar:
-    …
+    // …
   }
 
 That's really a lot prettier, except it breaks the rule about always grouping
diff --git a/docs/SIL.rst b/docs/SIL.rst
index 02b5426..0b314cd 100644
--- a/docs/SIL.rst
+++ b/docs/SIL.rst
@@ -1,4 +1,5 @@
 .. @raise litre.TestsAreMissing
+.. highlight:: none
 
 Swift Intermediate Language (SIL)
 =================================
diff --git a/docs/StringDesign.rst b/docs/StringDesign.rst
index c4a0772..d80004c 100644
--- a/docs/StringDesign.rst
+++ b/docs/StringDesign.rst
@@ -389,7 +389,9 @@
    `Search Grapheme Cluster: o`
 
 Also, each such segmentation provides a unique ``IndexType``, allowing
-a string to be indexed directly with different indexing schemes::
+a string to be indexed directly with different indexing schemes
+
+.. code-block:: swift-console
 
    |swift| var i = s.searchCharacters.startIndex
    `// r2 : UInt8 = UInt8(83)`
diff --git a/docs/SwiftFormat.md b/docs/SwiftFormat.md
new file mode 100644
index 0000000..715f36f
--- /dev/null
+++ b/docs/SwiftFormat.md
@@ -0,0 +1,49 @@
+
+# Swift-format
+
+## Introduction
+
+Note: This tool is still a work in progress.
+
+swift-format is a tool for automatically format your Swift files according to a
+set of rules. It is implemented as another driver kind, like swiftc, the batch
+compiler, so swift-format is actually a symbolic link to swift. This tool uses
+libIDE to format code, so it can be leveraged from multiple systems and editors.
+
+## Usage
+
+To print all the available options:
+
+     swift-format -help
+
+By default, swift-format will output the formatted file to the standard output:
+
+     swift-format sample.swift
+
+You can either output the result to a separate file:
+
+     swift-format sample.swift -o result.swift
+
+Or you can format in-place (the original file will be overwritten):
+
+     swift-format -in-place sample.swift
+
+If you want to indent using tabs instead of spaces, use the "-use-tabs" option:
+
+     swift-format -use-tabs sample.swift
+
+You can set the number of tabs or spaces using the "-tab-width" and
+"-indent-width" options, respectively.
+
+swift-format supports formatting a range of lines from a file:
+
+     swift-format -line-range 2:45 sample.swift
+
+This will format the file from lines 2 to 45, inclusive.
+
+You can format several files, but the "-line-range" option is not supported in
+that case.
+
+You can also provide several line ranges by using multiple "-line-range" options:
+
+     swift-format -line-range 2:45 -line-range 100:120 sample.swift
diff --git a/docs/Testing.rst b/docs/Testing.rst
index 75f3474..d18ac6a 100644
--- a/docs/Testing.rst
+++ b/docs/Testing.rst
@@ -62,7 +62,9 @@
 Although it is not recommended for day-to-day contributions, it is also
 technically possible to execute the tests directly via CMake. For example, if you have
 built Swift products at the directory ``build/Ninja-ReleaseAssert/swift-macosx-x86_64``,
-you may run the entire test suite directly using the following command::
+you may run the entire test suite directly using the following command:
+
+.. code-block:: bash
 
   cmake --build build/Ninja-ReleaseAssert/swift-macosx-x86_64 -- check-swift-macosx-x86_64
 
@@ -112,7 +114,9 @@
   ``executable_test`` in ``-Onone`` mode.
 
 If you need to manually run certain tests, you can invoke LLVM's lit.py script
-directly. For example::
+directly. For example:
+
+.. code-block:: bash
 
     % ${LLVM_SOURCE_ROOT}/utils/lit/lit.py -sv ${SWIFT_BUILD_ROOT}/test-iphonesimulator-i386/Parse/
 
@@ -128,7 +132,7 @@
 testing configuration explicitly, which then allows you to test files
 regardless of location.
 
-::
+.. code-block:: bash
 
     % ${LLVM_SOURCE_ROOT}/utils/lit/lit.py -sv --param swift_site_config=${SWIFT_BUILD_ROOT}/test-iphonesimulator-i386/lit.site.cfg ${SWIFT_SOURCE_ROOT}/test/Parse/
 
@@ -358,10 +362,16 @@
 * ``%{python}``: run the same Python interpreter that's being used to run the
   current ``lit`` test.
 
+* ``%FileCheck``: like the LLVM ``FileCheck`` utility, but occurrences of full
+  paths to the source and build directories in the input text are replaced with
+  path-independent constants.
+
+* ``%raw-FileCheck``: the LLVM ``FileCheck`` utility.
+
 When writing a test where output (or IR, SIL) depends on the bitness of the
 target CPU, use this pattern::
 
-  // RUN: %target-swift-frontend ... | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
+  // RUN: %target-swift-frontend ... | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
 
   // CHECK: common line
   // CHECK-32: only for 32-bit
@@ -377,7 +387,7 @@
 When writing a test where output (or IR, SIL) depends on the target CPU itself,
 use this pattern::
 
-  // RUN: %target-swift-frontend ... | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
+  // RUN: %target-swift-frontend ... | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
 
   // CHECK: common line
   // CHECK-i386:        only for i386
diff --git a/docs/archive/LangRefNew.rst b/docs/archive/LangRefNew.rst
index 85f02c8..d14ec79 100644
--- a/docs/archive/LangRefNew.rst
+++ b/docs/archive/LangRefNew.rst
@@ -494,7 +494,7 @@
 identifiers by code points only.  Source code must be normalized to a consistent
 normalization form before being submitted to the compiler.
 
-::
+.. code-block:: none
 
   // Valid identifiers
   foo
diff --git a/docs/conf.py b/docs/conf.py
index 9aef6f3..6b71bab 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -287,6 +287,8 @@
 def swift_get_lexer_by_name(_alias, *args, **kw):
     if _alias == 'swift':
         return swift_pygments_lexers.SwiftLexer()
+    elif _alias == 'sil':
+        return swift_pygments_lexers.SILLexer()
     elif _alias == 'swift-console':
         return swift_pygments_lexers.SwiftConsoleLexer()
     else:
diff --git a/docs/proposals/Concurrency.rst b/docs/proposals/Concurrency.rst
index c8606fb..43a2499 100644
--- a/docs/proposals/Concurrency.rst
+++ b/docs/proposals/Concurrency.rst
@@ -65,7 +65,9 @@
 executing the SIL code below in lockstep.  After they both load the same value
 they both try to release the object.  One thread succeeds and deallocates the
 object while another thread attempts to read the memory of a deallocated
-object::
+object:
+
+.. code-block:: sil
 
   %10 = global_addr @singleton : $*Bird
 
@@ -78,7 +80,9 @@
 
 Next, we'll look into the problem of sliced values. Intuitively, it is easy to
 see why sharing memory between two threads could lead to catastrophic bugs.
-Consider the program below::
+Consider the program below:
+
+.. code-block:: none
 
   Thread #1:              Thread #2:
    A.first = "John"        A.first = "Paul"
diff --git a/docs/proposals/InoutCOWOptimization.rst b/docs/proposals/InoutCOWOptimization.rst
index ccea04f..3ea135c 100644
--- a/docs/proposals/InoutCOWOptimization.rst
+++ b/docs/proposals/InoutCOWOptimization.rst
@@ -1,4 +1,6 @@
 :orphan:
+
+.. highlight:: sil
    
 ================================================
  Copy-On-Write Optimization of ``inout`` Values
diff --git a/docs/proposals/archive/ProgramStructureAndCompilationModel.rst b/docs/proposals/archive/ProgramStructureAndCompilationModel.rst
index cdc74f2..d549554 100644
--- a/docs/proposals/archive/ProgramStructureAndCompilationModel.rst
+++ b/docs/proposals/archive/ProgramStructureAndCompilationModel.rst
@@ -3,6 +3,8 @@
 .. @raise litre.TestsAreMissing
 .. _ProgramStructureAndCompilationModel:
 
+.. highlight:: none
+
 Swift Program Structure and Compilation Model
 =============================================
 
diff --git a/include/swift/ABI/MetadataValues.h b/include/swift/ABI/MetadataValues.h
index 9445fa5..26d0537 100644
--- a/include/swift/ABI/MetadataValues.h
+++ b/include/swift/ABI/MetadataValues.h
@@ -520,6 +520,7 @@
   // some high bits as well.
   enum : int_type {
     Indirect = 1,
+    Weak = 2,
 
     TypeMask = ((uintptr_t)-1) & ~(alignof(void*) - 1),
   };
@@ -537,10 +538,19 @@
                      | (indirect ? Indirect : 0));
   }
 
+  constexpr FieldType withWeak(bool weak) const {
+    return FieldType((Data & ~Weak)
+                     | (weak ? Weak : 0));
+  }
+
   bool isIndirect() const {
     return bool(Data & Indirect);
   }
 
+  bool isWeak() const {
+    return bool(Data & Weak);
+  }
+
   const Metadata *getType() const {
     return (const Metadata *)(Data & TypeMask);
   }
diff --git a/include/swift/AST/ASTContext.h b/include/swift/AST/ASTContext.h
index 0756059..dc3f256 100644
--- a/include/swift/AST/ASTContext.h
+++ b/include/swift/AST/ASTContext.h
@@ -206,8 +206,8 @@
   /// The name of the SwiftShims module "SwiftShims".
   Identifier SwiftShimsModuleName;
 
-  /// Note: in non-NDEBUG builds, tracks the context of each archetype
-  /// type, which can be very useful for debugging.
+  /// Note: in non-NDEBUG builds, tracks the context of each primary
+  /// archetype type, which can be very useful for debugging.
   llvm::DenseMap<ArchetypeType *, DeclContext *> ArchetypeContexts;
 
   // Define the set of known identifiers.
@@ -522,13 +522,10 @@
   /// 
   /// \param dc The context in which bridging is occurring.
   /// \param type The Swift for which we are querying bridging behavior.
-  /// \param resolver The lazy resolver.
   /// \param bridgedValueType The specific value type that is bridged,
   /// which will usually by the same as \c type.
-  Optional<Type> getBridgedToObjC(const DeclContext *dc,
-                                  Type type,
-                                  LazyResolver *resolver,
-                                  Type *bridgedValueType = nullptr) const;
+  Type getBridgedToObjC(const DeclContext *dc, Type type,
+                        Type *bridgedValueType = nullptr) const;
 
   /// Determine whether the given Swift type is representable in a
   /// given foreign language.
diff --git a/include/swift/AST/ArchetypeBuilder.h b/include/swift/AST/ArchetypeBuilder.h
index da59caf..78e8c15 100644
--- a/include/swift/AST/ArchetypeBuilder.h
+++ b/include/swift/AST/ArchetypeBuilder.h
@@ -216,9 +216,7 @@
 
 public:
   /// \brief Add a new generic parameter for which there may be requirements.
-  ///
-  /// \returns true if an error occurred, false otherwise.
-  bool addGenericParameter(GenericTypeParamDecl *GenericParam);
+  void addGenericParameter(GenericTypeParamDecl *GenericParam);
 
   /// Add the requirements placed on the given abstract type parameter
   /// to the given potential archetype.
@@ -227,9 +225,7 @@
   bool addGenericParameterRequirements(GenericTypeParamDecl *GenericParam);
 
   /// \brief Add a new generic parameter for which there may be requirements.
-  ///
-  /// \returns true if an error occurred, false otherwise.
-  bool addGenericParameter(GenericTypeParamType *GenericParam);
+  void addGenericParameter(GenericTypeParamType *GenericParam);
   
   /// \brief Add a new requirement.
   ///
@@ -248,9 +244,7 @@
   /// FIXME: Requirements from the generic signature are treated as coming from
   /// an outer scope in order to avoid disturbing the AllDependentTypes.
   /// Setting \c treatRequirementsAsExplicit to true disables this behavior.
-  ///
-  /// \returns true if an error occurred, false otherwise.
-  bool addGenericSignature(GenericSignature *sig, bool adoptArchetypes,
+  void addGenericSignature(GenericSignature *sig, bool adoptArchetypes,
                            bool treatRequirementsAsExplicit = false);
 
   /// \brief Get a generic signature based on the provided complete list
diff --git a/include/swift/AST/Attr.def b/include/swift/AST/Attr.def
index a1fd156..416de63 100644
--- a/include/swift/AST/Attr.def
+++ b/include/swift/AST/Attr.def
@@ -102,10 +102,7 @@
 SIMPLE_DECL_ATTR(optional, Optional,
                  OnConstructor|OnFunc|OnVar|OnSubscript|DeclModifier, 5)
 
-DECL_ATTR(swift3_migration, Swift3Migration,
-          OnEnum | OnStruct | OnClass | OnProtocol | OnTypeAlias |
-          OnVar | OnSubscript | OnConstructor | OnFunc | OnEnumElement |
-          OnGenericTypeParam | OnAssociatedType | LongAttribute, 6)
+/// NOTE: 6 is unused
 
 SIMPLE_DECL_ATTR(noreturn, NoReturn, OnFunc, 7)
 
diff --git a/include/swift/AST/Attr.h b/include/swift/AST/Attr.h
index 1d4702c..a4739f5 100644
--- a/include/swift/AST/Attr.h
+++ b/include/swift/AST/Attr.h
@@ -1018,28 +1018,6 @@
   }
 };
 
-/// The @swift3_migration attribute which describes the transformations
-/// required to migrate the given Swift 2.x API to Swift 3.
-class Swift3MigrationAttr : public DeclAttribute {
-  DeclName Renamed;
-  StringRef Message;
-
-public:
-  Swift3MigrationAttr(SourceLoc atLoc, SourceLoc attrLoc, SourceLoc lParenLoc,
-                      DeclName renamed, StringRef message, SourceLoc rParenLoc,
-                      bool implicit)
-    : DeclAttribute(DAK_Swift3Migration, atLoc, SourceRange(attrLoc, rParenLoc),
-                    implicit),
-      Renamed(renamed), Message(message) { }
-
-  DeclName getRenamed() const { return Renamed; }
-  StringRef getMessage() const { return Message; }
-
-  static bool classof(const DeclAttribute *DA) {
-    return DA->getKind() == DAK_Swift3Migration;
-  }
-};
-
 /// The @_specialize attribute, which forces specialization on the specified
 /// type list.
 class SpecializeAttr : public DeclAttribute {
diff --git a/include/swift/AST/Decl.h b/include/swift/AST/Decl.h
index 7fccfdf..964a2dc 100644
--- a/include/swift/AST/Decl.h
+++ b/include/swift/AST/Decl.h
@@ -29,7 +29,6 @@
 #include "swift/Basic/Range.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/Support/TrailingObjects.h"
 
 namespace swift {
@@ -1049,9 +1048,6 @@
   void printAsWritten(raw_ostream &OS) const;
 };
   
-template<typename T, ArrayRef<T> (GenericParamList::*accessor)() const>
-class NestedGenericParamListIterator;
-  
 /// GenericParamList - A list of generic parameters that is part of a generic
 /// function or type, along with extra requirements placed on those generic
 /// parameters and types derived from them.
@@ -1213,18 +1209,6 @@
   ///
   /// This does not include archetypes from the outer generic parameter list(s).
   ArrayRef<ArchetypeType *> getAllArchetypes() const { return AllArchetypes; }
-
-  /// \brief Return the number of primary archetypes.
-  unsigned getNumPrimaryArchetypes() const {
-    return size();
-  }
-  
-  /// \brief Retrieves the list containing only the primary archetypes described
-  /// by this generic parameter clause. This excludes archetypes for associated
-  /// types of the primary archetypes.
-  ArrayRef<ArchetypeType *> getPrimaryArchetypes() const {
-    return getAllArchetypes().slice(0, getNumPrimaryArchetypes());
-  }
   
   /// \brief Sets all archetypes *without* copying the source array.
   void setAllArchetypes(ArrayRef<ArchetypeType *> AA) {
@@ -1233,23 +1217,6 @@
     AllArchetypes = AA;
   }
 
-  using NestedArchetypeIterator
-    = NestedGenericParamListIterator<ArchetypeType*,
-                                     &GenericParamList::getAllArchetypes>;
-  using NestedGenericParamIterator
-    = NestedGenericParamListIterator<GenericTypeParamDecl*,
-                                     &GenericParamList::getParams>;
-  
-  /// \brief Retrieves a list containing all archetypes from this generic
-  /// parameter clause and all outer generic parameter clauses in outer-to-
-  /// inner order.
-  iterator_range<NestedArchetypeIterator> getAllNestedArchetypes() const;
-  
-  /// \brief Retrieves a list containing all generic parameter records from
-  /// this generic parameter clause and all outer generic parameter clauses in
-  /// outer-to-inner order.
-  iterator_range<NestedGenericParamIterator> getNestedGenericParams() const;
-  
   /// \brief Retrieve the outer generic parameter list, which provides the
   /// generic parameters of the context in which this generic parameter list
   /// exists.
@@ -1303,9 +1270,15 @@
     return depth;
   }
 
-  /// Derive a type substitution map for this generic parameter list from a
-  /// matching substitution vector.
-  TypeSubstitutionMap getSubstitutionMap(ArrayRef<Substitution> Subs) const;
+  /// Derive a contextual type substitution map from a substitution array.
+  /// This is just like GenericSignature::getSubstitutionMap(), except
+  /// with contextual types instead of interface types.
+  void
+  getSubstitutionMap(ModuleDecl *mod,
+                     GenericSignature *sig,
+                     ArrayRef<Substitution> subs,
+                     TypeSubstitutionMap &subsMap,
+                     ArchetypeConformanceMap &conformanceMap) const;
 
   /// Derive the all-archetypes list for the given list of generic
   /// parameters.
@@ -1313,7 +1286,10 @@
   deriveAllArchetypes(ArrayRef<GenericTypeParamDecl*> params,
                       SmallVectorImpl<ArchetypeType*> &archetypes);
 
-  ArrayRef<Substitution> getForwardingSubstitutions(ASTContext &C);
+  void getForwardingSubstitutionMap(TypeSubstitutionMap &result) const;
+
+  ArrayRef<Substitution>
+  getForwardingSubstitutions(GenericSignature *sig) const;
 
   /// Collect the nested archetypes of an archetype into the given
   /// collection.
@@ -1328,85 +1304,6 @@
   void dump();
 };
   
-/// An iterator template for lazily walking a nested generic parameter list.
-template<typename T, ArrayRef<T> (GenericParamList::*accessor)() const>
-class NestedGenericParamListIterator {
-  SmallVector<const GenericParamList*, 2> stack;
-  ArrayRef<T> elements;
-
-  void refreshElements() {
-    while (elements.empty()) {
-      stack.pop_back();
-      if (stack.empty()) break;
-      elements = (stack.back()->*accessor)();
-    }
-  }
-public:
-  // Create a 'begin' iterator for a generic param list.
-  NestedGenericParamListIterator(const GenericParamList *params) {
-    // Walk up to the outermost list to create a stack of lists to walk.
-    while (params) {
-      stack.push_back(params);
-      params = params->getOuterParameters();
-    }
-    // If the stack is empty, be like the 'end' iterator.
-    if (stack.empty())
-      return;
-
-    elements = (stack.back()->*accessor)();
-    refreshElements();
-  }
-  
-  // Create an 'end' iterator.
-  NestedGenericParamListIterator() {}
-  
-  // Iterator dereference.
-  const T &operator*() const {
-    return elements[0];
-  }
-  const T *operator->() const {
-    return &elements[0];
-  }
-  
-  // Iterator advancement.
-  NestedGenericParamListIterator &operator++() {
-    elements = elements.slice(1);
-    refreshElements();
-    return *this;
-  }
-  NestedGenericParamListIterator operator++(int) {
-    auto copy = *this;
-    ++(*this);
-    return copy;
-  }
-  
-  // Ghetto comparison. Only true if end() == end().
-  bool operator==(const NestedGenericParamListIterator &o) const {
-    return stack.empty() && o.stack.empty();
-  }
-  bool operator!=(const NestedGenericParamListIterator &o) const {
-    return !stack.empty() || !o.stack.empty();
-  }
-  
-  // An empty range of nested archetypes.
-  static iterator_range<NestedGenericParamListIterator> emptyRange() {
-    return {{}, {}};
-  }
-};
-  
-using NestedArchetypeIterator = GenericParamList::NestedArchetypeIterator;
-using NestedGenericParamIterator = GenericParamList::NestedGenericParamIterator;
-
-inline iterator_range<NestedArchetypeIterator>
-GenericParamList::getAllNestedArchetypes() const {
-  return {NestedArchetypeIterator(this), NestedArchetypeIterator()};
-}
-  
-inline iterator_range<NestedGenericParamIterator>
-GenericParamList::getNestedGenericParams() const {
-  return {NestedGenericParamIterator(this), NestedGenericParamIterator()};
-}
-
 /// A trailing where clause.
 class alignas(RequirementRepr) TrailingWhereClause final :
     private llvm::TrailingObjects<TrailingWhereClause, RequirementRepr> {
diff --git a/include/swift/AST/DiagnosticsParse.def b/include/swift/AST/DiagnosticsParse.def
index 405f42e..babe9f2 100644
--- a/include/swift/AST/DiagnosticsParse.def
+++ b/include/swift/AST/DiagnosticsParse.def
@@ -381,6 +381,9 @@
 
 WARNING(deprecated_operator_body,PointsToFirstBadToken,
         "operator should no longer be declared with body", ())
+WARNING(deprecated_operator_body_use_group,PointsToFirstBadToken,
+        "operator should no longer be declared with body; "
+        "use a precedence group instead", ())
 ERROR(operator_decl_no_fixity,none,
       "operator must be declared as 'prefix', 'postfix', or 'infix'", ())
 
@@ -743,6 +746,9 @@
 ERROR(parameter_curry_syntax_removed,none,
       "curried function declaration syntax has been removed; use a single parameter list", ())
 
+ERROR(initializer_as_typed_pattern,none,
+      "unexpected initializer in pattern; did you mean to use '='?", ())
+
 //------------------------------------------------------------------------------
 // Statement parsing diagnostics
 //------------------------------------------------------------------------------
@@ -1256,16 +1262,6 @@
 ERROR(effects_attribute_unknown_option,none,
       "unknown option '%0' for attribute '%1'", (StringRef, StringRef))
 
-// swift3_migration
-ERROR(attr_swift3_migration_label,none,
-      "expected 'renamed' or 'message' in 'swift3_migration' attribute", ())
-WARNING(warn_attr_swift3_migration_unknown_label,none,
-        "expected 'renamed' or 'message' in 'swift3_migration' attribute", ())
-ERROR(attr_swift3_migration_expected_rparen,none,
-      "expected ')' after name for 'swift3_migration' attribute", ())
-ERROR(attr_bad_swift_name,none,
-      "ill-formed Swift name '%0'", (StringRef))
-
 // unowned
 ERROR(attr_unowned_invalid_specifier,none,
       "expected 'safe' or 'unsafe'", ())
diff --git a/include/swift/AST/DiagnosticsSIL.def b/include/swift/AST/DiagnosticsSIL.def
index 260ee0b..8c62d14 100644
--- a/include/swift/AST/DiagnosticsSIL.def
+++ b/include/swift/AST/DiagnosticsSIL.def
@@ -179,7 +179,11 @@
 ERROR(missing_return,none,
       "missing return in a %select{function|closure}1 expected to return %0",
       (Type, unsigned))
-ERROR(non_exhaustive_switch,none, 
+ERROR(missing_never_call,none,
+      "%select{function|closure}1 with uninhabited return type %0 is missing "
+      "call to another never-returning function on all paths",
+      (Type, unsigned))
+ERROR(non_exhaustive_switch,none,
       "switch must be exhaustive, consider adding a default clause", ())
 ERROR(guard_body_must_not_fallthrough,none,
       "'guard' body may not fall through, consider using 'return' or 'break'"
diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def
index cc32531..9dcdb83 100644
--- a/include/swift/AST/DiagnosticsSema.def
+++ b/include/swift/AST/DiagnosticsSema.def
@@ -192,6 +192,9 @@
       "cannot subscript a value of type %0",
       (Type))
 
+ERROR(cannot_subscript_nil_literal,none,
+      "cannot subscript a nil literal value", ())
+
 ERROR(cannot_pass_rvalue_inout_subelement,none,
       "cannot pass immutable value as inout argument: %0",
       (StringRef))
@@ -683,6 +686,9 @@
       "in cast from type %0 to %1",
       (Type, Type))
 
+ERROR(types_not_convertible_use_bool_value,none,
+      "%0 is not convertible to %1; did you mean %0.boolValue", (Type, Type))
+
 ERROR(tuple_types_not_convertible_nelts,none,
       "%0 is not convertible to %1, "
       "tuples have a different number of elements", (Type, Type))
@@ -1434,10 +1440,11 @@
 
 // Protocols and existentials
 ERROR(assoc_type_outside_of_protocol,none,
-      "cannot use associated type %0 outside of its protocol", (Identifier))
-ERROR(typealias_to_assoc_type_outside_of_protocol,none,
-      "cannot use typealias %0 of associated type %1 outside of its protocol",
-      (Identifier, TypeLoc))
+      "associated type %0 can only be used with a concrete type or "
+      "generic parameter base", (Identifier))
+ERROR(typealias_outside_of_protocol,none,
+      "typealias %0 can only be used with a concrete type or "
+      "generic parameter base", (Identifier))
 
 ERROR(circular_protocol_def,none,
       "circular protocol inheritance %0", (StringRef))
@@ -1695,6 +1702,11 @@
 ERROR(enum_raw_type_not_equatable,none,
       "RawRepresentable 'init' cannot be synthesized because raw type %0 is not "
       "Equatable", (Type))
+ERROR(enum_raw_type_nonconforming_and_nonsynthable,none,
+      "%0 declares raw type %1, but does not conform to RawRepresentable "
+      "and conformance could not be synthesized", (Type, Type))
+NOTE(enum_declares_rawrep_with_raw_type,none,
+      "%0 declares raw type %1, which implies RawRepresentable", (Type, Type))
 ERROR(enum_raw_type_access,none,
       "enum %select{must be declared "
       "%select{private|fileprivate|internal|PUBLIC}2"
@@ -2166,9 +2178,6 @@
 ERROR(string_literal_broken_proto,none,
       "protocol 'ExpressibleByStringLiteral' is broken", ())
 
-ERROR(bool_type_broken,none,
-      "could not find a Bool type defined for 'is'", ())
-
 // Array literals
 ERROR(array_protocol_broken,none,
       "ExpressibleByArrayLiteral protocol definition is broken", ())
@@ -2488,7 +2497,10 @@
       "tuple pattern cannot match values of the non-tuple type %0", (Type))
 ERROR(closure_argument_list_tuple,none,
       "contextual closure type %0 expects %1 argument%s1, "
-      "but %2 were used in closure body", (Type, unsigned, unsigned))
+      "but %2 %select{were|was}3 used in closure body", (Type, unsigned, unsigned, bool))
+ERROR(closure_argument_list_single_tuple,none,
+      "contextual closure type specifies %0, but %1 %select{was|were}2 used in closure body, "
+      "try adding extra parentheses around the single tuple argument", (Type, unsigned, bool))
 ERROR(closure_argument_list_missing,none,
       "contextual type for closure argument list expects %0 argument%s0, "
       "which cannot be implicitly ignored", (unsigned))
@@ -2725,6 +2737,10 @@
       "members of constrained extensions cannot be declared @objc", ())
 ERROR(objc_in_generic_extension,none,
       "@objc is not supported within extensions of generic classes", ())
+ERROR(objc_operator, none,
+      "operator methods cannot be declared @objc", ())
+ERROR(objc_operator_proto, none,
+      "@objc protocols may not have operator requirements", ())
 
 ERROR(objc_for_generic_class,none,
       "generic subclasses of '@objc' classes cannot have an explicit '@objc' "
@@ -3102,12 +3118,6 @@
         "%select{variable|parameter}1 %0 was written to, but never read",
         (Identifier, unsigned))
 
-//------------------------------------------------------------------------------
-// Naming convention diagnostics
-//------------------------------------------------------------------------------
-WARNING(omit_needless_words, none,
-        "%0 could be named %1 [-Womit-needless-words]", (DeclName, DeclName))
-
 WARNING(extraneous_default_args_in_call, none,
         "call to %0 has extraneous arguments that could use defaults", 
         (DeclName))
diff --git a/include/swift/AST/Expr.h b/include/swift/AST/Expr.h
index 0aa9d36..2b0abbb 100644
--- a/include/swift/AST/Expr.h
+++ b/include/swift/AST/Expr.h
@@ -81,13 +81,8 @@
   ArrayDowncast,
   // A downcast from a dictionary type to another dictionary type.
   DictionaryDowncast,
-  // A downcast from a dictionary type to another dictionary type that
-  // requires bridging.
-  DictionaryDowncastBridged,
   // A downcast from a set type to another set type.
   SetDowncast,
-  // A downcast from a set type to another set type that requires bridging.
-  SetDowncastBridged,
   /// A downcast from an object of class or Objective-C existential
   /// type to its bridged value type.
   BridgeFromObjectiveC,
@@ -392,9 +387,8 @@
   class CollectionUpcastConversionExprBitfields {
     friend class CollectionUpcastConversionExpr;
     unsigned : NumExprBits;
-    unsigned BridgesToObjC : 1;
   };
-  enum { NumCollectionUpcastConversionExprBits = NumExprBits + 1 };
+  enum { NumCollectionUpcastConversionExprBits = NumExprBits + 0 };
   static_assert(NumCollectionUpcastConversionExprBits <= 32, "fits in an unsigned");
 
   class ObjCSelectorExprBitfields {
@@ -989,6 +983,7 @@
 /// "[\(min)..\(max)]"
 /// \endcode
 class InterpolatedStringLiteralExpr : public LiteralExpr {
+  /// Points at the beginning quote.
   SourceLoc Loc;
   MutableArrayRef<Expr *> Segments;
   Expr *SemanticExpr;
@@ -1007,10 +1002,12 @@
   void setSemanticExpr(Expr *SE) { SemanticExpr = SE; }
   
   SourceLoc getStartLoc() const {
-    return Segments.front()->getStartLoc();
+    return Loc;
   }
   SourceLoc getEndLoc() const {
-    return Segments.back()->getEndLoc();
+    // SourceLocs are token based, and the interpolated string is one string
+    // token, so the range should be (Start == End).
+    return Loc;
   }
   
   static bool classof(const Expr *E) {
@@ -1418,7 +1415,11 @@
 
 public:
   ArrayRef<ValueDecl*> getDecls() const { return Decls; }
-  
+
+  void setDecls(ArrayRef<ValueDecl *> domain) {
+    Decls = domain;
+  }
+
   /// getBaseType - Determine the type of the base object provided for the
   /// given overload set, which is only non-null when dealing with an overloaded
   /// member reference.
@@ -2935,19 +2936,12 @@
 public:
   CollectionUpcastConversionExpr(Expr *subExpr, Type type,
                                  ConversionPair keyConversion,
-                                 ConversionPair valueConversion,
-                                 bool bridgesToObjC)
+                                 ConversionPair valueConversion)
     : ImplicitConversionExpr(
         ExprKind::CollectionUpcastConversion, subExpr, type),
       KeyConversion(keyConversion), ValueConversion(valueConversion) {
     assert((!KeyConversion || ValueConversion)
            && "key conversion without value conversion");
-    CollectionUpcastConversionExprBits.BridgesToObjC = bridgesToObjC;
-  }
-
-  /// Whether this upcast bridges the source elements to Objective-C.
-  bool bridgesToObjC() const {
-    return CollectionUpcastConversionExprBits.BridgesToObjC;
   }
 
   /// Returns the expression that should be used to perform a
diff --git a/include/swift/AST/GenericSignature.h b/include/swift/AST/GenericSignature.h
index 74788b0..6cd223b 100644
--- a/include/swift/AST/GenericSignature.h
+++ b/include/swift/AST/GenericSignature.h
@@ -26,6 +26,7 @@
 namespace swift {
 
 class ArchetypeBuilder;
+class ProtocolType;
 
 /// Iterator that walks the generic parameter types declared in a generic
 /// signature and their dependent members.
@@ -163,13 +164,23 @@
     assert(Mem);
     return Mem;
   }
-  
-  /// Build a substitution map from a vector of Substitutions that correspond to
-  /// the generic parameters in this generic signature. The order of primary
-  /// archetypes in the substitution vector must match the order of generic
-  /// parameters in getGenericParams().
+
+  /// Build an interface type substitution map from a vector of Substitutions
+  /// that correspond to the generic parameters in this generic signature.
+  /// The order of primary archetypes in the substitution vector must match
+  /// the order of generic parameters in getGenericParams().
   TypeSubstitutionMap getSubstitutionMap(ArrayRef<Substitution> args) const;
-  
+
+  using LookupConformanceFn =
+      llvm::function_ref<ProtocolConformanceRef(Type, ProtocolType *)>;
+
+  /// Build an array of substitutions from an interface type substitution map,
+  /// using the given function to look up conformances.
+  void getSubstitutions(ModuleDecl &mod,
+                        const TypeSubstitutionMap &subs,
+                        LookupConformanceFn lookupConformance,
+                        SmallVectorImpl<Substitution> &result);
+
   /// Return a range that iterates through first all of the generic parameters
   /// of the signature, followed by all of their recursive member types exposed
   /// through protocol requirements.
@@ -181,7 +192,7 @@
     return GenericSignatureWitnessIterator(getRequirements());
   }
 
-  /// Determines whether this ASTContext is canonical.
+  /// Determines whether this GenericSignature is canonical.
   bool isCanonical() const;
   
   ASTContext &getASTContext() const;
diff --git a/include/swift/AST/KnownDecls.def b/include/swift/AST/KnownDecls.def
index 2282817..85a46fb 100644
--- a/include/swift/AST/KnownDecls.def
+++ b/include/swift/AST/KnownDecls.def
@@ -23,20 +23,12 @@
 FUNC_DECL(ArrayConditionalCast, "_arrayConditionalCast")
 
 FUNC_DECL(DictionaryUpCast, "_dictionaryUpCast")
-FUNC_DECL(DictionaryBridgeToObjectiveC, "_dictionaryBridgeToObjectiveC")
 FUNC_DECL(DictionaryDownCast, "_dictionaryDownCast")
 FUNC_DECL(DictionaryDownCastConditional, "_dictionaryDownCastConditional")
-FUNC_DECL(DictionaryBridgeFromObjectiveC, 
-          "_dictionaryBridgeFromObjectiveC")
-FUNC_DECL(DictionaryBridgeFromObjectiveCConditional, 
-          "_dictionaryBridgeFromObjectiveCConditional")
 
 FUNC_DECL(SetUpCast, "_setUpCast")
-FUNC_DECL(SetBridgeToObjectiveC, "_setBridgeToObjectiveC")
 FUNC_DECL(SetDownCast, "_setDownCast")
 FUNC_DECL(SetDownCastConditional, "_setDownCastConditional")
-FUNC_DECL(SetBridgeFromObjectiveC, "_setBridgeFromObjectiveC")
-FUNC_DECL(SetBridgeFromObjectiveCConditional, "_setBridgeFromObjectiveCConditional")
 
 FUNC_DECL(ConvertPointerToPointerArgument,
           "_convertPointerToPointerArgument")
@@ -67,6 +59,8 @@
 
 FUNC_DECL(BridgeAnythingToObjectiveC,
           "_bridgeAnythingToObjectiveC")
+FUNC_DECL(BridgeAnyObjectToAny,
+          "_bridgeAnyObjectToAny")
 
 FUNC_DECL(ConvertToAnyHashable, "_convertToAnyHashable")
 
diff --git a/include/swift/AST/PrintOptions.h b/include/swift/AST/PrintOptions.h
index c1e74e2..40047ba 100644
--- a/include/swift/AST/PrintOptions.h
+++ b/include/swift/AST/PrintOptions.h
@@ -16,6 +16,7 @@
 #include "swift/Basic/STLExtras.h"
 #include "swift/AST/AttrKind.h"
 #include "swift/AST/Identifier.h"
+#include <limits.h>
 #include <vector>
 
 namespace swift {
@@ -110,6 +111,36 @@
   }
 };
 
+/// A union of DeclAttrKind and TypeAttrKind.
+class AnyAttrKind {
+  unsigned kind : 31;
+  unsigned isType : 1;
+
+public:
+  AnyAttrKind(TypeAttrKind K) : kind(static_cast<unsigned>(K)), isType(1) {
+    static_assert(TAK_Count < UINT_MAX, "TypeAttrKind is > 31 bits");
+  }
+  AnyAttrKind(DeclAttrKind K) : kind(static_cast<unsigned>(K)), isType(0) {
+    static_assert(DAK_Count < UINT_MAX, "DeclAttrKind is > 31 bits");
+  }
+  AnyAttrKind() : kind(TAK_Count), isType(1) {}
+  AnyAttrKind(const AnyAttrKind &) = default;
+
+  /// Returns the TypeAttrKind, or TAK_Count if this is not a type attribute.
+  TypeAttrKind type() const {
+    return isType ? static_cast<TypeAttrKind>(kind) : TAK_Count;
+  }
+  /// Returns the DeclAttrKind, or DAK_Count if this is not a decl attribute.
+  DeclAttrKind decl() const {
+    return isType ? DAK_Count : static_cast<DeclAttrKind>(kind);
+  }
+
+  bool operator==(AnyAttrKind K) const {
+    return kind == K.kind && isType == K.isType;
+  }
+  bool operator!=(AnyAttrKind K) const { return !(*this == K); }
+};
+
 /// Options for printing AST nodes.
 ///
 /// A default-constructed PrintOptions is suitable for printing to users;
@@ -225,12 +256,12 @@
   bool PrintUserInaccessibleAttrs = true;
 
   /// List of attribute kinds that should not be printed.
-  std::vector<DeclAttrKind> ExcludeAttrList =
+  std::vector<AnyAttrKind> ExcludeAttrList =
       { DAK_Transparent, DAK_Effects, DAK_FixedLayout };
 
   /// List of attribute kinds that should be printed exclusively.
   /// Empty means allow all.
-  std::vector<DeclAttrKind> ExclusiveAttrList;
+  std::vector<AnyAttrKind> ExclusiveAttrList;
 
   /// Whether to print function @convention attribute on function types.
   bool PrintFunctionRepresentationAttrs = true;
@@ -314,7 +345,7 @@
 
   /// \brief The module in which the printer is used. Determines if the module
   /// name should be printed when printing a type.
-  ModuleDecl *CurrentModule;
+  ModuleDecl *CurrentModule = nullptr;
 
   /// \brief The information for converting archetypes to specialized types.
   std::shared_ptr<TypeTransformContext> TransformContext;
@@ -326,6 +357,16 @@
 
   BracketOptions BracketOptions;
 
+  bool excludeAttrKind(AnyAttrKind K) const {
+    if (std::any_of(ExcludeAttrList.begin(), ExcludeAttrList.end(),
+                    [K](AnyAttrKind other) { return other == K; }))
+      return true;
+    if (!ExclusiveAttrList.empty())
+      return std::none_of(ExclusiveAttrList.begin(), ExclusiveAttrList.end(),
+                          [K](AnyAttrKind other) { return other == K; });
+    return false;
+  }
+
   /// Retrieve the set of options for verbose printing to users.
   static PrintOptions printVerbose() {
     PrintOptions result;
@@ -350,7 +391,6 @@
     result.ExcludeAttrList.push_back(DAK_Exported);
     result.ExcludeAttrList.push_back(DAK_Inline);
     result.ExcludeAttrList.push_back(DAK_Rethrows);
-    result.ExcludeAttrList.push_back(DAK_Swift3Migration);
     result.PrintOverrideKeyword = false;
     result.AccessibilityFilter = Accessibility::Public;
     result.PrintIfConfig = false;
@@ -407,7 +447,6 @@
     result.PrintAccessibility = false;
     result.SkipUnavailable = false;
     result.ExcludeAttrList.push_back(DAK_Available);
-    result.ExcludeAttrList.push_back(DAK_Swift3Migration);
     result.ArgAndParamPrinting =
       PrintOptions::ArgAndParamPrintingMode::BothAlways;
     result.PrintDocumentationComments = false;
@@ -452,7 +491,6 @@
     PO.PrintFunctionRepresentationAttrs = false;
     PO.PrintDocumentationComments = false;
     PO.ExcludeAttrList.push_back(DAK_Available);
-    PO.ExcludeAttrList.push_back(DAK_Swift3Migration);
     PO.SkipPrivateStdlibDecls = true;
     PO.ExplodeEnumCaseDecls = true;
     return PO;
diff --git a/include/swift/AST/ProtocolConformance.h b/include/swift/AST/ProtocolConformance.h
index 5124590..23963d2 100644
--- a/include/swift/AST/ProtocolConformance.h
+++ b/include/swift/AST/ProtocolConformance.h
@@ -37,7 +37,6 @@
 class NormalProtocolConformance;
 class ProtocolConformance;
 class ModuleDecl;
-class SubstitutionIterator;
 enum class AllocationArena;
   
 /// \brief Type substitution mapping from substitutable types to their
@@ -562,8 +561,6 @@
     return GenericSubstitutions;
   }
 
-  SubstitutionIterator getGenericSubstitutionIterator() const;
-
   /// Get the protocol being conformed to.
   ProtocolDecl *getProtocol() const {
     return GenericConformance->getProtocol();
diff --git a/include/swift/AST/Substitution.h b/include/swift/AST/Substitution.h
index 6b1bab4..bedcfa9 100644
--- a/include/swift/AST/Substitution.h
+++ b/include/swift/AST/Substitution.h
@@ -59,12 +59,17 @@
   void dump() const;
   void dump(llvm::raw_ostream &os, unsigned indent = 0) const;
   
-  /// Substitute the replacement and conformance types with the given
-  /// substitution vector.
+  /// Apply a substitution to this substitution's replacement type and
+  /// conformances.
+  ///
+  /// Our replacement type must be written in terms of the context
+  /// archetypes of 'context', which in turn must be derived from the
+  /// generic requirements of 'sig'.
   Substitution subst(ModuleDecl *module,
+                     GenericSignature *sig,
                      GenericParamList *context,
                      ArrayRef<Substitution> subs) const;
-  
+
 private:
   friend class ProtocolConformance;
   
@@ -74,60 +79,6 @@
                      ArchetypeConformanceMap &conformanceMap) const;
 };
 
-/// An iterator over a list of archetypes and the substitutions
-/// applied to them.
-class SubstitutionIterator {
-  // TODO: this should use dependent types when getConformsTo() becomes
-  // efficient there.
-  ArrayRef<ArchetypeType*> Archetypes;
-  ArrayRef<Substitution> Subs;
-
-public:
-  SubstitutionIterator() = default;
-  explicit SubstitutionIterator(GenericParamList *params,
-                                ArrayRef<Substitution> subs);
-
-  struct iterator {
-    ArchetypeType * const *NextArch = nullptr;
-    const Substitution *NextSub = nullptr;
-
-    iterator() = default;
-    iterator(ArchetypeType * const *nextArch, const Substitution *nextSub)
-      : NextArch(nextArch), NextSub(nextSub) {}
-
-    iterator &operator++() {
-      ++NextArch;
-      ++NextSub;
-      return *this;
-    }
-
-    iterator operator++(int) {
-      iterator copy = *this;
-      ++*this;
-      return copy;
-    }
-
-    std::pair<ArchetypeType*,Substitution> operator*() const {
-      return { *NextArch, *NextSub };
-    }
-
-    bool operator==(const iterator &other) const {
-      assert((NextSub == other.NextSub) == (NextArch == other.NextArch));
-      return NextSub == other.NextSub;
-    }
-    bool operator!=(const iterator &other) const {
-      return !(*this == other);
-    }
-  };
-
-  ArrayRef<Substitution> getSubstitutions() const { return Subs; }
-
-  bool empty() const { return Archetypes.empty(); }
-
-  iterator begin() const { return { Archetypes.begin(), Subs.begin() }; }
-  iterator end() const { return { Archetypes.end(), Subs.end() }; }
-};
-
 void dump(const ArrayRef<Substitution> &subs);
 
 } // end namespace swift
diff --git a/include/swift/AST/Type.h b/include/swift/AST/Type.h
index 7df3aef..09d4937 100644
--- a/include/swift/AST/Type.h
+++ b/include/swift/AST/Type.h
@@ -167,7 +167,8 @@
   /// \param options Options that affect the substitutions.
   ///
   /// \returns the substituted type, or a null type if an error occurred.
-  Type subst(ModuleDecl *module, TypeSubstitutionMap &substitutions,
+  Type subst(ModuleDecl *module,
+             const TypeSubstitutionMap &substitutions,
              SubstOptions options) const;
 
   bool isPrivateStdlibType(bool whitelistProtocols=true) const;
@@ -184,11 +185,11 @@
   /// Get the canonical type, or return null if the type is null.
   CanType getCanonicalTypeOrNull() const; // in Types.h
 
-  /// Computes the meet between two types.
+  /// Computes the join between two types.
   ///
-  /// The meet of two types is the most specific type that is a supertype of
-  /// both \c type1 and \c type2. For example, given a simple class hierarchy as
-  /// follows:
+  /// The join of two types is the most specific type that is a supertype of
+  /// both \c type1 and \c type2, e.g., the least upper bound in the type
+  /// lattice. For example, given a simple class hierarchy as follows:
   ///
   /// \code
   /// class A { }
@@ -197,15 +198,15 @@
   /// class D { }
   /// \endcode
   ///
-  /// The meet of B and C is A, the meet of A and B is A. However, there is no
-  /// meet of D and A (or D and B, or D and C) because there is no common
+  /// The join of B and C is A, the join of A and B is A. However, there is no
+  /// join of D and A (or D and B, or D and C) because there is no common
   /// superclass. One would have to jump to an existential (e.g., \c AnyObject)
   /// to find a common type.
   /// 
-  /// \returns the meet of the two types, if there is a concrete type that can
-  /// express the meet, or a null type if the only meet would be a more-general
+  /// \returns the join of the two types, if there is a concrete type that can
+  /// express the join, or a null type if the only join would be a more-general
   /// existential type (e.g., \c Any).
-  static Type meet(Type type1, Type type2);
+  static Type join(Type type1, Type type2);
 
 private:
   // Direct comparison is disabled for types, because they may not be canonical.
diff --git a/include/swift/AST/TypeRepr.h b/include/swift/AST/TypeRepr.h
index 0cd143b..c5a0d1e 100644
--- a/include/swift/AST/TypeRepr.h
+++ b/include/swift/AST/TypeRepr.h
@@ -166,7 +166,7 @@
   TypeRepr *getTypeRepr() const { return Ty; }
 
   void printAttrs(llvm::raw_ostream &OS) const;
-  void printAttrs(ASTPrinter &Printer) const;
+  void printAttrs(ASTPrinter &Printer, const PrintOptions &Options) const;
 
   static bool classof(const TypeRepr *T) {
     return T->getKind() == TypeReprKind::Attributed;
diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h
index ababedf..79f6670 100644
--- a/include/swift/AST/Types.h
+++ b/include/swift/AST/Types.h
@@ -394,7 +394,7 @@
   bool hasReferenceSemantics();
 
   /// Is this an uninhabited type, such as 'Never'?
-  bool isNever();
+  bool isUninhabited();
 
   /// Is this the 'Any' type?
   bool isAny();
@@ -3748,12 +3748,10 @@
   /// True if this is the 'Self' parameter of a protocol or an associated type
   /// of 'Self'.
   bool isSelfDerived() {
-    ArchetypeType *t = this;
+    ArchetypeType *t = getPrimary();
 
-    do {
-      if (t->getSelfProtocol())
-        return true;
-    } while ((t = t->getParent()));
+    if (t && t->getSelfProtocol())
+      return true;
 
     return false;
   }
@@ -3810,6 +3808,16 @@
     return ParentOrOpened.isNull();
   }
 
+  /// getPrimary - Return the primary archetype parent of this archetype.
+  ArchetypeType *getPrimary() const {
+    assert(!getOpenedExistentialType() && "Check for opened existential first");
+
+    auto *archetype = this;
+    while (auto *parent = archetype->getParent())
+      archetype = parent;
+    return const_cast<ArchetypeType *>(archetype);
+  }
+
   /// Retrieve the ID number of this opened existential.
   UUID getOpenedExistentialID() const {
     assert(getOpenedExistentialType() && "Not an opened existential archetype");
diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h
index d8bb701..338bdeb 100644
--- a/include/swift/Basic/LangOptions.h
+++ b/include/swift/Basic/LangOptions.h
@@ -44,9 +44,6 @@
     /// \brief Disable API availability checking.
     bool DisableAvailabilityChecking = false;
     
-    /// Whether to warn about "needless" words in declarations.
-    bool WarnOmitNeedlessWords = false;
-
     /// Should access control be respected?
     bool EnableAccessControl = true;
 
@@ -95,9 +92,6 @@
     /// was not compiled with -enable-testing.
     bool EnableTestableAttrRequiresTestableModule = true;
 
-    /// Whether to implement SE-0111, the removal of argument labels in types.
-    bool SuppressArgumentLabelsInTypes = false;
-
     ///
     /// Flags for developers
     ///
@@ -143,17 +137,10 @@
     /// \brief Enable experimental nested generic types feature.
     bool EnableExperimentalNestedGenericTypes = false;
 
-    /// \brief Enable generalized collection casting.
-    bool EnableExperimentalCollectionCasts = true;
-
     /// Should we check the target OSs of serialized modules to see that they're
     /// new enough?
     bool EnableTargetOSChecking = true;
 
-    /// Should 'private' use Swift 3's lexical scoping, or the Swift 2 behavior
-    /// of 'fileprivate'?
-    bool EnableSwift3Private = true;
-
     /// Whether to use the import as member inference system
     ///
     /// When importing a global, try to infer whether we can import it as a
@@ -161,12 +148,6 @@
     /// and methods.
     bool InferImportAsMember = false;
 
-    /// Should 'id' in Objective-C be imported as 'Any' in Swift?
-    bool EnableIdAsAny = true;
-
-    /// Enable the Swift 3 migration via Fix-Its.
-    bool Swift3Migration = false;
-
     /// Sets the target we are building for and updates platform conditions
     /// to match.
     ///
diff --git a/include/swift/Driver/Compilation.h b/include/swift/Driver/Compilation.h
index 9af09e2..3b2f376 100644
--- a/include/swift/Driver/Compilation.h
+++ b/include/swift/Driver/Compilation.h
@@ -128,6 +128,10 @@
   /// True if temporary files should not be deleted.
   bool SaveTemps;
 
+  /// When true, dumps information on how long each compilation task took to
+  /// execute.
+  bool ShowDriverTimeCompilation;
+
   /// When true, dumps information about why files are being scheduled to be
   /// rebuilt.
   bool ShowIncrementalBuildDecisions = false;
@@ -145,7 +149,8 @@
               unsigned NumberOfParallelCommands = 1,
               bool EnableIncrementalBuild = false,
               bool SkipTaskExecution = false,
-              bool SaveTemps = false);
+              bool SaveTemps = false,
+              bool ShowDriverTimeCompilation = false);
   ~Compilation();
 
   ArrayRefView<std::unique_ptr<const Job>, const Job *, Compilation::unwrap>
diff --git a/include/swift/IDE/CodeCompletion.h b/include/swift/IDE/CodeCompletion.h
index adae171..021a9c0 100644
--- a/include/swift/IDE/CodeCompletion.h
+++ b/include/swift/IDE/CodeCompletion.h
@@ -128,8 +128,8 @@
     /// editor buffer if the preceding CallParameterName was inserted.
     CallParameterColon,
 
-    /// A equal sign between parameter name and value. Used in decl attribute.
-    DeclAttrParamEqual,
+    /// A colon between parameter name and value. Used in decl attribute.
+    DeclAttrParamColon,
 
     /// Required parameter type.
     CallParameterType,
@@ -197,7 +197,7 @@
            Kind == ChunkKind::CallParameterName ||
            Kind == ChunkKind::CallParameterInternalName ||
            Kind == ChunkKind::CallParameterColon ||
-           Kind == ChunkKind::DeclAttrParamEqual ||
+           Kind == ChunkKind::DeclAttrParamColon ||
            Kind == ChunkKind::DeclAttrParamKeyword ||
            Kind == ChunkKind::CallParameterType ||
            Kind == ChunkKind::CallParameterClosureType ||
diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td
index 878e6a8..34d98f2 100644
--- a/include/swift/Option/FrontendOptions.td
+++ b/include/swift/Option/FrontendOptions.td
@@ -94,10 +94,6 @@
   Flag<["-"], "disable-testable-attr-requires-testable-module">,
   HelpText<"Disable checking of @testable">;
 
-def suppress_argument_labels_in_types :
-  Flag<["-"], "suppress-argument-labels-in-types">,
-  HelpText<"SE-0111: Suppress argument labels in types">;
-
 def enable_target_os_checking :
   Flag<["-"], "enable-target-os-checking">,
   HelpText<"Enable checking the target OS of serialized modules">;
@@ -231,10 +227,6 @@
   Flag<["-"], "enable-experimental-nested-generic-types">,
   HelpText<"Enable experimental support for nested generic types">;
 
-def enable_experimental_collection_casts :
-  Flag<["-"], "enable-experimental-collection-casts">,
-  HelpText<"Enable experimental support for general collection casting">;
-
 def disable_availability_checking : Flag<["-"],
   "disable-availability-checking">,
   HelpText<"Disable checking for potentially unavailable APIs">;
@@ -247,20 +239,12 @@
   Flag<["-"], "enable-swift-newtype">,
   HelpText<"Enable the swift_newtype attribute">;
 
-def swift3_migration :
-  Flag<["-"], "swift3-migration">,
-  HelpText<"Enable Fix-It based migration aids for Swift 3">;
-
 def warn_long_function_bodies : Separate<["-"], "warn-long-function-bodies">,
   MetaVarName<"<n>">,
   HelpText<"Warns when type-checking a function takes longer than <n> ms">;
 def warn_long_function_bodies_EQ : Joined<["-"], "warn-long-function-bodies=">,
   Alias<warn_long_function_bodies>;
 
-def warn_omit_needless_words :
-  Flag<["-"], "Womit-needless-words">,
-  HelpText<"Warn about needless words in names">;
-
 def enable_source_import : Flag<["-"], "enable-source-import">,
   HelpText<"Enable importing of Swift source files">;
 
@@ -349,7 +333,4 @@
 def group_info_path : Separate<["-"], "group-info-path">,
   HelpText<"The path to collect the group information of the compiled module">;
 
-def enable_id_as_any: Flag<["-"], "enable-id-as-any">,
-  HelpText<"Enable importing ObjC 'id' as Swift 'Any' type">;
-
 } // end let Flags = [FrontendOption, NoDriverOption, HelpHidden]
diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td
index 4253d1f..57a65c9 100644
--- a/include/swift/Option/Options.td
+++ b/include/swift/Option/Options.td
@@ -169,6 +169,9 @@
 
 def save_temps : Flag<["-"], "save-temps">, Flags<[NoInteractiveOption]>,
   HelpText<"Save intermediate compilation results">;
+def driver_time_compilation : Flag<["-"], "driver-time-compilation">,
+  Flags<[NoInteractiveOption]>,
+  HelpText<"Prints the total time it took to execute all compilation tasks">;
 
 def emit_dependencies : Flag<["-"], "emit-dependencies">,
   Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
@@ -234,6 +237,10 @@
   Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
   HelpText<"Treat warnings as errors">;
 
+def continue_building_after_errors : Flag<["-"], "continue-building-after-errors">,
+  Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
+  HelpText<"Continue building, even after errors are encountered">;
+
 // Platform options.
 def enable_app_extension : Flag<["-"], "application-extension">,
   Flags<[FrontendOption, NoInteractiveOption]>,
@@ -321,11 +328,11 @@
   Flags<[SwiftFormatOption]>,
   HelpText<"Use tabs for indentation.">;
 
-def inplace : Flag<["-"], "inplace">, Group<code_formatting_Group>,
+def in_place : Flag<["-"], "in-place">, Group<code_formatting_Group>,
   Flags<[SwiftFormatOption]>,
   HelpText<"Overwrite input file with formatted file.">;
 
-def tab_width : Separate<["-"], "tabwidth">, Group<code_formatting_Group>,
+def tab_width : Separate<["-"], "tab-width">, Group<code_formatting_Group>,
   Flags<[SwiftFormatOption]>,
   HelpText<"Width of tab character.">, MetaVarName<"<n>">;
 
@@ -333,7 +340,7 @@
   Flags<[SwiftFormatOption]>,
   HelpText<"Number of characters to indent.">, MetaVarName<"<n>">;
 
-def line_ranges : Separate<["-"], "line-ranges">, Group<code_formatting_Group>,
+def line_range : Separate<["-"], "line-range">, Group<code_formatting_Group>,
   Flags<[SwiftFormatOption]>,
   HelpText<"<start line>:<end line>. Formats a range of lines (1-based). "
            "Can only be used with one input file.">, MetaVarName<"<n:n>">;
diff --git a/include/swift/Reflection/TypeLowering.h b/include/swift/Reflection/TypeLowering.h
index ce22a06..682ab66 100644
--- a/include/swift/Reflection/TypeLowering.h
+++ b/include/swift/Reflection/TypeLowering.h
@@ -19,6 +19,7 @@
 #define SWIFT_REFLECTION_TYPELOWERING_H
 
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/Support/Casting.h"
 
 #include <iostream>
@@ -206,6 +207,7 @@
   TypeRefBuilder &Builder;
   std::vector<std::unique_ptr<const TypeInfo>> Pool;
   llvm::DenseMap<const TypeRef *, const TypeInfo *> Cache;
+  llvm::DenseSet<const TypeRef *> RecursionCheck;
   llvm::DenseMap<std::pair<unsigned, unsigned>,
                  const ReferenceTypeInfo *> ReferenceCache;
 
diff --git a/include/swift/Runtime/HeapObject.h b/include/swift/Runtime/HeapObject.h
index 74dda40..e94a67a 100644
--- a/include/swift/Runtime/HeapObject.h
+++ b/include/swift/Runtime/HeapObject.h
@@ -899,8 +899,8 @@
 
 #else
 
-static inline void swift_unknownWeakLoadStrong(WeakReference *ref) {
-  swift_weakLoadStrong(ref);
+static inline void *swift_unknownWeakLoadStrong(WeakReference *ref) {
+  return static_cast<void *>(swift_weakLoadStrong(ref));
 }
 
 #endif /* SWIFT_OBJC_INTEROP */
@@ -918,8 +918,8 @@
 
 #else
 
-static inline void swift_unknownWeakTakeStrong(WeakReference *ref) {
-  swift_weakTakeStrong(ref);
+static inline void *swift_unknownWeakTakeStrong(WeakReference *ref) {
+  return static_cast<void *>(swift_weakTakeStrong(ref));
 }
 
 #endif /* SWIFT_OBJC_INTEROP */
@@ -1155,6 +1155,11 @@
 
 #endif /* SWIFT_OBJC_INTEROP */
 
+/// Return the name of a Swift type represented by a metadata object.
+SWIFT_CC(swift) SWIFT_RUNTIME_EXPORT
+extern "C"
+TwoWordPair<const char *, uintptr_t>::Return
+swift_getTypeName(const Metadata *type, bool qualified);  
 
 } // end namespace swift
 
diff --git a/include/swift/Runtime/Metadata.h b/include/swift/Runtime/Metadata.h
index e8cc88a..d14b0be 100644
--- a/include/swift/Runtime/Metadata.h
+++ b/include/swift/Runtime/Metadata.h
@@ -134,6 +134,7 @@
   = typename Runtime::template FarRelativeIndirectablePointer<Pointee,Nullable>;
 
 struct HeapObject;
+struct WeakReference;
   
 template <typename Runtime> struct TargetMetadata;
 using Metadata = TargetMetadata<InProcess>;
@@ -2327,8 +2328,9 @@
   = TargetOpaqueExistentialContainer<InProcess>;
 
 /// The basic layout of a class-bounded existential type.
-struct ClassExistentialContainer {
-  void *Value;
+template <typename ContainedValue>
+struct ClassExistentialContainerImpl {
+  ContainedValue Value;
 
   const WitnessTable **getWitnessTables() {
     return reinterpret_cast<const WitnessTable**>(this + 1);
@@ -2337,11 +2339,15 @@
     return reinterpret_cast<const WitnessTable* const *>(this + 1);
   }
 
-  void copyTypeInto(ClassExistentialContainer *dest, unsigned numTables) const {
+  void copyTypeInto(ClassExistentialContainerImpl *dest,
+                    unsigned numTables) const {
     for (unsigned i = 0; i != numTables; ++i)
       dest->getWitnessTables()[i] = getWitnessTables()[i];
   }
 };
+using ClassExistentialContainer = ClassExistentialContainerImpl<void *>;
+using WeakClassExistentialContainer =
+  ClassExistentialContainerImpl<WeakReference>;
 
 /// The possible physical representations of existential types.
 enum class ExistentialTypeRepresentation {
diff --git a/include/swift/Runtime/RuntimeFunctions.def b/include/swift/Runtime/RuntimeFunctions.def
index 5c741ea..5a18465 100644
--- a/include/swift/Runtime/RuntimeFunctions.def
+++ b/include/swift/Runtime/RuntimeFunctions.def
@@ -841,6 +841,12 @@
          ARGS(ObjCPtrTy),
          ATTRS(NoUnwind, ReadOnly))
 
+// id object_dispose(id object);
+FUNCTION(ObjectDispose, object_dispose, C_CC,
+         RETURNS(ObjCPtrTy),
+         ARGS(ObjCPtrTy),
+         ATTRS(NoUnwind))
+
 // Class objc_lookUpClass(const char *name);
 FUNCTION(LookUpClass, objc_lookUpClass, C_CC,
          RETURNS(ObjCClassPtrTy),
diff --git a/include/swift/SIL/CFG.h b/include/swift/SIL/CFG.h
index 281ccb4..7f54197 100644
--- a/include/swift/SIL/CFG.h
+++ b/include/swift/SIL/CFG.h
@@ -29,6 +29,7 @@
 template <> struct GraphTraits<swift::SILBasicBlock*> {
   typedef swift::SILBasicBlock NodeType;
   typedef NodeType::SuccessorListTy::iterator ChildIteratorType;
+  typedef NodeType *NodeRef;
 
   static NodeType *getEntryNode(NodeType *BB) { return BB; }
 
@@ -43,6 +44,7 @@
 template <> struct GraphTraits<const swift::SILBasicBlock*> {
   typedef const swift::SILBasicBlock NodeType;
   typedef NodeType::ConstSuccessorListTy::iterator ChildIteratorType;
+  typedef NodeType *NodeRef;
 
   static NodeType *getEntryNode(NodeType *BB) { return BB; }
 
@@ -57,6 +59,7 @@
 template <> struct GraphTraits<Inverse<swift::SILBasicBlock*> > {
   typedef swift::SILBasicBlock NodeType;
   typedef NodeType::pred_iterator ChildIteratorType;
+  typedef NodeType *NodeRef;
 
   static NodeType *getEntryNode(Inverse<swift::SILBasicBlock *> G) {
     return G.Graph;
@@ -72,6 +75,8 @@
 template <> struct GraphTraits<Inverse<const swift::SILBasicBlock*> > {
   typedef const swift::SILBasicBlock NodeType;
   typedef NodeType::pred_iterator ChildIteratorType;
+  typedef NodeType *NodeRef;
+
   static NodeType *getEntryNode(Inverse<const swift::SILBasicBlock *> G) {
     return G.Graph;
   }
@@ -86,6 +91,7 @@
 template <> struct GraphTraits<swift::SILFunction*>
     : public GraphTraits<swift::SILBasicBlock*> {
   typedef swift::SILFunction *GraphType;
+  typedef NodeType *NodeRef;
 
   static NodeType *getEntryNode(GraphType F) { return &F->front(); }
 
@@ -94,9 +100,11 @@
   static nodes_iterator nodes_end(GraphType F) { return F->end(); }
   static unsigned size(GraphType F) { return F->size(); }
 };
+
 template <> struct GraphTraits<Inverse<swift::SILFunction*> >
     : public GraphTraits<Inverse<swift::SILBasicBlock*> > {
   typedef Inverse<swift::SILFunction *> GraphType;
+  typedef NodeType *NodeRef;
 
   static NodeType *getEntryNode(GraphType F) { return &F.Graph->front(); }
 
diff --git a/include/swift/SIL/Dominance.h b/include/swift/SIL/Dominance.h
index 62da9a5..8002e4f 100644
--- a/include/swift/SIL/Dominance.h
+++ b/include/swift/SIL/Dominance.h
@@ -170,6 +170,7 @@
 template <> struct GraphTraits<swift::DominanceInfoNode *> {
   using NodeType = swift::DominanceInfoNode;
   using ChildIteratorType = NodeType::iterator;
+  typedef NodeType *NodeRef;
 
   static NodeType *getEntryNode(NodeType *N) { return N; }
   static inline ChildIteratorType child_begin(NodeType *N) {
@@ -181,6 +182,7 @@
 template <> struct GraphTraits<const swift::DominanceInfoNode *> {
   using NodeType = const swift::DominanceInfoNode;
   using ChildIteratorType = NodeType::const_iterator;
+  typedef NodeType *NodeRef;
 
   static NodeType *getEntryNode(NodeType *N) { return N; }
   static inline ChildIteratorType child_begin(NodeType *N) {
diff --git a/include/swift/SIL/Projection.h b/include/swift/SIL/Projection.h
index ddedb44..e2bbddb 100644
--- a/include/swift/SIL/Projection.h
+++ b/include/swift/SIL/Projection.h
@@ -870,6 +870,9 @@
   bool isSingleton() const {
     // If we only have one root node, there is no interesting explosion
     // here. Exit early.
+    //
+    // NOTE: In case of a type unable to be exploded, e.g. enum, we treated it
+    // as a singleton.
     if (ProjectionTreeNodes.size() == 1)
       return true;
 
diff --git a/include/swift/SIL/SILBasicBlock.h b/include/swift/SIL/SILBasicBlock.h
index 515e66f..993f80f 100644
--- a/include/swift/SIL/SILBasicBlock.h
+++ b/include/swift/SIL/SILBasicBlock.h
@@ -20,10 +20,6 @@
 #include "swift/Basic/Range.h"
 #include "swift/SIL/SILInstruction.h"
 
-namespace llvm {
-  template <class T> struct GraphTraits;
-};
-
 namespace swift {
 class SILFunction;
 class SILArgument;
diff --git a/include/swift/SIL/SILBuilder.h b/include/swift/SIL/SILBuilder.h
index 5297393..0577499 100644
--- a/include/swift/SIL/SILBuilder.h
+++ b/include/swift/SIL/SILBuilder.h
@@ -941,8 +941,9 @@
   DynamicMethodInst *createDynamicMethod(SILLocation Loc, SILValue Operand,
                                          SILDeclRef Member, SILType MethodTy,
                                          bool Volatile = false) {
-    return insert(new (F.getModule()) DynamicMethodInst(
-        getSILDebugLocation(Loc), Operand, Member, MethodTy, Volatile));
+    return insert(DynamicMethodInst::create(
+        getSILDebugLocation(Loc), Operand, Member, MethodTy, Volatile,
+        &F, OpenedArchetypes));
   }
 
   OpenExistentialAddrInst *
diff --git a/include/swift/SIL/SILCloner.h b/include/swift/SIL/SILCloner.h
index 66ed0f7..87fe698 100644
--- a/include/swift/SIL/SILCloner.h
+++ b/include/swift/SIL/SILCloner.h
@@ -221,9 +221,9 @@
   void doPreProcess(SILInstruction *Orig) {
     // Extend the set of available opened archetypes by the opened archetypes
     // used by the instruction being cloned.
-    auto OpenedArchetypeOperands = Orig->getOpenedArchetypeOperands();
+    auto TypeDependentOperands = Orig->getTypeDependentOperands();
     Builder.getOpenedArchetypes().addOpenedArchetypeOperands(
-        OpenedArchetypeOperands);
+        TypeDependentOperands);
   }
 
   void doPostProcess(SILInstruction *Orig, SILInstruction *Cloned) {
@@ -270,6 +270,7 @@
     {
       setInsertionPoint(SC.getBuilder().getInsertionBB(),
                         SC.getBuilder().getInsertionPoint());
+      setOpenedArchetypesTracker(SC.getBuilder().getOpenedArchetypesTracker());
     }
 
   ~SILBuilderWithPostProcess() {
diff --git a/include/swift/SIL/SILFunction.h b/include/swift/SIL/SILFunction.h
index be818be..99321e7 100644
--- a/include/swift/SIL/SILFunction.h
+++ b/include/swift/SIL/SILFunction.h
@@ -94,6 +94,9 @@
   /// The context archetypes of the function.
   GenericParamList *ContextGenericParams;
 
+  /// The forwarding substitutions, lazily computed.
+  Optional<ArrayRef<Substitution>> ForwardingSubs;
+
   /// The collection of all BasicBlocks in the SILFunction. Empty for external
   /// function references.
   BlockListType BlockList;
diff --git a/include/swift/SIL/SILInstruction.h b/include/swift/SIL/SILInstruction.h
index 5857bd6..b466a37 100644
--- a/include/swift/SIL/SILInstruction.h
+++ b/include/swift/SIL/SILInstruction.h
@@ -169,33 +169,52 @@
   /// Return the array of operands for this instruction.
   ArrayRef<Operand> getAllOperands() const;
 
-  /// Return the array of opened archetype operands for this instruction.
-  ArrayRef<Operand> getOpenedArchetypeOperands() const;
+  /// Return the array of type dependent operands for this instruction.
+  ///
+  /// Type dependent operands are hidden operands, i.e. not part of the SIL
+  /// syntax (although they are printed as "type-defs" in comments).
+  /// Their purpose is to establish a def-use relationship between
+  ///   -) an instruction/argument which defines a type, e.g. open_existential
+  /// and
+  ///   -) this instruction, which uses the type, but doesn't use the defining
+  ///      instruction as value-operand, e.g. a type in the substitution list.
+  ///
+  /// Currently there are two kinds of type dependent operands:
+  ///
+  /// 1. for opened archetypes:
+  ///     %o = open_existential_addr %0 : $*P to $*@opened("UUID") P
+  ///     %w = witness_method $@opened("UUID") P, ... // type-defs: %o
+  ///
+  /// 2. for the dynamic self argument:
+  ///     sil @foo : $@convention(method) (@thick X.Type) {
+  ///     bb0(%0 : $@thick X.Type):
+  ///       %a = apply %f<@dynamic_self X>() ... // type-defs: %0
+  ///
+  /// The type dependent operands are just there to let optimizations know that
+  /// there is a dependency between the instruction/argument which defines the
+  /// type and the instruction which uses the type.
+  ArrayRef<Operand> getTypeDependentOperands() const;
 
   /// Return the array of mutable operands for this instruction.
   MutableArrayRef<Operand> getAllOperands();
 
-  /// Return the array of opened archetypes operands for this instruction.
-  MutableArrayRef<Operand> getOpenedArchetypeOperands();
-
-  /// Returns true if a given kind of instruction may have opened archetype
-  /// operands.
-  bool mayHaveOpenedArchetypeOperands() const;
+  /// Return the array of mutable type depedent operands for this instruction.
+  MutableArrayRef<Operand> getTypeDependentOperands();
 
   unsigned getNumOperands() const { return getAllOperands().size(); }
 
-  unsigned getNumOpenedArchetypeOperands() const {
-    return getOpenedArchetypeOperands().size();
+  unsigned getNumTypeDependentOperands() const {
+    return getTypeDependentOperands().size();
   }
 
-  bool isOpenedArchetypeOperand(unsigned i) const {
-    return i >= getNumOperands() - getNumOpenedArchetypeOperands();
+  bool isTypeDependentOperand(unsigned i) const {
+    return i >= getNumOperands() - getNumTypeDependentOperands();
   }
 
-  bool isOpenedArchetypeOperand(Operand &O) const {
+  bool isTypeDependentOperand(Operand &O) const {
     assert(O.getUser() == this &&
            "Operand does not belong to a SILInstruction");
-    return isOpenedArchetypeOperand(O.getOperandNumber());
+    return isTypeDependentOperand(O.getOperandNumber());
   }
 
   SILValue getOperand(unsigned Num) const {
@@ -375,15 +394,11 @@
   ArrayRef<Operand> getAllOperands() const { return Operands.asArray(); }
   MutableArrayRef<Operand> getAllOperands() { return Operands.asArray(); }
 
-  bool hasOpenedArchetypeOperands() const {
-    return false;
-  }
-
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return {};
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return {};
   }
 
@@ -393,14 +408,14 @@
 };
 
 /// A template base class for instructions that take a single regular SILValue
-/// operand, a set of opened archetypes operands and has no result
+/// operand, a set of type dependent operands and has no result
 /// or a single value result. The operands are tail allocated after the
 /// instruction. Further trailing data can be allocated as well if
 /// TRAILING_TYPES are provided.
 template<ValueKind KIND, typename DERIVED,
          typename BASE, bool HAS_RESULT,
          typename... TRAILING_TYPES>
-class UnaryInstructionWithOpenArchetypesBase :
+class UnaryInstructionWithTypeDependentOperandsBase :
   public BASE,
   protected llvm::TrailingObjects<DERIVED, Operand, TRAILING_TYPES...> {
 
@@ -420,12 +435,12 @@
   using TrailingBase::totalSizeToAlloc;
 
   // Total number of operands of this instruction.
-  // It is number of opened archetype operands + 1.
+  // It is number of type dependent operands + 1.
   unsigned NumOperands;
 
 public:
   // Destruct tail allocated objects.
-  ~UnaryInstructionWithOpenArchetypesBase() {
+  ~UnaryInstructionWithTypeDependentOperandsBase() {
     Operand *Operands = &getAllOperands()[0];
     for (unsigned i = 0, end = NumOperands; i < end; ++i) {
       Operands[i].~Operand();
@@ -437,40 +452,40 @@
     return NumOperands;
   }
 
-  UnaryInstructionWithOpenArchetypesBase(
+  UnaryInstructionWithTypeDependentOperandsBase(
       SILDebugLocation DebugLoc, SILValue Operand,
-      ArrayRef<SILValue> OpenedArchetypeOperands)
-      : BASE(KIND, DebugLoc), NumOperands(1 + OpenedArchetypeOperands.size()) {
+      ArrayRef<SILValue> TypeDependentOperands)
+      : BASE(KIND, DebugLoc), NumOperands(1 + TypeDependentOperands.size()) {
     TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                           Operand, OpenedArchetypeOperands);
+                                           Operand, TypeDependentOperands);
   }
 
   template <typename X = void>
-  UnaryInstructionWithOpenArchetypesBase(
+  UnaryInstructionWithTypeDependentOperandsBase(
       SILDebugLocation DebugLoc, SILValue Operand,
-      ArrayRef<SILValue> OpenedArchetypeOperands,
+      ArrayRef<SILValue> TypeDependentOperands,
       typename std::enable_if<has_result<X>::value, SILType>::type Ty)
       : BASE(KIND, DebugLoc, Ty),
-        NumOperands(1 + OpenedArchetypeOperands.size())
+        NumOperands(1 + TypeDependentOperands.size())
   {
     TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                           Operand, OpenedArchetypeOperands);
+                                           Operand, TypeDependentOperands);
   }
 
   template <typename X = void, typename... A>
-  UnaryInstructionWithOpenArchetypesBase(
+  UnaryInstructionWithTypeDependentOperandsBase(
       SILDebugLocation DebugLoc, SILValue Operand,
-      ArrayRef<SILValue> OpenedArchetypeOperands,
+      ArrayRef<SILValue> TypeDependentOperands,
       typename std::enable_if<has_result<X>::value, SILType>::type Ty,
       A &&... args)
       : BASE(KIND, DebugLoc, Ty, std::forward<A>(args)...),
-        NumOperands(1 + OpenedArchetypeOperands.size())
+        NumOperands(1 + TypeDependentOperands.size())
   {
     TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                           Operand, OpenedArchetypeOperands);
+                                           Operand, TypeDependentOperands);
   }
 
-  unsigned getNumOpenedArchetypeOperands() const {
+  unsigned getNumTypeDependentOperands() const {
     return NumOperands - 1;
   }
 
@@ -494,15 +509,11 @@
             static_cast<size_t>(NumOperands)};
   }
 
-  bool hasOpenedArchetypeOperands() const {
-    return NumOperands > 1;
-  }
-
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return getAllOperands().slice(1);
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return getAllOperands().slice(1);
   }
 
@@ -604,7 +615,7 @@
   TailAllocatedDebugVariable VarInfo;
 
   AllocStackInst(SILDebugLocation Loc, SILType elementType,
-                 ArrayRef<SILValue> OpenedArchetypeOperands,
+                 ArrayRef<SILValue> TypeDependentOperands,
                  SILFunction &F,
                  SILDebugVariable Var);
 
@@ -649,11 +660,11 @@
     return { getTrailingObjects<Operand>(), NumOperands };
   }
 
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return getAllOperands();
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return getAllOperands();
   }
 
@@ -675,7 +686,7 @@
   bool ObjC : 1;
 
   AllocRefInst(SILDebugLocation Loc, SILType type, SILFunction &F, bool objc,
-               bool canBeOnStack, ArrayRef<SILValue> OpenedArchetypeOperands);
+               bool canBeOnStack, ArrayRef<SILValue> TypeDependentOperands);
 
   static AllocRefInst *create(SILDebugLocation Loc, SILType type,
                               SILFunction &F, bool objc, bool canBeOnStack,
@@ -697,11 +708,11 @@
     return { getTrailingObjects<Operand>(), NumOperands };
   }
 
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return getAllOperands();
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return getAllOperands();
   }
 
@@ -718,7 +729,7 @@
 /// the given metatype value. Aside from the reference count, the
 /// instance is returned uninitialized.
 class AllocRefDynamicInst final
-    : public UnaryInstructionWithOpenArchetypesBase<
+    : public UnaryInstructionWithTypeDependentOperandsBase<
                                   ValueKind::AllocRefDynamicInst,
                                   AllocRefDynamicInst,
                                   AllocationInst,
@@ -728,7 +739,7 @@
   bool ObjC;
 
   AllocRefDynamicInst(SILDebugLocation DebugLoc, SILValue operand,
-                      ArrayRef<SILValue> OpenedArchetypeOperands, SILType ty,
+                      ArrayRef<SILValue> TypeDependentOperands, SILType ty,
                       bool objc);
 
   static AllocRefDynamicInst *
@@ -742,7 +753,7 @@
 
 /// AllocValueBufferInst - Allocate memory in a value buffer.
 class AllocValueBufferInst final
-    : public UnaryInstructionWithOpenArchetypesBase<
+    : public UnaryInstructionWithTypeDependentOperandsBase<
                                   ValueKind::AllocValueBufferInst,
                                   AllocValueBufferInst,
                                   AllocationInst,
@@ -751,7 +762,7 @@
 
   AllocValueBufferInst(SILDebugLocation DebugLoc, SILType valueType,
                        SILValue operand,
-                       ArrayRef<SILValue> OpenedArchetypeOperands);
+                       ArrayRef<SILValue> TypeDependentOperands);
 
   static AllocValueBufferInst *
   create(SILDebugLocation DebugLoc, SILType valueType, SILValue operand,
@@ -778,7 +789,7 @@
   TailAllocatedDebugVariable VarInfo;
 
   AllocBoxInst(SILDebugLocation DebugLoc, SILType ElementType,
-               ArrayRef<SILValue> OpenedArchetypeOperands, SILFunction &F,
+               ArrayRef<SILValue> TypeDependentOperands, SILFunction &F,
                SILDebugVariable Var);
 
   static AllocBoxInst *create(SILDebugLocation Loc, SILType elementType,
@@ -820,11 +831,11 @@
     return {getTrailingObjects<Operand>(), NumOperands};
   }
 
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return getAllOperands();
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return getAllOperands();
   }
 
@@ -850,7 +861,7 @@
   AllocExistentialBoxInst(SILDebugLocation DebugLoc, SILType ExistentialType,
                           CanType ConcreteType,
                           ArrayRef<ProtocolConformanceRef> Conformances,
-                          ArrayRef<SILValue> OpenedArchetypeOperands,
+                          ArrayRef<SILValue> TypeDependentOperands,
                           SILFunction *Parent);
 
   static AllocExistentialBoxInst *
@@ -882,11 +893,11 @@
     return {getTrailingObjects<Operand>(), NumOperands};
   }
 
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return getAllOperands();
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return getAllOperands();
   }
 
@@ -942,12 +953,12 @@
   ApplyInstBase(ValueKind kind, SILDebugLocation DebugLoc, SILValue callee,
                 SILType substCalleeType, ArrayRef<Substitution> substitutions,
                 ArrayRef<SILValue> args,
-                ArrayRef<SILValue> openedArchetypesOperands,
+                ArrayRef<SILValue> TypeDependentOperands,
                 As... baseArgs)
       : Base(kind, DebugLoc, baseArgs...), SubstCalleeType(substCalleeType),
         NumSubstitutions(substitutions.size()), NonThrowing(false),
         NumCallArguments(args.size()),
-        Operands(this, args, openedArchetypesOperands, callee) {
+        Operands(this, args, TypeDependentOperands, callee) {
     static_assert(sizeof(Impl) == sizeof(*this),
         "subclass has extra storage, cannot use TailAllocatedOperandList");
     memcpy(getSubstitutionsStorage(), substitutions.begin(),
@@ -956,11 +967,11 @@
 
   static void *allocate(SILFunction &F,
                         ArrayRef<Substitution> substitutions,
-                        ArrayRef<SILValue> openedArchetypesOperands,
+                        ArrayRef<SILValue> TypeDependentOperands,
                         ArrayRef<SILValue> args) {
     return allocateApplyInst(
         F, sizeof(Impl) + decltype(Operands)::getExtraSize(
-                              args.size() + openedArchetypesOperands.size()) +
+                              args.size() + TypeDependentOperands.size()) +
                sizeof(substitutions[0]) * substitutions.size(),
         alignof(Impl));
   }
@@ -1071,15 +1082,11 @@
     return NumCallArguments;
   }
 
-  bool hasOpenedArchetypeOperands() const {
-    return getAllOperands().size() - 1 - getNumCallArguments() != 0;
-  }
-
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return Operands.getDynamicAsArray().slice(NumCallArguments);
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return Operands.getDynamicAsArray().slice(NumCallArguments);
   }
 };
@@ -1212,7 +1219,7 @@
             SILType SubstCalleeType, SILType ReturnType,
             ArrayRef<Substitution> Substitutions,
             ArrayRef<SILValue> Args,
-            ArrayRef<SILValue> OpenedArchetypeOperands,
+            ArrayRef<SILValue> TypeDependentOperands,
             bool isNonThrowing);
 
   static ApplyInst *create(SILDebugLocation DebugLoc, SILValue Callee,
@@ -1244,7 +1251,7 @@
                    SILType SubstCalleeType,
                    ArrayRef<Substitution> Substitutions,
                    ArrayRef<SILValue> Args,
-                   ArrayRef<SILValue> OpenedArchetypeOperands,
+                   ArrayRef<SILValue> TypeDependentOperands,
                    SILType ClosureType);
 
   static PartialApplyInst *create(SILDebugLocation DebugLoc, SILValue Callee,
@@ -2081,7 +2088,7 @@
 
   BindMemoryInst(SILDebugLocation Loc, SILValue Base, SILValue Index,
                  SILType BoundType,
-                 ArrayRef<SILValue> OpenedArchetypeOperands);
+                 ArrayRef<SILValue> TypeDependentOperands);
 
 public:
   // Destruct tail allocated objects.
@@ -2114,11 +2121,11 @@
             static_cast<size_t>(NumOperands)};
   }
 
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return getAllOperands().slice(2);
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return getAllOperands().slice(2);
   }
 
@@ -2231,7 +2238,7 @@
 /// Convert a heap object reference to a different type without any runtime
 /// checks.
 class UncheckedRefCastInst final
-  : public UnaryInstructionWithOpenArchetypesBase<
+  : public UnaryInstructionWithTypeDependentOperandsBase<
                                 ValueKind::UncheckedRefCastInst,
                                 UncheckedRefCastInst,
                                 ConversionInst,
@@ -2240,9 +2247,9 @@
   friend class SILBuilder;
 
   UncheckedRefCastInst(SILDebugLocation DebugLoc, SILValue Operand,
-                       ArrayRef<SILValue> OpenedArchetypeOperands, SILType Ty)
-      : UnaryInstructionWithOpenArchetypesBase(DebugLoc, Operand,
-                                               OpenedArchetypeOperands, Ty) {}
+                       ArrayRef<SILValue> TypeDependentOperands, SILType Ty)
+      : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, Operand,
+                                               TypeDependentOperands, Ty) {}
   static UncheckedRefCastInst *
   create(SILDebugLocation DebugLoc, SILValue Operand, SILType Ty,
          SILFunction &F, SILOpenedArchetypesState &OpenedArchetypes);
@@ -2291,7 +2298,7 @@
 };
 
 class UncheckedAddrCastInst final
-  : public UnaryInstructionWithOpenArchetypesBase<
+  : public UnaryInstructionWithTypeDependentOperandsBase<
                                 ValueKind::UncheckedAddrCastInst,
                                 UncheckedAddrCastInst,
                                 ConversionInst,
@@ -2300,9 +2307,9 @@
   friend class SILBuilder;
 
   UncheckedAddrCastInst(SILDebugLocation DebugLoc, SILValue Operand,
-                        ArrayRef<SILValue> OpenedArchetypeOperands, SILType Ty)
-      : UnaryInstructionWithOpenArchetypesBase(DebugLoc, Operand,
-                                               OpenedArchetypeOperands, Ty) {}
+                        ArrayRef<SILValue> TypeDependentOperands, SILType Ty)
+      : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, Operand,
+                                               TypeDependentOperands, Ty) {}
   static UncheckedAddrCastInst *
   create(SILDebugLocation DebugLoc, SILValue Operand, SILType Ty,
          SILFunction &F, SILOpenedArchetypesState &OpenedArchetypes);
@@ -2310,7 +2317,7 @@
 
 /// Convert a value's binary representation to a trivial type of the same size.
 class UncheckedTrivialBitCastInst final
-  : public UnaryInstructionWithOpenArchetypesBase<
+  : public UnaryInstructionWithTypeDependentOperandsBase<
                                 ValueKind::UncheckedTrivialBitCastInst,
                                 UncheckedTrivialBitCastInst,
                                 ConversionInst,
@@ -2319,10 +2326,10 @@
   friend class SILBuilder;
 
   UncheckedTrivialBitCastInst(SILDebugLocation DebugLoc, SILValue Operand,
-                              ArrayRef<SILValue> OpenedArchetypeOperands,
+                              ArrayRef<SILValue> TypeDependentOperands,
                               SILType Ty)
-      : UnaryInstructionWithOpenArchetypesBase(DebugLoc, Operand,
-                                               OpenedArchetypeOperands, Ty) {}
+      : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, Operand,
+                                               TypeDependentOperands, Ty) {}
 
   static UncheckedTrivialBitCastInst *
   create(SILDebugLocation DebugLoc, SILValue Operand, SILType Ty,
@@ -2331,7 +2338,7 @@
   
 /// Bitwise copy a value into another value of the same size or smaller.
 class UncheckedBitwiseCastInst final
-  : public UnaryInstructionWithOpenArchetypesBase<
+  : public UnaryInstructionWithTypeDependentOperandsBase<
                                 ValueKind::UncheckedBitwiseCastInst,
                                 UncheckedBitwiseCastInst,
                                 ConversionInst,
@@ -2340,10 +2347,10 @@
   friend class SILBuilder;
 
   UncheckedBitwiseCastInst(SILDebugLocation DebugLoc, SILValue Operand,
-                           ArrayRef<SILValue> OpenedArchetypeOperands,
+                           ArrayRef<SILValue> TypeDependentOperands,
                            SILType Ty)
-      : UnaryInstructionWithOpenArchetypesBase(DebugLoc, Operand,
-                                               OpenedArchetypeOperands, Ty) {}
+      : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, Operand,
+                                               TypeDependentOperands, Ty) {}
   static UncheckedBitwiseCastInst *
   create(SILDebugLocation DebugLoc, SILValue Operand, SILType Ty,
          SILFunction &F, SILOpenedArchetypesState &OpenedArchetypes);
@@ -2573,7 +2580,7 @@
 
 /// Perform an unconditional checked cast that aborts if the cast fails.
 class UnconditionalCheckedCastInst final
-  : public UnaryInstructionWithOpenArchetypesBase<
+  : public UnaryInstructionWithTypeDependentOperandsBase<
                                 ValueKind::UnconditionalCheckedCastInst,
                                 UnconditionalCheckedCastInst,
                                 ConversionInst,
@@ -2582,10 +2589,10 @@
   friend class SILBuilder;
 
   UnconditionalCheckedCastInst(SILDebugLocation DebugLoc, SILValue Operand,
-                               ArrayRef<SILValue> OpenedArchetypeOperands,
+                               ArrayRef<SILValue> TypeDependentOperands,
                                SILType DestTy)
-      : UnaryInstructionWithOpenArchetypesBase(DebugLoc, Operand,
-                                               OpenedArchetypeOperands,
+      : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, Operand,
+                                               TypeDependentOperands,
                                                DestTy) {}
 
   static UnconditionalCheckedCastInst *
@@ -3271,7 +3278,7 @@
 
   /// Constructs a MetatypeInst
   MetatypeInst(SILDebugLocation DebugLoc, SILType Metatype,
-               ArrayRef<SILValue> OpenedArchetypeOperands);
+               ArrayRef<SILValue> TypeDependentOperands);
 
   static MetatypeInst *create(SILDebugLocation DebugLoc, SILType Metatype,
                               SILFunction *F,
@@ -3293,11 +3300,11 @@
     return { getTrailingObjects<Operand>(), NumOperands };
   }
 
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return { getTrailingObjects<Operand>(), NumOperands };
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return { getTrailingObjects<Operand>(), NumOperands };
   }
 
@@ -3550,14 +3557,14 @@
 
   WitnessMethodInst(SILDebugLocation DebugLoc, CanType LookupType,
                     ProtocolConformanceRef Conformance, SILDeclRef Member,
-                    SILType Ty, ArrayRef<SILValue> OpenedArchetypeOperands,
+                    SILType Ty, ArrayRef<SILValue> TypeDependentOperands,
                     bool Volatile = false)
       : MethodInst(ValueKind::WitnessMethodInst, DebugLoc, Ty, Member,
                    Volatile),
         LookupType(LookupType), Conformance(Conformance),
-        NumOperands(OpenedArchetypeOperands.size()) {
+        NumOperands(TypeDependentOperands.size()) {
     TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                           OpenedArchetypeOperands);
+                                           TypeDependentOperands);
   }
 
   static WitnessMethodInst *
@@ -3596,11 +3603,11 @@
     return { getTrailingObjects<Operand>(), NumOperands };
   }
 
-  ArrayRef<Operand> getOpenedArchetypeOperands() const {
+  ArrayRef<Operand> getTypeDependentOperands() const {
     return { getTrailingObjects<Operand>(), NumOperands };
   }
 
-  MutableArrayRef<Operand> getOpenedArchetypeOperands() {
+  MutableArrayRef<Operand> getTypeDependentOperands() {
     return { getTrailingObjects<Operand>(), NumOperands };
   }
 
@@ -3613,14 +3620,25 @@
 /// constant referring to some Objective-C method, performs dynamic method
 /// lookup to extract the implementation of that method. This method lookup
 /// can fail at run-time
-class DynamicMethodInst
-  : public UnaryInstructionBase<ValueKind::DynamicMethodInst, MethodInst>
+class DynamicMethodInst final
+  : public UnaryInstructionWithTypeDependentOperandsBase<
+                                   ValueKind::DynamicMethodInst,
+                                   DynamicMethodInst,
+                                   MethodInst,
+                                   true>
 {
   friend class SILBuilder;
 
   DynamicMethodInst(SILDebugLocation DebugLoc, SILValue Operand,
-                    SILDeclRef Member, SILType Ty, bool Volatile = false)
-      : UnaryInstructionBase(DebugLoc, Operand, Ty, Member, Volatile) {}
+                    ArrayRef<SILValue> TypeDependentOperands,
+                    SILDeclRef Member, SILType Ty, bool Volatile)
+      : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, Operand,
+                               TypeDependentOperands, Ty, Member, Volatile) {}
+
+  static DynamicMethodInst *
+  create(SILDebugLocation DebugLoc, SILValue Operand,
+         SILDeclRef Member, SILType Ty, bool Volatile, SILFunction *F,
+         SILOpenedArchetypesState &OpenedArchetypes);
 };
 
 /// Given the address of an existential, "opens" the
@@ -3677,7 +3695,7 @@
 /// value of the given type, and returns the address of the uninitialized
 /// concrete value inside the existential container.
 class InitExistentialAddrInst final
-  : public UnaryInstructionWithOpenArchetypesBase<
+  : public UnaryInstructionWithTypeDependentOperandsBase<
                                 ValueKind::InitExistentialAddrInst,
                                 InitExistentialAddrInst,
                                 SILInstruction,
@@ -3689,11 +3707,11 @@
   ArrayRef<ProtocolConformanceRef> Conformances;
 
   InitExistentialAddrInst(SILDebugLocation DebugLoc, SILValue Existential,
-                          ArrayRef<SILValue> OpenedArchetypeOperands,
+                          ArrayRef<SILValue> TypeDependentOperands,
                           CanType ConcreteType, SILType ConcreteLoweredType,
                           ArrayRef<ProtocolConformanceRef> Conformances)
-      : UnaryInstructionWithOpenArchetypesBase(DebugLoc, Existential,
-                             OpenedArchetypeOperands,
+      : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, Existential,
+                             TypeDependentOperands,
                              ConcreteLoweredType.getAddressType()),
         ConcreteType(ConcreteType), Conformances(Conformances) {}
 
@@ -3721,7 +3739,7 @@
 /// conformances, creates a class existential value referencing the
 /// class instance.
 class InitExistentialRefInst final
-  : public UnaryInstructionWithOpenArchetypesBase<
+  : public UnaryInstructionWithTypeDependentOperandsBase<
                                 ValueKind::InitExistentialRefInst,
                                 InitExistentialRefInst,
                                 SILInstruction,
@@ -3734,10 +3752,10 @@
 
   InitExistentialRefInst(SILDebugLocation DebugLoc, SILType ExistentialType,
                          CanType FormalConcreteType, SILValue Instance,
-                         ArrayRef<SILValue> OpenedArchetypeOperands,
+                         ArrayRef<SILValue> TypeDependentOperands,
                          ArrayRef<ProtocolConformanceRef> Conformances)
-      : UnaryInstructionWithOpenArchetypesBase(DebugLoc, Instance,
-                                               OpenedArchetypeOperands,
+      : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, Instance,
+                                               TypeDependentOperands,
                                                ExistentialType),
         ConcreteType(FormalConcreteType), Conformances(Conformances) {}
 
@@ -3763,7 +3781,7 @@
 /// of conformances, creates an existential metatype value referencing
 /// the metatype.
 class InitExistentialMetatypeInst final
-  : public UnaryInstructionWithOpenArchetypesBase<
+  : public UnaryInstructionWithTypeDependentOperandsBase<
                                   ValueKind::InitExistentialMetatypeInst,
                                   InitExistentialMetatypeInst,
                                   SILInstruction,
@@ -3777,7 +3795,7 @@
   InitExistentialMetatypeInst(SILDebugLocation DebugLoc,
                               SILType existentialMetatypeType,
                               SILValue metatype,
-                              ArrayRef<SILValue> OpenedArchetypeOperands,
+                              ArrayRef<SILValue> TypeDependentOperands,
                               ArrayRef<ProtocolConformanceRef> conformances);
 
   static InitExistentialMetatypeInst *
@@ -4835,7 +4853,7 @@
 /// The success branch destination block receives the cast result as a BB
 /// argument.
 class CheckedCastBranchInst final:
-  public UnaryInstructionWithOpenArchetypesBase<
+  public UnaryInstructionWithTypeDependentOperandsBase<
                               ValueKind::CheckedCastBranchInst,
                               CheckedCastBranchInst,
                               TermInst,
@@ -4849,11 +4867,11 @@
 
   CheckedCastBranchInst(SILDebugLocation DebugLoc, bool IsExact,
                         SILValue Operand,
-                        ArrayRef<SILValue> OpenedArchetypeOperands,
+                        ArrayRef<SILValue> TypeDependentOperands,
                         SILType DestTy,
                         SILBasicBlock *SuccessBB, SILBasicBlock *FailureBB)
-      : UnaryInstructionWithOpenArchetypesBase(DebugLoc, Operand,
-                                               OpenedArchetypeOperands),
+      : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, Operand,
+                                               TypeDependentOperands),
         DestTy(DestTy), IsExact(IsExact),
         DestBBs{{this, SuccessBB}, {this, FailureBB}} {}
 
@@ -4982,7 +5000,7 @@
   TryApplyInst(SILDebugLocation DebugLoc, SILValue callee,
                SILType substCalleeType, ArrayRef<Substitution> substitutions,
                ArrayRef<SILValue> args,
-               ArrayRef<SILValue> openedArchetypesOperands,
+               ArrayRef<SILValue> TypeDependentOperands,
                SILBasicBlock *normalBB, SILBasicBlock *errorBB);
 
   static TryApplyInst *create(SILDebugLocation DebugLoc, SILValue callee,
diff --git a/include/swift/SIL/SILType.h b/include/swift/SIL/SILType.h
index b918192..39f6ffc 100644
--- a/include/swift/SIL/SILType.h
+++ b/include/swift/SIL/SILType.h
@@ -128,12 +128,12 @@
 
   ///  Apply a substitution to the type to produce another lowered SIL type.
   static SILType substType(SILModule &silModule, ModuleDecl *astModule,
-                           TypeSubstitutionMap &subs, SILType SrcTy);
+                           const TypeSubstitutionMap &subs, SILType SrcTy);
 
   ///  Apply a substitution to the function type.
   static CanSILFunctionType substFuncType(SILModule &silModule,
                                           ModuleDecl *astModule,
-                                          TypeSubstitutionMap &subs,
+                                          const TypeSubstitutionMap &subs,
                                           CanSILFunctionType SrcTy,
                                           bool dropGenerics);
 
@@ -451,7 +451,7 @@
                            ArrayRef<Substitution> Subs) const;
 
   SILType subst(SILModule &silModule, ModuleDecl *astModule,
-                TypeSubstitutionMap &subs) const;
+                const TypeSubstitutionMap &subs) const;
 
   /// If this is a specialized generic type, return all substitutions used to
   /// generate it.
diff --git a/include/swift/SIL/TypeSubstCloner.h b/include/swift/SIL/TypeSubstCloner.h
index 7d05ace..76ac61c 100644
--- a/include/swift/SIL/TypeSubstCloner.h
+++ b/include/swift/SIL/TypeSubstCloner.h
@@ -89,14 +89,15 @@
   }
 
   Substitution remapSubstitution(Substitution sub) {
-    auto newSub = sub.subst(SwiftMod,
-                            Original.getContextGenericParams(),
-                            ApplySubs);
+    if (!ApplySubs.empty()) {
+      auto *params = Original.getContextGenericParams();
+      auto sig = Original.getLoweredFunctionType()->getGenericSignature();
+      sub = sub.subst(SwiftMod, sig, params, ApplySubs);
+    }
     // Remap opened archetypes into the cloned context.
-    newSub = Substitution(getASTTypeInClonedContext(newSub.getReplacement()
-                                                      ->getCanonicalType()),
-                          newSub.getConformances());
-    return newSub;
+    return Substitution(getASTTypeInClonedContext(sub.getReplacement()
+                                                    ->getCanonicalType()),
+                        sub.getConformances());
   }
 
   ProtocolConformanceRef remapConformance(CanType type,
@@ -205,13 +206,13 @@
 
   void visitWitnessMethodInst(WitnessMethodInst *Inst) {
     // Specialize the Self substitution of the witness_method.
-    //
-    // FIXME: This needs to not only handle Self but all Self derived types so
-    // we handle type aliases correctly.
-    auto sub =
-      Inst->getSelfSubstitution().subst(Inst->getModule().getSwiftModule(),
-                                        Original.getContextGenericParams(),
-                                        ApplySubs);
+    auto sub = Inst->getSelfSubstitution();
+    if (!ApplySubs.empty()) {
+      auto sig = Original.getLoweredFunctionType()->getGenericSignature();
+      auto *params = Original.getContextGenericParams();
+      sub = sub.subst(Inst->getModule().getSwiftModule(),
+                      sig, params, ApplySubs);
+    }
 
     assert(sub.getConformances().size() == 1 &&
            "didn't get conformance from substitution?!");
diff --git a/include/swift/SILOptimizer/Analysis/CallerAnalysis.h b/include/swift/SILOptimizer/Analysis/CallerAnalysis.h
index d712573..770d55c 100644
--- a/include/swift/SILOptimizer/Analysis/CallerAnalysis.h
+++ b/include/swift/SILOptimizer/Analysis/CallerAnalysis.h
@@ -19,19 +19,11 @@
 #include "swift/SIL/SILModule.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/TinyPtrVector.h"
 
 namespace swift {
 
-/// NOTE: this can be extended to contain the callsites of the function.
-struct CallerAnalysisFunctionInfo {
-  /// A list of all the functions this function calls.
-  llvm::SetVector<SILFunction *> Callees;
-  /// A list of all the callers this function has.
-  llvm::SetVector<SILFunction *> Callers;
-};
-
 /// CallerAnalysis relies on keeping the Caller/Callee relation up-to-date
 /// lazily. i.e. when a function is invalidated, instead of recomputing the
 /// function it calls right away, its kept in a recompute list and
@@ -44,13 +36,59 @@
 /// to run every function through the a sequence of function passes which might
 /// invalidate the functions and make the computed list incomplete. So
 /// O(n) * O(n) = O(n^2).
+///
+/// In addition of caller information this analysis also provides information
+/// about partial applies of a function.
 class CallerAnalysis : public SILAnalysis {
 
+public:
+
+  /// NOTE: this can be extended to contain the callsites of the function.
+  class FunctionInfo {
+    friend class CallerAnalysis;
+
+    /// A list of all the functions this function calls or partially applies.
+    llvm::SetVector<SILFunction *> Callees;
+    /// A list of all the callers this function has.
+    llvm::SmallSet<SILFunction *, 4> Callers;
+
+    /// The number of partial applied arguments of this function.
+    ///
+    /// Specifically, it stores the minimum number of partial applied arguments
+    /// of each function which contain one or multiple partial_applys of this
+    /// function.
+    /// This is a little bit off-topic because a partial_apply is not really
+    /// a "call" of this function.
+    llvm::DenseMap<SILFunction *, int> PartialAppliers;
+
+  public:
+    /// Returns true if this function has at least one caller.
+    bool hasCaller() const {
+      return !Callers.empty();
+    }
+
+    /// Returns non zero if this function is partially applied anywhere.
+    ///
+    /// The return value is the minimum number of partially applied arguments.
+    /// Usually all partial applies of a function partially apply the same
+    /// number of arguments anyway.
+    int getMinPartialAppliedArgs() const {
+      int minArgs = 0;
+      for (auto Iter : PartialAppliers) {
+        int numArgs = Iter.second;
+        if (minArgs == 0 || numArgs < minArgs)
+          minArgs = numArgs;
+      }
+      return minArgs;
+    }
+  };
+  
+private:
   /// Current module we are analyzing.
   SILModule &Mod;
 
   /// A map between all the functions and their callsites in the module.
-  llvm::DenseMap<SILFunction *, CallerAnalysisFunctionInfo> CallInfo;
+  llvm::DenseMap<SILFunction *, FunctionInfo> FuncInfos;
 
   /// A list of functions that needs to be recomputed.
   llvm::SetVector<SILFunction *> RecomputeFunctionList;
@@ -74,7 +112,7 @@
   CallerAnalysis(SILModule *M) : SILAnalysis(AnalysisKind::Caller), Mod(*M) {
     // Make sure we compute everything first time called.
     for (auto &F : Mod) {
-      CallInfo.FindAndConstruct(&F);
+      FuncInfos.FindAndConstruct(&F);
       RecomputeFunctionList.insert(&F);
     }
   }
@@ -89,7 +127,7 @@
 
   virtual void invalidate(SILFunction *F, InvalidationKind K) {
     // Should we invalidate based on the invalidation kind.
-    bool shouldInvalidate = K & InvalidationKind::Calls;
+    bool shouldInvalidate = K & InvalidationKind::CallsAndInstructions;
     if (!shouldInvalidate)
       return;
 
@@ -111,20 +149,18 @@
     if (!shouldInvalidate)
       return;
 
-    CallInfo.clear();
+    FuncInfos.clear();
     RecomputeFunctionList.clear();
     for (auto &F : Mod) {
       RecomputeFunctionList.insert(&F);
     }
   }
 
-  /// Return true if the function has a caller inside current module.
-  bool hasCaller(SILFunction *F) {
+  const FunctionInfo &getCallerInfo(SILFunction *F) {
     // Recompute every function in the invalidated function list and empty the
     // list.
     processRecomputeFunctionList();
-    auto Iter = CallInfo.FindAndConstruct(F);
-    return !Iter.second.Callers.empty();
+    return FuncInfos[F];
   }
 };
 
diff --git a/include/swift/SILOptimizer/PassManager/PassManager.h b/include/swift/SILOptimizer/PassManager/PassManager.h
index 9f03a80..3916716 100644
--- a/include/swift/SILOptimizer/PassManager/PassManager.h
+++ b/include/swift/SILOptimizer/PassManager/PassManager.h
@@ -42,8 +42,21 @@
   /// A list of registered analysis.
   llvm::SmallVector<SILAnalysis *, 16> Analysis;
 
+  /// An entry in the FunctionWorkList.
+  struct WorklistEntry {
+    WorklistEntry(SILFunction *F) : F(F) { }
+
+    SILFunction *F;
+
+    /// The current position in the transform-list.
+    unsigned PipelineIdx = 0;
+
+    /// How many times the pipeline was restarted for the function.
+    unsigned NumRestarts = 0;
+  };
+
   /// The worklist of functions to be processed by function passes.
-  std::vector<SILFunction *> FunctionWorklist;
+  std::vector<WorklistEntry> FunctionWorklist;
 
   // Name of the current optimization stage for diagnostics.
   std::string StageName;
@@ -62,6 +75,13 @@
   /// A completed-passes mask for each function.
   llvm::DenseMap<SILFunction *, CompletedPasses> CompletedPassesMap;
 
+  /// Stores for each function the number of levels of specializations it is
+  /// derived from an original function. E.g. if a function is a signature
+  /// optimized specialization of a generic specialiation, it has level 2.
+  /// This is used to avoid an infinite amount of functions pushed on the
+  /// worklist (e.g. caused by a bug in a specializing optimization).
+  llvm::DenseMap<SILFunction *, int> DerivationLevels;
+
   /// Set to true when a pass invalidates an analysis.
   bool CurrentPassHasInvalidated = false;
 
@@ -96,13 +116,6 @@
   /// \brief Run one iteration of the optimization pipeline.
   void runOneIteration();
 
-  /// \brief Add a function to the function pass worklist.
-  void addFunctionToWorklist(SILFunction *F) {
-    assert(F && F->isDefinition() && F->shouldOptimize() &&
-           "Expected optimizable function definition!");
-    FunctionWorklist.push_back(F);
-  }
-
   /// \brief Restart the function pass pipeline on the same function
   /// that is currently being processed.
   void restartWithCurrentFunction(SILTransform *T);
@@ -124,11 +137,12 @@
     CompletedPassesMap.clear();
   }
 
-  /// \brief Add the function to the function pass worklist.
-  void notifyTransformationOfFunction(SILFunction *F) {
-    addFunctionToWorklist(F);
-  }
-
+  /// \brief Add the function \p F to the function pass worklist.
+  /// If not null, the function \p DerivedFrom is the function from which \p F
+  /// is derived. This is used to avoid an infinite amount of functions pushed
+  /// on the worklist (e.g. caused by a bug in a specializing optimization).
+  void addFunctionToWorklist(SILFunction *F, SILFunction *DerivedFrom);
+  
   /// \brief Iterate over all analysis and notify them of the function.
   /// This function does not necessarily have to be newly created function. It
   /// is the job of the analysis to make sure no extra work is done if the
@@ -211,9 +225,8 @@
   /// the module.
   void runModulePass(SILModuleTransform *SMT);
 
-  /// Run the passes in \p FuncTransforms on the function \p F.
-  void runPassesOnFunction(PassList FuncTransforms, SILFunction *F,
-                           bool runToCompletion);
+  /// Run the pass \p SFT on the function \p F.
+  void runPassOnFunction(SILFunctionTransform *SFT, SILFunction *F);
 
   /// Run the passes in \p FuncTransforms. Return true
   /// if the pass manager requested to stop the execution
diff --git a/include/swift/SILOptimizer/PassManager/Passes.def b/include/swift/SILOptimizer/PassManager/Passes.def
index c95dc8c..1194045 100644
--- a/include/swift/SILOptimizer/PassManager/Passes.def
+++ b/include/swift/SILOptimizer/PassManager/Passes.def
@@ -81,6 +81,8 @@
      "Removes redundant overflow checks")
 PASS(DCE, "dce",
      "Eliminate dead code")
+PASS(DeadArgSignatureOpt, "dead-arg-signature-opt",
+     "Create function with removed dead arguments")
 PASS(DeadFunctionElimination, "sil-deadfuncelim",
      "Remove unused functions")
 PASS(DeadObjectElimination, "deadobject-elim",
diff --git a/include/swift/SILOptimizer/PassManager/Transforms.h b/include/swift/SILOptimizer/PassManager/Transforms.h
index 052ed8c..0969bbc 100644
--- a/include/swift/SILOptimizer/PassManager/Transforms.h
+++ b/include/swift/SILOptimizer/PassManager/Transforms.h
@@ -96,10 +96,16 @@
 
     void injectFunction(SILFunction *Func) { F = Func; }
 
-    /// \brief Notify the pass manager of a function that needs to be
+    /// \brief Notify the pass manager of a function \p F that needs to be
     /// processed by the function passes and the analyses.
-    void notifyPassManagerOfFunction(SILFunction *F) {
-      PM->notifyTransformationOfFunction(F);
+    ///
+    /// If not null, the function \p DerivedFrom is the function from which \p F
+    /// is derived. This is used to limit the number of new functions which are
+    /// derived from a common base function, e.g. due to specialization.
+    /// The number should be small anyway, but bugs in optimizations could cause
+    /// an infinite loop in the passmanager.
+    void notifyPassManagerOfFunction(SILFunction *F, SILFunction *DerivedFrom) {
+      PM->addFunctionToWorklist(F, DerivedFrom);
       PM->notifyAnalysisOfFunction(F);
     }
 
diff --git a/include/swift/SILOptimizer/Utils/FunctionSignatureOptUtils.h b/include/swift/SILOptimizer/Utils/FunctionSignatureOptUtils.h
index dc3c562..1daa2ec 100644
--- a/include/swift/SILOptimizer/Utils/FunctionSignatureOptUtils.h
+++ b/include/swift/SILOptimizer/Utils/FunctionSignatureOptUtils.h
@@ -104,6 +104,15 @@
     if (!canOptimizeLiveArg())
       return false;
 
+    // See if the projection tree consists of potentially multiple levels of
+    // structs containing one field. In such a case, there is no point in
+    // exploding the argument.
+    //
+    // Also, in case of a type can not be exploded, e.g an enum, we treat it
+    // as a singleton.
+    if (ProjTree.isSingleton())
+      return false;
+
     // If this argument is @owned and we can not find all the releases for it
     // try to explode it, maybe we can find some of the releases and O2G some
     // of its components.
@@ -114,12 +123,6 @@
         ERM.hasSomeReleasesForArgument(Arg))
       return true;
 
-    // See if the projection tree consists of potentially multiple levels of
-    // structs containing one field. In such a case, there is no point in
-    // exploding the argument.
-    if (ProjTree.isSingleton())
-      return false;
-
     size_t explosionSize = ProjTree.liveLeafCount();
     return explosionSize >= 1 && explosionSize <= 3;
   }
diff --git a/include/swift/SILOptimizer/Utils/Local.h b/include/swift/SILOptimizer/Utils/Local.h
index 76d44b4..61c33ae 100644
--- a/include/swift/SILOptimizer/Utils/Local.h
+++ b/include/swift/SILOptimizer/Utils/Local.h
@@ -154,7 +154,7 @@
 
 /// \brief Return true if any call inside the given function may bind dynamic
 /// 'Self' to a generic argument of the callee.
-bool computeMayBindDynamicSelf(SILFunction *F);
+bool mayBindDynamicSelf(SILFunction *F);
 
 /// \brief Move an ApplyInst's FuncRef so that it dominates the call site.
 void placeFuncRef(ApplyInst *AI, DominanceInfo *DT);
diff --git a/include/swift/Serialization/ModuleFormat.h b/include/swift/Serialization/ModuleFormat.h
index b9989fa..2585dde 100644
--- a/include/swift/Serialization/ModuleFormat.h
+++ b/include/swift/Serialization/ModuleFormat.h
@@ -53,7 +53,7 @@
 /// in source control, you should also update the comment to briefly
 /// describe what change you made. The content of this comment isn't important;
 /// it just ensures a conflict if two people change the module format.
-const uint16_t VERSION_MINOR = 260; // Last change: open
+const uint16_t VERSION_MINOR = 261; // Last change: remove AllArchetypes indexing
 
 using DeclID = PointerEmbeddedInt<unsigned, 31>;
 using DeclIDField = BCFixed<31>;
@@ -1357,14 +1357,6 @@
     BCArray<IdentifierIDField>
   >;
 
-  using Swift3MigrationDeclAttrLayout = BCRecordLayout<
-    Swift3Migration_DECL_ATTR,
-    BCFixed<1>, // implicit flag
-    BCVBR<5>,   // number of bytes in rename string
-    BCVBR<5>,   // number of bytes in message string
-    BCBlob      // rename, followed by message
-  >;
-
   using SpecializeDeclAttrLayout = BCRecordLayout<
     Specialize_DECL_ATTR,
     BCArray<TypeIDField> // concrete types
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index b2ce941..7e2c040 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -801,9 +801,9 @@
   // There must be a generic type with one argument.
   NominalTypeDecl *nominal = (ctx.*getNominal)();
   if (!nominal) return nullptr;
-  auto generics = nominal->getGenericParams();
-  if (!generics) return nullptr;
-  if (generics->size() != 1) return nullptr;
+  auto sig = nominal->getGenericSignature();
+  if (!sig) return nullptr;
+  if (sig->getGenericParams().size() != 1) return nullptr;
 
   // There must be a property named "pointee".
   auto identifier = ctx.getIdentifier("pointee");
@@ -813,7 +813,7 @@
   // The property must have type T.
   VarDecl *property = dyn_cast<VarDecl>(results[0]);
   if (!property) return nullptr;
-  if (!property->getType()->isEqual(generics->getPrimaryArchetypes()[0]))
+  if (!property->getInterfaceType()->isEqual(sig->getGenericParams()[0]))
     return nullptr;
 
   cache = property;
@@ -2598,6 +2598,10 @@
 void ASTContext::dumpArchetypeContext(ArchetypeType *archetype,
                                       llvm::raw_ostream &os,
                                       unsigned indent) const {
+  archetype = archetype->getPrimary();
+  if (!archetype)
+    return;
+
   auto knownDC = ArchetypeContexts.find(archetype);
   if (knownDC != ArchetypeContexts.end())
     knownDC->second->printContext(os, indent);
@@ -3995,46 +3999,14 @@
           nominal->getName() == Id_CGFloat);
 }
 
-Optional<Type>
-ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
-                             LazyResolver *resolver,
-                             Type *bridgedValueType) const {
+Type ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
+                                  Type *bridgedValueType) const {
   if (type->isBridgeableObjectType()) {
     if (bridgedValueType) *bridgedValueType = type;
 
     return type;
   }
 
-  // Whitelist certain types even if Foundation is not imported, to ensure
-  // that casts from AnyObject to one of these types are not optimized away.
-  //
-  // Outside of these standard library types to which Foundation
-  // bridges, an _ObjectiveCBridgeable conformance can only be added
-  // in the same module where the Swift type itself is defined, so the
-  // optimizer will be guaranteed to see the conformance if it exists.
-  bool knownBridgedToObjC = false;
-  if (auto ntd = type->getAnyNominal())
-    knownBridgedToObjC = isStandardLibraryTypeBridgedInFoundation(ntd);
-
-  // TODO: Under id-as-any, container bridging is unconstrained. This check can
-  // go away.
-  if (!LangOpts.EnableIdAsAny) {
-    // If the type is generic, check whether its generic arguments are also
-    // bridged to Objective-C.
-    if (auto bgt = type->getAs<BoundGenericType>()) {
-      for (auto arg : bgt->getGenericArgs()) {
-        if (arg->hasTypeVariable())
-          continue;
-
-        if (!getBridgedToObjC(dc, arg, resolver))
-          return None;
-      }
-    }
-  } else {
-    // Under id-as-any, anything is bridged to objective c.
-    knownBridgedToObjC = true;
-  }
-
   if (auto metaTy = type->getAs<MetatypeType>())
     if (metaTy->getInstanceType()->mayHaveSuperclass())
       return type;
@@ -4062,7 +4034,8 @@
       auto proto = getProtocol(known);
       if (!proto) return None;
 
-      return dc->getParentModule()->lookupConformance(type, proto, resolver);
+      return dc->getParentModule()->lookupConformance(type, proto,
+                                                      getLazyResolver());
     };
 
   // Do we conform to _ObjectiveCBridgeable?
@@ -4076,7 +4049,7 @@
     if (conformance->isConcrete()) {
       return ProtocolConformance::getTypeWitnessByName(
                type, conformance->getConcrete(), Id_ObjectiveCType,
-               resolver);
+               getLazyResolver());
     } else {
       return type->castTo<ArchetypeType>()->getNestedType(Id_ObjectiveCType)
         .getValue();
@@ -4094,12 +4067,8 @@
       return nsErrorDecl->getDeclaredInterfaceType();
   }
 
-
-  // If we haven't imported Foundation but this is a whitelisted type,
-  // behave as above.
-  if (knownBridgedToObjC)
-    return Type();
-  return None;
+  // No special bridging to Objective-C, but this can become an 'Any'.
+  return Type();
 }
 
 std::pair<ArchetypeBuilder *, ArchetypeBuilder::PotentialArchetype *>
diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp
index d7bcaa8..1ef7516 100644
--- a/lib/AST/ASTDumper.cpp
+++ b/lib/AST/ASTDumper.cpp
@@ -1936,8 +1936,6 @@
   }
   void visitCollectionUpcastConversionExpr(CollectionUpcastConversionExpr *E) {
     printCommon(E, "collection_upcast_expr");
-    if (E->bridgesToObjC())
-      OS << " bridges_to_objc";
     OS << '\n';
     printRec(E->getSubExpr());
     if (auto keyConversion = E->getKeyConversion()) {
@@ -2477,7 +2475,13 @@
     printRec(T->getBase());
     OS << ')';
   }
-  
+
+  void visitProtocolTypeRepr(ProtocolTypeRepr *T) {
+    printCommon(T, "type_protocol") << '\n';
+    printRec(T->getBase());
+    OS << ')';
+  }
+
   void visitInOutTypeRepr(InOutTypeRepr *T) {
     printCommon(T, "type_inout") << '\n';
     printRec(T->getBase());
diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp
index c434acc..d9caa61 100644
--- a/lib/AST/ASTPrinter.cpp
+++ b/lib/AST/ASTPrinter.cpp
@@ -1172,7 +1172,12 @@
   void printTypeLoc(const TypeLoc &TL) {
     if (Options.TransformContext && TL.getType()) {
       if (auto RT = Options.TransformContext->transform(TL.getType())) {
+        // FIXME: it's not clear exactly what we want to keep from the existing
+        // options, and what we want to discard.
         PrintOptions FreshOptions;
+        FreshOptions.PrintAsInParamType = Options.PrintAsInParamType;
+        FreshOptions.ExcludeAttrList = Options.ExcludeAttrList;
+        FreshOptions.ExclusiveAttrList = Options.ExclusiveAttrList;
         RT.print(Printer, FreshOptions);
         return;
       }
@@ -1455,6 +1460,25 @@
   if (requirements.empty())
     return;
 
+  // FIXME: Type objects do not preserve info to print requirements accurately.
+  // SIL printing cares about semantics so \c PrevPreferTypeRepr is false but
+  // we need to set it to true for printing requirements.
+  struct PrefTypeReprForSILRAII {
+    PrintOptions &Opts;
+    bool PrevPreferTypeRepr;
+    PrefTypeReprForSILRAII(PrintOptions &opts) : Opts(opts) {
+      if (Opts.PrintForSIL) {
+        PrevPreferTypeRepr = Opts.PreferTypeRepr;
+        Opts.PreferTypeRepr = true;
+      }
+    }
+    ~PrefTypeReprForSILRAII() {
+      if (Opts.PrintForSIL) {
+        Opts.PreferTypeRepr = PrevPreferTypeRepr;
+      }
+    }
+  } PrefTypeReprForSILRAII(Options);
+
   std::vector<std::tuple<StringRef, StringRef, RequirementReprKind>> Elements;
   llvm::SmallString<64> Output;
   bool Handled = true;
@@ -2527,10 +2551,8 @@
 
 void PrintAST::visitParamDecl(ParamDecl *decl) {
   // Set and restore in-parameter-position printing of types
-  auto prior = Options.PrintAsInParamType;
-  Options.PrintAsInParamType = true;
+  llvm::SaveAndRestore<bool> savePrintParam(Options.PrintAsInParamType, true);
   visitVarDecl(decl);
-  Options.PrintAsInParamType = prior;
 }
 
 void PrintAST::printOneParameter(const ParamDecl *param, bool Curried,
@@ -2585,10 +2607,10 @@
   }
 
   // Set and restore in-parameter-position printing of types
-  auto prior = Options.PrintAsInParamType;
-  Options.PrintAsInParamType = true;
-  printTypeLoc(TheTypeLoc);
-  Options.PrintAsInParamType = prior;
+  {
+    llvm::SaveAndRestore<bool> savePrintParam(Options.PrintAsInParamType, true);
+    printTypeLoc(TheTypeLoc);
+  }
 
   if (param->isVariadic())
     Printer << "...";
@@ -3590,12 +3612,17 @@
       return;
     }
 
-    if (shouldPrintFullyQualified(T)) {
-      if (auto ParentDC = T->getDecl()->getDeclContext()) {
-        printDeclContext(ParentDC);
-        Printer << ".";
-      }
+    auto ParentDC = T->getDecl()->getDeclContext();
+    auto ParentNominal = ParentDC ?
+      ParentDC->getAsNominalTypeOrNominalTypeExtensionContext() : nullptr;
+
+    if (ParentNominal) {
+      visit(ParentNominal->getDeclaredType());
+      Printer << ".";
+    } else if (shouldPrintFullyQualified(T)) {
+      printModuleContext(T);
     }
+
     printTypeDeclName(T);
   }
 
@@ -3763,16 +3790,18 @@
     if (Options.SkipAttributes)
       return;
 
-    if (info.isAutoClosure()) {
+    if (info.isAutoClosure() && !Options.excludeAttrKind(TAK_autoclosure)) {
       Printer.printAttrName("@autoclosure");
       Printer << " ";
     }
-    if (inParameterPrinting && !info.isNoEscape()) {
+    if (inParameterPrinting && !info.isNoEscape() &&
+        !Options.excludeAttrKind(TAK_escaping)) {
       Printer.printAttrName("@escaping");
       Printer << " ";
     }
 
-    if (Options.PrintFunctionRepresentationAttrs) {
+    if (Options.PrintFunctionRepresentationAttrs &&
+        !Options.excludeAttrKind(TAK_convention)) {
       // TODO: coalesce into a single convention attribute.
       switch (info.getSILRepresentation()) {
       case SILFunctionType::Representation::Thick:
@@ -4253,7 +4282,7 @@
     // Substitute a context archetype if we have context generic params.
     if (Options.ContextGenericParams) {
       return visit(getGenericParamListAtDepth(T->getDepth())
-                     ->getPrimaryArchetypes()[T->getIndex()]);
+                     ->getParams()[T->getIndex()]->getArchetype());
     }
 
     auto Name = T->getName();
@@ -4369,12 +4398,8 @@
     return "array_downcast";
   case CheckedCastKind::DictionaryDowncast:
     return "dictionary_downcast";
-  case CheckedCastKind::DictionaryDowncastBridged:
-    return "dictionary_downcast_bridged";
   case CheckedCastKind::SetDowncast:
     return "set_downcast";
-  case CheckedCastKind::SetDowncastBridged:
-    return "set_downcast_bridged";
   case CheckedCastKind::BridgeFromObjectiveC:
     return "bridge_from_objc";
   }
diff --git a/lib/AST/ASTVerifier.cpp b/lib/AST/ASTVerifier.cpp
index 193a5fb..f83926c 100644
--- a/lib/AST/ASTVerifier.cpp
+++ b/lib/AST/ASTVerifier.cpp
@@ -78,7 +78,7 @@
     using ScopeLike = llvm::PointerUnion<DeclContext *, BraceStmt *>;
     SmallVector<ScopeLike, 4> Scopes;
 
-    /// The set of archetypes that are currently available.
+    /// The set of primary archetypes that are currently available.
     SmallPtrSet<ArchetypeType *, 4> ActiveArchetypes;
 
     /// \brief The stack of optional evaluations active at this point.
@@ -106,8 +106,8 @@
       for (auto genericParams = dc->getGenericParamsOfContext();
            genericParams;
            genericParams = genericParams->getOuterParameters()) {
-        ActiveArchetypes.insert(genericParams->getAllArchetypes().begin(),
-                                genericParams->getAllArchetypes().end());
+        for (auto *param : genericParams->getParams())
+          ActiveArchetypes.insert(param->getArchetype());
       }
     }
 
@@ -446,8 +446,11 @@
             return false;
           }
 
+          // Get the primary archetype.
+          auto *parent = archetype->getPrimary();
+
           // Otherwise, the archetype needs to be from this scope.
-          if (ActiveArchetypes.count(archetype) == 0) {
+          if (ActiveArchetypes.count(parent) == 0) {
             // FIXME: Make an exception for serialized extensions, which don't
             // currently have the correct archetypes.
             if (auto activeScope = Scopes.back().dyn_cast<DeclContext *>()) {
@@ -463,7 +466,7 @@
             Out << "AST verification error: archetype "
                 << archetype->getString() << " not allowed in this context\n";
 
-            auto knownDC = Ctx.ArchetypeContexts.find(archetype);
+            auto knownDC = Ctx.ArchetypeContexts.find(parent);
             if (knownDC != Ctx.ArchetypeContexts.end()) {
               llvm::errs() << "archetype came from:\n";
               knownDC->second->dumpContext();
@@ -534,8 +537,9 @@
 
       // Add any archetypes from this scope into the set of active archetypes.
       if (auto genericParams = getImmediateGenericParams(scope))
-        ActiveArchetypes.insert(genericParams->getAllArchetypes().begin(),
-                                genericParams->getAllArchetypes().end());
+        for (auto *param : genericParams->getParams())
+          if (auto *archetype = param->getArchetype())
+            ActiveArchetypes.insert(archetype);
     }
     void pushScope(BraceStmt *scope) {
       Scopes.push_back(scope);
@@ -546,7 +550,11 @@
       // Remove archetypes from this scope from the set of active archetypes.
       if (auto genericParams
             = getImmediateGenericParams(Scopes.back().get<DeclContext*>())) {
-        for (auto archetype : genericParams->getAllArchetypes()) {
+        for (auto *param : genericParams->getParams()) {
+          auto *archetype = param->getArchetype();
+          if (archetype == nullptr)
+            continue;
+
           if (!ActiveArchetypes.erase(archetype)) {
             llvm::errs() << "archetype " << archetype
                          << " not introduced by scope?\n";
diff --git a/lib/AST/ArchetypeBuilder.cpp b/lib/AST/ArchetypeBuilder.cpp
index ddc245b..d468d85 100644
--- a/lib/AST/ArchetypeBuilder.cpp
+++ b/lib/AST/ArchetypeBuilder.cpp
@@ -909,19 +909,16 @@
   return PA;
 }
 
-bool ArchetypeBuilder::addGenericParameter(GenericTypeParamDecl *GenericParam) {
+void ArchetypeBuilder::addGenericParameter(GenericTypeParamDecl *GenericParam) {
   ProtocolDecl *RootProtocol = dyn_cast<ProtocolDecl>(GenericParam->getDeclContext());
   if (!RootProtocol) {
     if (auto Ext = dyn_cast<ExtensionDecl>(GenericParam->getDeclContext()))
       RootProtocol = dyn_cast_or_null<ProtocolDecl>(Ext->getExtendedType()->getAnyNominal());
   }
-  PotentialArchetype *PA
-    = addGenericParameter(
+  addGenericParameter(
         GenericParam->getDeclaredType()->castTo<GenericTypeParamType>(),
         RootProtocol,
         GenericParam->getName());
-
-  return (!PA);
 }
 
 bool ArchetypeBuilder::addGenericParameterRequirements(GenericTypeParamDecl *GenericParam) {
@@ -935,17 +932,14 @@
                                           visited);
 }
 
-bool ArchetypeBuilder::addGenericParameter(GenericTypeParamType *GenericParam) {
+void ArchetypeBuilder::addGenericParameter(GenericTypeParamType *GenericParam) {
   auto name = GenericParam->getName();
   // Trim '$' so that archetypes are more readily discernible from abstract
   // parameters.
   if (name.str().startswith("$"))
     name = Context.getIdentifier(name.str().slice(1, name.str().size()));
   
-  PotentialArchetype *PA = addGenericParameter(GenericParam,
-                                               nullptr,
-                                               name);
-  return !PA;
+  addGenericParameter(GenericParam, nullptr, name);
 }
 
 bool ArchetypeBuilder::addConformanceRequirement(PotentialArchetype *PAT,
@@ -1477,6 +1471,10 @@
   case RequirementKind::Conformance: {
     PotentialArchetype *pa = resolveArchetype(req.getFirstType());
     assert(pa && "Re-introducing invalid requirement");
+    // FIXME: defensively return if assertions are disabled until we figure out
+    // how this sitatuaion can occur and fix it properly.
+    if (!pa)
+      return;
 
     SmallVector<ProtocolDecl *, 4> conformsTo;
     bool existential = req.getSecondType()->isExistentialType(conformsTo);
@@ -2048,14 +2046,6 @@
         --skipLevels;
       }
 
-      // Return the archetype.
-      // FIXME: Use the allArchetypes vector instead of the generic param if
-      // available because of cross-module archetype serialization woes.
-      if (!myGenericParams->getAllArchetypes().empty())
-        return myGenericParams->getPrimaryArchetypes()[index];
-
-      // During type-checking, we may try to mapTypeIntoContext before
-      // AllArchetypes has been built, so fall back to the generic params.
       return myGenericParams->getParams()[index]->getArchetype();
     }
 
@@ -2104,18 +2094,17 @@
   return type;
 }
 
-bool ArchetypeBuilder::addGenericSignature(GenericSignature *sig,
+void ArchetypeBuilder::addGenericSignature(GenericSignature *sig,
                                            bool adoptArchetypes,
                                            bool treatRequirementsAsExplicit) {
-  if (!sig) return false;
+  if (!sig) return;
   
   RequirementSource::Kind sourceKind = treatRequirementsAsExplicit
     ? RequirementSource::Explicit
     : RequirementSource::OuterScope;
   
   for (auto param : sig->getGenericParams()) {
-    if (addGenericParameter(param))
-      return true;
+    addGenericParameter(param);
 
     if (adoptArchetypes) {
       // If this generic parameter has an archetype, use it as the concrete
@@ -2133,7 +2122,6 @@
           pa->SameTypeSource = RequirementSource(sourceKind, SourceLoc());
         }
       }
-
     }
   }
 
@@ -2141,7 +2129,6 @@
   for (auto &reqt : sig->getRequirements()) {
     addRequirement(reqt, source);
   }
-  return false;
 }
 
 Type ArchetypeBuilder::substDependentType(Type type) {
diff --git a/lib/AST/Attr.cpp b/lib/AST/Attr.cpp
index 7e55c96..197b824 100644
--- a/lib/AST/Attr.cpp
+++ b/lib/AST/Attr.cpp
@@ -249,16 +249,8 @@
     if (!Options.PrintUserInaccessibleAttrs &&
         DeclAttribute::isUserInaccessible(DA->getKind()))
       continue;
-    if (std::find(Options.ExcludeAttrList.begin(),
-                  Options.ExcludeAttrList.end(),
-                  DA->getKind()) != Options.ExcludeAttrList.end())
+    if (Options.excludeAttrKind(DA->getKind()))
       continue;
-    if (!Options.ExclusiveAttrList.empty()) {
-      if (std::find(Options.ExclusiveAttrList.begin(),
-                    Options.ExclusiveAttrList.end(),
-                    DA->getKind()) == Options.ExclusiveAttrList.end())
-        continue;
-    }
 
     AttributeVector &which = DA->isDeclModifier() ? modifiers :
                              isShortAvailable(DA) ? shortAvailableAttributes :
@@ -423,33 +415,6 @@
     break;
   }
 
-  case DAK_Swift3Migration: {
-    auto attr = cast<Swift3MigrationAttr>(this);
-    Printer.printAttrName("@swift3_migration");
-    Printer << "(";
-
-    bool printedAny = false;
-    auto printSeparator = [&] {
-      if (printedAny) Printer << ", ";
-      else printedAny = true;
-    };
-
-    if (attr->getRenamed()) {
-      printSeparator();
-      Printer << "renamed: \"" << attr->getRenamed() << "\"";
-    }
-
-    if (!attr->getMessage().empty()) {
-      printSeparator();
-      Printer << "message: \"";
-      Printer << attr->getMessage();
-      Printer << "\"";
-    }
-
-    Printer << ")";
-    break;
-  }
-
   case DAK_Specialize: {
     Printer << "@" << getAttrName() << "(";
     auto *attr = cast<SpecializeAttr>(this);
@@ -572,8 +537,6 @@
     return "<<ObjC bridged>>";
   case DAK_SynthesizedProtocol:
     return "<<synthesized protocol>>";
-  case DAK_Swift3Migration:
-    return "swift3_migration";
   case DAK_Specialize:
     return "_specialize";
   }
diff --git a/lib/AST/CMakeLists.txt b/lib/AST/CMakeLists.txt
index 9e5c117..0bd0b85 100644
--- a/lib/AST/CMakeLists.txt
+++ b/lib/AST/CMakeLists.txt
@@ -68,10 +68,10 @@
     clangAPINotes
     clangBasic
 
-  COMPONENT_DEPENDS
+  LLVM_COMPONENT_DEPENDS
     bitreader bitwriter irreader debuginfoDWARF
     profiledata instrumentation object objcarcopts mc mcparser
-    bitreader bitwriter ipo option core support ${LLVM_TARGETS_TO_BUILD}
+    bitreader bitwriter lto ipo option core support ${LLVM_TARGETS_TO_BUILD}
   )
 
 if(NOT SWIFT_BUILT_STANDALONE)
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index d892ca2..1d3e8e7 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -536,29 +536,38 @@
   Requirements = newRequirements;
 }
 
-ArrayRef<Substitution>
-GenericParamList::getForwardingSubstitutions(ASTContext &C) {
-  SmallVector<Substitution, 4> subs;
-
-  // TODO: IRGen wants substitutions for secondary archetypes.
-  // for (auto &param : params->getNestedGenericParams()) {
-  //  ArchetypeType *archetype = param.getAsTypeParam()->getArchetype();
-
-  for (auto archetype : getAllNestedArchetypes()) {
-    // "Check conformance" on each declared protocol to build a
-    // conformance map.
-    SmallVector<ProtocolConformanceRef, 2> conformances;
-
-    for (ProtocolDecl *proto : archetype->getConformsTo()) {
-      conformances.push_back(ProtocolConformanceRef(proto));
-    }
-
-    // Build an identity mapping with the derived conformances.
-    auto replacement = SubstitutedType::get(archetype, archetype, C);
-    subs.push_back({replacement, C.AllocateCopy(conformances)});
+void GenericParamList::
+getForwardingSubstitutionMap(TypeSubstitutionMap &result) const {
+  // Add forwarding substitutions from the outer context if we have
+  // a type nested inside a generic function.
+  for (auto *params = this;
+       params != nullptr;
+       params = params->getOuterParameters()) {
+    for (auto *param : params->getParams())
+      result[param->getDeclaredType()->getCanonicalType().getPointer()]
+          = param->getArchetype();
   }
+}
 
-  return C.AllocateCopy(subs);
+ArrayRef<Substitution>
+GenericParamList::getForwardingSubstitutions(GenericSignature *sig) const {
+  // This is stupid. We don't really need a module, because we
+  // should not be looking up concrete conformances when we
+  // substitute types here.
+  auto *mod = getParams()[0]->getDeclContext()->getParentModule();
+
+  TypeSubstitutionMap subs;
+  getForwardingSubstitutionMap(subs);
+
+  auto lookupConformanceFn =
+      [&](Type replacement, ProtocolType *protoType)
+          -> ProtocolConformanceRef {
+    return ProtocolConformanceRef(protoType->getDecl());
+  };
+
+  SmallVector<Substitution, 4> result;
+  sig->getSubstitutions(*mod, subs, lookupConformanceFn, result);
+  return sig->getASTContext().AllocateCopy(result);
 }
 
 /// \brief Add the nested archetypes of the given archetype to the set
@@ -1896,16 +1905,13 @@
 ValueDecl::getFormalAccessScope(const DeclContext *useDC) const {
   const DeclContext *result = getDeclContext();
   Accessibility access = getFormalAccess(useDC);
-  bool swift3PrivateChecked = false;
 
   while (!result->isModuleScopeContext()) {
     if (result->isLocalContext())
       return result;
 
-    if (access == Accessibility::Private && !swift3PrivateChecked) {
-      if (result->getASTContext().LangOpts.EnableSwift3Private)
-        return result;
-      swift3PrivateChecked = true;
+    if (access == Accessibility::Private) {
+      return result;
     }
 
     if (auto enclosingNominal = dyn_cast<NominalTypeDecl>(result)) {
@@ -2025,8 +2031,8 @@
 
   if (auto *enumDecl = dyn_cast<EnumDecl>(this)) {
     switch (*knownProtocol) {
-    // Enums with raw types can implicitly derive their RawRepresentable
-    // conformance.
+    // The presence of a raw type is an explicit declaration that
+    // the compiler should derive a RawRepresentable conformance.
     case KnownProtocolKind::RawRepresentable:
       return enumDecl->hasRawType();
     
@@ -3970,10 +3976,7 @@
   if (Type objectTy = indexTy->getAnyOptionalObjectType())
     indexTy = objectTy;
 
-  if (getASTContext().getBridgedToObjC(getDeclContext(), indexTy, resolver))
-    return ObjCSubscriptKind::Keyed;
-
-  return ObjCSubscriptKind::None;
+  return ObjCSubscriptKind::Keyed;
 }
 
 SourceRange SubscriptDecl::getSourceRange() const {
@@ -4935,17 +4938,14 @@
     return {};
 
   // Make sure the clang node has swift_newtype attribute
-  if (!structDecl->getClangNode())
-    return {};
-  auto clangNode = structDecl->getClangNode();
-  if (!clangNode.getAsDecl() ||
-      !clangNode.castAsDecl()->getAttr<clang::SwiftNewtypeAttr>())
+  auto clangNode = structDecl->getClangDecl();
+  if (!clangNode || !clangNode->hasAttr<clang::SwiftNewtypeAttr>())
     return {};
 
   // Underlying type is the type of rawValue
   for (auto member : structDecl->getMembers())
     if (auto varDecl = dyn_cast<VarDecl>(member))
-      if (varDecl->getName().str() == "rawValue")
+      if (varDecl->getName() == getASTContext().Id_rawValue)
         return varDecl->getType();
 
   return {};
diff --git a/lib/AST/DeclContext.cpp b/lib/AST/DeclContext.cpp
index 8ca4360..abef65f 100644
--- a/lib/AST/DeclContext.cpp
+++ b/lib/AST/DeclContext.cpp
@@ -213,6 +213,7 @@
     }
     llvm_unreachable("bad DeclContextKind");
   }
+  llvm_unreachable("unknown parent");
 }
 
 GenericSignature *DeclContext::getGenericSignatureOfContext() const {
diff --git a/lib/AST/GenericSignature.cpp b/lib/AST/GenericSignature.cpp
index 50e9a1f..09c5395 100644
--- a/lib/AST/GenericSignature.cpp
+++ b/lib/AST/GenericSignature.cpp
@@ -414,6 +414,63 @@
   return subs;
 }
 
+void GenericSignature::
+getSubstitutions(ModuleDecl &mod,
+                 const TypeSubstitutionMap &subs,
+                 GenericSignature::LookupConformanceFn lookupConformance,
+                 SmallVectorImpl<Substitution> &result) {
+  auto &ctx = getASTContext();
+
+  Type currentReplacement;
+  SmallVector<ProtocolConformanceRef, 4> currentConformances;
+
+  for (const auto &req : getRequirements()) {
+    switch (req.getKind()) {
+    case RequirementKind::Conformance: {
+      // Get the conformance and record it.
+      auto protoType = req.getSecondType()->castTo<ProtocolType>();
+      currentConformances.push_back(
+          lookupConformance(currentReplacement, protoType));
+      break;
+    }
+
+    case RequirementKind::Superclass:
+      // Superclass requirements aren't recorded in substitutions.
+      break;
+
+    case RequirementKind::SameType:
+      // Same-type requirements aren't recorded in substitutions.
+      break;
+
+    case RequirementKind::WitnessMarker:
+      // Flush the current conformances.
+      if (currentReplacement) {
+        result.push_back({
+          currentReplacement,
+          ctx.AllocateCopy(currentConformances)
+        });
+        currentConformances.clear();
+      }
+
+      // Each witness marker starts a new substitution.
+      currentReplacement = req.getFirstType().subst(&mod, subs, SubstOptions());
+      if (!currentReplacement)
+        currentReplacement = ErrorType::get(ctx);
+
+      break;
+    }
+  }
+
+  // Flush the final conformances.
+  if (currentReplacement) {
+    result.push_back({
+      currentReplacement,
+      ctx.AllocateCopy(currentConformances),
+    });
+    currentConformances.clear();
+  }
+}
+
 bool GenericSignature::requiresClass(Type type, ModuleDecl &mod) {
   if (!type->isTypeParameter()) return false;
 
diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp
index 5f0184f..1cb1331 100644
--- a/lib/AST/Module.cpp
+++ b/lib/AST/Module.cpp
@@ -558,9 +558,8 @@
   // don't have access to the module. It will have to go away once we're
   // properly differentiating bound generic types based on the protocol
   // conformances visible from a given module.
-  if (!module) {
+  if (!module)
     module = getAnyNominal()->getParentModule();
-  }
 
   // Check the context, introducing the default if needed.
   if (!gpContext)
@@ -569,8 +568,8 @@
   assert(gpContext->getAsNominalTypeOrNominalTypeExtensionContext()
          == getAnyNominal() && "not a valid context");
 
-  auto *genericParams = gpContext->getGenericParamsOfContext();
-  if (!genericParams)
+  auto *genericSig = gpContext->getGenericSignatureOfContext();
+  if (genericSig == nullptr)
     return { };
 
   // If we already have a cached copy of the substitutions, return them.
@@ -596,8 +595,8 @@
 
       for (Type arg : boundGeneric->getGenericArgs()) {
         auto gp = genericParams->getParams()[index++];
-        auto archetype = gp->getArchetype();
-        substitutions[archetype] = arg;
+        substitutions[gp->getDeclaredType()->getCanonicalType()
+                        .getPointer()] = arg;
       }
 
       parent = CanType(boundGeneric->getParent());
@@ -616,64 +615,33 @@
 
   // Add forwarding substitutions from the outer context if we have
   // a type nested inside a generic function.
-  if (auto *outerGenericParams = parentDC->getGenericParamsOfContext()) {
-    for (auto archetype : outerGenericParams->getAllNestedArchetypes())
-      substitutions[archetype] = archetype;
-  }
+  if (auto *outerParams = parentDC->getGenericParamsOfContext())
+    outerParams->getForwardingSubstitutionMap(substitutions);
 
-  // Collect all of the archetypes.
-  SmallVector<ArchetypeType *, 2> allArchetypesList;
-  ArrayRef<ArchetypeType *> allArchetypes = genericParams->getAllArchetypes();
-  if (genericParams->getOuterParameters()) {
-    SmallVector<const GenericParamList *, 2> allGenericParams;
-    unsigned numArchetypes = 0;
-    for (; genericParams; genericParams = genericParams->getOuterParameters()) {
-      allGenericParams.push_back(genericParams);
-      numArchetypes += genericParams->getAllArchetypes().size();
-    }
-    allArchetypesList.reserve(numArchetypes);
-    for (auto gp = allGenericParams.rbegin(), gpEnd = allGenericParams.rend();
-         gp != gpEnd; ++gp) {
-      allArchetypesList.append((*gp)->getAllArchetypes().begin(),
-                               (*gp)->getAllArchetypes().end());
-    }
-    allArchetypes = allArchetypesList;
-  }
+  auto lookupConformanceFn =
+      [&](Type replacement, ProtocolType *protoType)
+          -> ProtocolConformanceRef {
 
-  // For each of the archetypes, compute the substitution.
-  bool hasTypeVariables = canon->hasTypeVariable();
-  SmallVector<Substitution, 4> resultSubstitutions;
-  resultSubstitutions.resize(allArchetypes.size());
-  unsigned index = 0;
-  for (auto archetype : allArchetypes) {
-    // Substitute into the type.
-    SubstOptions options;
-    if (hasTypeVariables)
-      options |= SubstFlags::IgnoreMissing;
-    auto type = Type(archetype).subst(module, substitutions, options);
-    if (!type)
-      type = ErrorType::get(module->getASTContext());
+    auto *proto = protoType->getDecl();
 
-    SmallVector<ProtocolConformanceRef, 4> conformances;
-    for (auto proto : archetype->getConformsTo()) {
-      // If the type is a type variable or is dependent, just fill in empty
-      // conformances.
-      if (type->is<TypeVariableType>() || type->isTypeParameter()) {
-        conformances.push_back(ProtocolConformanceRef(proto));
+    // If the type is a type variable or is dependent, just fill in empty
+    // conformances.
+    if (replacement->is<TypeVariableType>() || replacement->isTypeParameter())
+      return ProtocolConformanceRef(proto);
 
-      // Otherwise, find the conformances.
-      } else {
-        if (auto conforms = module->lookupConformance(type, proto, resolver))
-          conformances.push_back(*conforms);
-        else
-          conformances.push_back(ProtocolConformanceRef(proto));
-      }
-    }
+    // Otherwise, find the conformance.
+    auto conforms = module->lookupConformance(replacement, proto, resolver);
+    if (conforms)
+      return *conforms;
 
-    // Record this substitution.
-    resultSubstitutions[index] = {type, ctx.AllocateCopy(conformances)};
-    ++index;
-  }
+    // FIXME: Should we ever end up here?
+    return ProtocolConformanceRef(proto);
+  };
+
+  SmallVector<Substitution, 4> result;
+  genericSig->getSubstitutions(*module, substitutions,
+                               lookupConformanceFn,
+                               result);
 
   // Before recording substitutions, make sure we didn't end up doing it
   // recursively.
@@ -681,7 +649,8 @@
     return *known;
 
   // Copy and record the substitutions.
-  auto permanentSubs = ctx.AllocateCopy(resultSubstitutions,
+  bool hasTypeVariables = canon->hasTypeVariable();
+  auto permanentSubs = ctx.AllocateCopy(result,
                                         hasTypeVariables
                                           ? AllocationArena::ConstraintSolver
                                           : AllocationArena::Permanent);
diff --git a/lib/AST/NameLookup.cpp b/lib/AST/NameLookup.cpp
index 7532992..1530b01 100644
--- a/lib/AST/NameLookup.cpp
+++ b/lib/AST/NameLookup.cpp
@@ -327,23 +327,34 @@
   return anyRemoved;
 }
 
-static bool matchesDiscriminator(Identifier discriminator,
-                                 const ValueDecl *value) {
+namespace {
+enum class DiscriminatorMatch {
+  NoDiscriminator,
+  Matches,
+  Different
+};
+}
+
+static DiscriminatorMatch matchDiscriminator(Identifier discriminator,
+                                             const ValueDecl *value) {
   if (value->getFormalAccess() > Accessibility::FilePrivate)
-    return false;
+    return DiscriminatorMatch::NoDiscriminator;
 
   auto containingFile =
     dyn_cast<FileUnit>(value->getDeclContext()->getModuleScopeContext());
   if (!containingFile)
-    return false;
+    return DiscriminatorMatch::Different;
 
-  return
-    discriminator == containingFile->getDiscriminatorForPrivateValue(value);
+  if (discriminator == containingFile->getDiscriminatorForPrivateValue(value))
+    return DiscriminatorMatch::Matches;
+
+  return DiscriminatorMatch::Different;
 }
 
-static bool matchesDiscriminator(Identifier discriminator,
-                                 UnqualifiedLookupResult lookupResult) {
-  return matchesDiscriminator(discriminator, lookupResult.getValueDecl());
+static DiscriminatorMatch
+matchDiscriminator(Identifier discriminator,
+                   UnqualifiedLookupResult lookupResult) {
+  return matchDiscriminator(discriminator, lookupResult.getValueDecl());
 }
 
 template <typename Result>
@@ -353,19 +364,21 @@
   if (discriminator.empty())
     return;
 
-  auto doesNotMatch = [discriminator](Result next) -> bool {
-    return !matchesDiscriminator(discriminator, next);
-  };
-
-  auto lastMatchIter = std::find_if_not(results.rbegin(), results.rend(),
-                                        doesNotMatch);
+  auto lastMatchIter = std::find_if(results.rbegin(), results.rend(),
+                                    [discriminator](Result next) -> bool {
+    return
+      matchDiscriminator(discriminator, next) == DiscriminatorMatch::Matches;
+  });
   if (lastMatchIter == results.rend())
     return;
 
   Result lastMatch = *lastMatchIter;
 
   auto newEnd = std::remove_if(results.begin(), lastMatchIter.base()-1,
-                               doesNotMatch);
+                               [discriminator](Result next) -> bool {
+    return
+      matchDiscriminator(discriminator, next) == DiscriminatorMatch::Different;
+  });
   results.erase(newEnd, results.end());
   results.push_back(lastMatch);
 }
@@ -1026,9 +1039,7 @@
   assert(sourceDC && "ValueDecl being accessed must have a valid DeclContext");
   switch (access) {
   case Accessibility::Private:
-    if (sourceDC->getASTContext().LangOpts.EnableSwift3Private)
-      return useDC == sourceDC || useDC->isChildContextOf(sourceDC);
-    SWIFT_FALLTHROUGH;
+    return useDC == sourceDC || useDC->isChildContextOf(sourceDC);
   case Accessibility::FilePrivate:
     return useDC->getModuleScopeContext() == sourceDC->getModuleScopeContext();
   case Accessibility::Internal: {
diff --git a/lib/AST/ProtocolConformance.cpp b/lib/AST/ProtocolConformance.cpp
index 966c78b..c9083f2 100644
--- a/lib/AST/ProtocolConformance.cpp
+++ b/lib/AST/ProtocolConformance.cpp
@@ -333,13 +333,6 @@
   assert(genericConformance->getKind() != ProtocolConformanceKind::Specialized);
 }
 
-SubstitutionIterator
-SpecializedProtocolConformance::getGenericSubstitutionIterator() const {
-  return SubstitutionIterator(
-          GenericConformance->getDeclContext()->getGenericParamsOfContext(),
-                              GenericSubstitutions);
-}
-
 bool SpecializedProtocolConformance::hasTypeWitness(
                       AssociatedTypeDecl *assocType, 
                       LazyResolver *resolver) const {
@@ -358,16 +351,33 @@
   }
 
   // Otherwise, perform substitutions to create this witness now.
-  TypeSubstitutionMap substitutionMap = GenericConformance->getGenericParams()
-    ->getSubstitutionMap(GenericSubstitutions);
+  auto conformingDC = getDeclContext();
+  auto conformingModule = conformingDC->getParentModule();
+
+  auto *genericParams = GenericConformance->getGenericParams();
+  auto *genericSig = GenericConformance->getGenericSignature();
+
+  TypeSubstitutionMap substitutionMap;
+
+  // FIXME: We could have a new version of Type::subst() that
+  // takes a conformanceMap in addition to a substitutionMap,
+  // but for now this is ignored below
+  ArchetypeConformanceMap conformanceMap;
+
+  // Compute a context type substitution map from the
+  // substitution array stored in this conformance
+  genericParams->getSubstitutionMap(conformingModule, genericSig,
+                                    GenericSubstitutions,
+                                    substitutionMap,
+                                    conformanceMap);
 
   auto genericWitnessAndDecl
     = GenericConformance->getTypeWitnessSubstAndDecl(assocType, resolver);
 
   auto &genericWitness = genericWitnessAndDecl.first;
   auto *typeDecl = genericWitnessAndDecl.second;
-  auto conformingDC = getDeclContext();
-  auto conformingModule = conformingDC->getParentModule();
+
+  // Apply the substitution we computed above
   auto specializedType
     = genericWitness.getReplacement().subst(conformingModule, substitutionMap,
                                             None);
@@ -503,20 +513,23 @@
     assert(inherited->getType()->isEqual(spec->getGenericConformance()->getType())
            && "inherited conformance doesn't match type?!");
     
+    // Fill in the substitution and conformance maps.
     TypeSubstitutionMap subMap;
     ArchetypeConformanceMap conformanceMap;
-    
-    // Fill in the substitution and conformance maps.
-    for (auto archAndSub : spec->getGenericSubstitutionIterator()) {
-      auto arch = archAndSub.first;
-      auto sub = archAndSub.second;
-      conformanceMap[arch] = sub.getConformances();
-      if (arch->isPrimary())
-        subMap[arch] = sub.getReplacement();
-    }
-    auto r = inherited->subst(getDeclContext()->getParentModule(),
-                            getType(), spec->getGenericSubstitutions(),
-                            subMap, conformanceMap);
+
+    auto subs = spec->getGenericSubstitutions();
+
+    auto *conformingDC = spec->getDeclContext();
+    auto *conformingModule = conformingDC->getParentModule();
+
+    auto *sig = conformingDC->getGenericSignatureOfContext();
+    auto *params = conformingDC->getGenericParamsOfContext();
+
+    params->getSubstitutionMap(conformingModule, sig, subs,
+                               subMap, conformanceMap);
+
+    auto r = inherited->subst(conformingModule, getType(), subs,
+                              subMap, conformanceMap);
     assert(getType()->isEqual(r->getType())
            && "substitution didn't produce conformance for same type?!");
     return r;
@@ -593,10 +606,14 @@
     if (resolver)
       resolver->resolveRawType(theEnum);
     if (theEnum->hasRawType()) {
-      if (auto rawRepresentable = getASTContext().getProtocol(
-                                    KnownProtocolKind::RawRepresentable)) {
-        ConformanceTable->addSynthesizedConformance(mutableThis,
-                                                    rawRepresentable);
+      if (auto rawRepresentable = ctx.getProtocol(KnownProtocolKind::RawRepresentable)) {
+
+        // The presence of a raw type is an explicit declaration that
+        // the compiler should derive a RawRepresentable conformance.
+        auto conformance = ctx.getConformance(mutableThis->getDeclaredTypeInContext(), rawRepresentable,
+                                              mutableThis->getNameLoc(), mutableThis->getInnermostDeclContext(),
+                                              ProtocolConformanceState::Incomplete);
+        ConformanceTable->registerProtocolConformance(conformance);
       }
     }
   }
diff --git a/lib/AST/Substitution.cpp b/lib/AST/Substitution.cpp
index 618a2fa..598c57f 100644
--- a/lib/AST/Substitution.cpp
+++ b/lib/AST/Substitution.cpp
@@ -31,23 +31,6 @@
     Conformance.equals(other.Conformance);
 }
 
-static void
-getSubstitutionMaps(GenericParamList *context,
-                    ArrayRef<Substitution> subs,
-                    TypeSubstitutionMap &typeMap,
-                    ArchetypeConformanceMap &conformanceMap) {
-  for (auto arch : context->getAllNestedArchetypes()) {
-    auto sub = subs.front();
-    subs = subs.slice(1);
-
-    // Save the conformances from the substitution so that we can substitute
-    // them into substitutions that map between archetypes.
-    conformanceMap[arch] = sub.getConformances();
-    typeMap[arch] = sub.getReplacement();
-  }
-  assert(subs.empty() && "did not use all substitutions?!");
-}
-
 Substitution::Substitution(Type Replacement,
                            ArrayRef<ProtocolConformanceRef> Conformance)
   : Replacement(Replacement), Conformance(Conformance)
@@ -58,12 +41,14 @@
 }
 
 Substitution Substitution::subst(Module *module,
+                                 GenericSignature *sig,
                                  GenericParamList *context,
                                  ArrayRef<Substitution> subs) const {
   TypeSubstitutionMap subMap;
   ArchetypeConformanceMap conformanceMap;
-  getSubstitutionMaps(context, subs,
-                      subMap, conformanceMap);
+
+  assert(sig && context);
+  context->getSubstitutionMap(module, sig, subs, subMap, conformanceMap);
   return subst(module, subs, subMap, conformanceMap);
 }
 
@@ -157,8 +142,3 @@
 
   return Substitution{substReplacement, substConfs};
 }
-
-SubstitutionIterator::SubstitutionIterator(GenericParamList *params,
-                                           ArrayRef<Substitution> subs)
-  : Archetypes(params->getAllArchetypes()), Subs(subs) {
-}
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 24c436f..e10a0be 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -89,12 +89,11 @@
   return getCanonicalType().hasReferenceSemantics();
 }
 
-bool TypeBase::isNever() {
+bool TypeBase::isUninhabited() {
   if (auto nominalDecl = getAnyNominal())
     if (auto enumDecl = dyn_cast<EnumDecl>(nominalDecl))
       if (enumDecl->getAllElements().empty())
         return true;
-
   return false;
 }
 
@@ -2027,9 +2026,15 @@
 getObjCObjectRepresentable(Type type, const DeclContext *dc) {
   // @objc metatypes are representable when their instance type is.
   if (auto metatype = type->getAs<AnyMetatypeType>()) {
+    auto instanceType = metatype->getInstanceType();
+
+    // Consider metatype of any existential type as not Objective-C
+    // representable.
+    if (metatype->is<MetatypeType>() && instanceType->isAnyExistentialType())
+      return ForeignRepresentableKind::None;
+
     // If the instance type is not representable verbatim, the metatype is not
     // representable.
-    auto instanceType = metatype->getInstanceType();
     if (getObjCObjectRepresentable(instanceType, dc)
           != ForeignRepresentableKind::Object)
       return ForeignRepresentableKind::None;
@@ -2062,12 +2067,10 @@
     return ForeignRepresentableKind::Object;
   
   // Any can be bridged to id.
-  if (type->getASTContext().LangOpts.EnableIdAsAny) {
-    if (type->isAny()) {
-      return ForeignRepresentableKind::Bridged;
-    }
+  if (type->isAny()) {
+    return ForeignRepresentableKind::Bridged;
   }
-  
+
   // Class-constrained generic parameters, from ObjC generic classes.
   if (auto tyContext = dc->getInnermostTypeContext())
     if (auto clas = tyContext->getAsClassOrClassExtensionContext())
@@ -2224,12 +2227,19 @@
     case ForeignLanguage::ObjectiveC:
       if (isa<StructDecl>(nominal) || isa<EnumDecl>(nominal)) {
         // Optional structs are not representable in (Objective-)C if they
-        // originally came from C, whether or not they are bridged. If they
-        // are defined in Swift, they are only representable if they are
-        // bridged (checked below).
+        // originally came from C, whether or not they are bridged, unless they
+        // came from swift_newtype. If they are defined in Swift, they are only
+        // representable if they are bridged (checked below).
         if (wasOptional) {
-          if (nominal->hasClangNode())
+          if (nominal->hasClangNode()) {
+            Type underlyingType =
+                nominal->getDeclaredType()->getSwiftNewtypeUnderlyingType();
+            if (underlyingType) {
+              return getForeignRepresentable(OptionalType::get(underlyingType),
+                                             language, dc);
+            }
             return failure();
+          }
           break;
         }
       }
@@ -2757,19 +2767,32 @@
   return Params->getParams();
 }
 
-TypeSubstitutionMap
-GenericParamList::getSubstitutionMap(ArrayRef<swift::Substitution> Subs) const {
+void GenericParamList::
+getSubstitutionMap(ModuleDecl *mod,
+                   GenericSignature *sig,
+                   ArrayRef<Substitution> subs,
+                   TypeSubstitutionMap &subsMap,
+                   ArchetypeConformanceMap &conformanceMap) const {
+
+  // Map from interface types to archetypes
   TypeSubstitutionMap map;
-  
-  for (auto arch : getAllNestedArchetypes()) {
-    auto sub = Subs.front();
-    Subs = Subs.slice(1);
-    
-    map.insert({arch, sub.getReplacement()});
+  getForwardingSubstitutionMap(map);
+
+  for (auto depTy : sig->getAllDependentTypes()) {
+
+    // Map the interface type to a context type.
+    auto contextTy = depTy.subst(mod, map, SubstOptions());
+    auto *archetype = contextTy->castTo<ArchetypeType>();
+
+    auto sub = subs.front();
+    subs = subs.slice(1);
+
+    // Record the replacement type and its conformances.
+    subsMap[archetype] = sub.getReplacement();
+    conformanceMap[archetype] = sub.getConformances();
   }
   
-  assert(Subs.empty() && "did not use all substitutions?!");
-  return map;
+  assert(subs.empty() && "did not use all substitutions?!");
 }
 
 FunctionType *
@@ -2885,7 +2908,8 @@
                               None);
 }
 
-Type Type::subst(Module *module, TypeSubstitutionMap &substitutions,
+Type Type::subst(Module *module,
+                 const TypeSubstitutionMap &substitutions,
                  SubstOptions options) const {
   /// Return the original type or a null type, depending on the 'ignoreMissing'
   /// flag.
@@ -2985,8 +3009,7 @@
     // FIXME: This feels painfully inefficient. We're creating a dense map
     // for a single substitution.
     substitutions[dc->getSelfInterfaceType()
-                    ->getCanonicalType()
-                    ->castTo<GenericTypeParamType>()]
+                    ->getCanonicalType().getPointer()]
       = baseTy;
     return substitutions;
   }
@@ -3017,8 +3040,7 @@
       auto args = boundGeneric->getGenericArgs();
       for (unsigned i = 0, n = args.size(); i != n; ++i) {
         substitutions[params[i]->getDeclaredType()->getCanonicalType()
-                        ->castTo<GenericTypeParamType>()]
-          = args[i];
+                        .getPointer()] = args[i];
       }
 
       // Continue looking into the parent.
diff --git a/lib/AST/TypeJoinMeet.cpp b/lib/AST/TypeJoinMeet.cpp
index e5d6bb7..39398be 100644
--- a/lib/AST/TypeJoinMeet.cpp
+++ b/lib/AST/TypeJoinMeet.cpp
@@ -1,4 +1,4 @@
-//===--- TypeJoinMeet.cpp - Swift Type "Join" and "Meet"  -----------------===//
+//===--- TypeJoinjoin.cpp - Swift Type "join" and "meet"  -----------------===//
 //
 // This source file is part of the Swift.org open source project
 //
@@ -10,8 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file implements the "meet" operation for types (and, eventually,
-//  "join").
+//  This file implements the "join" operation for types (and, eventually,
+//  "meet").
 //
 //===----------------------------------------------------------------------===//
 #include "swift/AST/ASTContext.h"
@@ -20,15 +20,15 @@
 #include "llvm/ADT/SmallPtrSet.h"
 using namespace swift;
 
-Type Type::meet(Type type1, Type type2) {
+Type Type::join(Type type1, Type type2) {
   assert(!type1->hasTypeVariable() && !type2->hasTypeVariable() &&
-         "Cannot compute meet of types involving type variables");
+         "Cannot compute join of types involving type variables");
 
   // FIXME: This algorithm is woefully incomplete, and is only currently used
   // for optimizing away extra exploratory work in the constraint solver. It
   // should eventually encompass all of the subtyping rules of the language.
 
-  // If the types are equivalent, the meet is obvious.
+  // If the types are equivalent, the join is obvious.
   if (type1->isEqual(type2))
     return type1;
 
@@ -64,7 +64,21 @@
     return nullptr;
   }
 
-  // The meet can only be an existential.
+  // If one or both of the types are optional types, look at the underlying
+  // object type.
+  OptionalTypeKind otk1, otk2;
+  Type objectType1 = type1->getAnyOptionalObjectType(otk1);
+  Type objectType2 = type2->getAnyOptionalObjectType(otk2);
+  if (otk1 == OTK_Optional || otk2 == OTK_Optional) {
+    // Compute the join of the unwrapped type. If there is none, we're done.
+    Type unwrappedJoin = join(objectType1 ? objectType1 : type1,
+                              objectType2 ? objectType2 : type2);
+    if (!unwrappedJoin) return nullptr;
+
+    return OptionalType::get(unwrappedJoin);
+  }
+
+  // The join can only be an existential.
   return nullptr;
 }
 
diff --git a/lib/AST/TypeRepr.cpp b/lib/AST/TypeRepr.cpp
index 4a24c1b..d78ef41 100644
--- a/lib/AST/TypeRepr.cpp
+++ b/lib/AST/TypeRepr.cpp
@@ -264,36 +264,43 @@
 
 void AttributedTypeRepr::printImpl(ASTPrinter &Printer,
                                    const PrintOptions &Opts) const {
-  printAttrs(Printer);
+  printAttrs(Printer, Opts);
   printTypeRepr(Ty, Printer, Opts);
 }
 
 void AttributedTypeRepr::printAttrs(llvm::raw_ostream &OS) const {
   StreamPrinter Printer(OS);
-  printAttrs(Printer);
+  printAttrs(Printer, PrintOptions());
 }
 
-void AttributedTypeRepr::printAttrs(ASTPrinter &Printer) const {
+void AttributedTypeRepr::printAttrs(ASTPrinter &Printer,
+                                    const PrintOptions &Options) const {
   const TypeAttributes &Attrs = getAttrs();
 
-  if (Attrs.has(TAK_autoclosure)) {
+  auto hasAttr = [&](TypeAttrKind K) -> bool {
+    if (Options.excludeAttrKind(K))
+      return false;
+    return Attrs.has(K);
+  };
+
+  if (hasAttr(TAK_autoclosure)) {
     Printer.printAttrName("@autoclosure");
     Printer << " ";
   }
-  if (Attrs.has(TAK_escaping)) {
+  if (hasAttr(TAK_escaping)) {
     Printer.printAttrName("@escaping");
     Printer << " ";
   }
 
-  if (Attrs.has(TAK_thin)) {
+  if (hasAttr(TAK_thin)) {
     Printer.printAttrName("@thin");
     Printer << " ";
   }
-  if (Attrs.has(TAK_thick)) {
+  if (hasAttr(TAK_thick)) {
     Printer.printAttrName("@thick");
     Printer << " ";
   }
-  if (Attrs.convention.hasValue()) {
+  if (hasAttr(TAK_convention) && Attrs.convention.hasValue()) {
     Printer.printAttrName("@convention");
     Printer << "(" << Attrs.convention.getValue() << ") ";
   }
diff --git a/lib/ASTSectionImporter/CMakeLists.txt b/lib/ASTSectionImporter/CMakeLists.txt
index cc17918..5f20e7f 100644
--- a/lib/ASTSectionImporter/CMakeLists.txt
+++ b/lib/ASTSectionImporter/CMakeLists.txt
@@ -1,5 +1,5 @@
 add_swift_library(swiftASTSectionImporter STATIC
   ASTSectionImporter.cpp
   LINK_LIBRARIES swiftBasic
-  COMPONENT_DEPENDS core)
+  LLVM_COMPONENT_DEPENDS core)
 
diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt
index 9d528e3..97862ca 100644
--- a/lib/Basic/CMakeLists.txt
+++ b/lib/Basic/CMakeLists.txt
@@ -98,7 +98,7 @@
 
   C_COMPILE_FLAGS ${UUID_INCLUDE}
   LINK_LIBRARIES ${UUID_LIBRARIES}
-  COMPONENT_DEPENDS support)
+  LLVM_COMPONENT_DEPENDS support)
 
 message(STATUS "Swift version: ${SWIFT_VERSION}")
 message(STATUS "Swift vendor: ${SWIFT_VENDOR}")
diff --git a/lib/Basic/PartsOfSpeech.def b/lib/Basic/PartsOfSpeech.def
index 43c1c67..4b77777 100644
--- a/lib/Basic/PartsOfSpeech.def
+++ b/lib/Basic/PartsOfSpeech.def
@@ -266,7 +266,6 @@
 VERB(drain)
 VERB(draw)
 VERB(dream)
-VERB(dream)
 VERB(dress)
 VERB(drink)
 VERB(drip)
diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp
index bc18785..ad249f1 100644
--- a/lib/ClangImporter/ClangImporter.cpp
+++ b/lib/ClangImporter/ClangImporter.cpp
@@ -332,6 +332,9 @@
           // Don't emit LLVM IR.
           "-fsyntax-only",
 
+          // enable block support
+          "-fblocks",
+
           "-fretain-comments-from-system-headers",
 
           SHIMS_INCLUDE_FLAG, searchPathOpts.RuntimeResourcePath,
@@ -341,7 +344,7 @@
   if (triple.isOSDarwin()) {
     invocationArgStrs.insert(invocationArgStrs.end(), {
       // Darwin uses Objective-C ARC.
-      "-x", "objective-c", "-std=gnu11", "-fobjc-arc", "-fblocks",
+      "-x", "objective-c", "-std=gnu11", "-fobjc-arc",
 
       // Define macros that Swift bridging headers use.
       "-DSWIFT_CLASS_EXTRA=__attribute__((annotate(\""
@@ -2564,6 +2567,11 @@
       else if (inference.isSetter())
         result.AccessorKind = ImportedAccessorKind::PropertySetter;
 
+      // Inits are factory. These C functions are neither convenience nor
+      // designated, as they return a fully formed object of that type.
+      if (inference.isInit())
+        result.InitKind = CtorInitializerKind::Factory;
+
       return result;
     }
   }
diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp
index 958708c..ab6dab4 100644
--- a/lib/ClangImporter/ImportDecl.cpp
+++ b/lib/ClangImporter/ImportDecl.cpp
@@ -1037,6 +1037,19 @@
   return addErrorDomain(swiftDecl, clangNamedDecl, importer);
 }
 
+/// Determine whether this is the declaration of Objective-C's 'id' type.
+static bool isObjCId(ASTContext &ctx, const clang::Decl *decl) {
+  if (!ctx.LangOpts.EnableObjCInterop) return false;
+
+  auto typedefDecl = dyn_cast<clang::TypedefNameDecl>(decl);
+  if (!typedefDecl) return false;
+
+  if (!typedefDecl->getDeclContext()->getRedeclContext()->isTranslationUnit())
+    return false;
+
+  return typedefDecl->getName() == "id";
+}
+
 namespace {
   /// \brief Convert Clang declarations into the corresponding Swift
   /// declarations.
@@ -1532,36 +1545,6 @@
 
       Type SwiftType;
       if (Decl->getDeclContext()->getRedeclContext()->isTranslationUnit()) {
-        // Ignore the 'id' typedef. We want to bridge the underlying
-        // ObjCId type.
-        //
-        // When we remove the EnableIdAsAny staging flag, the 'id' entry
-        // should be removed from MappedTypes.def, and this conditional should
-        // become unnecessary.
-        if (Name.str() == "id" && Impl.SwiftContext.LangOpts.EnableIdAsAny) {
-          Impl.SpecialTypedefNames[Decl->getCanonicalDecl()] =
-              MappedTypeNameKind::DoNothing;
-
-          auto DC = Impl.importDeclContextOf(Decl, importedName.EffectiveContext);
-          if (!DC) return nullptr;
-
-          auto loc = Impl.importSourceLoc(Decl->getLocStart());
-          
-          // Leave behind a typealias for 'id' marked unavailable, to instruct
-          // people to use Any instead.
-          auto unavailableAlias = Impl.createDeclWithClangNode<TypeAliasDecl>(
-                          Decl, Accessibility::Public, loc, Name, loc,
-                          TypeLoc::withoutLoc(Impl.SwiftContext.TheAnyType),
-                          /*genericparams*/nullptr, DC);
-
-          auto attr = AvailableAttr::createUnconditional(
-                        Impl.SwiftContext, "'id' is not available in Swift; use 'Any'",
-                        "", UnconditionalAvailabilityKind::UnavailableInSwift);
-
-          unavailableAlias->getAttrs().add(attr);
-          return nullptr;
-        }
-      
         bool IsError;
         StringRef StdlibTypeName;
         MappedTypeNameKind NameMapping;
@@ -1714,6 +1697,17 @@
                                       TypeLoc::withoutLoc(SwiftType),
                                       /*genericparams*/nullptr, DC);
       Result->computeType();
+
+      // Make Objective-C's 'id' unavailable.
+      ASTContext &ctx = DC->getASTContext();
+      if (isObjCId(ctx, Decl)) {
+        auto attr = AvailableAttr::createUnconditional(
+                      ctx,
+                      "'id' is not available in Swift; use 'Any'", "",
+                      UnconditionalAvailabilityKind::UnavailableInSwift);
+        Result->getAttrs().add(attr);
+      }
+
       return Result;
     }
 
@@ -5154,11 +5148,8 @@
     GenericSignature *calculateGenericSignature(GenericParamList *genericParams,
                                                 DeclContext *dc) {
       ArchetypeBuilder builder(*dc->getParentModule(), Impl.SwiftContext.Diags);
-      for (auto param : *genericParams) {
-        if (builder.addGenericParameter(param)) {
-          return nullptr;
-        }
-      }
+      for (auto param : *genericParams)
+        builder.addGenericParameter(param);
       for (auto param : *genericParams) {
         if (builder.addGenericParameterRequirements(param)) {
           return nullptr;
@@ -6495,6 +6486,9 @@
 
 bool ClangImporter::Implementation::isUnavailableInSwift(
     const clang::Decl *decl) {
+  // 'id' is always unavailable in Swift.
+  if (isObjCId(SwiftContext, decl)) return true;
+
   // FIXME: Somewhat duplicated from importAttributes(), but this is a
   // more direct path.
   if (decl->getAvailability() == clang::AR_Unavailable) return true;
diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp
index b66863a..7783eaf 100644
--- a/lib/ClangImporter/ImportType.cpp
+++ b/lib/ClangImporter/ImportType.cpp
@@ -331,7 +331,7 @@
         pointeeType = Impl.importType(pointeeQualType,
                                       ImportTypeKind::Pointee,
                                       AllowNSUIntegerAsInt,
-                                      /*can fully bridge*/false);
+                                      /*isFullyBridgeable*/false);
 
       // If the pointed-to type is unrepresentable in Swift, import as
       // OpaquePointer.
@@ -418,7 +418,7 @@
       Type elementType = Impl.importType(type->getElementType(),
                                          ImportTypeKind::Pointee,
                                          AllowNSUIntegerAsInt,
-                                         /*can fully bridge*/false);
+                                         /*isFullyBridgeable*/false);
       if (!elementType)
         return Type();
       
@@ -985,11 +985,9 @@
 
       // id maps to Any in bridgeable contexts, AnyObject otherwise.
       if (type->isObjCIdType()) {
-        if (Impl.SwiftContext.LangOpts.EnableIdAsAny)
-          return {proto->getDeclaredType(),
-                  ImportHint(ImportHint::ObjCBridged,
-                             Impl.SwiftContext.TheAnyType)};
-        return {proto->getDeclaredType(), ImportHint::ObjCPointer};
+        return {proto->getDeclaredType(),
+                ImportHint(ImportHint::ObjCBridged,
+                           Impl.SwiftContext.TheAnyType)};
       }
 
       // Class maps to AnyObject.Type.
@@ -2272,7 +2270,14 @@
                                OptionalityOfReturn);
     // Adjust the result type for a throwing function.
     if (swiftResultTy && errorInfo) {
-      origSwiftResultTy = swiftResultTy->getCanonicalType();
+
+      // Get the original unbridged result type.
+      origSwiftResultTy = importType(resultType, resultKind,
+                                 allowNSUIntegerAsIntInResult,
+                                 /*isFullyBridgeable*/false,
+                                 OptionalityOfReturn)
+                              ->getCanonicalType();
+
       swiftResultTy = adjustResultTypeForThrowingFunction(*errorInfo,
                                                           swiftResultTy);
     }
diff --git a/lib/ClangImporter/MappedTypes.def b/lib/ClangImporter/MappedTypes.def
index c23f0f4..ba5fc75 100644
--- a/lib/ClangImporter/MappedTypes.def
+++ b/lib/ClangImporter/MappedTypes.def
@@ -144,7 +144,6 @@
 // Objective-C types.
 MAP_TYPE("BOOL", ObjCBool, 8, "ObjectiveC", "ObjCBool", false, DoNothing)
 MAP_TYPE("SEL",  ObjCSel, 0, "ObjectiveC", "Selector", false, DoNothing)
-MAP_STDLIB_TYPE("id", ObjCId, 0, "AnyObject", false, DoNothing)
 MAP_STDLIB_TYPE("Class", ObjCClass, 0, "AnyClass", false, DoNothing)
 MAP_STDLIB_TYPE(
   Impl.SwiftContext.getSwiftName(KnownFoundationEntity::NSInteger),
diff --git a/lib/ClangImporter/SwiftLookupTable.cpp b/lib/ClangImporter/SwiftLookupTable.cpp
index 60c93f2..f0a781e 100644
--- a/lib/ClangImporter/SwiftLookupTable.cpp
+++ b/lib/ClangImporter/SwiftLookupTable.cpp
@@ -216,7 +216,6 @@
     if (auto decl = entry.dyn_cast<clang::NamedDecl *>()) {
       if (isa<clang::TagDecl>(decl) ||
           isa<clang::ObjCInterfaceDecl>(decl) ||
-          isa<clang::ObjCProtocolDecl>(decl) ||
           isa<clang::TypedefNameDecl>(decl))
         return decl;
     }
diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp
index af0223f..bdf1aa4 100644
--- a/lib/Driver/Compilation.cpp
+++ b/lib/Driver/Compilation.cpp
@@ -33,6 +33,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Timer.h"
 #include "llvm/Support/YAMLParser.h"
 
 using namespace swift;
@@ -48,7 +49,8 @@
                          unsigned NumberOfParallelCommands,
                          bool EnableIncrementalBuild,
                          bool SkipTaskExecution,
-                         bool SaveTemps)
+                         bool SaveTemps,
+                         bool ShowDriverTimeCompilation)
   : Diags(Diags), Level(Level), RawInputArgs(std::move(InputArgs)),
     TranslatedArgs(std::move(TranslatedArgs)), 
     InputFilesWithTypes(std::move(InputsWithTypes)), ArgsHash(ArgsHash),
@@ -56,7 +58,8 @@
     NumberOfParallelCommands(NumberOfParallelCommands),
     SkipTaskExecution(SkipTaskExecution),
     EnableIncrementalBuild(EnableIncrementalBuild),
-    SaveTemps(SaveTemps) {
+    SaveTemps(SaveTemps),
+    ShowDriverTimeCompilation(ShowDriverTimeCompilation) {
 };
 
 using CommandSet = llvm::SmallPtrSet<const Job *, 16>;
@@ -421,14 +424,43 @@
   }
 
   int Result = EXIT_SUCCESS;
+  llvm::TimerGroup DriverTimerGroup("Driver Time Compilation");
+  llvm::SmallDenseMap<const Job *, std::unique_ptr<llvm::Timer>, 16>
+    DriverTimers;
 
   // Set up a callback which will be called immediately after a task has
   // started. This callback may be used to provide output indicating that the
   // task began.
-  auto taskBegan = [this] (ProcessId Pid, void *Context) {
+  auto taskBegan = [&] (ProcessId Pid, void *Context) {
     // TODO: properly handle task began.
     const Job *BeganCmd = (const Job *)Context;
 
+    if (ShowDriverTimeCompilation) {
+      llvm::SmallString<128> TimerName;
+      llvm::raw_svector_ostream OS(TimerName);
+
+      OS << BeganCmd->getSource().getClassName();
+      for (auto A : BeganCmd->getSource().getInputs()) {
+        if (const InputAction *IA = dyn_cast<InputAction>(A)) {
+          OS << " " << IA->getInputArg().getValue();
+        }
+      }
+      for (auto J : BeganCmd->getInputs()) {
+        for (auto A : J->getSource().getInputs()) {
+          if (const InputAction *IA = dyn_cast<InputAction>(A)) {
+            OS << " " << IA->getInputArg().getValue();
+          }
+        }
+      }
+
+      DriverTimers.insert({
+        BeganCmd,
+        std::unique_ptr<llvm::Timer>(
+          new llvm::Timer(OS.str(), DriverTimerGroup))
+      });
+      DriverTimers[BeganCmd]->startTimer();
+    }
+
     // For verbose output, print out each command as it begins execution.
     if (Level == OutputLevel::Verbose)
       BeganCmd->printCommandLine(llvm::errs());
@@ -445,6 +477,10 @@
                            void *Context) -> TaskFinishedResponse {
     const Job *FinishedCmd = (const Job *)Context;
 
+    if (ShowDriverTimeCompilation) {
+      DriverTimers[FinishedCmd]->stopTimer();
+    }
+
     if (Level == OutputLevel::Parseable) {
       // Parseable output was requested.
       parseable_output::emitFinishedMessage(llvm::errs(), *FinishedCmd, Pid,
@@ -572,6 +608,10 @@
                             void *Context) -> TaskFinishedResponse {
     const Job *SignalledCmd = (const Job *)Context;
 
+    if (ShowDriverTimeCompilation) {
+      DriverTimers[SignalledCmd]->stopTimer();
+    }
+
     if (Level == OutputLevel::Parseable) {
       // Parseable output was requested.
       parseable_output::emitSignalledMessage(llvm::errs(), *SignalledCmd, Pid,
@@ -721,6 +761,7 @@
 
   // If we don't have to do any cleanup work, just exec the subprocess.
   if (Level < OutputLevel::Parseable &&
+      !ShowDriverTimeCompilation &&
       (SaveTemps || TempFilePaths.empty()) &&
       CompilationRecordPath.empty() &&
       Jobs.size() == 1) {
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 03dc1cb..8d71657 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -367,6 +367,10 @@
     !ArgList->hasArg(options::OPT_embed_bitcode);
 
   bool SaveTemps = ArgList->hasArg(options::OPT_save_temps);
+  bool ContinueBuildingAfterErrors =
+    ArgList->hasArg(options::OPT_continue_building_after_errors);
+  bool ShowDriverTimeCompilation =
+    ArgList->hasArg(options::OPT_driver_time_compilation);
 
   std::unique_ptr<DerivedArgList> TranslatedArgList(
     translateInputArgs(*ArgList));
@@ -501,15 +505,17 @@
                                                  NumberOfParallelCommands,
                                                  Incremental,
                                                  DriverSkipExecution,
-                                                 SaveTemps));
+                                                 SaveTemps,
+                                                 ShowDriverTimeCompilation));
 
   buildJobs(Actions, OI, OFM.get(), *TC, *C);
 
   // For updating code we need to go through all the files and pick up changes,
-  // even if they have compiler errors.
-  // Also for getting bulk fixits.
+  // even if they have compiler errors. Also for getting bulk fixits, or for when
+  // users explicitly request to continue building despite errors.
   if (OI.CompilerMode == OutputInfo::Mode::UpdateCode ||
-      OI.ShouldGenerateFixitEdits)
+      OI.ShouldGenerateFixitEdits ||
+      ContinueBuildingAfterErrors)
     C->setContinueBuildingAfterErrors();
 
   if (ShowIncrementalBuildDecisions)
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 2283d26..87cd7fb 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -727,7 +727,8 @@
 }
 
 static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
-                          DiagnosticEngine &Diags, bool isImmediate) {
+                          DiagnosticEngine &Diags,
+                          const FrontendOptions &FrontendOpts) {
   using namespace options;
 
   Opts.AttachCommentsToDecls |= Args.hasArg(OPT_dump_api_path);
@@ -740,11 +741,10 @@
   Opts.EnableExperimentalNestedGenericTypes |=
     Args.hasArg(OPT_enable_experimental_nested_generic_types);
 
-  Opts.EnableExperimentalCollectionCasts |=
-    Args.hasArg(OPT_enable_experimental_collection_casts);
-
   Opts.DisableAvailabilityChecking |=
       Args.hasArg(OPT_disable_availability_checking);
+  if (FrontendOpts.InputKind == InputFileKind::IFK_SIL)
+    Opts.DisableAvailabilityChecking = true;
   
   if (auto A = Args.getLastArg(OPT_enable_access_control,
                                OPT_disable_access_control)) {
@@ -769,12 +769,9 @@
   if (Opts.DebuggerSupport)
     Opts.EnableDollarIdentifiers = true;
   Opts.Playground |= Args.hasArg(OPT_playground);
-  Opts.Swift3Migration |= Args.hasArg(OPT_swift3_migration);
-  Opts.WarnOmitNeedlessWords = Args.hasArg(OPT_warn_omit_needless_words);
   Opts.InferImportAsMember |= Args.hasArg(OPT_enable_infer_import_as_member);
 
   Opts.EnableThrowWithoutTry |= Args.hasArg(OPT_enable_throw_without_try);
-  Opts.EnableIdAsAny |= Args.hasArg(OPT_enable_id_as_any);
 
   if (auto A = Args.getLastArg(OPT_enable_objc_attr_requires_foundation_module,
                                OPT_disable_objc_attr_requires_foundation_module)) {
@@ -788,9 +785,6 @@
       = A->getOption().matches(OPT_enable_testable_attr_requires_testable_module);
   }
 
-  Opts.SuppressArgumentLabelsInTypes |=
-    Args.hasArg(OPT_suppress_argument_labels_in_types);
-
   if (const Arg *A = Args.getLastArg(OPT_debug_constraints_attempt)) {
     unsigned attempt;
     if (StringRef(A->getValue()).getAsInteger(10, attempt)) {
@@ -1327,8 +1321,7 @@
     return true;
   }
 
-  if (ParseLangArgs(LangOpts, ParsedArgs, Diags,
-                    FrontendOpts.actionIsImmediate())) {
+  if (ParseLangArgs(LangOpts, ParsedArgs, Diags, FrontendOpts)) {
     return true;
   }
 
diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp
index 17eae2e..2702c3e 100644
--- a/lib/FrontendTool/FrontendTool.cpp
+++ b/lib/FrontendTool/FrontendTool.cpp
@@ -598,6 +598,13 @@
     if (Info.ID == diag::objc_witness_selector_mismatch.ID ||
         Info.ID == diag::witness_non_objc.ID)
       return false;
+    // This interacts badly with the migrator. For such code:
+    //   func test(p: Int, _: String) {}
+    //   test(0, "")
+    // the compiler bizarrely suggests to change order of arguments in the call
+    // site.
+    if (Info.ID == diag::argument_out_of_order_unnamed_unnamed.ID)
+      return false;
     // The following interact badly with the swift migrator by removing @IB*
     // attributes when there is some unrelated type issue.
     if (Info.ID == diag::invalid_iboutlet.ID ||
@@ -613,6 +620,10 @@
     // invalidating some inits with type errors.
     if (Info.ID == diag::init_not_instance_member.ID)
       return false;
+    // Renaming enum cases interacts poorly with the swift migrator by
+    // reverting changes made by the mgirator.
+    if (Info.ID == diag::could_not_find_enum_case.ID)
+      return false;
 
     if (Kind == DiagnosticKind::Error)
       return true;
@@ -631,7 +642,13 @@
         Info.ID == diag::selector_construction_suggest.ID ||
         Info.ID == diag::selector_literal_deprecated_suggest.ID ||
         Info.ID == diag::attr_noescape_deprecated.ID ||
-        Info.ID == diag::attr_autoclosure_escaping_deprecated.ID)
+        Info.ID == diag::attr_autoclosure_escaping_deprecated.ID ||
+        Info.ID == diag::attr_warn_unused_result_removed.ID ||
+        Info.ID == diag::any_as_anyobject_fixit.ID ||
+        Info.ID == diag::deprecated_protocol_composition.ID ||
+        Info.ID == diag::deprecated_protocol_composition_single.ID ||
+        Info.ID == diag::deprecated_any_composition.ID ||
+        Info.ID == diag::deprecated_operator_body.ID)
       return true;
 
     return false;
diff --git a/lib/IDE/CodeCompletion.cpp b/lib/IDE/CodeCompletion.cpp
index 088dbc0..8c529be 100644
--- a/lib/IDE/CodeCompletion.cpp
+++ b/lib/IDE/CodeCompletion.cpp
@@ -466,7 +466,7 @@
     case ChunkKind::CallParameterName:
     case ChunkKind::CallParameterInternalName:
     case ChunkKind::CallParameterColon:
-    case ChunkKind::DeclAttrParamEqual:
+    case ChunkKind::DeclAttrParamColon:
     case ChunkKind::CallParameterType:
     case ChunkKind::CallParameterClosureType:
     case ChunkKind::GenericParameterName:
@@ -1148,7 +1148,7 @@
     case ChunkKind::RethrowsKeyword:
     case ChunkKind::DeclIntroducer:
     case ChunkKind::CallParameterColon:
-    case ChunkKind::DeclAttrParamEqual:
+    case ChunkKind::DeclAttrParamColon:
     case ChunkKind::CallParameterType:
     case ChunkKind::CallParameterClosureType:
     case ChunkKind::OptionalBegin:
@@ -1185,7 +1185,7 @@
       switch (C.getKind()) {
       case ChunkKind::TypeAnnotation:
       case ChunkKind::CallParameterClosureType:
-      case ChunkKind::DeclAttrParamEqual:
+      case ChunkKind::DeclAttrParamColon:
         continue;
       case ChunkKind::ThrowsKeyword:
       case ChunkKind::RethrowsKeyword:
@@ -1578,11 +1578,15 @@
 
 static Type getReturnTypeFromContext(const DeclContext *DC) {
   if (auto FD = dyn_cast<AbstractFunctionDecl>(DC)) {
-    if (auto FT = FD->getType()->getAs<FunctionType>()) {
-      return FT->getResult();
+    if (FD->hasType()) {
+      if (auto FT = FD->getType()->getAs<FunctionType>()) {
+        return FT->getResult();
+      }
     }
   } else if (auto CE = dyn_cast<AbstractClosureExpr>(DC)) {
-    return CE->getResultType();
+    if (CE->getType()) {
+      return CE->getResultType();
+    }
   }
   return Type();
 }
@@ -2869,7 +2873,8 @@
           // type is the typealias instead of the underlying type of the alias.
           Optional<Type> Result = None;
           if (auto AT = MT->getInstanceType()) {
-            if (AT->getKind() == TypeKind::NameAlias &&
+            if (!CD->getType()->is<ErrorType>() &&
+                AT->getKind() == TypeKind::NameAlias &&
                 AT->getDesugaredType() == CD->getResultType().getPointer())
               Result = AT;
           }
@@ -4117,7 +4122,7 @@
         Options.setArchetypeSelfTransform(transformType, VD->getDeclContext());
       Options.PrintDefaultParameterPlaceholder = false;
       Options.PrintImplicitAttrs = false;
-      Options.SkipAttributes = true;
+      Options.ExclusiveAttrList.push_back(TAK_escaping);
       Options.PrintOverrideKeyword = false;
       Options.PrintPropertyAccessors = false;
       VD->print(Printer, Options);
@@ -4137,9 +4142,12 @@
     bool missingOverride = Reason == DeclVisibilityKind::MemberOfSuper &&
                            !isKeywordSpecified("override");
 
-    if (missingDeclIntroducer && missingAccess)
-      Builder.addAccessControlKeyword(
-          std::min(VD->getFormalAccess(), AccessibilityOfContext));
+    if (missingDeclIntroducer && missingAccess) {
+      auto Access = std::min(VD->getFormalAccess(), AccessibilityOfContext);
+      // Only emit 'public', not needed otherwise.
+      if (Access >= Accessibility::Public)
+        Builder.addAccessControlKeyword(Access);
+    }
 
     // FIXME: if we're missing 'override', but have the decl introducer we
     // should delete it and re-add both in the correct order.
diff --git a/lib/IDE/CodeCompletionResultBuilder.h b/lib/IDE/CodeCompletionResultBuilder.h
index d28675b..57deb12 100644
--- a/lib/IDE/CodeCompletionResultBuilder.h
+++ b/lib/IDE/CodeCompletionResultBuilder.h
@@ -255,7 +255,7 @@
                      DeclAttrParamKeyword, Name);
     if (NeedSpecify)
       addChunkWithText(CodeCompletionString::Chunk::ChunkKind::
-                       DeclAttrParamEqual, "=");
+                       DeclAttrParamColon, ": ");
     if (!Annotation.empty())
       addTypeAnnotation(Annotation);
   }
diff --git a/lib/IDE/REPLCodeCompletion.cpp b/lib/IDE/REPLCodeCompletion.cpp
index ec02b10..4f609b4 100644
--- a/lib/IDE/REPLCodeCompletion.cpp
+++ b/lib/IDE/REPLCodeCompletion.cpp
@@ -66,7 +66,7 @@
     case CodeCompletionString::Chunk::ChunkKind::CallParameterInternalName:
     case CodeCompletionString::Chunk::ChunkKind::CallParameterColon:
     case CodeCompletionString::Chunk::ChunkKind::DeclAttrParamKeyword:
-    case CodeCompletionString::Chunk::ChunkKind::DeclAttrParamEqual:
+    case CodeCompletionString::Chunk::ChunkKind::DeclAttrParamColon:
     case CodeCompletionString::Chunk::ChunkKind::CallParameterType:
     case CodeCompletionString::Chunk::ChunkKind::CallParameterClosureType:
     case CodeCompletionString::Chunk::ChunkKind::OptionalBegin:
diff --git a/lib/IDE/TypeReconstruction.cpp b/lib/IDE/TypeReconstruction.cpp
index 95e1e09..6dbfaf9 100644
--- a/lib/IDE/TypeReconstruction.cpp
+++ b/lib/IDE/TypeReconstruction.cpp
@@ -12,6 +12,7 @@
 
 #include "swift/IDE/Utils.h"
 #include "swift/AST/Decl.h"
+#include "swift/AST/GenericSignature.h"
 #include "swift/AST/Mangle.h"
 #include "swift/AST/NameLookup.h"
 #include "swift/Basic/Demangle.h"
@@ -61,14 +62,22 @@
       auto *nominal_type_decl = unbound_generic_type->getDecl();
       if (!nominal_type_decl)
         break;
-      GenericParamList *generic_param_list =
-          nominal_type_decl->getGenericParams();
-      if (!generic_param_list)
+      GenericSignature *generic_sig =
+          nominal_type_decl->getGenericSignature();
+      if (!generic_sig)
         break;
-      if (arg_idx >= generic_param_list->getAllArchetypes().size())
-        break;
-      return generic_param_list->getAllArchetypes()[arg_idx];
-    } break;
+      for (auto depTy : generic_sig->getAllDependentTypes()) {
+        if (arg_idx == 0) {
+          return ArchetypeBuilder::mapTypeIntoContext(
+              nominal_type_decl, depTy)->castTo<ArchetypeType>();
+        }
+
+        arg_idx--;
+      }
+
+      // Index was out of bounds...
+      break;
+    }
     case TypeKind::BoundGenericClass:
     case TypeKind::BoundGenericStruct:
     case TypeKind::BoundGenericEnum: {
@@ -101,35 +110,6 @@
   return nullptr;
 }
 
-enum class MemberType : uint32_t { Invalid, BaseClass, Field };
-
-struct MemberInfo {
-  Type clang_type;
-  const std::string name;
-  uint64_t byte_size;
-  uint32_t byte_offset;
-  MemberType member_type;
-  bool is_fragile;
-
-  MemberInfo(MemberType member_type)
-      : clang_type(), name(), byte_size(0), byte_offset(0),
-        member_type(member_type), is_fragile(false) {}
-};
-
-struct EnumElementInfo {
-  Type clang_type;
-  ConstString name;
-  uint64_t byte_size;
-  uint32_t value;       // The value for this enumeration element
-  uint32_t extra_value; // If not UINT32_MAX, then this value is an extra value
-  // that appears at offset 0 to tell one or more empty
-  // enums apart. This value will only be filled in if there
-  // are one or more enum elements that have a non-zero byte size
-
-  EnumElementInfo()
-      : clang_type(), name(), byte_size(0), extra_value(UINT32_MAX) {}
-};
-
 class DeclsLookupSource {
 public:
   typedef SmallVectorImpl<ValueDecl *> ValueDecls;
diff --git a/lib/IRGen/GenArchetype.h b/lib/IRGen/GenArchetype.h
index b2abfcf..b80a7b2 100644
--- a/lib/IRGen/GenArchetype.h
+++ b/lib/IRGen/GenArchetype.h
@@ -18,6 +18,7 @@
 #define SWIFT_IRGEN_GENARCHETYPE_H
 
 #include "swift/AST/Types.h"
+#include "llvm/ADT/STLExtras.h"
 
 namespace llvm {
   class Value;
@@ -31,6 +32,13 @@
   class Address;
   class IRGenFunction;
 
+  using GetTypeParameterInContextFn =
+    llvm::function_ref<CanType(CanType type)>;
+
+  void bindArchetypeAccessPaths(IRGenFunction &IGF,
+                                GenericSignature *generics,
+                                GetTypeParameterInContextFn getInContext);
+
   /// Emit a type metadata reference for an archetype.
   llvm::Value *emitArchetypeTypeMetadataRef(IRGenFunction &IGF,
                                             CanArchetypeType archetype);
diff --git a/lib/IRGen/GenClangType.cpp b/lib/IRGen/GenClangType.cpp
index 02d756c..75656fd 100644
--- a/lib/IRGen/GenClangType.cpp
+++ b/lib/IRGen/GenClangType.cpp
@@ -493,7 +493,7 @@
 clang::CanQualType GenClangType::visitEnumType(CanEnumType type) {
   // Special case: Uninhabited enums are not @objc, so we don't
   // know what to do below, but we can just convert to 'void'.
-  if (type->isNever())
+  if (type->isUninhabited())
     return Converter.convert(IGM, IGM.Context.TheEmptyTupleType);
 
   assert(type->getDecl()->isObjC() && "not an @objc enum?!");
@@ -743,15 +743,6 @@
         auto ptrTy = ctx.getObjCObjectPointerType(clangType);
         return ctx.getCanonicalType(ptrTy);
       }
-    } else if (decl == IGM.Context.getBoolDecl()) {
-      // FIXME: Handle _Bool and DarwinBoolean.
-      auto &ctx = IGM.getClangASTContext();
-      auto &TI = ctx.getTargetInfo();
-      // FIXME: Figure out why useSignedCharForObjCBool() returns
-      // 'true' on Linux
-      if (IGM.ObjCInterop && TI.useSignedCharForObjCBool()) {
-        return ctx.SignedCharTy;
-      }
     }
   }
 
diff --git a/lib/IRGen/GenClass.cpp b/lib/IRGen/GenClass.cpp
index 6d40eb4..979a3f4 100644
--- a/lib/IRGen/GenClass.cpp
+++ b/lib/IRGen/GenClass.cpp
@@ -726,6 +726,22 @@
                                          llvm::Value *metadataValue) {
   auto *theClass = selfType.getClassOrBoundGenericClass();
 
+  // Foreign classes should not be freed by sending -release.
+  // They should also probably not be freed with object_dispose(),
+  // either.
+  //
+  // However, in practice, the only time we should try to free an
+  // instance of a foreign class here is inside an initializer
+  // delegating to a factory initializer. In this case, the object
+  // was allocated with +allocWithZone:, so calling object_dispose()
+  // should be OK.
+  if (theClass->getForeignClassKind() == ClassDecl::ForeignKind::RuntimeOnly) {
+    selfValue = IGF.Builder.CreateBitCast(selfValue, IGF.IGM.ObjCPtrTy);
+    IGF.Builder.CreateCall(IGF.IGM.getObjectDisposeFn(),
+                           {selfValue});
+    return;
+  }
+
   llvm::Value *size, *alignMask;
   getInstanceSizeAndAlignMask(IGF, selfType, theClass, selfValue,
                               size, alignMask);
diff --git a/lib/IRGen/GenDecl.cpp b/lib/IRGen/GenDecl.cpp
index cdd2d28..014231f 100644
--- a/lib/IRGen/GenDecl.cpp
+++ b/lib/IRGen/GenDecl.cpp
@@ -2000,7 +2000,7 @@
 
   auto nom = conformingType->getAnyNominal();
   auto clas = dyn_cast<ClassDecl>(nom);
-  if (nom->isGenericContext() ||
+  if ((nom->isGenericContext() && (!clas || !clas->usesObjCGenericsModel())) ||
       (clas && doesClassMetadataRequireDynamicInitialization(IGM, clas))) {
     // Conformances for generics and concrete subclasses of generics
     // are represented by referencing the nominal type descriptor.
@@ -2152,7 +2152,7 @@
                   LinkEntity::forProtocolDescriptor(conformance->getProtocol()),
                   getPointerAlignment(), ProtocolDescriptorStructTy);
     auto typeEntity = getTypeEntityInfo(*this,
-                                        conformance->getType()->getCanonicalType());
+                                    conformance->getType()->getCanonicalType());
     auto flags = typeEntity.flags
         .withConformanceKind(ProtocolConformanceReferenceKind::WitnessTable);
 
diff --git a/lib/IRGen/GenMeta.cpp b/lib/IRGen/GenMeta.cpp
index ac4aba1..3333be2 100644
--- a/lib/IRGen/GenMeta.cpp
+++ b/lib/IRGen/GenMeta.cpp
@@ -267,8 +267,8 @@
 }
 
 // Get the type that exists at runtime to represent a compile-time type.
-static CanType
-getRuntimeReifiedType(IRGenModule &IGM, CanType type) {
+CanType
+irgen::getRuntimeReifiedType(IRGenModule &IGM, CanType type) {
   return CanType(type.transform([&](Type t) -> Type {
     if (isTypeErasedGenericClassType(CanType(t))) {
       return t->getAnyNominal()->getDeclaredType()->getCanonicalType();
@@ -1340,7 +1340,7 @@
   // Non-native types are just wrapped in various ways.
   if (auto classDecl = dyn_cast<ClassDecl>(typeDecl)) {
     // We emit a completely different pattern for foreign classes.
-    if (classDecl->isForeign()) {
+    if (classDecl->getForeignClassKind() == ClassDecl::ForeignKind::CFType) {
       return emitForeignTypeMetadataRef(IGF, type);
     }
 
@@ -2414,8 +2414,10 @@
                          NominalTypeDecl::StoredPropertyRange storedProperties){
     SmallVector<FieldTypeInfo, 4> types;
     for (VarDecl *prop : storedProperties) {
-      types.push_back(FieldTypeInfo(prop->getType()->getCanonicalType(),
-                                    /*indirect*/ false));
+      auto propertyType = prop->getType()->getCanonicalType();
+      types.push_back(FieldTypeInfo(propertyType,
+                                    /*indirect*/ false,
+                                    propertyType->is<WeakStorageType>()));
     }
     return getFieldTypeAccessorFn(IGM, type, types);
   }
@@ -2431,7 +2433,7 @@
       auto caseType = elt.decl->getArgumentType()->getCanonicalType();
       bool isIndirect = elt.decl->isIndirect()
         || elt.decl->getParentEnum()->isIndirect();
-      types.push_back(FieldTypeInfo(caseType, isIndirect));
+      types.push_back(FieldTypeInfo(caseType, isIndirect, /*weak*/ false));
     }
     return getFieldTypeAccessorFn(IGM, type, types);
   }
@@ -2760,6 +2762,18 @@
   // use it to provide metadata for generic parameters in field types.
   IGF.bindLocalTypeDataFromTypeMetadata(formalType, IsExact, metadata);
   
+  // Bind archetype access paths if the type is generic.
+  if (type->isGenericContext()) {
+    auto declCtxt = type;
+    if (auto generics = declCtxt->getGenericSignatureOfContext()) {
+      auto getInContext = [&](CanType type) -> CanType {
+        return ArchetypeBuilder::mapTypeIntoContext(declCtxt, type, nullptr)
+            ->getCanonicalType();
+      };
+      bindArchetypeAccessPaths(IGF, generics, getInContext);
+    }
+  }
+
   // Allocate storage for the field vector.
   unsigned allocSize = fieldTypes.size() * IGM.getPointerSize().getValue();
   auto allocSizeVal = llvm::ConstantInt::get(IGM.IntPtrTy, allocSize);
@@ -2784,9 +2798,13 @@
     
     auto metadata = IGF.emitTypeMetadataRef(fieldTy);
 
+    auto fieldTypeInfo = fieldTypes[i];
+
     // Mix in flag bits.
-    if (fieldTypes[i].isIndirect()) {
-      auto flags = FieldType().withIndirect(true);
+    if (fieldTypeInfo.hasFlags()) {
+      auto flags = FieldType()
+        .withIndirect(fieldTypeInfo.isIndirect())
+        .withWeak(fieldTypeInfo.isWeak());
       auto metadataBits = IGF.Builder.CreatePtrToInt(metadata, IGF.IGM.SizeTy);
       metadataBits = IGF.Builder.CreateOr(metadataBits,
                    llvm::ConstantInt::get(IGF.IGM.SizeTy, flags.getIntValue()));
diff --git a/lib/IRGen/GenMeta.h b/lib/IRGen/GenMeta.h
index 7f61d89..2f7a627 100644
--- a/lib/IRGen/GenMeta.h
+++ b/lib/IRGen/GenMeta.h
@@ -85,6 +85,10 @@
                                                    CanType type,
                                                    SymbolReferenceKind refKind);
 
+  /// Get the type as it exists in Swift's runtime type system, removing any
+  /// erased generic parameters.
+  CanType getRuntimeReifiedType(IRGenModule &IGM, CanType type);
+
   /// Emit a reference to a compile-time constant piece of heap metadata, or
   /// return a null pointer if the type's heap metadata cannot be represented
   /// by a constant.
diff --git a/lib/IRGen/GenProto.cpp b/lib/IRGen/GenProto.cpp
index 263401b..5da8cb1 100644
--- a/lib/IRGen/GenProto.cpp
+++ b/lib/IRGen/GenProto.cpp
@@ -1276,6 +1276,17 @@
       }
       return *Fulfillments;
     }
+
+    void bindArchetypeAccessPathsInConformance(IRGenFunction &IGF) {
+      auto declCtx = Conformance.getDeclContext();
+      if (auto generics = declCtx->getGenericSignatureOfContext()) {
+        auto getInContext = [&](CanType type) -> CanType {
+          return ArchetypeBuilder::mapTypeIntoContext(declCtx, type, nullptr)
+              ->getCanonicalType();
+        };
+        bindArchetypeAccessPaths(IGF, generics, getInContext);
+      }
+    }
   };
 }
 
@@ -1335,6 +1346,9 @@
   // Bind local type data from the metadata argument.
   IGF.bindLocalTypeDataFromTypeMetadata(ConcreteType, IsExact, self);
 
+  // Bind archetype access paths.
+  bindArchetypeAccessPathsInConformance(IGF);
+
   // For now, assume that an associated type is cheap enough to access
   // that it doesn't need a new cache entry.
   if (auto archetype = dyn_cast<ArchetypeType>(associatedType)) {
@@ -1458,6 +1472,9 @@
                                         associatedTypeMetadata);
   IGF.bindLocalTypeDataFromTypeMetadata(ConcreteType, IsExact, self);
 
+  // Bind archetype access paths.
+  bindArchetypeAccessPathsInConformance(IGF);
+
   // For now, assume that finding an abstract conformance is always
   // fast enough that it's not worth caching.
   // TODO: provide an API to find the best metadata path to the conformance
@@ -1832,9 +1849,8 @@
                              {srcBaseArchetype, association});
 }
 
-static void bindArchetypeAccessPaths(IRGenFunction &IGF,
-                                     GenericSignature *Generics,
-                                     GetTypeParameterInContextFn getInContext) {
+void irgen::bindArchetypeAccessPaths(IRGenFunction &IGF, GenericSignature *Generics,
+                              GetTypeParameterInContextFn getInContext) {
   // Remember all the extra ways we have of reaching the parameter
   // archetypes due to type equality constraints.
   for (auto reqt : Generics->getRequirements()) {
diff --git a/lib/IRGen/IRGenModule.h b/lib/IRGen/IRGenModule.h
index 7561c97..2346854 100644
--- a/lib/IRGen/IRGenModule.h
+++ b/lib/IRGen/IRGenModule.h
@@ -133,25 +133,30 @@
 
 /// A type descriptor for a field type accessor.
 class FieldTypeInfo {
-  llvm::PointerIntPair<CanType, 1, unsigned> Info;
+  llvm::PointerIntPair<CanType, 2, unsigned> Info;
   /// Bits in the "int" part of the Info pair.
   enum : unsigned {
     /// Flag indicates that the case is indirectly stored in a box.
     Indirect = 1,
+    /// Indicates a weak optional reference
+    Weak = 2,
   };
 
-  static unsigned getFlags(bool indirect) {
-    return (indirect ? Indirect : 0);
+  static unsigned getFlags(bool indirect, bool weak) {
+    return (indirect ? Indirect : 0)
+         | (weak ? Weak : 0);
     //   | (blah ? Blah : 0) ...
   }
 
 public:
-  FieldTypeInfo(CanType type, bool indirect)
-    : Info(type, getFlags(indirect))
+  FieldTypeInfo(CanType type, bool indirect, bool weak)
+    : Info(type, getFlags(indirect, weak))
   {}
 
   CanType getType() const { return Info.getPointer(); }
   bool isIndirect() const { return Info.getInt() & Indirect; }
+  bool isWeak() const { return Info.getInt() & Weak; }
+  bool hasFlags() const { return Info.getInt() != 0; }
 };
 
 /// The principal singleton which manages all of IR generation.
diff --git a/lib/IRGen/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp
index 57f4dee..070deb1 100644
--- a/lib/IRGen/IRGenSIL.cpp
+++ b/lib/IRGen/IRGenSIL.cpp
@@ -594,11 +594,14 @@
       if (getActiveDominancePoint() == VarDominancePoint ||
           isActiveDominancePointDominatedBy(VarDominancePoint)) {
         llvm::Type *ArgTys;
-        auto *Ty = Storage->getType()->getScalarType();
-        // Pointers and Floats are expected to fit into a register.
-        if (Ty->isPointerTy() || Ty->isFloatingPointTy())
-          ArgTys = { Storage->getType() };
+        auto *Ty = Storage->getType();
+        // Vectors, Pointers and Floats are expected to fit into a register.
+        if (Ty->isPointerTy() || Ty->isFloatingPointTy() || Ty->isVectorTy())
+          ArgTys = { Ty };
         else {
+          // If this is not a scalar or vector type, we can't handle it.
+          if (isa<llvm::CompositeType>(Ty))
+            continue;
           // The storage is guaranteed to be no larger than the register width.
           // Extend the storage so it would fit into a register.
           llvm::Type *IntTy;
@@ -747,8 +750,10 @@
     // Force all archetypes referenced by the type to be bound by this point.
     // TODO: just make sure that we have a path to them that the debug info
     //       can follow.
-    if (!IGM.IRGen.Opts.Optimize && Ty.getType()->hasArchetype())
-      Ty.getType()->getCanonicalType().visit([&](Type t) {
+    auto runtimeTy = getRuntimeReifiedType(IGM,
+                                           Ty.getType()->getCanonicalType());
+    if (!IGM.IRGen.Opts.Optimize && runtimeTy->hasArchetype())
+      runtimeTy.visit([&](Type t) {
         if (auto archetype = dyn_cast<ArchetypeType>(CanType(t)))
           emitTypeMetadataRef(archetype);
        });
diff --git a/lib/Immediate/CMakeLists.txt b/lib/Immediate/CMakeLists.txt
index 698553b..f6919cd 100644
--- a/lib/Immediate/CMakeLists.txt
+++ b/lib/Immediate/CMakeLists.txt
@@ -7,6 +7,6 @@
     swiftSILGen
     swiftSILOptimizer
     swiftIRGen
-  COMPONENT_DEPENDS
+  LLVM_COMPONENT_DEPENDS
     linker mcjit)
 
diff --git a/lib/LLVMPasses/CMakeLists.txt b/lib/LLVMPasses/CMakeLists.txt
index 40b30be..20ea297 100644
--- a/lib/LLVMPasses/CMakeLists.txt
+++ b/lib/LLVMPasses/CMakeLists.txt
@@ -7,7 +7,7 @@
   LLVMStackPromotion.cpp
   LLVMMergeFunctions.cpp
 
-  COMPONENT_DEPENDS
+  LLVM_COMPONENT_DEPENDS
   analysis
   )
 
diff --git a/lib/LLVMPasses/LLVMARCOpts.cpp b/lib/LLVMPasses/LLVMARCOpts.cpp
index 511db00..6d22d6b 100644
--- a/lib/LLVMPasses/LLVMARCOpts.cpp
+++ b/lib/LLVMPasses/LLVMARCOpts.cpp
@@ -545,8 +545,10 @@
 
   // We have to have a known heap metadata value, reject dynamically computed
   // ones, or places
+  // Also, make sure we have a definitive initializer for the global.
   GlobalVariable *GV = dyn_cast<GlobalVariable>(P->stripPointerCasts());
-  if (GV == 0 || GV->mayBeOverridden()) return DtorKind::Unknown;
+  if (GV == 0 || !GV->hasDefinitiveInitializer())
+    return DtorKind::Unknown;
 
   ConstantStruct *CS = dyn_cast_or_null<ConstantStruct>(GV->getInitializer());
   if (CS == 0 || CS->getNumOperands() == 0) return DtorKind::Unknown;
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index e545b0c..0979959 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -507,11 +507,6 @@
       .Case("public", Accessibility::Public)
       .Case("open", Accessibility::Open);
 
-    if (access == Accessibility::FilePrivate &&
-        !Context.LangOpts.EnableSwift3Private) {
-      access = Accessibility::Private;
-    }
-
     if (!consumeIf(tok::l_paren)) {
       // Normal accessibility attribute.
       AttrRange = Loc;
@@ -1061,107 +1056,6 @@
     break;
   }
 
-  case DAK_Swift3Migration: {
-    if (Tok.isNot(tok::l_paren)) {
-      diagnose(Loc, diag::attr_expected_lparen, AttrName,
-               DeclAttribute::isDeclModifier(DK));
-      return false;
-    }
-
-    SourceLoc lParenLoc = consumeToken(tok::l_paren);
-
-    DeclName renamed;
-    StringRef message;
-    bool invalid = false;
-    do {
-      // If we see a closing parenthesis, we're done.
-      if (Tok.is(tok::r_paren))
-        break;
-
-      if (Tok.isNot(tok::identifier)) {
-        diagnose(Tok, diag::attr_swift3_migration_label);
-        if (Tok.isNot(tok::r_paren))
-          skipUntil(tok::r_paren);
-        consumeIf(tok::r_paren);
-        invalid = true;
-        break;
-      }
-
-      // Consume the identifier.
-      StringRef name = Tok.getText();
-      SourceLoc nameLoc = consumeToken();
-
-      // If we don't have the '=', complain.
-      SourceLoc equalLoc;
-      if (findAttrValueDelimiter()) {
-        consumeToken();
-      } else {
-        diagnose(Tok, diag::attr_expected_colon_separator, name, AttrName);
-        invalid = true;
-        continue;
-      }
-
-      // If we don't have a string, complain.
-      if (Tok.isNot(tok::string_literal)) {
-        diagnose(Tok, diag::attr_expected_string_literal_arg, name, AttrName);
-        invalid = true;
-        break;
-      }
-
-      // Dig out the string.
-      auto paramString = getStringLiteralIfNotInterpolated(*this, nameLoc, Tok,
-                                                            name.str());
-      SourceLoc paramLoc = consumeToken(tok::string_literal);
-      if (!paramString) {
-        invalid = true;
-        continue;
-      }
-
-      if (name == "message") {
-        if (!message.empty())
-          diagnose(nameLoc, diag::attr_duplicate_argument, name);
-
-        message = *paramString;
-        continue;
-      }
-
-      if (name == "renamed") {
-        if (renamed)
-          diagnose(nameLoc, diag::attr_duplicate_argument, name);
-
-        // Parse the name.
-        DeclName newName = parseDeclName(Context, *paramString);
-        if (!newName) {
-          diagnose(paramLoc, diag::attr_bad_swift_name, *paramString);
-          continue;
-        }
-
-        renamed = newName;
-        continue;
-      }
-
-      diagnose(nameLoc, diag::warn_attr_swift3_migration_unknown_label);
-    } while (consumeIf(tok::comma));
-
-    // Parse the closing ')'.
-    SourceLoc rParenLoc;
-    if (invalid && !Tok.is(tok::r_paren)) {
-      skipUntil(tok::r_paren);
-      if (Tok.is(tok::r_paren)) {
-        rParenLoc = consumeToken();
-      } else
-        rParenLoc = Tok.getLoc();
-    } else {
-      parseMatchingToken(tok::r_paren, rParenLoc,
-                         diag::attr_swift3_migration_expected_rparen,
-                         lParenLoc);
-    }
-
-    Attributes.add(new (Context) Swift3MigrationAttr(AtLoc, Loc, lParenLoc,
-                                                     renamed, message,
-                                                     rParenLoc, false));
-    break;
-    }
   case DAK_Specialize: {
     if (Tok.isNot(tok::l_paren)) {
       diagnose(Loc, diag::attr_expected_lparen, AttrName,
@@ -1444,7 +1338,7 @@
   SourceLoc Loc = consumeToken();
 
   bool isAutoclosureEscaping = false;
-  SourceLoc autoclosureEscapingRightParenLoc;
+  SourceRange autoclosureEscapingParenRange;
   StringRef conventionName;
 
   // Handle @autoclosure(escaping)
@@ -1462,9 +1356,9 @@
     }
 
     if (isAutoclosureEscaping) {
-      consumeToken(tok::l_paren);
+      autoclosureEscapingParenRange.Start = consumeToken(tok::l_paren);
       consumeToken(tok::identifier);
-      autoclosureEscapingRightParenLoc = consumeToken(tok::r_paren);
+      autoclosureEscapingParenRange.End = consumeToken(tok::r_paren);
     }
   } else if (attr == TAK_convention) {
     SourceLoc LPLoc;
@@ -1516,9 +1410,11 @@
       if (Attributes.has(TAK_noescape)) {
         diagnose(Loc, diag::attr_noescape_conflicts_escaping_autoclosure);
       } else {
+        StringRef replacement = " @escaping ";
+        if (autoclosureEscapingParenRange.End.getAdvancedLoc(1) != Tok.getLoc())
+          replacement = replacement.drop_back();
         diagnose(Loc, diag::attr_autoclosure_escaping_deprecated)
-            .fixItReplace({Loc, autoclosureEscapingRightParenLoc},
-                          "@autoclosure @escaping ");
+            .fixItReplace(autoclosureEscapingParenRange, replacement);
       }
       Attributes.setAttr(TAK_escaping, Loc);
     } else if (Attributes.has(TAK_noescape)) {
@@ -1896,6 +1792,22 @@
 /// \endverbatim
 ParserStatus Parser::parseDecl(ParseDeclOptions Flags,
                                llvm::function_ref<void(Decl*)> Handler) {
+  if (Tok.isAny(tok::pound_sourceLocation, tok::pound_line))
+    return parseLineDirective(Tok.is(tok::pound_line));
+
+  if (Tok.is(tok::pound_if)) {
+    auto IfConfigResult = parseDeclIfConfig(Flags);
+    if (auto ICD = IfConfigResult.getPtrOrNull()) {
+      // The IfConfigDecl is ahead of its members in source order.
+      Handler(ICD);
+      // Copy the active members into the entries list.
+      for (auto activeMember : ICD->getActiveMembers()) {
+        Handler(activeMember);
+      }
+    }
+    return IfConfigResult;
+  }
+
   Decl* LastDecl = nullptr;
   auto InternalHandler  = [&](Decl *D) {
     LastDecl = D;
@@ -2046,6 +1958,13 @@
       // Otherwise this is not a context-sensitive keyword.
       SWIFT_FALLTHROUGH;
 
+    case tok::pound_if:
+    case tok::pound_sourceLocation:
+    case tok::pound_line:
+      // We see some attributes right before these pounds.
+      // TODO: Emit dedicated errors for them.
+      SWIFT_FALLTHROUGH;
+
     // Obvious nonsense.
     default:
       if (FoundCCTokenInAttr) {
@@ -2139,26 +2058,6 @@
       DeclResult = parseDeclProtocol(Flags, Attributes);
       Status = DeclResult;
       break;
-    case tok::pound_if: {
-      auto IfConfigResult = parseDeclIfConfig(Flags);
-      Status = IfConfigResult;
-
-      if (auto ICD = IfConfigResult.getPtrOrNull()) {
-        // The IfConfigDecl is ahead of its members in source order.
-        InternalHandler(ICD);
-        // Copy the active members into the entries list.
-        for (auto activeMember : ICD->getActiveMembers()) {
-          InternalHandler(activeMember);
-        }
-      }
-      break;
-    }
-    case tok::pound_sourceLocation:
-      Status = parseLineDirective(false);
-      break;
-    case tok::pound_line:
-      Status = parseLineDirective(true);
-      break;
 
     case tok::kw_func:
       DeclResult = parseDeclFunc(StaticLoc, StaticSpelling, Flags, Attributes);
@@ -5586,9 +5485,15 @@
 ParserResult<OperatorDecl>
 Parser::parseDeclPrefixOperator(SourceLoc OperatorLoc, Identifier Name,
                                 SourceLoc NameLoc, DeclAttributes &Attributes) {
-  SourceLoc LBraceLoc;
-  if (consumeIf(tok::l_brace, LBraceLoc)) {
-    diagnose(LBraceLoc, diag::deprecated_operator_body);
+  SourceLoc lBraceLoc;
+  if (consumeIf(tok::l_brace, lBraceLoc)) {
+    auto Diag = diagnose(lBraceLoc, diag::deprecated_operator_body);
+    if (Tok.is(tok::r_brace)) {
+      SourceLoc lastGoodLocEnd = Lexer::getLocForEndOfToken(SourceMgr,
+                                                            NameLoc);
+      SourceLoc rBraceEnd = Lexer::getLocForEndOfToken(SourceMgr, Tok.getLoc());
+      Diag.fixItRemoveChars(lastGoodLocEnd, rBraceEnd);
+    }
 
     skipUntilDeclRBrace();
     (void) consumeIf(tok::r_brace);
@@ -5604,9 +5509,15 @@
 Parser::parseDeclPostfixOperator(SourceLoc OperatorLoc,
                                  Identifier Name, SourceLoc NameLoc,
                                  DeclAttributes &Attributes) {
-  SourceLoc lbraceLoc;
-  if (consumeIf(tok::l_brace, lbraceLoc)) {
-    diagnose(lbraceLoc, diag::deprecated_operator_body);
+  SourceLoc lBraceLoc;
+  if (consumeIf(tok::l_brace, lBraceLoc)) {
+    auto Diag = diagnose(lBraceLoc, diag::deprecated_operator_body);
+    if (Tok.is(tok::r_brace)) {
+      SourceLoc lastGoodLocEnd = Lexer::getLocForEndOfToken(SourceMgr,
+                                                            NameLoc);
+      SourceLoc rBraceEnd = Lexer::getLocForEndOfToken(SourceMgr, Tok.getLoc());
+      Diag.fixItRemoveChars(lastGoodLocEnd, rBraceEnd);
+    }
 
     skipUntilDeclRBrace();
     (void) consumeIf(tok::r_brace);
@@ -5631,9 +5542,20 @@
     }
   }
 
-  SourceLoc lbraceLoc;
-  if (consumeIf(tok::l_brace, lbraceLoc)) {
-    diagnose(lbraceLoc, diag::deprecated_operator_body);
+  SourceLoc lBraceLoc;
+  if (consumeIf(tok::l_brace, lBraceLoc)) {
+    if (Tok.is(tok::r_brace)) {
+      SourceLoc lastGoodLoc = precedenceGroupNameLoc;
+      if (lastGoodLoc.isInvalid())
+        lastGoodLoc = nameLoc;
+      SourceLoc lastGoodLocEnd = Lexer::getLocForEndOfToken(SourceMgr,
+                                                            lastGoodLoc);
+      SourceLoc rBraceEnd = Lexer::getLocForEndOfToken(SourceMgr, Tok.getLoc());
+      diagnose(lBraceLoc, diag::deprecated_operator_body)
+        .fixItRemoveChars(lastGoodLocEnd, rBraceEnd);
+    } else {
+      diagnose(lBraceLoc, diag::deprecated_operator_body_use_group);
+    }
 
     skipUntilDeclRBrace();
     (void) consumeIf(tok::r_brace);
diff --git a/lib/Parse/ParseGeneric.cpp b/lib/Parse/ParseGeneric.cpp
index 96435a7..0a1cbbf 100644
--- a/lib/Parse/ParseGeneric.cpp
+++ b/lib/Parse/ParseGeneric.cpp
@@ -183,17 +183,7 @@
   // as written all the way to the right angle bracket (">")
   auto LastGenericParam = GenericParams->getParams().back();
   auto EndOfLastGenericParam =
-  Lexer::getLocForEndOfToken(SourceMgr,
-                             LastGenericParam->getLoc());
-
-  // If the generic parameter list has inherited requirements attached
-  // directly to the parameters themselves, leave them in place.
-  auto InheritedGenericConstraints = LastGenericParam->getInherited();
-  if (!InheritedGenericConstraints.empty()) {
-    EndOfLastGenericParam =
-    Lexer::getLocForEndOfToken(SourceMgr,
-                               InheritedGenericConstraints.back().getLoc());
-  }
+      Lexer::getLocForEndOfToken(SourceMgr, LastGenericParam->getEndLoc());
 
   CharSourceRange RemoveWhereRange { SourceMgr,
     EndOfLastGenericParam,
@@ -218,17 +208,14 @@
 
   auto Diag = diagnose(WhereRangeInsideBrackets.Start,
                        diag::where_inside_brackets);
+  Diag.fixItRemoveChars(RemoveWhereRange.getStart(),
+                        RemoveWhereRange.getEnd());
 
   if (Tok.is(tok::kw_where)) {
-    Diag.fixItRemoveChars(RemoveWhereRange.getStart(),
-                          RemoveWhereRange.getEnd())
-      .fixItReplace(Tok.getLoc(),
-                    WhereClauseText.str());
+    Diag.fixItReplace(Tok.getLoc(), WhereClauseText.str());
   } else {
-    Diag.fixItRemoveChars(RemoveWhereRange.getStart(),
-                          RemoveWhereRange.getEnd())
-      .fixItInsert(Lexer::getLocForEndOfToken(SourceMgr, PreviousLoc),
-                   WhereClauseText.str());
+    Diag.fixItInsert(Lexer::getLocForEndOfToken(SourceMgr, PreviousLoc),
+                     WhereClauseText.str());
   }
 }
 
diff --git a/lib/Parse/ParsePattern.cpp b/lib/Parse/ParsePattern.cpp
index f1cf87b..f102cb4 100644
--- a/lib/Parse/ParsePattern.cpp
+++ b/lib/Parse/ParsePattern.cpp
@@ -278,6 +278,29 @@
         status |= type;
         param.Type = type.getPtrOrNull();
 
+        if (param.SpecifierKind == ParsedParameter::InOut) {
+          if (auto *fnTR = dyn_cast_or_null<FunctionTypeRepr>(param.Type)) {
+            // If the input to the function isn't parenthesized, apply the inout
+            // to the first (only) parameter, as we would in Swift 2. (This
+            // syntax is deprecated in Swift 3.)
+            TypeRepr *argsTR = fnTR->getArgsTypeRepr();
+            if (!isa<TupleTypeRepr>(argsTR)) {
+              auto *newArgsTR =
+                  new (Context) InOutTypeRepr(argsTR, param.LetVarInOutLoc);
+              auto *newTR =
+                  new (Context) FunctionTypeRepr(fnTR->getGenericParams(),
+                                                 newArgsTR,
+                                                 fnTR->getThrowsLoc(),
+                                                 fnTR->getArrowLoc(),
+                                                 fnTR->getResultTypeRepr());
+              newTR->setGenericSignature(fnTR->getGenericSignature());
+              param.Type = newTR;
+              param.SpecifierKind = ParsedParameter::Let;
+              param.LetVarInOutLoc = SourceLoc();
+            }
+          }
+        }
+
         // If we didn't parse a type, then we already diagnosed that the type
         // was invalid.  Remember that.
         if (type.isParseError() && !type.hasCodeCompletion())
@@ -763,15 +786,63 @@
   auto result = parsePattern();
   
   // Now parse an optional type annotation.
-  if (consumeIf(tok::colon)) {
+  if (Tok.is(tok::colon)) {
+    SourceLoc pastEndOfPrevLoc = getEndOfPreviousLoc();
+    SourceLoc colonLoc = consumeToken(tok::colon);
+    SourceLoc startOfNextLoc = Tok.getLoc();
+    
     if (result.isNull())  // Recover by creating AnyPattern.
       result = makeParserErrorResult(new (Context) AnyPattern(PreviousLoc));
     
     ParserResult<TypeRepr> Ty = parseType();
     if (Ty.hasCodeCompletion())
       return makeParserCodeCompletionResult<Pattern>();
-    if (Ty.isNull())
+    if (!Ty.isNull()) {
+      // Attempt to diagnose initializer calls incorrectly written
+      // as typed patterns, such as "var x: [Int]()".
+      if (Tok.isFollowingLParen()) {
+        BacktrackingScope backtrack(*this);
+        
+        // Create a local context if needed so we can parse trailing closures.
+        LocalContext dummyContext;
+        Optional<ContextChange> contextChange;
+        if (!CurLocalContext) {
+          contextChange.emplace(*this, CurDeclContext, &dummyContext);
+        }
+        
+        SourceLoc lParenLoc, rParenLoc;
+        SmallVector<Expr *, 2> args;
+        SmallVector<Identifier, 2> argLabels;
+        SmallVector<SourceLoc, 2> argLabelLocs;
+        Expr *trailingClosure;
+        ParserStatus status = parseExprList(tok::l_paren, tok::r_paren,
+                                            /*isPostfix=*/true,
+                                            /*isExprBasic=*/false,
+                                            lParenLoc, args, argLabels,
+                                            argLabelLocs, rParenLoc,
+                                            trailingClosure);
+        if (status.isSuccess()) {
+          backtrack.cancelBacktrack();
+          
+          // Suggest replacing ':' with '=' (ensuring proper whitespace).
+          
+          bool needSpaceBefore = (pastEndOfPrevLoc == colonLoc);
+          bool needSpaceAfter =
+            SourceMgr.getByteDistance(colonLoc, startOfNextLoc) <= 1;
+          
+          StringRef replacement = " = ";
+          if (!needSpaceBefore) replacement = replacement.drop_front();
+          if (!needSpaceAfter)  replacement = replacement.drop_back();
+          
+          diagnose(lParenLoc, diag::initializer_as_typed_pattern)
+            .highlight({Ty.get()->getStartLoc(), rParenLoc})
+            .fixItReplace(colonLoc, replacement);
+          result.setIsParseError();
+        }
+      }
+    } else {
       Ty = makeParserResult(new (Context) ErrorTypeRepr(PreviousLoc));
+    }
     
     result = makeParserResult(result,
                             new (Context) TypedPattern(result.get(), Ty.get()));
diff --git a/lib/Parse/ParseSIL.cpp b/lib/Parse/ParseSIL.cpp
index 98642f4..fa2bee0 100644
--- a/lib/Parse/ParseSIL.cpp
+++ b/lib/Parse/ParseSIL.cpp
@@ -211,33 +211,40 @@
 
     // Parsing logic.
     bool parseASTType(CanType &result);
-    bool parseSILType(SILType &Result, GenericParamList *&genericParams,
+    bool parseSILType(SILType &Result,
+                      GenericSignature *&genericSig,
+                      GenericParamList *&genericParams,
                       bool IsFuncDecl = false);
     bool parseSILType(SILType &Result) {
-      GenericParamList *Junk;
-      return parseSILType(Result, Junk);
+      GenericSignature *IgnoredSig;
+      GenericParamList *IgnoredParams;
+      return parseSILType(Result, IgnoredSig, IgnoredParams);
     }
     bool parseSILType(SILType &Result, SourceLoc &TypeLoc) {
       TypeLoc = P.Tok.getLoc();
       return parseSILType(Result);
     }
     bool parseSILType(SILType &Result, SourceLoc &TypeLoc,
+                      GenericSignature *&GenericSig,
                       GenericParamList *&GenericParams) {
       TypeLoc = P.Tok.getLoc();
-      return parseSILType(Result, GenericParams);
+      return parseSILType(Result, GenericSig, GenericParams);
     }
 
     /// Parse a SIL type without the leading '$' or value category specifier.
     bool parseSILTypeWithoutQualifiers(SILType &Result,
                                        SILValueCategory category,
                                        const TypeAttributes &attrs,
+                                       GenericSignature *&genericSig,
                                        GenericParamList *&genericParams,
                                        bool IsFuncDecl = false);
     bool parseSILTypeWithoutQualifiers(SILType &Result,
                                        SILValueCategory category,
                                        const TypeAttributes &attrs) {
-      GenericParamList *Junk;
-      return parseSILTypeWithoutQualifiers(Result, category, attrs, Junk);
+      GenericSignature *IgnoredSig;
+      GenericParamList *IgnoredParams;
+      return parseSILTypeWithoutQualifiers(Result, category, attrs,
+                                           IgnoredSig, IgnoredParams);
     }
 
     bool parseSILDottedPath(ValueDecl *&Decl,
@@ -297,11 +304,14 @@
                    SmallVectorImpl<ParsedSubstitution> &parsed);
 
     ProtocolConformance *parseProtocolConformance(ProtocolDecl *&proto,
-                             GenericParamList *&generics, bool localScope);
+                             GenericSignature *&genericSig,
+                             GenericParamList *&genericParams,
+                             bool localScope);
     ProtocolConformance *parseProtocolConformance() {
       ProtocolDecl *dummy;
+      GenericSignature *sig;
       GenericParamList *gp;
-      return parseProtocolConformance(dummy, gp, true);
+      return parseProtocolConformance(dummy, sig, gp, true);
     }
 
     Optional<llvm::coverage::Counter>
@@ -827,8 +837,10 @@
 bool SILParser::parseSILTypeWithoutQualifiers(SILType &Result,
                                               SILValueCategory category,
                                               const TypeAttributes &attrs,
+                                              GenericSignature *&GenericSig,
                                               GenericParamList *&GenericParams,
                                               bool IsFuncDecl){
+  GenericSig = nullptr;
   GenericParams = nullptr;
 
   // If this is part of a function decl, generic parameters are visible in the
@@ -850,8 +862,8 @@
     if (auto generics = fnType->getGenericParams()) {
       GenericParams = generics;
 
-      auto *genericSig = handleSILGenericParams(P.Context, generics, &P.SF);
-      fnType->setGenericSignature(genericSig);
+      GenericSig = handleSILGenericParams(P.Context, generics, &P.SF);
+      fnType->setGenericSignature(GenericSig);
     }
   }
   
@@ -874,8 +886,13 @@
 ///   sil-type:
 ///     '$' '*'? attribute-list (generic-params)? type
 ///
-bool SILParser::parseSILType(SILType &Result, GenericParamList *&GenericParams,
+bool SILParser::parseSILType(SILType &Result,
+                             GenericSignature *&GenericSig,
+                             GenericParamList *&GenericParams,
                              bool IsFuncDecl){
+  GenericSig = nullptr;
+  GenericParams = nullptr;
+
   if (P.parseToken(tok::sil_dollar, diag::expected_sil_type))
     return true;
 
@@ -896,7 +913,8 @@
     attrs.setAttr(TAK_convention, P.PreviousLoc);
     attrs.convention = "thin";
   }
-  return parseSILTypeWithoutQualifiers(Result, category, attrs, GenericParams,
+  return parseSILTypeWithoutQualifiers(Result, category, attrs,
+                                       GenericSig, GenericParams,
                                        IsFuncDecl);
 }
 
@@ -1461,20 +1479,39 @@
 /// from a SILFunctionType.
 bool getApplySubstitutionsFromParsed(
                              SILParser &SP,
-                             GenericParamList *gp,
+                             GenericSignature *sig,
+                             GenericParamList *params,
                              ArrayRef<ParsedSubstitution> parses,
                              SmallVectorImpl<Substitution> &subs) {
+  if (parses.empty()) {
+    assert (!sig && !params);
+    return false;
+  }
+
+  assert(sig && params);
+
+  // Map from interface types to archetypes
+  TypeSubstitutionMap map;
+  params->getForwardingSubstitutionMap(map);
+
+  auto *mod = SP.SILMod.getSwiftModule();
+
   // The replacement is for the corresponding archetype by ordering.
-  for (auto subArchetype : gp->getAllNestedArchetypes()) {
+  for (auto depTy : sig->getAllDependentTypes()) {
+
+    // Map the interface type to a context type.
+    auto contextTy = depTy.subst(mod, map, SubstOptions());
+    auto *archetype = contextTy->castTo<ArchetypeType>();
+
     if (parses.empty()) {
-      SP.P.diagnose(gp->getRAngleLoc(), diag::sil_missing_substitutions);
+      SP.P.diagnose(params->getRAngleLoc(), diag::sil_missing_substitutions);
       return true;
     }
     auto parsed = parses.front();
     parses = parses.slice(1);
 
     SmallVector<ProtocolConformanceRef, 2> conformances;
-    if (getConformancesForSubstitution(SP.P, subArchetype,
+    if (getConformancesForSubstitution(SP.P, archetype,
                                        parsed.replacement,
                                        parsed.loc, conformances))
       return true;
@@ -1483,7 +1520,7 @@
                     SP.P.Context.AllocateCopy(conformances)});
   }
   if (!parses.empty()) {
-    SP.P.diagnose(gp->getRAngleLoc(), diag::sil_too_many_substitutions);
+    SP.P.diagnose(params->getRAngleLoc(), diag::sil_too_many_substitutions);
     return true;
   }
   return false;
@@ -1842,9 +1879,10 @@
       return true;
     }
     assert(foundBuiltins.size() == 1 && "ambiguous builtin name?!");
-    
-    GenericParamList *genericParams
-      = cast<FuncDecl>(foundBuiltins[0])->getGenericParams();
+
+    auto *builtinFunc = cast<FuncDecl>(foundBuiltins[0]);
+    GenericSignature *genericSig = builtinFunc->getGenericSignature();
+    GenericParamList *genericParams = builtinFunc->getGenericParams();
     
     SmallVector<ParsedSubstitution, 4> parsedSubs;
     SmallVector<Substitution, 4> subs;
@@ -1856,7 +1894,8 @@
         P.diagnose(P.Tok, diag::sil_substitutions_on_non_polymorphic_type);
         return true;
       }
-      if (getApplySubstitutionsFromParsed(*this, genericParams,parsedSubs,subs))
+      if (getApplySubstitutionsFromParsed(*this, genericSig, genericParams,
+                                          parsedSubs, subs))
         return true;
     }
     
@@ -2340,6 +2379,7 @@
                         SetterFuncName, SelfName;
     SmallVector<ParsedSubstitution, 4> ParsedInitStorageSubs,
                                        ParsedSetterSubs;
+    GenericSignature *InitStorageSig, *SetterSig;
     GenericParamList *InitStorageParams, *SetterParams;
     SILType InitStorageTy, SetterTy;
     
@@ -2351,7 +2391,7 @@
         || parseValueName(StorageName)
         || P.parseToken(tok::r_paren, diag::expected_tok_in_sil_instr, ")")
         || P.parseToken(tok::colon, diag::expected_tok_in_sil_instr, ":")
-        || parseSILType(InitStorageTy, InitStorageParams)
+        || parseSILType(InitStorageTy, InitStorageSig, InitStorageParams)
         || P.parseToken(tok::comma, diag::expected_tok_in_sil_instr, ",")
         || parseValueName(SetterFuncName)
         || parseApplySubstitutions(ParsedSetterSubs)
@@ -2359,7 +2399,7 @@
         || parseValueName(SelfName)
         || P.parseToken(tok::r_paren, diag::expected_tok_in_sil_instr, ")")
         || P.parseToken(tok::colon, diag::expected_tok_in_sil_instr, ":")
-        || parseSILType(SetterTy, SetterParams))
+        || parseSILType(SetterTy, SetterSig, SetterParams))
       return true;
     
     // Resolve the types of the operands.
@@ -2368,9 +2408,10 @@
     SILValue SetterFunc = getLocalValue(SetterFuncName, SetterTy, InstLoc, B);
     
     SmallVector<Substitution, 4> InitStorageSubs, SetterSubs;
-    if (getApplySubstitutionsFromParsed(*this, InitStorageParams,
+    if (getApplySubstitutionsFromParsed(*this,
+                                        InitStorageSig, InitStorageParams,
                                         ParsedInitStorageSubs, InitStorageSubs)
-        || getApplySubstitutionsFromParsed(*this, SetterParams,
+        || getApplySubstitutionsFromParsed(*this, SetterSig, SetterParams,
                                            ParsedSetterSubs, SetterSubs))
       return true;
     
@@ -3573,6 +3614,7 @@
     
     UnresolvedValueName invokeName;
     SILType invokeTy;
+    GenericSignature *invokeGenericSig;
     GenericParamList *invokeGenericParams;
     
     SILType blockType;
@@ -3586,7 +3628,7 @@
         parseValueName(invokeName) ||
         parseApplySubstitutions(parsedSubs) ||
         P.parseToken(tok::colon, diag::expected_tok_in_sil_instr, ":") ||
-        parseSILType(invokeTy, invokeGenericParams) ||
+        parseSILType(invokeTy, invokeGenericSig, invokeGenericParams) ||
         P.parseToken(tok::comma, diag::expected_tok_in_sil_instr, ",") ||
         parseSILIdentifier(type, typeLoc,
                            diag::expected_tok_in_sil_instr, "type") ||
@@ -3611,7 +3653,9 @@
         P.diagnose(typeLoc, diag::sil_substitutions_on_non_polymorphic_type);
         return true;
       }
-      if (getApplySubstitutionsFromParsed(*this, invokeGenericParams,
+      if (getApplySubstitutionsFromParsed(*this,
+                                          invokeGenericSig,
+                                          invokeGenericParams,
                                           parsedSubs, subs))
         return true;
     }
@@ -3657,10 +3701,11 @@
 
   SILType Ty;
   SourceLoc TypeLoc;
+  GenericSignature *GenericSig = nullptr;
   GenericParamList *GenericParams = nullptr;
   if (P.parseToken(tok::r_paren, diag::expected_tok_in_sil_instr, ")") ||
       P.parseToken(tok::colon, diag::expected_tok_in_sil_instr, ":") ||
-      parseSILType(Ty, TypeLoc, GenericParams))
+      parseSILType(Ty, TypeLoc, GenericSig, GenericParams))
     return true;
 
   auto FTI = Ty.getAs<SILFunctionType>();
@@ -3675,7 +3720,8 @@
       P.diagnose(TypeLoc, diag::sil_substitutions_on_non_polymorphic_type);
       return true;
     }
-    if (getApplySubstitutionsFromParsed(*this, GenericParams, parsedSubs, subs))
+    if (getApplySubstitutionsFromParsed(*this, GenericSig, GenericParams,
+                                        parsedSubs, subs))
       return true;
   }
 
@@ -3911,8 +3957,10 @@
     // Construct a Scope for the function body so TypeAliasDecl can be added to
     // the scope.
     Scope Body(this, ScopeKind::FunctionBody);
+    GenericSignature *GenericSig;
     GenericParamList *ContextParams;
-    if (FunctionState.parseSILType(FnType, ContextParams, true/*IsFuncDecl*/))
+    if (FunctionState.parseSILType(FnType, GenericSig, ContextParams,
+                                   true/*IsFuncDecl*/))
       return true;
     auto SILFnType = FnType.getAs<SILFunctionType>();
     if (!SILFnType || !FnType.isObject()) {
@@ -3949,7 +3997,9 @@
       // Resolve specialization attributes after setting ContextParams.
       for (auto &Attr : SpecAttrs) {
         SmallVector<Substitution, 4> Subs;
-        if (getApplySubstitutionsFromParsed(FunctionState, ContextParams,
+        if (getApplySubstitutionsFromParsed(FunctionState,
+                                            GenericSig,
+                                            ContextParams,
                                             Attr.subs, Subs)) {
           return true;
         }
@@ -4289,7 +4339,9 @@
 }
 
 ProtocolConformance *SILParser::parseProtocolConformance(
-           ProtocolDecl *&proto, GenericParamList *&generics,
+           ProtocolDecl *&proto,
+           GenericSignature *&genericSig,
+           GenericParamList *&genericParams,
            bool localScope) {
   // Parse generic params for the protocol conformance. We need to make sure
   // they have the right scope.
@@ -4297,9 +4349,12 @@
   if (localScope)
     GenericsScope.emplace(&P, ScopeKind::Generics);
 
-  generics = P.maybeParseGenericParams().getPtrOrNull();
-  if (generics) {
-    handleSILGenericParams(P.Context, generics, &P.SF);
+  // Make sure we don't leave it uninitialized in the caller
+  genericSig = nullptr;
+
+  genericParams = P.maybeParseGenericParams().getPtrOrNull();
+  if (genericParams) {
+    genericSig = handleSILGenericParams(P.Context, genericParams, &P.SF);
   }
 
   ProtocolConformance *retVal = parseProtocolConformanceHelper(proto,
@@ -4346,15 +4401,16 @@
     if (P.parseToken(tok::l_paren, diag::expected_sil_witness_lparen))
       return nullptr;
     ProtocolDecl *dummy;
+    GenericSignature *sig;
     GenericParamList *gp;
-    auto genericConform = parseProtocolConformance(dummy, gp, localScope);
+    auto genericConform = parseProtocolConformance(dummy, sig, gp, localScope);
     if (!genericConform)
       return nullptr;
     if (P.parseToken(tok::r_paren, diag::expected_sil_witness_rparen))
       return nullptr;
 
     SmallVector<Substitution, 4> subs;
-    if (getApplySubstitutionsFromParsed(*this, gp, parsedSubs, subs))
+    if (getApplySubstitutionsFromParsed(*this, sig, gp, parsedSubs, subs))
       return nullptr;
 
     auto result = P.Context.getSpecializedConformance(
@@ -4414,8 +4470,10 @@
 
   // Parse the protocol conformance.
   ProtocolDecl *proto;
-  GenericParamList *dummy;
-  auto conf = WitnessState.parseProtocolConformance(proto, dummy,
+  GenericSignature *dummySig;
+  GenericParamList *dummyParams;
+  auto conf = WitnessState.parseProtocolConformance(proto,
+                                                    dummySig, dummyParams,
                                                     false/*localScope*/);
 
   NormalProtocolConformance *theConformance = conf ?
@@ -4847,12 +4905,13 @@
     SourceLoc FnLoc = Tok.getLoc();
     // We need to turn on InSILBody to parse the function reference.
     Lexer::SILBodyRAII Tmp(*L);
-    GenericParamList *Ignored;
+    GenericSignature *IgnoredSig;
+    GenericParamList *IgnoredParams;
     Scope S(this, ScopeKind::TopLevel);
     Scope Body(this, ScopeKind::FunctionBody);
     if ((ScopeState.parseGlobalName(FnName)) ||
         parseToken(tok::colon, diag::expected_sil_colon_value_ref) ||
-        ScopeState.parseSILType(Ty, Ignored, true))
+        ScopeState.parseSILType(Ty, IgnoredSig, IgnoredParams, true))
       return true;
 
     // The function doesn't exist yet. Create a zombie forward declaration.
diff --git a/lib/Parse/ParseType.cpp b/lib/Parse/ParseType.cpp
index e319f80..b5a5383 100644
--- a/lib/Parse/ParseType.cpp
+++ b/lib/Parse/ParseType.cpp
@@ -450,7 +450,7 @@
       // Skip until we hit the '>'.
       RAngleLoc = skipUntilGreaterInTypeList(/*protocolComposition=*/true);
     }
-    
+
     auto composition = ProtocolCompositionTypeRepr::create(
       Context, Protocols, ProtocolLoc, {LAngleLoc, RAngleLoc});
 
@@ -470,6 +470,16 @@
         replacement += extractText(*Begin);
       }
 
+      // Copy trailing content after '>' to the replacement string.
+      // FIXME: lexer should smartly separate '>' and trailing contents like '?'.
+      StringRef TrailingContent = L->getTokenAt(RAngleLoc).getRange().str().
+        substr(1);
+      if (!TrailingContent.empty()) {
+        replacement.insert(replacement.begin(), '(');
+        replacement += ")";
+        replacement += TrailingContent;
+      }
+
       // Replace 'protocol<T1, T2>' with 'T1 & T2'
       diagnose(ProtocolLoc,
         Protocols.size() > 1 ? diag::deprecated_protocol_composition
diff --git a/lib/PrintAsObjC/PrintAsObjC.cpp b/lib/PrintAsObjC/PrintAsObjC.cpp
index 04d74ca..6136cd1 100644
--- a/lib/PrintAsObjC/PrintAsObjC.cpp
+++ b/lib/PrintAsObjC/PrintAsObjC.cpp
@@ -1193,7 +1193,7 @@
         SD != ctx.getDictionaryDecl() &&
         SD != ctx.getSetDecl() &&
         !isSwiftNewtype(SD)) {
-      ty = *ctx.getBridgedToObjC(&M, ty, /*resolver*/nullptr);
+      ty = ctx.getBridgedToObjC(&M, ty);
     }
     
     assert(ty && "unknown bridged type");
@@ -1533,14 +1533,15 @@
 class ReferencedTypeFinder : private TypeVisitor<ReferencedTypeFinder> {
   friend TypeVisitor;
 
+  ModuleDecl &M;
   llvm::function_ref<void(ReferencedTypeFinder &, const TypeDecl *)> Callback;
   bool IsWithinConstrainedObjCGeneric = false;
 
-  ReferencedTypeFinder(decltype(Callback) callback) : Callback(callback) {}
+  ReferencedTypeFinder(ModuleDecl &mod, decltype(Callback) callback)
+    : M(mod), Callback(callback) {}
 
   void visitType(TypeBase *base) {
-    assert(base->getDesugaredType() == base && "unhandled sugared type");
-    return;
+    llvm_unreachable("unhandled type");
   }
 
   void visitNameAliasType(NameAliasType *aliasTy) {
@@ -1556,14 +1557,31 @@
       visit(elemTy);
   }
 
+  void visitReferenceStorageType(ReferenceStorageType *ty) {
+    visit(ty->getReferentType());
+  }
+
   void visitNominalType(NominalType *nominal) {
     Callback(*this, nominal->getDecl());
   }
 
-  void visitMetatypeType(MetatypeType *metatype) {
+  void visitAnyMetatypeType(AnyMetatypeType *metatype) {
     visit(metatype->getInstanceType());
   }
 
+  void visitDynamicSelfType(DynamicSelfType *module) {
+    return;
+  }
+
+  void visitArchetypeType(ArchetypeType *archetype) {
+    // Appears in protocols and in generic ObjC classes.
+    return;
+  }
+
+  void visitGenericTypeParamType(GenericTypeParamType *archetype) {
+    llvm_unreachable("unexpected generic type param type in @objc decl");
+  }
+
   void visitSubstitutedType(SubstitutedType *sub) {
     visit(sub->getSinglyDesugaredType());
   }
@@ -1596,28 +1614,34 @@
 
   /// Returns true if \p archetype has any constraints other than being
   /// class-bound ("conforms to" AnyObject).
-  static bool isConstrainedArchetype(const ArchetypeType *archetype) {
-    if (archetype->getSuperclass())
+  static bool isConstrained(ModuleDecl &mod,
+                            GenericSignature *sig,
+                            GenericTypeParamType *paramTy) {
+    if (sig->getSuperclassBound(paramTy, mod))
       return true;
 
-    if (archetype->getConformsTo().size() > 1)
+    auto conformsTo = sig->getConformsTo(paramTy, mod);
+
+    if (conformsTo.size() > 1)
       return true;
-    if (archetype->getConformsTo().size() == 0)
+    if (conformsTo.size() == 0)
       return false;
 
-    const ProtocolDecl *proto = archetype->getConformsTo().front();
+    const ProtocolDecl *proto = conformsTo.front();
     if (auto knownKind = proto->getKnownProtocolKind())
       return knownKind.getValue() != KnownProtocolKind::AnyObject;
     return true;
   }
 
   void visitBoundGenericType(BoundGenericType *boundGeneric) {
-    bool isObjCGeneric = boundGeneric->getDecl()->hasClangNode();
+    auto *decl = boundGeneric->getDecl();
+    bool isObjCGeneric = decl->hasClangNode();
+    auto *sig = decl->getGenericSignature();
 
     for_each(boundGeneric->getGenericArgs(),
-             boundGeneric->getDecl()->getGenericParams()->getPrimaryArchetypes(),
-             [&](Type argTy, const ArchetypeType *archetype) {
-      if (isObjCGeneric && isConstrainedArchetype(archetype))
+             sig->getInnermostGenericParams(),
+             [&](Type argTy, GenericTypeParamType *paramTy) {
+      if (isObjCGeneric && isConstrained(M, sig, paramTy))
         IsWithinConstrainedObjCGeneric = true;
       visit(argTy);
       IsWithinConstrainedObjCGeneric = false;
@@ -1636,8 +1660,8 @@
     return IsWithinConstrainedObjCGeneric;
   }
 
-  static void walk(Type ty, decltype(Callback) callback) {
-    ReferencedTypeFinder(callback).visit(ty);
+  static void walk(ModuleDecl &mod, Type ty, decltype(Callback) callback) {
+    ReferencedTypeFinder(mod, callback).visit(ty);
   }
 };
 
@@ -1819,13 +1843,14 @@
       }
 
       bool needsToBeIndividuallyDelayed = false;
-      ReferencedTypeFinder::walk(VD->getType(),
+      ReferencedTypeFinder::walk(M, VD->getType(),
                                  [&](ReferencedTypeFinder &finder,
                                      const TypeDecl *TD) {
         if (TD == container)
           return;
 
-        if (finder.isWithinConstrainedObjCGeneric()) {
+        if (finder.isWithinConstrainedObjCGeneric() &&
+            isa<NominalTypeDecl>(TD)) {
           // We can delay individual members of classes; do so if necessary.
           if (isa<ClassDecl>(container)) {
             if (!tryRequire(TD)) {
@@ -1860,18 +1885,21 @@
           if (!forwardDeclare(CD)) {
             (void)addImport(CD);
           }
-        } else if (auto PD = dyn_cast<ProtocolDecl>(TD))
+        } else if (auto PD = dyn_cast<ProtocolDecl>(TD)) {
           forwardDeclare(PD);
-        else if (addImport(TD))
-          return;
-        else if (auto ED = dyn_cast<EnumDecl>(TD))
-          forwardDeclare(ED);
-        else if (auto TAD = dyn_cast<TypeAliasDecl>(TD))
+        } else if (auto TAD = dyn_cast<TypeAliasDecl>(TD)) {
+          (void)addImport(TD);
+          // Just in case, make sure the underlying type is visible too.
           finder.visit(TAD->getUnderlyingType());
-        else if (isa<AbstractTypeParamDecl>(TD))
+        } else if (addImport(TD)) {
+          return;
+        } else if (auto ED = dyn_cast<EnumDecl>(TD)) {
+          forwardDeclare(ED);
+        } else if (isa<AbstractTypeParamDecl>(TD)) {
           llvm_unreachable("should not see type params here");
-        else
+        } else {
           assert(false && "unknown local type decl");
+        }
       });
 
       if (needsToBeIndividuallyDelayed) {
diff --git a/lib/SIL/Bridging.cpp b/lib/SIL/Bridging.cpp
index 9596a16..b8da3dd 100644
--- a/lib/SIL/Bridging.cpp
+++ b/lib/SIL/Bridging.cpp
@@ -171,7 +171,7 @@
   }
   
   // `Any` can bridge to `AnyObject` (`id` in ObjC).
-  if (Context.LangOpts.EnableIdAsAny && t->isAny()) {
+  if (t->isAny()) {
     return Context.getProtocol(KnownProtocolKind::AnyObject)->getDeclaredType();
   }
   
diff --git a/lib/SIL/DynamicCasts.cpp b/lib/SIL/DynamicCasts.cpp
index 7ed4d6a..3695da9 100644
--- a/lib/SIL/DynamicCasts.cpp
+++ b/lib/SIL/DynamicCasts.cpp
@@ -30,19 +30,8 @@
 
 static bool
 mayBridgeToObjectiveC(Module *M, CanType T) {
-  // If the target type is either an unknown dynamic type, or statically
-  // known to bridge, the cast may succeed.
-  // TODO: We could be more precise with the bridged-to type.
-  if (T->hasArchetype())
-    return true;
-  
-  if (T->isAnyExistentialType())
-    return true;
-  
-  if (M->getASTContext().getBridgedToObjC(M, T, nullptr))
-    return true;
-
-  return false;
+  // FIXME: Disable when we don't support Objective-C interoperability?
+  return true;
 }
 
 static bool
@@ -61,14 +50,7 @@
     if (M->getASTContext().isStandardLibraryTypeBridgedInFoundation(N))
       return false;
 
-  auto bridgeTy  = M->getASTContext().getBridgedToObjC(M, T, nullptr);
-  if (!bridgeTy.hasValue())
-    return false;
-
-  if (bridgeTy->isNull())
-    return true;
-
-  return false;
+  return !M->getASTContext().getBridgedToObjC(M, T);
 }
 
 static bool canClassOrSuperclassesHaveExtensions(ClassDecl *CD,
@@ -250,6 +232,59 @@
       && !type.isAnyClassReferenceType();
 }
 
+/// Given two class types, check whether there's a hierarchy relationship
+/// between them.
+static DynamicCastFeasibility
+classifyClassHierarchyCast(CanType source, CanType target) {
+  // Upcast: if the target type statically matches a type in the
+  // source type's hierarchy, this is a static upcast and the cast
+  // will always succeed.
+  if (target->isExactSuperclassOf(source, nullptr))
+    return DynamicCastFeasibility::WillSucceed;
+
+  // Upcast: if the target type might dynamically match a type in the
+  // source type's hierarchy, this might be an upcast, in which
+  // case the cast might succeed.
+  if (target->isBindableToSuperclassOf(source, nullptr))
+    return DynamicCastFeasibility::MaySucceed;
+
+  // Downcast: if the source type might dynamically match a type in the
+  // target type's hierarchy, this might be a downcast, in which case
+  // the cast might succeed.  Note that this also covers the case where
+  // the source type statically matches a type in the target type's
+  // hierarchy; since it's a downcast, the cast still at best might succeed.
+  if (source->isBindableToSuperclassOf(target, nullptr))
+    return DynamicCastFeasibility::MaySucceed;
+
+  // Otherwise, the classes are unrelated and the cast will fail (at least
+  // on these grounds).
+  return DynamicCastFeasibility::WillFail;
+}
+
+static CanType getNSBridgedClassOfCFClass(Module *M, CanType type) {
+  if (auto classDecl = type->getClassOrBoundGenericClass()) {
+    if (classDecl->getForeignClassKind() == ClassDecl::ForeignKind::CFType) {
+      if (auto bridgedAttr =
+            classDecl->getAttrs().getAttribute<ObjCBridgedAttr>()) {
+        auto bridgedClass = bridgedAttr->getObjCClass();
+        // TODO: this should handle generic classes properly.
+        if (!bridgedClass->isGenericContext()) {
+          return bridgedClass->getDeclaredInterfaceType()->getCanonicalType();
+        }
+      }
+    }
+  }
+  return CanType();
+}
+
+static bool isCFBridgingConversion(Module *M, SILType sourceType,
+                                   SILType targetType) {
+  return (sourceType.getSwiftRValueType() ==
+            getNSBridgedClassOfCFClass(M, targetType.getSwiftRValueType()) ||
+          targetType.getSwiftRValueType() ==
+            getNSBridgedClassOfCFClass(M, sourceType.getSwiftRValueType()));
+}
+
 /// Try to classify the dynamic-cast relationship between two types.
 DynamicCastFeasibility
 swift::classifyDynamicCast(Module *M,
@@ -311,6 +346,30 @@
     return DynamicCastFeasibility::MaySucceed;
   }
 
+  // Casts from AnyHashable.
+  if (auto sourceStruct = dyn_cast<StructType>(source)) {
+    if (sourceStruct->getDecl() == M->getASTContext().getAnyHashableDecl()) {
+      if (auto hashable = getHashableExistentialType(M)) {
+        // Succeeds if Hashable can be cast to the target type.
+        return classifyDynamicCastFromProtocol(M, hashable, target,
+                                               isWholeModuleOpts);
+      }
+    }
+  }
+
+  // Casts to AnyHashable.
+  if (auto targetStruct = dyn_cast<StructType>(target)) {
+    if (targetStruct->getDecl() == M->getASTContext().getAnyHashableDecl()) {
+      // Succeeds if the source type can be dynamically cast to Hashable.
+      // Hashable is not actually a legal existential type right now, but
+      // the check doesn't care about that.
+      if (auto hashable = getHashableExistentialType(M)) {
+        return classifyDynamicCastToProtocol(source, hashable,
+                                             isWholeModuleOpts);
+      }
+    }
+  }
+
   // Metatype casts.
   if (auto sourceMetatype = dyn_cast<AnyMetatypeType>(source)) {
     auto targetMetatype = dyn_cast<AnyMetatypeType>(target);
@@ -369,7 +428,7 @@
     // cast.
     if (source.getClassOrBoundGenericClass() &&
         target.getClassOrBoundGenericClass())
-      return classifyDynamicCast(M, source, target, false, isWholeModuleOpts);
+      return classifyClassHierarchyCast(source, target);
 
     // Different structs cannot be cast to each other.
     if (source.getStructOrBoundGenericStruct() &&
@@ -386,7 +445,7 @@
     // If we don't know any better, assume that the cast may succeed.
     return DynamicCastFeasibility::MaySucceed;
   }
-  
+
   // Function casts.
   if (auto sourceFunction = dyn_cast<FunctionType>(source)) {
     if (auto targetFunction = dyn_cast<FunctionType>(target)) {
@@ -457,16 +516,25 @@
         }
       }
 
+      // Try a hierarchy cast.  If that isn't failure, we can report it.
+      auto hierarchyResult = classifyClassHierarchyCast(source, target);
+      if (hierarchyResult != DynamicCastFeasibility::WillFail)
+        return hierarchyResult;
 
-      if (target->isExactSuperclassOf(source, nullptr))
-        return DynamicCastFeasibility::WillSucceed;
-      if (target->isBindableToSuperclassOf(source, nullptr))
-        return DynamicCastFeasibility::MaySucceed;
-      if (source->isBindableToSuperclassOf(target, nullptr))
-        return DynamicCastFeasibility::MaySucceed;
+      // As a backup, consider whether either type is a CF class type
+      // with an NS bridged equivalent.
+      CanType bridgedSource = getNSBridgedClassOfCFClass(M, source);
+      CanType bridgedTarget = getNSBridgedClassOfCFClass(M, target);
 
-      // FIXME: bridged types, e.g. CF <-> NS (but not for metatypes).
-      return DynamicCastFeasibility::WillFail;
+      // If neither type qualifies, we're done.
+      if (!bridgedSource && !bridgedTarget)
+        return DynamicCastFeasibility::WillFail;
+
+      // Otherwise, map over to the bridged types and try to answer the
+      // question there.
+      if (bridgedSource) source = bridgedSource;
+      if (bridgedTarget) target = bridgedTarget;
+      return classifyDynamicCast(M, source, target, false, isWholeModuleOpts);
     }
 
     // Casts from a class into a non-class can never succeed if the target must
@@ -532,13 +600,11 @@
   if (source->isBridgeableObjectType() && mayBridgeToObjectiveC(M, target)) {
     // Try to get the ObjC type which is bridged to target type.
     assert(!target.isAnyExistentialType());
-    Optional<Type> ObjCTy = M->getASTContext().getBridgedToObjC(
-        M, target, nullptr);
-    if (ObjCTy && ObjCTy.getValue()) {
+    if (Type ObjCTy = M->getASTContext().getBridgedToObjC(M, target)) {
       // If the bridged ObjC type is known, check if
       // source type can be cast into it.
       return classifyDynamicCast(M, source,
-          ObjCTy.getValue().getCanonicalTypeOrNull(),
+          ObjCTy.getCanonicalTypeOrNull(),
           /* isSourceTypeExact */ false, isWholeModuleOpts);
     }
     return DynamicCastFeasibility::MaySucceed;
@@ -547,13 +613,11 @@
   if (target->isBridgeableObjectType() && mayBridgeToObjectiveC(M, source)) {
     // Try to get the ObjC type which is bridged to source type.
     assert(!source.isAnyExistentialType());
-    Optional<Type> ObjCTy = M->getASTContext().getBridgedToObjC(
-        M, source, nullptr);
-    if (ObjCTy && ObjCTy.getValue()) {
+    if (Type ObjCTy = M->getASTContext().getBridgedToObjC(M, source)) {
       // If the bridged ObjC type is known, check if
       // this type can be cast into target type.
       return classifyDynamicCast(M,
-          ObjCTy.getValue().getCanonicalTypeOrNull(),
+          ObjCTy.getCanonicalTypeOrNull(),
           target,
           /* isSourceTypeExact */ false, isWholeModuleOpts);
     }
@@ -599,30 +663,6 @@
     }
   }
 
-  // Casts from AnyHashable.
-  if (auto sourceStruct = dyn_cast<StructType>(source)) {
-    if (sourceStruct->getDecl() == M->getASTContext().getAnyHashableDecl()) {
-      if (auto hashable = getHashableExistentialType(M)) {
-        // Succeeds if Hashable can be cast to the target type.
-        return classifyDynamicCastFromProtocol(M, hashable, target,
-                                               isWholeModuleOpts);
-      }
-    }
-  }
-
-  // Casts to AnyHashable.
-  if (auto targetStruct = dyn_cast<StructType>(target)) {
-    if (targetStruct->getDecl() == M->getASTContext().getAnyHashableDecl()) {
-      // Succeeds if the source type can be dynamically cast to Hashable.
-      // Hashable is not actually a legal existential type right now, but
-      // the check doesn't care about that.
-      if (auto hashable = getHashableExistentialType(M)) {
-        return classifyDynamicCastToProtocol(source, hashable,
-                                             isWholeModuleOpts);
-      }
-    }
-  }
-
   return DynamicCastFeasibility::WillFail;
 }
 
@@ -685,9 +725,11 @@
     SILModule &M;
     ASTContext &Ctx;
     SILLocation Loc;
+    Module *SwiftModule;
   public:
     CastEmitter(SILBuilder &B, Module *swiftModule, SILLocation loc)
-      : B(B), M(B.getModule()), Ctx(M.getASTContext()), Loc(loc) {}
+      : B(B), M(B.getModule()), Ctx(M.getASTContext()), Loc(loc),
+        SwiftModule(swiftModule) {}
 
     Source emitTopLevel(Source source, Target target) {
       unsigned sourceOptDepth = getOptionalDepth(source.FormalType);
@@ -768,8 +810,8 @@
       }
       assert(!target.FormalType.getAnyOptionalObjectType());
 
-      // The only other thing we return WillSucceed for currently is
-      // an upcast.
+      // The only other things we return WillSucceed for currently is
+      // an upcast or CF/NS toll-free-bridging conversion.
       // FIXME: Upcasts between existential metatypes are not handled yet.
       // We should generate for it:
       // %openedSrcMetatype = open_existential srcMetatype
@@ -781,7 +823,12 @@
       } else {
         value = getOwnedScalar(source, srcTL);
       }
-      value = B.createUpcast(Loc, value, target.LoweredType.getObjectType());
+      auto targetTy = target.LoweredType;
+      if (isCFBridgingConversion(SwiftModule, targetTy, value->getType())) {
+        value = B.createUncheckedRefCast(Loc, value, targetTy.getObjectType());
+      } else {
+        value = B.createUpcast(Loc, value, targetTy.getObjectType());
+      }
       return putOwnedScalar(value, target);
     }
 
diff --git a/lib/SIL/SILFunction.cpp b/lib/SIL/SILFunction.cpp
index 074d3f0..533b470 100644
--- a/lib/SIL/SILFunction.cpp
+++ b/lib/SIL/SILFunction.cpp
@@ -555,8 +555,15 @@
 }
 
 ArrayRef<Substitution> SILFunction::getForwardingSubstitutions() {
+  if (ForwardingSubs)
+    return *ForwardingSubs;
+
   auto *params = getContextGenericParams();
   if (!params)
     return {};
-  return params->getForwardingSubstitutions(getASTContext());
+
+  auto sig = getLoweredFunctionType()->getGenericSignature();
+  ForwardingSubs = params->getForwardingSubstitutions(sig);
+
+  return *ForwardingSubs;
 }
diff --git a/lib/SIL/SILFunctionType.cpp b/lib/SIL/SILFunctionType.cpp
index e6d0311..7754fd6 100644
--- a/lib/SIL/SILFunctionType.cpp
+++ b/lib/SIL/SILFunctionType.cpp
@@ -2105,13 +2105,13 @@
       public CanTypeVisitor<SILTypeSubstituter, CanType> {
     SILModule &TheSILModule;
     Module *TheASTModule;
-    TypeSubstitutionMap &Subs;
+    const TypeSubstitutionMap &Subs;
 
     ASTContext &getASTContext() { return TheSILModule.getASTContext(); }
 
   public:
     SILTypeSubstituter(SILModule &silModule, Module *astModule,
-                       TypeSubstitutionMap &subs)
+                       const TypeSubstitutionMap &subs)
       : TheSILModule(silModule), TheASTModule(astModule), Subs(subs)
     {}
 
@@ -2219,19 +2219,19 @@
 }
 
 SILType SILType::substType(SILModule &silModule, Module *astModule,
-                           TypeSubstitutionMap &subs, SILType SrcTy) {
+                           const TypeSubstitutionMap &subs, SILType SrcTy) {
   return SrcTy.subst(silModule, astModule, subs);
 }
 
 SILType SILType::subst(SILModule &silModule, Module *astModule,
-                       TypeSubstitutionMap &subs) const {
+                       const TypeSubstitutionMap &subs) const {
   SILTypeSubstituter STST(silModule, astModule, subs);
   return STST.subst(*this);
 }
 
 CanSILFunctionType SILType::substFuncType(SILModule &silModule,
                                           Module *astModule,
-                                          TypeSubstitutionMap &subs,
+                                          const TypeSubstitutionMap &subs,
                                           CanSILFunctionType SrcTy,
                                           bool dropGenerics) {
   SILTypeSubstituter STST(silModule, astModule, subs);
diff --git a/lib/SIL/SILInstruction.cpp b/lib/SIL/SILInstruction.cpp
index b31a53a..a4e30c0 100644
--- a/lib/SIL/SILInstruction.cpp
+++ b/lib/SIL/SILInstruction.cpp
@@ -680,8 +680,8 @@
   (!::std::is_same<BaseClass, GET_IMPLEMENTING_CLASS(DerivedClass, MemberName,\
                                                      ExpectedType)>::value)
 
-  class OpenedArchetypeOperandsAccessor
-      : public SILVisitor<OpenedArchetypeOperandsAccessor,
+  class TypeDependentOperandsAccessor
+      : public SILVisitor<TypeDependentOperandsAccessor,
                           ArrayRef<Operand>> {
   public:
 #define VALUE(CLASS, PARENT) \
@@ -690,16 +690,16 @@
     }
 #define INST(CLASS, PARENT, MEMBEHAVIOR, RELEASINGBEHAVIOR)                    \
     ArrayRef<Operand> visit##CLASS(const CLASS *I) {                           \
-      if (!IMPLEMENTS_METHOD(CLASS, SILInstruction, getOpenedArchetypeOperands, \
+      if (!IMPLEMENTS_METHOD(CLASS, SILInstruction, getTypeDependentOperands, \
                              ArrayRef<Operand>() const))                       \
         return {};                                                             \
-      return I->getOpenedArchetypeOperands();                                 \
+      return I->getTypeDependentOperands();                                 \
     }
 #include "swift/SIL/SILNodes.def"
   };
 
-  class OpenedArchetypeOperandsMutableAccessor
-    : public SILVisitor<OpenedArchetypeOperandsMutableAccessor,
+  class TypeDependentOperandsMutableAccessor
+    : public SILVisitor<TypeDependentOperandsMutableAccessor,
                         MutableArrayRef<Operand> > {
   public:
 #define VALUE(CLASS, PARENT) \
@@ -708,30 +708,13 @@
     }
 #define INST(CLASS, PARENT, MEMBEHAVIOR, RELEASINGBEHAVIOR)                    \
     MutableArrayRef<Operand> visit##CLASS(CLASS *I) {                          \
-      if (!IMPLEMENTS_METHOD(CLASS, SILInstruction, getOpenedArchetypeOperands, \
+      if (!IMPLEMENTS_METHOD(CLASS, SILInstruction, getTypeDependentOperands, \
                              MutableArrayRef<Operand>()))                      \
         return {};                                                             \
-      return I->getOpenedArchetypeOperands();                                 \
+      return I->getTypeDependentOperands();                                 \
     }
 #include "swift/SIL/SILNodes.def"
   };
-
-  class MayHaveOpenedArchetypeOperandsAccessor
-      : public SILVisitor<MayHaveOpenedArchetypeOperandsAccessor,
-                          bool> {
-  public:
-#define VALUE(CLASS, PARENT)                                                   \
-  bool visit##CLASS(const CLASS *I) {                                          \
-    llvm_unreachable("accessing non-instruction " #CLASS);                     \
-  }
-#define INST(CLASS, PARENT, MEMBEHAVIOR, RELEASINGBEHAVIOR)                    \
-  bool visit##CLASS(const CLASS *I) {                                          \
-    return IMPLEMENTS_METHOD(CLASS, SILInstruction,                            \
-                             getOpenedArchetypeOperands,                       \
-                             ArrayRef<Operand>() const);                       \
-  }
-#include "swift/SIL/SILNodes.def"
-  };
 } // end anonymous namespace
 
 ArrayRef<Operand> SILInstruction::getAllOperands() const {
@@ -742,18 +725,13 @@
   return AllOperandsMutableAccessor().visit(this);
 }
 
-ArrayRef<Operand> SILInstruction::getOpenedArchetypeOperands() const {
-  return OpenedArchetypeOperandsAccessor().visit(
+ArrayRef<Operand> SILInstruction::getTypeDependentOperands() const {
+  return TypeDependentOperandsAccessor().visit(
       const_cast<SILInstruction *>(this));
 }
 
-MutableArrayRef<Operand> SILInstruction::getOpenedArchetypeOperands() {
-  return OpenedArchetypeOperandsMutableAccessor().visit(this);
-}
-
-bool SILInstruction::mayHaveOpenedArchetypeOperands() const {
-  return MayHaveOpenedArchetypeOperandsAccessor().visit(
-      const_cast<SILInstruction *>(this));
+MutableArrayRef<Operand> SILInstruction::getTypeDependentOperands() {
+  return TypeDependentOperandsMutableAccessor().visit(this);
 }
 
 /// getOperandNumber - Return which operand this is in the operand list of the
diff --git a/lib/SIL/SILInstructions.cpp b/lib/SIL/SILInstructions.cpp
index e832fad..9251f97 100644
--- a/lib/SIL/SILInstructions.cpp
+++ b/lib/SIL/SILInstructions.cpp
@@ -35,9 +35,14 @@
 // \p openedArchetypes is being used as a set. We don't use a real set type here
 // for performance reasons.
 static void
-collectOpenedArchetypes(CanType Ty,
-                        SmallVectorImpl<CanType> &openedArchetypes) {
-  if (!Ty || !Ty->hasOpenedExistential())
+collectDependentTypeInfo(CanType Ty,
+                        SmallVectorImpl<CanType> &openedArchetypes,
+                        bool &hasDynamicSelf) {
+  if (!Ty)
+    return;
+  if (Ty->hasDynamicSelfType())
+    hasDynamicSelf = true;
+  if (!Ty->hasOpenedExistential())
     return;
   Ty.visit([&](Type t) {
     if (t->isOpenedExistential()) {
@@ -52,65 +57,47 @@
   });
 }
 
-// Collect used opened archetypes from the list of substitutions.
-static void
-collectOpenedArchetypes(ArrayRef<Substitution> subs,
-                        SmallVectorImpl<CanType> &openedArchetypes) {
-  openedArchetypes.clear();
-  for (auto sub : subs) {
-    auto Ty = sub.getReplacement().getCanonicalTypeOrNull();
-    collectOpenedArchetypes(Ty, openedArchetypes);
-  }
-}
-
 // Takes a set of open archetypes as input and produces a set of
 // references to open archetype definitions.
-static void collectOpenedArchetypeOperands(
+static void buildTypeDependentOperands(
     SmallVectorImpl<CanType> &OpenedArchetypes,
-    SmallVectorImpl<SILValue> &OpenedArchetypeOperands,
-    SILOpenedArchetypesState &OpenedArchetypesState, SILModule &Module) {
+    bool hasDynamicSelf,
+    SmallVectorImpl<SILValue> &TypeDependentOperands,
+    SILOpenedArchetypesState &OpenedArchetypesState, SILFunction &F) {
 
   for (auto archetype : OpenedArchetypes) {
     auto Def = OpenedArchetypesState.getOpenedArchetypeDef(
-        Module.Types.getLoweredType(archetype).getSwiftRValueType());
+        F.getModule().Types.getLoweredType(archetype).getSwiftRValueType());
     assert(getOpenedArchetypeOf(Def->getType().getSwiftRValueType()) &&
            "Opened archetype operands should be of an opened existential type");
-    OpenedArchetypeOperands.push_back(Def);
+    TypeDependentOperands.push_back(Def);
   }
+  if (hasDynamicSelf)
+    TypeDependentOperands.push_back(F.getSelfMetadataArgument());
 }
 
-// Collects all opened archetypes from a substitutions list
-// and form a corresponding list of opened archetype operands.
+// Collects all opened archetypes from a type and a substitutions list and form
+// a corresponding list of opened archetype operands.
 // We need to know the number of opened archetypes to estimate
 // the number of opened archetype operands for the instruction
 // being formed, because we need to reserve enough memory
 // for these operands.
-static void
-collectOpenedArchetypeOperands(
-    ArrayRef<Substitution> subs,
-    SmallVectorImpl<SILValue> &openedArchetypeOperands,
-    SILOpenedArchetypesState &OpenedArchetypesState,
-    SILModule &Module) {
+static void collectTypeDependentOperands(
+                      SmallVectorImpl<SILValue> &TypeDependentOperands,
+                      SILOpenedArchetypesState &OpenedArchetypesState,
+                      SILFunction &F,
+                      CanType Ty,
+                      ArrayRef<Substitution> subs = ArrayRef<Substitution>()) {
   SmallVector<CanType, 32> openedArchetypes;
-  collectOpenedArchetypes(subs, openedArchetypes);
-  collectOpenedArchetypeOperands(openedArchetypes, openedArchetypeOperands,
-                                 OpenedArchetypesState, Module);
-}
-
-// Collects all opened archetypes from a type and form a corresponding
-// list of opened archetype operands.
-// We need to know the number of opened archetypes to estimate
-// the number of opened archetype operands for the instruction
-// being formed, because we need to reserve enough memory
-// for these operands.
-static void collectOpenedArchetypeOperands(CanType Ty,
-                            SmallVectorImpl<SILValue> &openedArchetypeOperands,
-                            SILOpenedArchetypesState &OpenedArchetypesState,
-                            SILModule &Module) {
-  SmallVector<CanType, 32> openedArchetypes;
-  collectOpenedArchetypes(Ty, openedArchetypes);
-  collectOpenedArchetypeOperands(openedArchetypes, openedArchetypeOperands,
-                                 OpenedArchetypesState, Module);
+  bool hasDynamicSelf = false;
+  collectDependentTypeInfo(Ty, openedArchetypes, hasDynamicSelf);
+  for (auto sub : subs) {
+    auto ReplTy = sub.getReplacement().getCanonicalTypeOrNull();
+    collectDependentTypeInfo(ReplTy, openedArchetypes, hasDynamicSelf);
+  }
+  buildTypeDependentOperands(openedArchetypes, hasDynamicSelf,
+                                 TypeDependentOperands,
+                                 OpenedArchetypesState, F);
 }
 
 //===----------------------------------------------------------------------===//
@@ -138,15 +125,15 @@
 }
 
 AllocStackInst::AllocStackInst(SILDebugLocation Loc, SILType elementType,
-                               ArrayRef<SILValue> OpenedArchetypeOperands,
+                               ArrayRef<SILValue> TypeDependentOperands,
                                SILFunction &F,
                                SILDebugVariable Var)
     : AllocationInst(ValueKind::AllocStackInst, Loc,
                      elementType.getAddressType()),
-      NumOperands(OpenedArchetypeOperands.size()),
+      NumOperands(TypeDependentOperands.size()),
       VarInfo(Var, getTrailingObjects<char>()) {
   TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                         OpenedArchetypeOperands);
+                                         TypeDependentOperands);
 }
 
 AllocStackInst *
@@ -154,14 +141,13 @@
                        SILType elementType, SILFunction &F,
                        SILOpenedArchetypesState &OpenedArchetypes,
                        SILDebugVariable Var) {
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(elementType.getSwiftRValueType(),
-                                 OpenedArchetypeOperands,
-                                 OpenedArchetypes, F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               elementType.getSwiftRValueType());
   void *Buffer = allocateDebugVarCarryingInst<AllocStackInst>(
-      F.getModule(), Var, OpenedArchetypeOperands);
+      F.getModule(), Var, TypeDependentOperands);
   return ::new (Buffer)
-      AllocStackInst(Loc, elementType, OpenedArchetypeOperands, F, Var);
+      AllocStackInst(Loc, elementType, TypeDependentOperands, F, Var);
 }
 
 /// getDecl - Return the underlying variable declaration associated with this
@@ -172,34 +158,32 @@
 
 AllocRefInst::AllocRefInst(SILDebugLocation Loc, SILType elementType,
                            SILFunction &F, bool objc, bool canBeOnStack,
-                           ArrayRef<SILValue> OpenedArchetypeOperands)
+                           ArrayRef<SILValue> TypeDependentOperands)
     : AllocationInst(ValueKind::AllocRefInst, Loc, elementType),
       StackPromotable(canBeOnStack),
-      NumOperands(OpenedArchetypeOperands.size()), ObjC(objc) {
+      NumOperands(TypeDependentOperands.size()), ObjC(objc) {
   TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                         OpenedArchetypeOperands);
+                                         TypeDependentOperands);
 }
 
 AllocRefInst *AllocRefInst::create(SILDebugLocation Loc, SILType elementType,
                            SILFunction &F, bool objc, bool canBeOnStack,
                            SILOpenedArchetypesState &OpenedArchetypes) {
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(elementType.getSwiftRValueType(),
-                                 OpenedArchetypeOperands,
-                                 OpenedArchetypes, F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               elementType.getSwiftRValueType());
   void *Buffer = F.getModule().allocateInst(
-      sizeof(AllocRefInst) +
-          sizeof(Operand) * (OpenedArchetypeOperands.size()),
+      sizeof(AllocRefInst) + sizeof(Operand) * (TypeDependentOperands.size()),
       alignof(AllocRefInst));
   return ::new (Buffer) AllocRefInst(Loc, elementType, F, objc, canBeOnStack,
-                                     OpenedArchetypeOperands);
+                                     TypeDependentOperands);
 }
 
 AllocRefDynamicInst::AllocRefDynamicInst(
     SILDebugLocation DebugLoc, SILValue operand,
-    ArrayRef<SILValue> OpenedArchetypeOperands, SILType ty, bool objc)
-    : UnaryInstructionWithOpenArchetypesBase(DebugLoc, operand,
-                                             OpenedArchetypeOperands, ty),
+    ArrayRef<SILValue> TypeDependentOperands, SILType ty, bool objc)
+    : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, operand,
+                                                    TypeDependentOperands, ty),
       ObjC(objc) {
 }
 
@@ -208,42 +192,40 @@
                             SILType ty, bool objc,
                             SILFunction &F,
                             SILOpenedArchetypesState &OpenedArchetypes) {
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(ty.getSwiftRValueType(),
-                                 OpenedArchetypeOperands,
-                                 OpenedArchetypes, F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               ty.getSwiftRValueType());
   void *Buffer = F.getModule().allocateInst(
       sizeof(AllocRefDynamicInst) +
-          sizeof(Operand) * (OpenedArchetypeOperands.size() + 1),
+          sizeof(Operand) * (TypeDependentOperands.size() + 1),
       alignof(AllocRefDynamicInst));
   return ::new (Buffer)
-      AllocRefDynamicInst(DebugLoc, operand, OpenedArchetypeOperands, ty, objc);
+      AllocRefDynamicInst(DebugLoc, operand, TypeDependentOperands, ty, objc);
 }
 
 AllocBoxInst::AllocBoxInst(SILDebugLocation Loc, SILType ElementType,
-                           ArrayRef<SILValue> OpenedArchetypeOperands,
+                           ArrayRef<SILValue> TypeDependentOperands,
                            SILFunction &F, SILDebugVariable Var)
     : AllocationInst(ValueKind::AllocBoxInst, Loc,
                      SILType::getPrimitiveObjectType(
                        SILBoxType::get(ElementType.getSwiftRValueType()))),
-      NumOperands(OpenedArchetypeOperands.size()),
+      NumOperands(TypeDependentOperands.size()),
       VarInfo(Var, getTrailingObjects<char>()) {
   TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                         OpenedArchetypeOperands);
+                                         TypeDependentOperands);
 }
 
 AllocBoxInst *AllocBoxInst::create(SILDebugLocation Loc, SILType ElementType,
                                    SILFunction &F,
                                    SILOpenedArchetypesState &OpenedArchetypes,
                                    SILDebugVariable Var) {
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(ElementType.getSwiftRValueType(),
-                                 OpenedArchetypeOperands,
-                                 OpenedArchetypes, F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               ElementType.getSwiftRValueType());
   void *Buffer = allocateDebugVarCarryingInst<AllocBoxInst>(
-      F.getModule(), Var, OpenedArchetypeOperands);
+      F.getModule(), Var, TypeDependentOperands);
   return ::new (Buffer)
-      AllocBoxInst(Loc, ElementType, OpenedArchetypeOperands, F, Var);
+      AllocBoxInst(Loc, ElementType, TypeDependentOperands, F, Var);
 }
 
 /// getDecl - Return the underlying variable declaration associated with this
@@ -286,13 +268,13 @@
 AllocExistentialBoxInst::AllocExistentialBoxInst(
     SILDebugLocation Loc, SILType ExistentialType, CanType ConcreteType,
     ArrayRef<ProtocolConformanceRef> Conformances,
-    ArrayRef<SILValue> OpenedArchetypeOperands, SILFunction *Parent)
+    ArrayRef<SILValue> TypeDependentOperands, SILFunction *Parent)
     : AllocationInst(ValueKind::AllocExistentialBoxInst, Loc,
                      ExistentialType.getObjectType()),
-      NumOperands(OpenedArchetypeOperands.size()),
+      NumOperands(TypeDependentOperands.size()),
       ConcreteType(ConcreteType), Conformances(Conformances) {
   TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                         OpenedArchetypeOperands);
+                                         TypeDependentOperands);
 }
 
 static void declareWitnessTable(SILModule &Mod,
@@ -310,14 +292,13 @@
     ArrayRef<ProtocolConformanceRef> Conformances,
     SILFunction *F,
     SILOpenedArchetypesState &OpenedArchetypes) {
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(ConcreteType,
-                                 OpenedArchetypeOperands,
-                                 OpenedArchetypes, F->getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, *F,
+                               ConcreteType);
   SILModule &Mod = F->getModule();
   void *Buffer =
       Mod.allocateInst(sizeof(AllocExistentialBoxInst) +
-                           sizeof(Operand) * (OpenedArchetypeOperands.size()),
+                           sizeof(Operand) * (TypeDependentOperands.size()),
                        alignof(AllocExistentialBoxInst));
   for (ProtocolConformanceRef C : Conformances)
     declareWitnessTable(Mod, C);
@@ -325,31 +306,30 @@
                                                 ExistentialType,
                                                 ConcreteType,
                                                 Conformances,
-                                                OpenedArchetypeOperands,
+                                                TypeDependentOperands,
                                                 F);
 }
 
 AllocValueBufferInst::AllocValueBufferInst(
     SILDebugLocation DebugLoc, SILType valueType, SILValue operand,
-    ArrayRef<SILValue> OpenedArchetypeOperands)
-    : UnaryInstructionWithOpenArchetypesBase(DebugLoc, operand,
-                                             OpenedArchetypeOperands,
-                                             valueType.getAddressType()) {}
+    ArrayRef<SILValue> TypeDependentOperands)
+    : UnaryInstructionWithTypeDependentOperandsBase(DebugLoc, operand,
+                                                    TypeDependentOperands,
+                                                 valueType.getAddressType()) {}
 
 AllocValueBufferInst *
 AllocValueBufferInst::create(SILDebugLocation DebugLoc, SILType valueType,
                              SILValue operand, SILFunction &F,
                              SILOpenedArchetypesState &OpenedArchetypes) {
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(valueType.getSwiftRValueType(),
-                                 OpenedArchetypeOperands,
-                                 OpenedArchetypes, F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               valueType.getSwiftRValueType());
   void *Buffer = F.getModule().allocateInst(
       sizeof(AllocValueBufferInst) +
-          sizeof(Operand) * (OpenedArchetypeOperands.size() + 1),
+          sizeof(Operand) * (TypeDependentOperands.size() + 1),
       alignof(AllocValueBufferInst));
   return ::new (Buffer) AllocValueBufferInst(DebugLoc, valueType, operand,
-                                             OpenedArchetypeOperands);
+                                             TypeDependentOperands);
 }
 
 BuiltinInst *BuiltinInst::create(SILDebugLocation Loc, Identifier Name,
@@ -394,10 +374,10 @@
 ApplyInst::ApplyInst(SILDebugLocation Loc, SILValue Callee,
                      SILType SubstCalleeTy, SILType Result,
                      ArrayRef<Substitution> Subs,
-                     ArrayRef<SILValue> Args, ArrayRef<SILValue> OpenedArchetypeOperands,
+                     ArrayRef<SILValue> Args, ArrayRef<SILValue> TypeDependentOperands,
                      bool isNonThrowing)
     : ApplyInstBase(ValueKind::ApplyInst, Loc, Callee, SubstCalleeTy, Subs,
-                    Args, OpenedArchetypeOperands, Result) {
+                    Args, TypeDependentOperands, Result) {
   setNonThrowing(isNonThrowing);
 }
 
@@ -407,13 +387,13 @@
                              ArrayRef<SILValue> Args, bool isNonThrowing,
                              SILFunction &F,
                              SILOpenedArchetypesState &OpenedArchetypes) {
-  SmallVector<SILValue, 32> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(Subs, OpenedArchetypeOperands,
-                                 OpenedArchetypes, F.getModule());
-  void *Buffer = allocate(F, Subs, OpenedArchetypeOperands, Args);
+  SmallVector<SILValue, 32> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               SubstCalleeTy.getSwiftRValueType(), Subs);
+  void *Buffer = allocate(F, Subs, TypeDependentOperands, Args);
   return ::new(Buffer) ApplyInst(Loc, Callee, SubstCalleeTy,
                                  Result, Subs, Args,
-                                 OpenedArchetypeOperands, isNonThrowing);
+                                 TypeDependentOperands, isNonThrowing);
 }
 
 bool swift::doesApplyCalleeHaveSemantics(SILValue callee, StringRef semantics) {
@@ -431,14 +411,14 @@
                                    SILType SubstCalleeTy,
                                    ArrayRef<Substitution> Subs,
                                    ArrayRef<SILValue> Args,
-                                   ArrayRef<SILValue> OpenedArchetypeOperands,
+                                   ArrayRef<SILValue> TypeDependentOperands,
                                    SILType ClosureType)
     // FIXME: the callee should have a lowered SIL function type, and
     // PartialApplyInst
     // should derive the type of its result by partially applying the callee's
     // type.
     : ApplyInstBase(ValueKind::PartialApplyInst, Loc, Callee, SubstCalleeTy,
-                    Subs, Args, OpenedArchetypeOperands, ClosureType) {}
+                    Subs, Args, TypeDependentOperands, ClosureType) {}
 
 PartialApplyInst *
 PartialApplyInst::create(SILDebugLocation Loc, SILValue Callee,
@@ -446,13 +426,13 @@
                          ArrayRef<SILValue> Args, SILType ClosureType,
                          SILFunction &F,
                          SILOpenedArchetypesState &OpenedArchetypes) {
-  SmallVector<SILValue, 32> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(Subs, OpenedArchetypeOperands,
-                                 OpenedArchetypes, F.getModule());
-  void *Buffer = allocate(F, Subs, OpenedArchetypeOperands, Args);
+  SmallVector<SILValue, 32> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               SubstCalleeTy.getSwiftRValueType(), Subs);
+  void *Buffer = allocate(F, Subs, TypeDependentOperands, Args);
   return ::new(Buffer) PartialApplyInst(Loc, Callee, SubstCalleeTy,
                                         Subs, Args,
-                                        OpenedArchetypeOperands, ClosureType);
+                                        TypeDependentOperands, ClosureType);
 }
 
 TryApplyInstBase::TryApplyInstBase(ValueKind valueKind, SILDebugLocation Loc,
@@ -463,10 +443,10 @@
 TryApplyInst::TryApplyInst(SILDebugLocation Loc, SILValue callee,
                            SILType substCalleeTy, ArrayRef<Substitution> subs,
                            ArrayRef<SILValue> args,
-                           ArrayRef<SILValue> openedArchetypeOperands,
+                           ArrayRef<SILValue> TypeDependentOperands,
                            SILBasicBlock *normalBB, SILBasicBlock *errorBB)
     : ApplyInstBase(ValueKind::TryApplyInst, Loc, callee, substCalleeTy, subs,
-                    args, openedArchetypeOperands, normalBB, errorBB) {}
+                    args, TypeDependentOperands, normalBB, errorBB) {}
 
 
 TryApplyInst *TryApplyInst::create(SILDebugLocation Loc, SILValue callee,
@@ -476,12 +456,12 @@
                                    SILBasicBlock *normalBB,
                                    SILBasicBlock *errorBB, SILFunction &F,
                                 SILOpenedArchetypesState &OpenedArchetypes) {
-  SmallVector<SILValue, 32> openedArchetypeOperands;
-  collectOpenedArchetypeOperands(subs, openedArchetypeOperands,
-                                 OpenedArchetypes, F.getModule());
-  void *buffer = allocate(F, subs, openedArchetypeOperands, args);
+  SmallVector<SILValue, 32> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               substCalleeTy.getSwiftRValueType(), subs);
+  void *buffer = allocate(F, subs, TypeDependentOperands, args);
   return ::new (buffer) TryApplyInst(Loc, callee, substCalleeTy, subs, args,
-                                     openedArchetypeOperands,
+                                     TypeDependentOperands,
                                      normalBB, errorBB);
 }
 
@@ -697,27 +677,26 @@
 BindMemoryInst::create(SILDebugLocation Loc, SILValue Base, SILValue Index,
                        SILType BoundType, SILFunction &F,
                        SILOpenedArchetypesState &OpenedArchetypes) {
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(BoundType.getSwiftRValueType(),
-                                 OpenedArchetypeOperands,
-                                 OpenedArchetypes, F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               BoundType.getSwiftRValueType());
   void *Buffer = F.getModule().allocateInst(
       sizeof(BindMemoryInst) +
-          sizeof(Operand) * (OpenedArchetypeOperands.size() + NumFixedOpers),
+          sizeof(Operand) * (TypeDependentOperands.size() + NumFixedOpers),
       alignof(BindMemoryInst));
   return ::new (Buffer)
-    BindMemoryInst(Loc, Base, Index, BoundType, OpenedArchetypeOperands);
+    BindMemoryInst(Loc, Base, Index, BoundType, TypeDependentOperands);
 }
 
 BindMemoryInst::BindMemoryInst(SILDebugLocation Loc, SILValue Base,
                                SILValue Index,
                                SILType BoundType,
-                               ArrayRef<SILValue> OpenedArchetypeOperands)
+                               ArrayRef<SILValue> TypeDependentOperands)
   : SILInstruction(ValueKind::BindMemoryInst, Loc),
     BoundType(BoundType),
-    NumOperands(NumFixedOpers + OpenedArchetypeOperands.size()) {
+    NumOperands(NumFixedOpers + TypeDependentOperands.size()) {
   TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                         Base, Index, OpenedArchetypeOperands);
+                                         Base, Index, TypeDependentOperands);
 }
 
 UncheckedRefCastAddrInst::UncheckedRefCastAddrInst(SILDebugLocation Loc,
@@ -762,11 +741,11 @@
     : SILInstruction(ValueKind::TupleInst, Loc, Ty), Operands(this, Elems) {}
 
 MetatypeInst::MetatypeInst(SILDebugLocation Loc, SILType Metatype,
-                           ArrayRef<SILValue> OpenedArchetypeOperands)
+                           ArrayRef<SILValue> TypeDependentOperands)
     : SILInstruction(ValueKind::MetatypeInst, Loc, Metatype),
-      NumOperands(OpenedArchetypeOperands.size()) {
+      NumOperands(TypeDependentOperands.size()) {
   TrailingOperandsList::InitOperandsList(getAllOperands().begin(), this,
-                                         OpenedArchetypeOperands);
+                                         TypeDependentOperands);
 }
 
 bool TupleExtractInst::isTrivialEltOfOneRCIDTuple() const {
@@ -1461,17 +1440,35 @@
                           SILOpenedArchetypesState &OpenedArchetypes,
                           bool Volatile) {
   SILModule &Mod = F->getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(LookupType, OpenedArchetypeOperands,
-                                 OpenedArchetypes, F->getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, *F,
+                               LookupType);
   void *Buffer =
       Mod.allocateInst(sizeof(WitnessMethodInst) +
-                           sizeof(Operand) * OpenedArchetypeOperands.size(),
+                           sizeof(Operand) * TypeDependentOperands.size(),
                        alignof(WitnessMethodInst));
 
   declareWitnessTable(Mod, Conformance);
   return ::new (Buffer) WitnessMethodInst(Loc, LookupType, Conformance, Member,
-                                          Ty, OpenedArchetypeOperands, Volatile);
+                                          Ty, TypeDependentOperands, Volatile);
+}
+
+DynamicMethodInst *
+DynamicMethodInst::create(SILDebugLocation DebugLoc, SILValue Operand,
+                          SILDeclRef Member, SILType Ty, bool Volatile,
+                          SILFunction *F,
+                          SILOpenedArchetypesState &OpenedArchetypes) {
+  SILModule &Mod = F->getModule();
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, *F,
+                               Ty.getSwiftRValueType());
+
+  unsigned size =
+      totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
+  void *Buffer = Mod.allocateInst(size, alignof(DynamicMethodInst));
+  return ::new (Buffer) DynamicMethodInst(DebugLoc, Operand,
+                                          TypeDependentOperands,
+                                          Member, Ty, Volatile);
 }
 
 InitExistentialAddrInst *InitExistentialAddrInst::create(
@@ -1479,17 +1476,17 @@
     SILType ConcreteLoweredType, ArrayRef<ProtocolConformanceRef> Conformances,
     SILFunction *F, SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &Mod = F->getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(ConcreteType, OpenedArchetypeOperands,
-                                 OpenedArchetypes, F->getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, *F,
+                               ConcreteType);
   unsigned size =
-      totalSizeToAlloc<swift::Operand>(1 + OpenedArchetypeOperands.size());
+      totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
   void *Buffer = Mod.allocateInst(size,
                                   alignof(InitExistentialAddrInst));
   for (ProtocolConformanceRef C : Conformances)
     declareWitnessTable(Mod, C);
   return ::new (Buffer) InitExistentialAddrInst(Loc, Existential,
-                                                OpenedArchetypeOperands,
+                                                TypeDependentOperands,
                                                 ConcreteType,
                                                 ConcreteLoweredType,
                                                 Conformances);
@@ -1502,11 +1499,11 @@
                                SILFunction *F,
                                SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &Mod = F->getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(ConcreteType, OpenedArchetypeOperands,
-                                 OpenedArchetypes, F->getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, *F,
+                               ConcreteType);
   unsigned size =
-      totalSizeToAlloc<swift::Operand>(1 + OpenedArchetypeOperands.size());
+      totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
 
   void *Buffer = Mod.allocateInst(size,
                                   alignof(InitExistentialRefInst));
@@ -1516,17 +1513,17 @@
   return ::new (Buffer) InitExistentialRefInst(Loc, ExistentialType,
                                                ConcreteType,
                                                Instance,
-                                               OpenedArchetypeOperands,
+                                               TypeDependentOperands,
                                                Conformances);
 }
 
 InitExistentialMetatypeInst::InitExistentialMetatypeInst(
     SILDebugLocation Loc, SILType existentialMetatypeType, SILValue metatype,
-    ArrayRef<SILValue> OpenedArchetypeOperands,
+    ArrayRef<SILValue> TypeDependentOperands,
     ArrayRef<ProtocolConformanceRef> conformances)
-    : UnaryInstructionWithOpenArchetypesBase(Loc, metatype,
-                                             OpenedArchetypeOperands,
-                                             existentialMetatypeType),
+    : UnaryInstructionWithTypeDependentOperandsBase(Loc, metatype,
+                                                    TypeDependentOperands,
+                                                    existentialMetatypeType),
       NumConformances(conformances.size()) {
   std::uninitialized_copy(conformances.begin(), conformances.end(),
                           getTrailingObjects<ProtocolConformanceRef>());
@@ -1537,13 +1534,12 @@
     ArrayRef<ProtocolConformanceRef> conformances, SILFunction *F,
     SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &M = F->getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(existentialMetatypeType.getSwiftRValueType(),
-                                 OpenedArchetypeOperands,
-                                 OpenedArchetypes, M);
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, *F,
+                               existentialMetatypeType.getSwiftRValueType());
 
   unsigned size = totalSizeToAlloc<swift::Operand, ProtocolConformanceRef>(
-      1 + OpenedArchetypeOperands.size(), conformances.size());
+      1 + TypeDependentOperands.size(), conformances.size());
 
   void *buffer = M.allocateInst(size, alignof(InitExistentialMetatypeInst));
   for (ProtocolConformanceRef conformance : conformances)
@@ -1551,7 +1547,7 @@
 
   return ::new (buffer) InitExistentialMetatypeInst(
       Loc, existentialMetatypeType, metatype,
-      OpenedArchetypeOperands, conformances);
+      TypeDependentOperands, conformances);
 }
 
 ArrayRef<ProtocolConformanceRef>
@@ -1629,15 +1625,14 @@
                              SILType Ty, SILFunction &F,
                              SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &Mod = F.getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(Ty.getSwiftRValueType(),
-                                 OpenedArchetypeOperands, OpenedArchetypes,
-                                 F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               Ty.getSwiftRValueType());
   unsigned size =
-      totalSizeToAlloc<swift::Operand>(1 + OpenedArchetypeOperands.size());
+      totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
   void *Buffer = Mod.allocateInst(size, alignof(UncheckedRefCastInst));
   return ::new (Buffer) UncheckedRefCastInst(DebugLoc, Operand,
-                                             OpenedArchetypeOperands, Ty);
+                                             TypeDependentOperands, Ty);
 }
 
 UncheckedAddrCastInst *
@@ -1645,15 +1640,14 @@
                               SILType Ty, SILFunction &F,
                               SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &Mod = F.getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(Ty.getSwiftRValueType(),
-                                 OpenedArchetypeOperands, OpenedArchetypes,
-                                 F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               Ty.getSwiftRValueType());
   unsigned size =
-      totalSizeToAlloc<swift::Operand>(1 + OpenedArchetypeOperands.size());
+      totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
   void *Buffer = Mod.allocateInst(size, alignof(UncheckedAddrCastInst));
   return ::new (Buffer) UncheckedAddrCastInst(DebugLoc, Operand,
-                                              OpenedArchetypeOperands, Ty);
+                                              TypeDependentOperands, Ty);
 }
 
 UncheckedTrivialBitCastInst *
@@ -1661,15 +1655,14 @@
                               SILType Ty, SILFunction &F,
                               SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &Mod = F.getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(Ty.getSwiftRValueType(),
-                                 OpenedArchetypeOperands, OpenedArchetypes,
-                                 F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               Ty.getSwiftRValueType());
   unsigned size =
-      totalSizeToAlloc<swift::Operand>(1 + OpenedArchetypeOperands.size());
+      totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
   void *Buffer = Mod.allocateInst(size, alignof(UncheckedTrivialBitCastInst));
   return ::new (Buffer) UncheckedTrivialBitCastInst(DebugLoc, Operand,
-                                                    OpenedArchetypeOperands,
+                                                    TypeDependentOperands,
                                                     Ty);
 }
 
@@ -1678,30 +1671,28 @@
                                  SILType Ty, SILFunction &F,
                                  SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &Mod = F.getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(Ty.getSwiftRValueType(),
-                                 OpenedArchetypeOperands, OpenedArchetypes,
-                                 F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               Ty.getSwiftRValueType());
   unsigned size =
-      totalSizeToAlloc<swift::Operand>(1 + OpenedArchetypeOperands.size());
+      totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
   void *Buffer = Mod.allocateInst(size, alignof(UncheckedBitwiseCastInst));
   return ::new (Buffer) UncheckedBitwiseCastInst(DebugLoc, Operand,
-                                                 OpenedArchetypeOperands, Ty);
+                                                 TypeDependentOperands, Ty);
 }
 
 UnconditionalCheckedCastInst *UnconditionalCheckedCastInst::create(
     SILDebugLocation DebugLoc, SILValue Operand, SILType DestTy, SILFunction &F,
     SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &Mod = F.getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(DestTy.getSwiftRValueType(),
-                                 OpenedArchetypeOperands, OpenedArchetypes,
-                                 F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               DestTy.getSwiftRValueType());
   unsigned size =
-      totalSizeToAlloc<swift::Operand>(1 + OpenedArchetypeOperands.size());
+      totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
   void *Buffer = Mod.allocateInst(size, alignof(UnconditionalCheckedCastInst));
   return ::new (Buffer) UnconditionalCheckedCastInst(DebugLoc, Operand,
-                                                     OpenedArchetypeOperands, DestTy);
+                                                     TypeDependentOperands, DestTy);
 }
 
 CheckedCastBranchInst *CheckedCastBranchInst::create(
@@ -1709,15 +1700,14 @@
     SILBasicBlock *SuccessBB, SILBasicBlock *FailureBB, SILFunction &F,
     SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &Mod = F.getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(DestTy.getSwiftRValueType(),
-                                 OpenedArchetypeOperands, OpenedArchetypes,
-                                 F.getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, F,
+                               DestTy.getSwiftRValueType());
   unsigned size =
-      totalSizeToAlloc<swift::Operand>(1 + OpenedArchetypeOperands.size());
+      totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
   void *Buffer = Mod.allocateInst(size, alignof(CheckedCastBranchInst));
   return ::new (Buffer) CheckedCastBranchInst(DebugLoc, IsExact, Operand,
-                                              OpenedArchetypeOperands, DestTy,
+                                              TypeDependentOperands, DestTy,
                                               SuccessBB, FailureBB);
 }
 
@@ -1725,14 +1715,13 @@
                                    SILFunction *F,
                                    SILOpenedArchetypesState &OpenedArchetypes) {
   SILModule &Mod = F->getModule();
-  SmallVector<SILValue, 8> OpenedArchetypeOperands;
-  collectOpenedArchetypeOperands(getOpenedArchetypeOf(Ty.getSwiftRValueType()),
-                                 OpenedArchetypeOperands, OpenedArchetypes,
-                                 F->getModule());
+  SmallVector<SILValue, 8> TypeDependentOperands;
+  collectTypeDependentOperands(TypeDependentOperands, OpenedArchetypes, *F,
+                               Ty.castTo<MetatypeType>().getInstanceType());
   void *Buffer =
       Mod.allocateInst(sizeof(MetatypeInst) +
-                           sizeof(Operand) * OpenedArchetypeOperands.size(),
+                           sizeof(Operand) * TypeDependentOperands.size(),
                        alignof(MetatypeInst));
 
-  return ::new (Buffer) MetatypeInst(Loc, Ty, OpenedArchetypeOperands);
+  return ::new (Buffer) MetatypeInst(Loc, Ty, TypeDependentOperands);
 }
diff --git a/lib/SIL/SILOpenedArchetypesTracker.cpp b/lib/SIL/SILOpenedArchetypesTracker.cpp
index 73a343f..64931af 100644
--- a/lib/SIL/SILOpenedArchetypesTracker.cpp
+++ b/lib/SIL/SILOpenedArchetypesTracker.cpp
@@ -87,13 +87,11 @@
     const SILInstruction *I) {
   assert((!I->getParent() || I->getFunction() == &F) &&
          "Instruction does not belong to a proper SILFunction");
-  for (auto &Op : I->getOpenedArchetypeOperands()) {
+  for (auto &Op : I->getTypeDependentOperands()) {
     auto OpenedArchetypeDef = Op.get();
-    assert(isa<SILInstruction>(OpenedArchetypeDef) &&
-           "typedef operand should refer to a SILInstruction");
-    addOpenedArchetypeDef(
-        getOpenedArchetypeOf(cast<SILInstruction>(OpenedArchetypeDef)),
-        OpenedArchetypeDef);
+    if (auto *DefInst = dyn_cast<SILInstruction>(OpenedArchetypeDef)) {
+      addOpenedArchetypeDef(getOpenedArchetypeOf(DefInst), OpenedArchetypeDef);
+    }
   }
 }
 
diff --git a/lib/SIL/SILPrinter.cpp b/lib/SIL/SILPrinter.cpp
index c6f012d..ad3bb3e 100644
--- a/lib/SIL/SILPrinter.cpp
+++ b/lib/SIL/SILPrinter.cpp
@@ -546,20 +546,41 @@
   //===--------------------------------------------------------------------===//
   // SILInstruction Printing Logic
 
+  bool printTypeDependentOperands(SILInstruction *I) {
+    ArrayRef<Operand> TypeDepOps = I->getTypeDependentOperands();
+    if (TypeDepOps.empty())
+      return false;
+
+    PrintState.OS.PadToColumn(50);
+    *this << "// type-defs: ";
+    interleave(TypeDepOps,
+               [&](const Operand &op) { *this << getID(op.get()); },
+               [&] { *this << ", "; });
+    return true;
+  }
+
   /// Print out the users of the SILValue \p V. Return true if we printed out
   /// either an id or a use list. Return false otherwise.
-  bool printUsersOfSILValue(SILValue V) {
-    if (!V->hasValue()) {
+  bool printUsersOfSILValue(SILValue V, bool printedSlashes) {
+
+    if (V->hasValue() && V->use_empty())
+      return printedSlashes;
+
+    if (printedSlashes) {
+      *this << "; ";
+    } else {
       PrintState.OS.PadToColumn(50);
-      *this << "// id: " << getID(V);
+      *this << "// ";
+    }
+    if (!V->hasValue()) {
+      *this << "id: " << getID(V);
       return true;
     }
 
     if (V->use_empty())
-      return false;
+      return true;
 
-    PrintState.OS.PadToColumn(50);
-    *this << "// user";
+    *this << "user";
     if (std::next(V->use_begin()) != V->use_end())
       *this << 's';
     *this << ": ";
@@ -733,14 +754,16 @@
     // Print the value.
     visit(V);
 
+    bool printedSlashes = false;
     if (auto *I = dyn_cast<SILInstruction>(V)) {
       auto &SM = I->getModule().getASTContext().SourceMgr;
       printDebugLocRef(I->getLoc(), SM);
       printDebugScopeRef(I->getDebugScope(), SM);
+      printedSlashes = printTypeDependentOperands(I);
     }
 
     // Print users, or id for valueless instructions.
-    bool printedSlashes = printUsersOfSILValue(V);
+    printedSlashes = printUsersOfSILValue(V, printedSlashes);
 
     // Print SIL location.
     if (Ctx.printVerbose()) {
@@ -1320,9 +1343,9 @@
     if (WMI->isVolatile())
       *this << "[volatile] ";
     *this << "$" << WMI->getLookupType() << ", " << WMI->getMember();
-    if (!WMI->getOpenedArchetypeOperands().empty()) {
+    if (!WMI->getTypeDependentOperands().empty()) {
       *this << ", ";
-      *this << getIDAndType(WMI->getOpenedArchetypeOperands()[0].get());
+      *this << getIDAndType(WMI->getTypeDependentOperands()[0].get());
     }
     *this << " : " << WMI->getType();
   }
@@ -1775,7 +1798,7 @@
   llvm::SmallString<16> disambiguatedNameBuf;
   unsigned disambiguatedNameCounter = 1;
   while (params) {
-    for (ArchetypeType *param : params->getPrimaryArchetypes()) {
+    for (GenericTypeParamDecl *param : params->getParams()) {
       Identifier name = param->getName();
       while (!UsedNames.insert(name).second) {
         disambiguatedNameBuf.clear();
@@ -1786,7 +1809,7 @@
         name = getASTContext().getIdentifier(disambiguatedNameBuf);
       }
       if (name != param->getName())
-        Aliases[CanType(param)] = name;
+        Aliases[CanType(param->getArchetype())] = name;
     }
     
     params = params->getOuterParameters();
diff --git a/lib/SIL/SILType.cpp b/lib/SIL/SILType.cpp
index 932749a..f7ae562 100644
--- a/lib/SIL/SILType.cpp
+++ b/lib/SIL/SILType.cpp
@@ -72,7 +72,7 @@
 
 bool SILType::isNoReturnFunction() const {
   if (auto funcTy = dyn_cast<SILFunctionType>(getSwiftRValueType()))
-    return funcTy->getSILResult().getSwiftRValueType()->isNever();
+    return funcTy->getSILResult().getSwiftRValueType()->isUninhabited();
 
   return false;
 }
diff --git a/lib/SIL/SILVerifier.cpp b/lib/SIL/SILVerifier.cpp
index b941256..9b9e892 100644
--- a/lib/SIL/SILVerifier.cpp
+++ b/lib/SIL/SILVerifier.cpp
@@ -49,27 +49,27 @@
 // prevent release builds from triggering spurious unused variable warnings.
 #ifndef NDEBUG
 
-/// Returns true if A is an opened existential type, Self, or is equal to an
-/// archetype in F's nested archetype list.
-///
-/// FIXME: Once Self has been removed in favor of opened existential types
-/// everywhere, remove support for self.
+/// Returns true if A is an opened existential type or is equal to an
+/// archetype from F's generic context.
 static bool isArchetypeValidInFunction(ArchetypeType *A, SILFunction *F) {
-  // The only two cases where an archetype is always legal in a function is if
-  // it is self or if it is from an opened existential type. Currently, Self is
-  // being migrated away from in favor of opened existential types, so we should
-  // remove the special case here for Self when that process is completed.
-  //
-  // *NOTE* Associated types of self are not valid here.
-  if (!A->getOpenedExistentialType().isNull() || A->getSelfProtocol())
+  if (!A->getOpenedExistentialType().isNull())
     return true;
 
-  // Ok, we have an archetype, make sure it is in the nested archetypes of our
-  // caller.
-  for (auto Iter : F->getContextGenericParams()->getAllNestedArchetypes())
-    if (A->isEqual(&*Iter))
-      return true;
-  return A->getIsRecursive();
+  // Find the primary archetype.
+  A = A->getPrimary();
+
+  // Ok, we have a primary archetype, make sure it is in the nested generic
+  // parameters of our caller.
+  for (auto *params = F->getContextGenericParams();
+       params != nullptr;
+       params = params->getOuterParameters()) {
+
+    for (auto param : params->getParams())
+      if (param->getArchetype()->isEqual(A))
+        return true;
+  }
+
+  return false;
 }
 
 namespace {
@@ -517,7 +517,7 @@
               "instruction's operand's owner isn't the instruction");
       require(isInValueUses(&operand), "operand value isn't used by operand");
 
-      if (I->isOpenedArchetypeOperand(operand)) {
+      if (I->isTypeDependentOperand(operand)) {
         require(isa<SILInstruction>(I),
                "opened archetype operand should refer to a SILInstruction");
       }
@@ -698,18 +698,18 @@
     return fnTy->substGenericArgs(F.getModule(), M, subs);
   }
 
-  /// Check that for each opened archetype in substitutions, there is an
-  /// opened archetype operand.
-  void checkApplySubstitutionsOpenedArchetypes(SILInstruction *AI,
-                                               ArrayRef<Substitution> Subs) {
-    // If we have a substitution whose replacement type is an archetype, make
-    // sure that the replacement archetype is in the context generic params of
-    // the caller function.
+  /// Check that for each opened archetype or dynamic self type in substitutions
+  /// or the calle type, there is a type dependent operand.
+  void checkApplyTypeDependentArguments(ApplySite AS) {
+    SILInstruction *AI = AS.getInstruction();
+
     llvm::DenseSet<CanType> FoundOpenedArchetypes;
-    for (auto &Sub : Subs) {
-      Sub.getReplacement().visit([&](Type Ty) {
-        if (!Ty->isOpenedExistential())
-          return;
+    unsigned hasDynamicSelf = 0;
+
+    // Function to collect opened archetypes in FoundOpenedArchetypes and set
+    // hasDynamicSelf.
+    auto HandleType = [&](Type Ty) {
+      if (Ty->isOpenedExistential()) {
         auto *A = Ty->getAs<ArchetypeType>();
         require(isArchetypeValidInFunction(A, AI->getFunction()),
                 "Archetype to be substituted must be valid in function.");
@@ -718,35 +718,54 @@
         // Also check that they are properly tracked inside the current
         // function.
         auto Def =
-            OpenedArchetypes.getOpenedArchetypeDef(Ty.getCanonicalTypeOrNull());
+          OpenedArchetypes.getOpenedArchetypeDef(Ty.getCanonicalTypeOrNull());
         require(Def, "Opened archetype should be registered in SILFunction");
         require(Def == AI ||
-                    Dominance->properlyDominates(cast<SILInstruction>(Def), AI),
+                Dominance->properlyDominates(cast<SILInstruction>(Def), AI),
                 "Use of an opened archetype should be dominated by a "
                 "definition of this opened archetype");
-      });
+      }
+      if (Ty->hasDynamicSelfType()) {
+        hasDynamicSelf = 1;
+      }
+    };
+
+    // Search for opened archetypes and dynamic self.
+    for (auto &Sub : AS.getSubstitutions()) {
+      Sub.getReplacement().visit(HandleType);
     }
+    AS.getSubstCalleeType().visit(HandleType);
 
-    require(FoundOpenedArchetypes.size() ==
-                AI->getOpenedArchetypeOperands().size(),
-            "Number of opened archetypes in the substitutions list should "
-            "match the number of opened archetype operands");
+    require(FoundOpenedArchetypes.size() + hasDynamicSelf ==
+                AI->getTypeDependentOperands().size(),
+            "Number of opened archetypes and dynamic self in the substitutions "
+            "list should match the number of type dependent operands");
 
-    for (auto &Op : AI->getOpenedArchetypeOperands()) {
+    for (auto &Op : AI->getTypeDependentOperands()) {
       auto V = Op.get();
-      require(isa<SILInstruction>(V),
-             "opened archetype operand should refer to a SIL instruction");
-      auto Archetype = getOpenedArchetypeOf(cast<SILInstruction>(V));
-      require(Archetype, "opened archetype operand should define an opened archetype");
-      require(FoundOpenedArchetypes.count(Archetype),
-              "opened archetype operand does not correspond to any opened archetype from "
-              "the substitutions list");
+      if (isa<SILArgument>(V)) {
+        require(hasDynamicSelf,
+                "dynamic self operand without dynamic self type");
+        require(AI->getFunction()->hasSelfMetadataParam(),
+                "self metadata operand in function without self metadata param");
+        require((ValueBase *)V == AI->getFunction()->getSelfMetadataArgument(),
+                "wrong self metadata operand");
+      } else {
+        require(isa<SILInstruction>(V),
+                "opened archetype operand should refer to a SIL instruction");
+        auto Archetype = getOpenedArchetypeOf(cast<SILInstruction>(V));
+        require(Archetype,
+                "opened archetype operand should define an opened archetype");
+        require(FoundOpenedArchetypes.count(Archetype),
+                "opened archetype operand does not correspond to any opened "
+                "archetype from the substitutions list");
+      }
     }
   }
 
   void checkFullApplySite(FullApplySite site) {
-    checkApplySubstitutionsOpenedArchetypes(site.getInstruction(),
-                                            site.getSubstitutions());
+    checkApplyTypeDependentArguments(site);
+
     // Then make sure that we have a type that can be substituted for the
     // callee.
     auto substTy = checkApplySubstitutions(site.getSubstitutions(),
@@ -866,7 +885,7 @@
     require(resultInfo->getExtInfo().hasContext(),
             "result of closure cannot have a thin function type");
 
-    checkApplySubstitutionsOpenedArchetypes(PAI, PAI->getSubstitutions());
+    checkApplyTypeDependentArguments(PAI);
 
     auto substTy = checkApplySubstitutions(PAI->getSubstitutions(),
                                         PAI->getCallee()->getType());
@@ -1429,9 +1448,10 @@
   void checkMetatypeInst(MetatypeInst *MI) {
     require(MI->getType().is<MetatypeType>(),
             "metatype instruction must be of metatype type");
-    require(MI->getType().castTo<MetatypeType>()->hasRepresentation(),
+    auto MetaTy = MI->getType().castTo<MetatypeType>();
+    require(MetaTy->hasRepresentation(),
             "metatype instruction must have a metatype representation");
-    verifyOpenedArchetype(MI, MI->getType().getSwiftRValueType());
+    verifyOpenedArchetype(MI, MetaTy.getInstanceType());
   }
   void checkValueMetatypeInst(ValueMetatypeInst *MI) {
     require(MI->getType().is<MetatypeType>(),
@@ -1702,11 +1722,11 @@
 
     auto lookupType = AMI->getLookupType();
     if (getOpenedArchetype(lookupType)) {
-      require(AMI->getOpenedArchetypeOperands().size() == 1,
-              "Must have an opened existential operand");
+      require(AMI->getTypeDependentOperands().size() == 1,
+              "Must have a type dependent operand for the opened archetype");
       verifyOpenedArchetype(AMI, lookupType);
     } else {
-      require(AMI->getOpenedArchetypeOperands().empty(),
+      require(AMI->getTypeDependentOperands().empty(),
               "Should not have an operand for the opened existential");
     }
     if (isa<ArchetypeType>(lookupType) || lookupType->isAnyExistentialType()) {
@@ -1737,9 +1757,11 @@
     auto methodTy = constantInfo.SILFnType;
 
     // Map interface types to archetypes.
-    if (auto *params = constantInfo.ContextGenericParams)
-      methodTy = methodTy->substGenericArgs(F.getModule(), M,
-                                            params->getForwardingSubstitutions(C));
+    if (auto *params = constantInfo.ContextGenericParams) {
+      auto sig = constantInfo.SILFnType->getGenericSignature();
+      auto subs = params->getForwardingSubstitutions(sig);
+      methodTy = methodTy->substGenericArgs(F.getModule(), M, subs);
+    }
     assert(!methodTy->isPolymorphic());
 
     // Replace Self parameter with type of 'self' at the call site.
@@ -1793,6 +1815,7 @@
               .getSwiftRValueType()
               ->isBindableTo(EMI->getType().getSwiftRValueType(), nullptr),
             "result must be of the method's type");
+    verifyOpenedArchetype(EMI, EMI->getType().getSwiftRValueType());
   }
 
   void checkClassMethodInst(ClassMethodInst *CMI) {
@@ -2075,18 +2098,18 @@
     SILType resultType = I->getType();
     require(resultType.is<ExistentialMetatypeType>(),
             "init_existential_metatype result must be an existential metatype");
+    auto MetaTy = resultType.castTo<ExistentialMetatypeType>();
     require(resultType.isObject(),
             "init_existential_metatype result must not be an address");
-    require(resultType.castTo<ExistentialMetatypeType>()->hasRepresentation(),
+    require(MetaTy->hasRepresentation(),
             "init_existential_metatype result must have a representation");
-    require(resultType.castTo<ExistentialMetatypeType>()->getRepresentation()
+    require(MetaTy->getRepresentation()
               == operandType.castTo<MetatypeType>()->getRepresentation(),
             "init_existential_metatype result must match representation of "
             "operand");
 
     checkExistentialProtocolConformances(resultType, I->getConformances());
-    verifyOpenedArchetype(
-        I, getOpenedArchetypeOf(I->getType().getSwiftRValueType()));
+    verifyOpenedArchetype(I, MetaTy.getInstanceType());
   }
 
   void checkExistentialProtocolConformances(SILType resultType,
@@ -2166,30 +2189,31 @@
     verifyOpenedArchetype(CI, CI->getType().getSwiftRValueType());
   }
 
-  /// Verify if a given type is an opened archetype.
-  /// If this is the case, verify that the provided instruction has an
-  /// opened archetype parameter for it.
+  /// Verify if a given type is or contains an opened archetype or dynamic self.
+  /// If this is the case, verify that the provided instruction has a type
+  /// dependent operand for it.
   void verifyOpenedArchetype(SILInstruction *I, CanType Ty) {
     if (!Ty)
       return;
-    // Check for each referenced opened archetype from Ty
-    // that the instruction contains an opened archetype operand
-    // for it.
+    // Check the type and all of its contained types.
     Ty.visit([&](Type t) {
-      if (!t->isOpenedExistential())
+      SILValue Def;
+      if (t->isOpenedExistential()) {
+        Def = OpenedArchetypes.getOpenedArchetypeDef(t);
+        require(Def, "Opened archetype should be registered in SILFunction");
+      } else if (t->hasDynamicSelfType()) {
+        require(I->getFunction()->hasSelfParam(),
+              "Function containing dynamic self type must have self parameter");
+        Def = I->getFunction()->getSelfArgument();
+      } else {
         return;
-      auto Def = OpenedArchetypes.getOpenedArchetypeDef(t);
-      require(Def, "Opened archetype should be registered in SILFunction");
-      bool found = false;
-      for (auto &TypeDefOp : I->getOpenedArchetypeOperands()) {
-        if (TypeDefOp.get() == Def) {
-          found = true;
-          break;
-        }
       }
-      require(found,
-              "Instruction should contain an opened archetype operand for "
-              "every used open archetype");
+      for (auto &TypeDefOp : I->getTypeDependentOperands()) {
+        if (TypeDefOp.get() == Def)
+          return;
+      }
+      require(false, "Instruction should contain a type dependent operand for "
+                     "every used open archetype or dynamic self");
     });
   }
 
diff --git a/lib/SILGen/SILGen.cpp b/lib/SILGen/SILGen.cpp
index 8157b64..43d637f 100644
--- a/lib/SILGen/SILGen.cpp
+++ b/lib/SILGen/SILGen.cpp
@@ -319,15 +319,13 @@
   return found;
 }
 
-ProtocolConformance *
+Optional<ProtocolConformanceRef>
 SILGenModule::getConformanceToBridgedStoredNSError(SILLocation loc, Type type) {
   auto proto = getBridgedStoredNSError(loc);
-  if (!proto) return nullptr;
+  if (!proto) return None;
 
   // Find the conformance to _BridgedStoredNSError.
-  auto result = SwiftModule->lookupConformance(type, proto, nullptr);
-  if (result) return result->getConcrete();
-  return nullptr;
+  return SwiftModule->lookupConformance(type, proto, nullptr);
 }
 
 ProtocolConformance *SILGenModule::getNSErrorConformanceToError() {
diff --git a/lib/SILGen/SILGen.h b/lib/SILGen/SILGen.h
index dacc8be..e019161 100644
--- a/lib/SILGen/SILGen.h
+++ b/lib/SILGen/SILGen.h
@@ -393,8 +393,8 @@
 
   /// Find the conformance of the given Swift type to the
   /// _BridgedStoredNSError protocol.
-  ProtocolConformance *getConformanceToBridgedStoredNSError(SILLocation loc,
-                                                            Type type);
+  Optional<ProtocolConformanceRef>
+  getConformanceToBridgedStoredNSError(SILLocation loc, Type type);
 
   /// Retrieve the conformance of NSError to the Error protocol.
   ProtocolConformance *getNSErrorConformanceToError();
diff --git a/lib/SILGen/SILGenBridging.cpp b/lib/SILGen/SILGenBridging.cpp
index 835176c..ce9c2bf 100644
--- a/lib/SILGen/SILGenBridging.cpp
+++ b/lib/SILGen/SILGenBridging.cpp
@@ -66,7 +66,7 @@
           gen.SGM.SwiftModule, nullptr);
 
   if (!substitutions.empty()) {
-    // Substitute into the witness function tye.
+    // Substitute into the witness function type.
     witnessFnTy = witnessFnTy.substGenericArgs(gen.SGM.M, substitutions);
   }
 
@@ -451,12 +451,9 @@
 
   // Fall back to dynamic Any-to-id bridging.
   // The destination type should be AnyObject in this case.
-  //
-  // TODO: Should only get here if -enable-id-as-any is active.
-  assert(gen.getASTContext().LangOpts.EnableIdAsAny
-         && loweredBridgedTy->isEqual(
-              gen.getASTContext().getProtocol(KnownProtocolKind::AnyObject)
-                ->getDeclaredType()));
+  assert(loweredBridgedTy->isEqual(
+           gen.getASTContext().getProtocol(KnownProtocolKind::AnyObject)
+             ->getDeclaredType()));
 
   // If the input argument is known to be an existential, save the runtime
   // some work by opening it.
@@ -465,7 +462,7 @@
     
     auto openedExistential = gen.emitOpenExistential(loc, v, openedTy,
                                                  gen.getLoweredType(openedTy));
-    v = openedExistential.Value;
+    v = gen.manageOpaqueValue(openedExistential, loc, SGFContext());
     loweredNativeTy = openedTy;
   }
 
@@ -704,20 +701,25 @@
       gen.getASTContext().getProtocol(KnownProtocolKind::AnyObject)
         ->getDeclaredType())
       && "Any should bridge to AnyObject");
-    
-    // Open the type of the reference and use it to build an Any.
-    auto openedTy = ArchetypeType::getOpened(loweredBridgedTy);
-    auto openedSILTy = SILType::getPrimitiveObjectType(openedTy);
+
     // TODO: Ever need to handle +0 values here?
     assert(v.hasCleanup());
-    auto opened = gen.B.createOpenExistentialRef(loc, v.forward(gen),
-                                                 openedSILTy);
-    auto result = gen.emitTemporaryAllocation(loc, nativeTy);
-    auto resultVal = gen.B.createInitExistentialAddr(loc, result,
-                                                     openedTy, openedSILTy,
-                                                     {});
-    gen.B.createStore(loc, opened, resultVal);
-    return gen.emitManagedRValueWithCleanup(result);
+
+    // Use a runtime call to bridge the AnyObject to Any. We do this instead of
+    // a simple AnyObject-to-Any upcast because the ObjC API may have returned
+    // a null object in spite of its annotation.
+    
+    // Bitcast to Optional. This provides a barrier to the optimizer to prevent
+    // it from attempting to eliminate null checks.
+    auto optionalBridgedTy = OptionalType::get(loweredBridgedTy)
+      ->getCanonicalType();
+    auto optionalV = gen.B.createUncheckedBitCast(loc, v.getValue(),
+                          SILType::getPrimitiveObjectType(optionalBridgedTy));
+    auto optionalMV = ManagedValue(optionalV, v.getCleanup());
+    return gen.emitApplyOfLibraryIntrinsic(loc,
+                           gen.getASTContext().getBridgeAnyObjectToAny(nullptr),
+                           {}, optionalMV, SGFContext())
+      .getAsSingleValue(gen, loc);
   }
 
   return v;
@@ -738,20 +740,29 @@
   llvm_unreachable("bad CC");
 }
 
-/// Bridge an optional foreign error type to Error.
+/// Bridge a possibly-optional foreign error type to Error.
 ManagedValue SILGenFunction::emitBridgedToNativeError(SILLocation loc,
                                                   ManagedValue bridgedError) {
-  // If the incoming error is non-optional, inject it into an optional.
-  Type bridgedErrorTy = bridgedError.getType().getSwiftRValueType();
-  if (!bridgedErrorTy->getAnyOptionalObjectType()) {
-    SILType loweredOptErrorTy =
-        SGM.getLoweredType(OptionalType::get(bridgedErrorTy));
-    auto *someDecl = getASTContext().getOptionalSomeDecl();
-    auto *enumInst = B.createEnum(loc, bridgedError.getValue(), someDecl,
-                                  loweredOptErrorTy);
-    bridgedError = ManagedValue(enumInst, bridgedError.getCleanup());
+  // If the incoming error is non-optional, just do an existential erasure.
+  CanType bridgedErrorTy = bridgedError.getType().getSwiftRValueType();
+  if (!bridgedErrorTy.getAnyOptionalObjectType()) {
+    auto nativeErrorTy = SILType::getExceptionType(getASTContext());
+
+    auto conformance = SGM.getNSErrorConformanceToError();
+    if (!conformance) return emitUndef(loc, nativeErrorTy);
+    ProtocolConformanceRef conformanceArray[] = {
+      ProtocolConformanceRef(conformance)
+    };
+    auto conformances = getASTContext().AllocateCopy(conformanceArray);
+
+    SILValue nativeError =
+      B.createInitExistentialRef(loc, nativeErrorTy, bridgedErrorTy,
+                                 bridgedError.forward(*this), conformances);
+    return emitManagedRValueWithCleanup(nativeError);
   }
 
+  // Otherwise, we need to call a runtime function to potential substitute
+  // a standard error for a nil NSError.
   auto bridgeFn = emitGlobalFunctionRef(loc, SGM.getNSErrorToErrorFn());
   auto bridgeFnType = bridgeFn->getType().castTo<SILFunctionType>();
   assert(bridgeFnType->getNumAllResults() == 1);
@@ -948,6 +959,9 @@
     SGM.M, SGM.M.getSwiftModule(), subs);
   SILType substSILTy = SILType::getPrimitiveObjectType(substTy);
   
+  // Use the same context generic params as the native entry point.
+  F.setContextGenericParams(nativeInfo.ContextGenericParams);
+
   auto loc = thunk.getAsRegularLocation();
   loc.markAutoGenerated();
   Scope scope(Cleanups, CleanupLocation::get(loc));
@@ -1107,6 +1121,9 @@
   auto nativeFnTy = F.getLoweredFunctionType();
   assert(nativeFnTy == nativeCI.SILFnType);
 
+  // Use the same context generic params as the native entry point.
+  F.setContextGenericParams(nativeCI.ContextGenericParams);
+  
   // Find the foreign error convention and 'self' parameter index.
   Optional<ForeignErrorConvention> foreignError;
   if (nativeFnTy->hasErrorResult()) {
diff --git a/lib/SILGen/SILGenConstructor.cpp b/lib/SILGen/SILGenConstructor.cpp
index de9f5db..55559e4 100644
--- a/lib/SILGen/SILGenConstructor.cpp
+++ b/lib/SILGen/SILGenConstructor.cpp
@@ -491,9 +491,10 @@
   ArrayRef<Substitution> subs;
   // Call the initializer.
   ArrayRef<Substitution> forwardingSubs;
-  if (auto *genericParamList = ctor->getGenericParamsOfContext())
-    forwardingSubs =
-        genericParamList->getForwardingSubstitutions(getASTContext());
+  if (auto *genericParamList = ctor->getGenericParamsOfContext()) {
+    auto *genericSig = ctor->getGenericSignatureOfContext();
+    forwardingSubs = genericParamList->getForwardingSubstitutions(genericSig);
+  }
   std::tie(initVal, initTy, subs)
     = emitSiblingMethodRef(Loc, selfValue, initConstant, forwardingSubs);
 
@@ -871,8 +872,10 @@
         // Get the substitutions for the constructor context.
         ArrayRef<Substitution> subs;
         auto *genericParams = dc->getGenericParamsOfContext();
-        if (genericParams)
-          subs = genericParams->getForwardingSubstitutions(getASTContext());
+        if (genericParams) {
+          auto *genericSig = dc->getGenericSignatureOfContext();
+          subs = genericParams->getForwardingSubstitutions(genericSig);
+        }
 
         // Get the type of the initialization result, in terms
         // of the constructor context's archetypes.
diff --git a/lib/SILGen/SILGenConvert.cpp b/lib/SILGen/SILGenConvert.cpp
index 3ab4dd3..0343f6c 100644
--- a/lib/SILGen/SILGenConvert.cpp
+++ b/lib/SILGen/SILGenConvert.cpp
@@ -459,147 +459,145 @@
   // If we're erasing to the 'Error' type, we might be able to get an NSError
   // representation more efficiently.
   auto &ctx = getASTContext();
-  auto nsError = ctx.getNSErrorDecl();
-  if (allowEmbeddedNSError && nsError &&
-      existentialTL.getSemanticType().getSwiftRValueType()->getAnyNominal() ==
-        ctx.getErrorDecl()) {
-    // Check whether the concrete type conforms to the _BridgedStoredNSError
-    // protocol. In that case, call the _nsError witness getter to extract the
-    // NSError directly.
-    auto conformance =
-      SGM.getConformanceToBridgedStoredNSError(loc, concreteFormalType);
+  if (ctx.LangOpts.EnableObjCInterop && conformances.size() == 1 &&
+      conformances[0].getRequirement() == ctx.getErrorDecl() &&
+      ctx.getNSErrorDecl()) {
+    auto nsErrorDecl = ctx.getNSErrorDecl();
 
-    CanType nsErrorType =
-      nsError->getDeclaredInterfaceType()->getCanonicalType();
-
-    ProtocolConformanceRef nsErrorConformances[1] = {
-      ProtocolConformanceRef(SGM.getNSErrorConformanceToError())
-    };
-
-    if (conformance && nsError && SGM.getNSErrorConformanceToError()) {
-      if (auto witness =
-            conformance->getWitness(SGM.getNSErrorRequirement(loc), nullptr)) {
-        // Create a reference to the getter witness.
-        SILDeclRef getter =
-          getGetterDeclRef(cast<VarDecl>(witness.getDecl()),
-                           /*isDirectAccessorUse=*/true);
-        
-        // Compute the substitutions.
-        ArrayRef<Substitution> substitutions =
-          concreteFormalType->gatherAllSubstitutions(
-          SGM.SwiftModule, nullptr);
-
-        // Emit the erasure, through the getter to _nsError.
-        return emitExistentialErasure(
-            loc, nsErrorType,
-            getTypeLowering(nsErrorType),
-            existentialTL,
-            ctx.AllocateCopy(nsErrorConformances),
-            C,
-            [&](SGFContext innerC) -> ManagedValue {
-              // Call the getter.
-              return emitGetAccessor(loc, getter, substitutions,
-                                     ArgumentSource(loc,
-                                                    RValue(*this, loc,
-                                                           concreteFormalType,
-                                                           F(SGFContext()))),
-                                     /*isSuper=*/false,
-                                     /*isDirectAccessorUse=*/true,
-                                     RValue(), innerC)
-                .getAsSingleValue(*this, loc);
-            });
+    // If the concrete type is NSError or a subclass thereof, just erase it
+    // directly.
+    auto nsErrorType = nsErrorDecl->getDeclaredType()->getCanonicalType();
+    if (nsErrorType->isExactSuperclassOf(concreteFormalType, nullptr)) {
+      ManagedValue nsError =  F(SGFContext());
+      if (nsErrorType != concreteFormalType) {
+        nsError = ManagedValue(B.createUpcast(loc, nsError.getValue(),
+                                              getLoweredType(nsErrorType)),
+                               nsError.getCleanup());
       }
+      return emitBridgedToNativeError(loc, nsError);
     }
 
-    // Check whether the concrete type is an archetype. If so, call the
-    // _getEmbeddedNSError() witness to try to dig out the embedded NSError.
-    if (auto archetypeType = concreteFormalType->getAs<ArchetypeType>()) {
-      if (std::find(archetypeType->getConformsTo().begin(),
-                       archetypeType->getConformsTo().end(),
-                       ctx.getErrorDecl())
-            != archetypeType->getConformsTo().end()) {
-        auto contBB = createBasicBlock();
-        auto isNotPresentBB = createBasicBlock();
-        auto isPresentBB = createBasicBlock();
+    // If the concrete type is known to conform to _BridgedStoredNSError,
+    // call the _nsError witness getter to extract the NSError directly,
+    // then just erase the NSError.
+    if (auto storedNSErrorConformance =
+          SGM.getConformanceToBridgedStoredNSError(loc, concreteFormalType)) {
+      auto nsErrorVar = SGM.getNSErrorRequirement(loc);
+      if (!nsErrorVar) return emitUndef(loc, existentialTL.getLoweredType());
 
-        SILValue existentialResult =
-          contBB->createBBArg(existentialTL.getLoweredType());
+      ArrayRef<Substitution> nsErrorVarSubstitutions;
 
-        ProtocolConformanceRef trivialErrorConformances[1] = {
-          ProtocolConformanceRef(ctx.getErrorDecl())
-        };
-
-        Substitution substitutions[1] = {
-          Substitution(concreteFormalType,
-                       ctx.AllocateCopy(trivialErrorConformances))
-        };
-
-        // Call swift_stdlib_getErrorEmbeddedNSError to attempt to extract an
-        // NSError from the value.
-        ManagedValue concreteValue = F(SGFContext());
-        ManagedValue potentialNSError =
-          emitApplyOfLibraryIntrinsic(loc,
-                                      SGM.getGetErrorEmbeddedNSError(loc),
-                                      ctx.AllocateCopy(substitutions),
-                                      { concreteValue },
-                                      SGFContext())
-            .getAsSingleValue(*this, loc);
-
-        // Check whether we got an NSError back.
-        SILValue hasNSError =
-          emitDoesOptionalHaveValue(loc, potentialNSError.getValue());
-
-        B.createCondBranch(loc, hasNSError, isPresentBB, isNotPresentBB);
-
-        // If we did get an NSError, emit the existential erasure from that
-        // NSError.
-        B.emitBlock(isPresentBB);
-        SILValue branchArg;
-        {
-          // Don't allow cleanups to escape the conditional block.
-          FullExpr presentScope(Cleanups, CleanupLocation::get(loc));
-          
-          // Emit the existential erasure from the NSError.
-          branchArg = emitExistentialErasure(
-              loc, nsErrorType,
-              getTypeLowering(nsErrorType),
-              existentialTL,
-              ctx.AllocateCopy(nsErrorConformances),
-              C,
-              [&](SGFContext innerC) -> ManagedValue {
-                // Pull the NSError object out of the optional result.
-                auto &inputTL = getTypeLowering(potentialNSError.getType());
-                auto nsErrorValue =
-                  emitUncheckedGetOptionalValueFrom(loc, potentialNSError,
-                                                    inputTL);
-
-
-                // Perform an unchecked cast down to NSError, because it was typed
-                // as 'AnyObject' for layering reasons.
-                return ManagedValue(B.createUncheckedRefCast(
-                                      loc,
-                                      nsErrorValue.getValue(),
-                                      getLoweredType(nsErrorType)),
-                                    nsErrorValue.getCleanup());
-
-              }).forward(*this);
+      // Devirtualize.  Maybe this should be done implicitly by
+      // emitPropertyLValue?
+      if (storedNSErrorConformance->isConcrete()) {
+        if (auto witnessVar = storedNSErrorConformance->getConcrete()
+                                          ->getWitness(nsErrorVar, nullptr)) {
+          nsErrorVar = cast<VarDecl>(witnessVar.getDecl());
+          nsErrorVarSubstitutions = witnessVar.getSubstitutions();
         }
-        B.createBranch(loc, contBB, branchArg);
+      }
 
-        // If we did not get an NSError, just directly emit the existential
-        // (recursively).
-        B.emitBlock(isNotPresentBB);
+      auto nativeError = F(SGFContext());
+
+      WritebackScope writebackScope(*this);
+      auto nsError =
+        emitRValueForPropertyLoad(loc, nativeError, concreteFormalType,
+                                  /*super*/ false, nsErrorVar,
+                                  nsErrorVarSubstitutions,
+                                  AccessSemantics::Ordinary, nsErrorType,
+                                  SGFContext())
+        .getAsSingleValue(*this, loc);
+
+      return emitBridgedToNativeError(loc, nsError);
+    }
+
+    // Otherwise, if it's an archetype, try calling the _getEmbeddedNSError()
+    // witness to try to dig out the embedded NSError.  But don't do this
+    // when we're being called recursively.
+    if (isa<ArchetypeType>(concreteFormalType) && allowEmbeddedNSError) {
+      auto contBB = createBasicBlock();
+      auto isNotPresentBB = createBasicBlock();
+      auto isPresentBB = createBasicBlock();
+
+      // Call swift_stdlib_getErrorEmbeddedNSError to attempt to extract an
+      // NSError from the value.
+      auto getEmbeddedNSErrorFn = SGM.getGetErrorEmbeddedNSError(loc);
+      if (!getEmbeddedNSErrorFn)
+        return emitUndef(loc, existentialTL.getLoweredType());
+
+      Substitution getEmbeddedNSErrorSubstitutions[1] = {
+        Substitution(concreteFormalType, conformances)
+      };
+
+      ManagedValue concreteValue = F(SGFContext());
+      ManagedValue potentialNSError =
+        emitApplyOfLibraryIntrinsic(loc,
+                                    getEmbeddedNSErrorFn,
+                                    getEmbeddedNSErrorSubstitutions,
+                                    { concreteValue.copy(*this, loc) },
+                                    SGFContext())
+          .getAsSingleValue(*this, loc);
+
+      // We're going to consume 'concreteValue' in exactly one branch,
+      // so kill its cleanup now and recreate it on both branches.
+      (void) concreteValue.forward(*this);
+
+      // Check whether we got an NSError back.
+      std::pair<EnumElementDecl*, SILBasicBlock*> cases[] = {
+        { ctx.getOptionalSomeDecl(), isPresentBB },
+        { ctx.getOptionalNoneDecl(), isNotPresentBB }
+      };
+      B.createSwitchEnum(loc, potentialNSError.forward(*this),
+                         /*default*/ nullptr, cases);
+
+      // If we did get an NSError, emit the existential erasure from that
+      // NSError.
+      B.emitBlock(isPresentBB);
+      SILValue branchArg;
+      {
+        // Don't allow cleanups to escape the conditional block.
+        FullExpr presentScope(Cleanups, CleanupLocation::get(loc));
+        enterDestroyCleanup(concreteValue.getValue());
+
+        // Receive the error value.  It's typed as an 'AnyObject' for
+        // layering reasons, so perform an unchecked cast down to NSError.
+        OptionalTypeKind optKind;
+        SILType anyObjectTy =
+          potentialNSError.getType().getAnyOptionalObjectType(SGM.M, optKind);
+        SILValue nsError = isPresentBB->createBBArg(anyObjectTy);
+        nsError = B.createUncheckedRefCast(loc, nsError, 
+                                           getLoweredType(nsErrorType));
+
+        branchArg = emitBridgedToNativeError(loc,
+                                        emitManagedRValueWithCleanup(nsError))
+                      .forward(*this);
+      }
+      B.createBranch(loc, contBB, branchArg);
+
+      // If we did not get an NSError, just directly emit the existential.
+      // Since this is a recursive call, make sure we don't end up in this
+      // path again.
+      B.emitBlock(isNotPresentBB);
+      {
+        FullExpr presentScope(Cleanups, CleanupLocation::get(loc));
+        concreteValue = emitManagedRValueWithCleanup(concreteValue.getValue());
         branchArg = emitExistentialErasure(loc, concreteFormalType, concreteTL,
                                            existentialTL, conformances,
-                                           SGFContext(), F,
+                                           SGFContext(),
+                                           [&](SGFContext C) {
+                                             return concreteValue;
+                                           },
                                            /*allowEmbeddedNSError=*/false)
                       .forward(*this);
-        B.createBranch(loc, contBB, branchArg);
-
-        // Continue.
-        B.emitBlock(contBB);
-        return emitManagedRValueWithCleanup(existentialResult, existentialTL);
       }
+      B.createBranch(loc, contBB, branchArg);
+
+      // Continue.
+      B.emitBlock(contBB);
+
+      SILValue existentialResult =
+        contBB->createBBArg(existentialTL.getLoweredType());
+      return emitManagedRValueWithCleanup(existentialResult, existentialTL);
     }
   }
 
@@ -641,19 +639,51 @@
                                            concreteTL.getLoweredType(),
                                            existential);
     // Initialize the concrete value in-place.
-    InitializationPtr init(
-        new ExistentialInitialization(existential, valueAddr, concreteFormalType,
-                                      ExistentialRepresentation::Boxed,
-                                      *this));
-    ManagedValue mv = F(SGFContext(init.get()));
+    ExistentialInitialization init(existential, valueAddr, concreteFormalType,
+                                   ExistentialRepresentation::Boxed, *this);
+    ManagedValue mv = F(SGFContext(&init));
     if (!mv.isInContext()) {
-      mv.forwardInto(*this, loc, init->getAddress());
-      init->finishInitialization(*this);
+      mv.forwardInto(*this, loc, init.getAddress());
+      init.finishInitialization(*this);
     }
     
     return emitManagedRValueWithCleanup(existential);
   }
   case ExistentialRepresentation::Opaque: {
+  
+    // If the concrete value is a pseudogeneric archetype, first erase it to
+    // its upper bound.
+    auto anyObjectProto = getASTContext()
+      .getProtocol(KnownProtocolKind::AnyObject);
+    auto anyObjectTy = anyObjectProto
+      ? anyObjectProto->getDeclaredType()->getCanonicalType()
+      : CanType();
+    auto eraseToAnyObject =
+    [&, concreteFormalType, F](SGFContext C) -> ManagedValue {
+      auto concreteValue = F(SGFContext());
+      auto anyObjectConformance = SGM.SwiftModule
+        ->lookupConformance(concreteFormalType, anyObjectProto, nullptr);
+      ProtocolConformanceRef buf[] = {
+        *anyObjectConformance,
+      };
+      
+      auto asAnyObject = B.createInitExistentialRef(loc,
+                                  SILType::getPrimitiveObjectType(anyObjectTy),
+                                  concreteFormalType,
+                                  concreteValue.getValue(),
+                                  getASTContext().AllocateCopy(buf));
+      return ManagedValue(asAnyObject, concreteValue.getCleanup());
+    };
+    
+    auto concreteTLPtr = &concreteTL;
+    if (this->F.getLoweredFunctionType()->isPseudogeneric()) {
+      if (anyObjectTy && concreteFormalType->is<ArchetypeType>()) {
+        concreteFormalType = anyObjectTy;
+        concreteTLPtr = &getTypeLowering(anyObjectTy);
+        F = eraseToAnyObject;
+      }
+    }
+
     // Allocate the existential.
     SILValue existential =
       getBufferForExprResult(loc, existentialTL.getLoweredType(), C);
@@ -662,7 +692,7 @@
     SILValue valueAddr = B.createInitExistentialAddr(
                             loc, existential,
                             concreteFormalType,
-                            concreteTL.getLoweredType(),
+                            concreteTLPtr->getLoweredType(),
                             conformances);
     // Initialize the concrete value in-place.
     InitializationPtr init(
diff --git a/lib/SILGen/SILGenDynamicCast.cpp b/lib/SILGen/SILGenDynamicCast.cpp
index fa96c05..cd6ce0f 100644
--- a/lib/SILGen/SILGenDynamicCast.cpp
+++ b/lib/SILGen/SILGenDynamicCast.cpp
@@ -290,11 +290,7 @@
                                          SILLocation loc,
                                          Type destType,
                                          SGFContext C,
-                                         bool conditional,
-                                         bool bridgesFromObjC) {
-  if (SGF.getASTContext().LangOpts.EnableExperimentalCollectionCasts)
-    bridgesFromObjC = false;
-
+                                         bool conditional) {
   // Compute substitutions for the intrinsic call.
   auto fromCollection = cast<BoundGenericStructType>(
                           sourceType->getCanonicalType());
@@ -307,21 +303,13 @@
     fn = conditional ? SGF.SGM.getArrayConditionalCast(loc)
                      : SGF.SGM.getArrayForceCast(loc);
   } else if (fromCollection->getDecl() == ctx.getDictionaryDecl()) {
-    fn = bridgesFromObjC
-           ? (conditional
-                ? SGF.SGM.getDictionaryBridgeFromObjectiveCConditional(loc)
-                : SGF.SGM.getDictionaryBridgeFromObjectiveC(loc))
-           : (conditional
-                ? SGF.SGM.getDictionaryDownCastConditional(loc)
-                : SGF.SGM.getDictionaryDownCast(loc));
+    fn = (conditional
+           ? SGF.SGM.getDictionaryDownCastConditional(loc)
+           : SGF.SGM.getDictionaryDownCast(loc));
   } else if (fromCollection->getDecl() == ctx.getSetDecl()) {
-    fn = bridgesFromObjC
-           ? (conditional
-                ? SGF.SGM.getSetBridgeFromObjectiveCConditional(loc)
-                : SGF.SGM.getSetBridgeFromObjectiveC(loc))
-           : (conditional
-                ? SGF.SGM.getSetDownCastConditional(loc)
-                : SGF.SGM.getSetDownCast(loc));
+    fn = (conditional
+           ? SGF.SGM.getSetDownCastConditional(loc)
+           : SGF.SGM.getSetDownCast(loc));
   } else {
     llvm_unreachable("unsupported collection upcast kind");
   }
@@ -329,14 +317,14 @@
   // This will have been diagnosed by the accessors above.
   if (!fn) return SGF.emitUndefRValue(loc, destType);
 
-  auto fnArcheTypes = fn->getGenericParams()->getPrimaryArchetypes();
+  auto fnGenericParams = fn->getGenericSignature()->getGenericParams();
   auto fromSubsts = fromCollection->gatherAllSubstitutions(
       SGF.SGM.SwiftModule, nullptr);
   auto toSubsts = toCollection->gatherAllSubstitutions(
       SGF.SGM.SwiftModule, nullptr);
-  assert(fnArcheTypes.size() == fromSubsts.size() + toSubsts.size() &&
+  assert(fnGenericParams.size() == fromSubsts.size() + toSubsts.size() &&
          "wrong number of generic collection parameters");
-  (void) fnArcheTypes;
+  (void) fnGenericParams;
 
   // Form type parameter substitutions.
   SmallVector<Substitution, 4> subs;
@@ -402,17 +390,11 @@
   // entry points.
   if (castKind == CheckedCastKind::ArrayDowncast ||
       castKind == CheckedCastKind::DictionaryDowncast ||
-      castKind == CheckedCastKind::DictionaryDowncastBridged ||
-      castKind == CheckedCastKind::SetDowncast ||
-      castKind == CheckedCastKind::SetDowncastBridged) {
-    bool bridgesFromObjC
-      = (castKind == CheckedCastKind::DictionaryDowncastBridged ||
-         castKind == CheckedCastKind::SetDowncastBridged);
+      castKind == CheckedCastKind::SetDowncast) {
     ManagedValue operandMV = SGF.emitRValueAsSingleValue(operand);
     return emitCollectionDowncastExpr(SGF, operandMV, operand->getType(), loc,
                                       targetType, C,
-                                      /*conditional=*/false,
-                                      bridgesFromObjC);
+                                      /*conditional=*/false);
   }
 
   CheckedCastEmitter emitter(SGF, loc, operand->getType(),
@@ -438,16 +420,10 @@
   // entry points.
   if (castKind == CheckedCastKind::ArrayDowncast ||
       castKind == CheckedCastKind::DictionaryDowncast ||
-      castKind == CheckedCastKind::DictionaryDowncastBridged ||
-      castKind == CheckedCastKind::SetDowncast ||
-      castKind == CheckedCastKind::SetDowncastBridged) {
-    bool bridgesFromObjC
-      = (castKind == CheckedCastKind::DictionaryDowncastBridged ||
-         castKind == CheckedCastKind::SetDowncastBridged);
+      castKind == CheckedCastKind::SetDowncast) {
     return emitCollectionDowncastExpr(SGF, operand, operandType, loc,
                                       resultObjectType, C,
-                                      /*conditional=*/true,
-                                      bridgesFromObjC);
+                                      /*conditional=*/true);
   }
 
   operand = adjustForConditionalCheckedCastOperand(loc, operand,
@@ -554,18 +530,12 @@
   // Handle collection downcasts separately.
   if (castKind == CheckedCastKind::ArrayDowncast ||
       castKind == CheckedCastKind::DictionaryDowncast ||
-      castKind == CheckedCastKind::DictionaryDowncastBridged ||
-      castKind == CheckedCastKind::SetDowncast ||
-      castKind == CheckedCastKind::SetDowncastBridged) {
-    bool bridgesFromObjC
-      = (castKind == CheckedCastKind::DictionaryDowncastBridged ||
-         castKind == CheckedCastKind::SetDowncastBridged);
+      castKind == CheckedCastKind::SetDowncast) {
     ManagedValue operandMV = SGF.emitRValueAsSingleValue(operand);
     ManagedValue optValue = emitCollectionDowncastExpr(
                               SGF, operandMV, operand->getType(), loc,
                               targetType,
-                              SGFContext(), /*conditional=*/true,
-                              bridgesFromObjC)
+                              SGFContext(), /*conditional=*/true)
       .getAsSingleValue(SGF, loc);
 
     // Materialize the input.
diff --git a/lib/SILGen/SILGenExpr.cpp b/lib/SILGen/SILGenExpr.cpp
index 09ee4bd..0d5646d 100644
--- a/lib/SILGen/SILGenExpr.cpp
+++ b/lib/SILGen/SILGenExpr.cpp
@@ -978,21 +978,15 @@
   auto toCollection = cast<BoundGenericStructType>(
                         E->getType()->getCanonicalType());
 
-  bool bridgesToObjC = E->bridgesToObjC();
-  if (SGF.getASTContext().LangOpts.EnableExperimentalCollectionCasts)
-    bridgesToObjC = false;
-
   // Get the intrinsic function.
   auto &ctx = SGF.getASTContext();
   FuncDecl *fn = nullptr;
   if (fromCollection->getDecl() == ctx.getArrayDecl()) {
     fn = SGF.SGM.getArrayForceCast(loc);
   } else if (fromCollection->getDecl() == ctx.getDictionaryDecl()) {
-    fn = bridgesToObjC ? SGF.SGM.getDictionaryBridgeToObjectiveC(loc)
-                       : SGF.SGM.getDictionaryUpCast(loc);
+    fn = SGF.SGM.getDictionaryUpCast(loc);
   } else if (fromCollection->getDecl() == ctx.getSetDecl()) {
-    fn = bridgesToObjC ? SGF.SGM.getSetBridgeToObjectiveC(loc)
-                       : SGF.SGM.getSetUpCast(loc);
+    fn = SGF.SGM.getSetUpCast(loc);
   } else {
     llvm_unreachable("unsupported collection upcast kind");
   }
@@ -1000,14 +994,14 @@
   // This will have been diagnosed by the accessors above.
   if (!fn) return SGF.emitUndefRValue(E, E->getType());
   
-  auto fnArcheTypes = fn->getGenericParams()->getPrimaryArchetypes();
+  auto fnGenericParams = fn->getGenericParams()->getParams();
   auto fromSubsts = fromCollection->gatherAllSubstitutions(
       SGF.SGM.SwiftModule, nullptr);
   auto toSubsts = toCollection->gatherAllSubstitutions(
       SGF.SGM.SwiftModule, nullptr);
-  assert(fnArcheTypes.size() == fromSubsts.size() + toSubsts.size() &&
+  assert(fnGenericParams.size() == fromSubsts.size() + toSubsts.size() &&
          "wrong number of generic collection parameters");
-  (void) fnArcheTypes;
+  (void) fnGenericParams;
   
   // Form type parameter substitutions.
   SmallVector<Substitution, 4> subs;
@@ -1439,10 +1433,8 @@
                                        CanType baseTy, CanType arrayTy,
                                        unsigned numElements) {
   // Reabstract the base type against the array element type.
-  AbstractionPattern baseAbstraction(
-    arrayTy->getNominalOrBoundGenericNominal()
-           ->getGenericParams()->getPrimaryArchetypes()[0]);
-  
+  auto baseAbstraction = AbstractionPattern::getOpaque();
+
   // Allocate the array.
   SILValue numEltsVal = gen.B.createIntegerLiteral(loc,
                              SILType::getBuiltinWordType(gen.getASTContext()),
@@ -2274,12 +2266,28 @@
   return SGF.emitEmptyTupleRValue(E, C);
 }
 
-static bool isNullableTypeInC(SILModule &M, Type ty) {
+static bool isVerbatimNullableTypeInC(SILModule &M, Type ty) {
   ty = ty->getLValueOrInOutObjectType()->getReferenceStorageReferent();
 
-  // Functions, class instances, and @objc existentials are all nullable.
-  if (ty->hasReferenceSemantics())
+  // Class instances, and @objc existentials are all nullable.
+  if (ty->hasReferenceSemantics()) {
+    // So are blocks, but we usually bridge them to Swift closures before we get
+    // a chance to check for optional promotion, so we're already screwed if
+    // an API lies about nullability.
+    if (auto fnTy = ty->getAs<AnyFunctionType>()) {
+      switch (fnTy->getRepresentation()) {
+      // Carried verbatim from C.
+      case FunctionTypeRepresentation::Block:
+      case FunctionTypeRepresentation::CFunctionPointer:
+        return true;
+      // Was already bridged.
+      case FunctionTypeRepresentation::Swift:
+      case FunctionTypeRepresentation::Thin:
+        return false;
+      }
+    }
     return true;
+  }
 
   // Other types like UnsafePointer can also be nullable.
   const DeclContext *DC = M.getAssociatedContext();
@@ -2310,7 +2318,7 @@
   // Functions that return non-optional reference type and were imported from
   // Objective-C.
   if (auto func = dyn_cast<FuncDecl>(decl)) {
-    assert((isNullableTypeInC(M, func->getResultType())
+    assert((isVerbatimNullableTypeInC(M, func->getResultType())
             || func->getResultType()->hasArchetype())
            && "func's result type is not nullable?!");
     return func->hasClangNode();
@@ -2319,7 +2327,7 @@
   // Computed properties of non-optional reference type that were imported from
   // Objective-C.
   if (auto var = dyn_cast<VarDecl>(decl)) {
-    assert((isNullableTypeInC(M, var->getType()->getReferenceStorageReferent())
+    assert((isVerbatimNullableTypeInC(M, var->getType()->getReferenceStorageReferent())
             || var->getType()->getReferenceStorageReferent()->hasArchetype())
            && "property's result type is not nullable?!");
     return var->hasClangNode();
@@ -2328,7 +2336,7 @@
   // Subscripts of non-optional reference type that were imported from
   // Objective-C.
   if (auto subscript = dyn_cast<SubscriptDecl>(decl)) {
-    assert((isNullableTypeInC(M, subscript->getElementType())
+    assert((isVerbatimNullableTypeInC(M, subscript->getElementType())
             || subscript->getElementType()->hasArchetype())
            && "subscript's result type is not nullable?!");
     return subscript->hasClangNode();
@@ -2352,7 +2360,7 @@
   // get the function we're calling.
   if (auto apply = dyn_cast<ApplyExpr>(expr)) {
     // The result has to be a nullable type.
-    if (!isNullableTypeInC(M, apply->getType()))
+    if (!isVerbatimNullableTypeInC(M, apply->getType()))
       return false;
     
     auto getFuncDeclFromDynamicMemberLookup = [&](Expr *expr) -> FuncDecl * {
@@ -2405,25 +2413,25 @@
 
   // A reference to a member property.
   if (auto member = dyn_cast<MemberRefExpr>(expr)) {
-    return isNullableTypeInC(M, member->getType()) &&
+    return isVerbatimNullableTypeInC(M, member->getType()) &&
       mayLieAboutNonOptionalReturn(M, member->getMember().getDecl());
   }
 
   // A reference to a subscript.
   if (auto subscript = dyn_cast<SubscriptExpr>(expr)) {
-    return isNullableTypeInC(M, subscript->getType()) &&
+    return isVerbatimNullableTypeInC(M, subscript->getType()) &&
       mayLieAboutNonOptionalReturn(M, subscript->getDecl().getDecl());
   }
 
   // A reference to a member property found via dynamic lookup.
   if (auto member = dyn_cast<DynamicMemberRefExpr>(expr)) {
-    return isNullableTypeInC(M, member->getType()) &&
+    return isVerbatimNullableTypeInC(M, member->getType()) &&
       mayLieAboutNonOptionalReturn(M, member->getMember().getDecl());
   }
 
   // A reference to a subscript found via dynamic lookup.
   if (auto subscript = dyn_cast<DynamicSubscriptExpr>(expr)) {
-    return isNullableTypeInC(M, subscript->getType()) &&
+    return isVerbatimNullableTypeInC(M, subscript->getType()) &&
       mayLieAboutNonOptionalReturn(M, subscript->getMember().getDecl());
   }
 
diff --git a/lib/SILGen/SILGenForeignError.cpp b/lib/SILGen/SILGenForeignError.cpp
index 9098f2c..c8462cf 100644
--- a/lib/SILGen/SILGenForeignError.cpp
+++ b/lib/SILGen/SILGenForeignError.cpp
@@ -290,14 +290,20 @@
 static SILValue emitUnwrapIntegerResult(SILGenFunction &gen,
                                         SILLocation loc,
                                         SILValue value) {
-  while (!value->getType().is<BuiltinIntegerType>()) {
-    auto structDecl = value->getType().getStructOrBoundGenericStruct();
-    assert(structDecl && "value for error result wasn't of struct type!");
-    assert(std::next(structDecl->getStoredProperties().begin())
-             == structDecl->getStoredProperties().end());
-    auto property = *structDecl->getStoredProperties().begin();
-    value = gen.B.createStructExtract(loc, value, property);
-  }
+  CanType boolType = gen.SGM.Types.getBoolType();
+
+  value = gen.emitBridgedToNativeValue(
+      loc, ManagedValue::forUnmanaged(value),
+      SILFunctionTypeRepresentation::CFunctionPointer,
+      boolType).forward(gen);
+
+  auto structDecl = value->getType().getStructOrBoundGenericStruct();
+  assert(structDecl && "value for error result wasn't of struct type!");
+  assert(std::next(structDecl->getStoredProperties().begin())
+           == structDecl->getStoredProperties().end());
+  auto property = *structDecl->getStoredProperties().begin();
+  value = gen.B.createStructExtract(loc, value, property);
+  assert(value->getType().is<BuiltinIntegerType>());
 
   return value;
 }
@@ -315,20 +321,28 @@
 
   SILValue resultValue =
     emitUnwrapIntegerResult(gen, loc, result.getUnmanagedValue());
-  SILValue zero =
-    gen.B.createIntegerLiteral(loc, resultValue->getType(), 0);
+  CanType resultType = resultValue->getType().getSwiftRValueType();
 
-  ASTContext &ctx = gen.getASTContext();
-  SILValue resultIsError =
-    gen.B.createBuiltinBinaryFunction(loc,
-                                      zeroIsError ? "cmp_eq" : "cmp_ne",
-                                      resultValue->getType(),
-                                      SILType::getBuiltinIntegerType(1, ctx),
-                                      {resultValue, zero});
+  if (!resultType->isBuiltinIntegerType(1)) {
+    SILValue zero =
+      gen.B.createIntegerLiteral(loc, resultValue->getType(), 0);
+
+    ASTContext &ctx = gen.getASTContext();
+    resultValue =
+      gen.B.createBuiltinBinaryFunction(loc,
+                                        "cmp_ne",
+                                        resultValue->getType(),
+                                        SILType::getBuiltinIntegerType(1, ctx),
+                                        {resultValue, zero});
+  }
 
   SILBasicBlock *errorBB = gen.createBasicBlock(FunctionSection::Postmatter);
   SILBasicBlock *contBB = gen.createBasicBlock();
-  gen.B.createCondBranch(loc, resultIsError, errorBB, contBB);
+
+  if (zeroIsError)
+    gen.B.createCondBranch(loc, resultValue, contBB, errorBB);
+  else
+    gen.B.createCondBranch(loc, resultValue, errorBB, contBB);
 
   gen.emitForeignErrorBlock(loc, errorBB, errorSlot);
 
diff --git a/lib/SILGen/SILGenFunction.cpp b/lib/SILGen/SILGenFunction.cpp
index f66b082..6a6a111 100644
--- a/lib/SILGen/SILGenFunction.cpp
+++ b/lib/SILGen/SILGenFunction.cpp
@@ -815,8 +815,10 @@
 
   // Forward substitutions.
   ArrayRef<Substitution> subs;
-  if (auto gp = getConstantInfo(to).ContextGenericParams) {
-    subs = gp->getForwardingSubstitutions(getASTContext());
+  auto constantInfo = getConstantInfo(to);
+  if (auto gp = constantInfo.ContextGenericParams) {
+    auto sig = constantInfo.SILFnType->getGenericSignature();
+    subs = gp->getForwardingSubstitutions(sig);
   }
 
   SILValue toFn = getNextUncurryLevelRef(*this, vd, to, from.isDirectReference,
diff --git a/lib/SILGen/SILGenLValue.cpp b/lib/SILGen/SILGenLValue.cpp
index 8415969..16685d8 100644
--- a/lib/SILGen/SILGenLValue.cpp
+++ b/lib/SILGen/SILGenLValue.cpp
@@ -1584,10 +1584,11 @@
 static ArrayRef<Substitution>
 getNonMemberVarDeclSubstitutions(SILGenModule &SGM, VarDecl *var) {
   ArrayRef<Substitution> substitutions;
-  if (auto genericParams
-      = var->getDeclContext()->getGenericParamsOfContext())
-    substitutions =
-        genericParams->getForwardingSubstitutions(SGM.getASTContext());
+  auto *dc = var->getDeclContext();
+  if (auto genericParams = dc->getGenericParamsOfContext()) {
+    auto *genericSig = dc->getGenericSignatureOfContext();
+    substitutions = genericParams->getForwardingSubstitutions(genericSig);
+  }
   return substitutions;
 }
 
diff --git a/lib/SILOptimizer/Analysis/CallerAnalysis.cpp b/lib/SILOptimizer/Analysis/CallerAnalysis.cpp
index 751a40a..aa68198 100644
--- a/lib/SILOptimizer/Analysis/CallerAnalysis.cpp
+++ b/lib/SILOptimizer/Analysis/CallerAnalysis.cpp
@@ -28,25 +28,42 @@
           continue;
 
         // Update the callee information for this function.
-        CallerAnalysisFunctionInfo &CallerInfo
-                               = CallInfo.FindAndConstruct(F).second;
+        FunctionInfo &CallerInfo = FuncInfos[F];
         CallerInfo.Callees.insert(CalleeFn);
         
         // Update the callsite information for the callee.
-        CallerAnalysisFunctionInfo &CalleeInfo
-                               = CallInfo.FindAndConstruct(CalleeFn).second;
+        FunctionInfo &CalleeInfo = FuncInfos[CalleeFn];
         CalleeInfo.Callers.insert(F);
-      }   
+        continue;
+      }
+      if (auto *PAI = dyn_cast<PartialApplyInst>(&II)) {
+        SILFunction *CalleeFn = PAI->getCalleeFunction();
+        if (!CalleeFn)
+          continue;
+
+        // Update the callee information for this function.
+        FunctionInfo &CallerInfo = FuncInfos[F];
+        CallerInfo.Callees.insert(CalleeFn);
+        
+        // Update the partial-apply information for the callee.
+        FunctionInfo &CalleeInfo = FuncInfos[CalleeFn];
+        int &minAppliedArgs = CalleeInfo.PartialAppliers[F];
+        int numArgs = (int)PAI->getNumArguments();
+        if (minAppliedArgs == 0 || numArgs < minAppliedArgs) {
+          minAppliedArgs = numArgs;
+        }
+        continue;
+      }
     }   
   }   
 }
 
 void CallerAnalysis::invalidateExistingCalleeRelation(SILFunction *F) {
-  CallerAnalysisFunctionInfo &CallerInfo = CallInfo.FindAndConstruct(F).second;
+  FunctionInfo &CallerInfo = FuncInfos[F];
   for (auto Callee : CallerInfo.Callees) {
-    CallerAnalysisFunctionInfo &CalleeInfo
-                                    = CallInfo.FindAndConstruct(Callee).second;
-    CalleeInfo.Callers.remove(F);
+    FunctionInfo &CalleeInfo = FuncInfos[Callee];
+    CalleeInfo.Callers.erase(F);
+    CalleeInfo.PartialAppliers.erase(F);
   }
 }
 
diff --git a/lib/SILOptimizer/IPO/CapturePromotion.cpp b/lib/SILOptimizer/IPO/CapturePromotion.cpp
index aa930cd..e1c0e3f 100644
--- a/lib/SILOptimizer/IPO/CapturePromotion.cpp
+++ b/lib/SILOptimizer/IPO/CapturePromotion.cpp
@@ -663,7 +663,7 @@
 static bool
 isNonescapingUse(Operand *O, SmallVectorImpl<SILInstruction*> &Mutations) {
   auto *U = O->getUser();
-  if (U->isOpenedArchetypeOperand(*O))
+  if (U->isTypeDependentOperand(*O))
     return true;
   // Marking the boxed value as escaping is OK. It's just a DI annotation.
   if (isa<MarkFunctionEscapeInst>(U))
@@ -862,6 +862,7 @@
   // Create the substitution maps.
   TypeSubstitutionMap InterfaceSubs;
   TypeSubstitutionMap ContextSubs;
+  ArchetypeConformanceMap ConformanceMap;
 
   ArrayRef<Substitution> ApplySubs = PAI->getSubstitutions();
   auto genericSig = F->getLoweredFunctionType()->getGenericSignature();
@@ -869,7 +870,9 @@
 
   if (!ApplySubs.empty()) {
     InterfaceSubs = genericSig->getSubstitutionMap(ApplySubs);
-    ContextSubs = genericParams->getSubstitutionMap(ApplySubs);
+    genericParams->getSubstitutionMap(F->getModule().getSwiftModule(),
+                                      genericSig, ApplySubs,
+                                      ContextSubs, ConformanceMap);
   } else {
     assert(!genericSig && "Function type has Unexpected generic signature!");
     assert(!genericParams &&
diff --git a/lib/SILOptimizer/IPO/CapturePropagation.cpp b/lib/SILOptimizer/IPO/CapturePropagation.cpp
index d52fa61..6bee0b0 100644
--- a/lib/SILOptimizer/IPO/CapturePropagation.cpp
+++ b/lib/SILOptimizer/IPO/CapturePropagation.cpp
@@ -31,7 +31,9 @@
 namespace {
 /// Propagate constants through closure captures by specializing the partially
 /// applied function.
-class CapturePropagation : public SILModuleTransform
+/// Also optimize away partial_apply instructions where all partially applied
+/// arguments are dead.
+class CapturePropagation : public SILFunctionTransform
 {
 public:
   void run() override;
@@ -237,7 +239,7 @@
   CanSILFunctionType NewFTy =
     Lowering::adjustFunctionType(PAI->getType().castTo<SILFunctionType>(),
                                  SILFunctionType::Representation::Thin);
-  SILFunction *NewF = getModule()->createFunction(
+  SILFunction *NewF = OrigF->getModule().createFunction(
       SILLinkage::Shared, Name, NewFTy,
       /*contextGenericParams*/ nullptr, OrigF->getLocation(), OrigF->isBare(),
       OrigF->isTransparent(), Fragile, OrigF->isThunk(),
@@ -258,15 +260,11 @@
                                              SILFunction *SpecialF) {
   SILBuilderWithScope Builder(OrigPAI);
   auto FuncRef = Builder.createFunctionRef(OrigPAI->getLoc(), SpecialF);
-  auto NewPAI = Builder.createPartialApply(OrigPAI->getLoc(),
-                                           FuncRef,
-                                           SpecialF->getLoweredType(),
-                                           ArrayRef<Substitution>(),
-                                           ArrayRef<SILValue>(),
-                                           OrigPAI->getType());
-  OrigPAI->replaceAllUsesWith(NewPAI);
+  auto *T2TF = Builder.createThinToThickFunction(OrigPAI->getLoc(),
+                                                 FuncRef, OrigPAI->getType());
+  OrigPAI->replaceAllUsesWith(T2TF);
   recursivelyDeleteTriviallyDeadInstructions(OrigPAI, true);
-  DEBUG(llvm::dbgs() << "  Rewrote caller:\n" << *NewPAI);
+  DEBUG(llvm::dbgs() << "  Rewrote caller:\n" << *T2TF);
 }
 
 /// For now, we conservative only specialize if doing so can eliminate dynamic
@@ -286,25 +284,121 @@
   return false;
 }
 
+/// Returns true if block \p BB only contains a return or throw of the first
+/// block argument and side-effect-free instructions.
+static bool onlyContainsReturnOrThrowOfArg(SILBasicBlock *BB) {
+  for (SILInstruction &I : *BB) {
+    if (isa<ReturnInst>(&I) || isa<ThrowInst>(&I)) {
+      SILValue RetVal = I.getOperand(0);
+      if (BB->getNumBBArg() == 1 && RetVal == BB->getBBArg(0))
+        return true;
+      return false;
+    }
+    if (I.mayHaveSideEffects() || isa<TermInst>(&I))
+      return false;
+  }
+  llvm_unreachable("should have seen a terminator instruction");
+}
+
+/// Checks if \p Orig is a thunk which calls another function but without
+/// passing the trailing \p numDeadParams dead parameters.
+static SILFunction *getSpecializedWithDeadParams(SILFunction *Orig,
+                                                 int numDeadParams) {
+  SILBasicBlock &EntryBB = *Orig->begin();
+  unsigned NumArgs = EntryBB.getNumBBArg();
+  SILModule &M = Orig->getModule();
+  
+  // Check if all dead parameters have trivial types. We don't support non-
+  // trivial types because it's very hard to find places where we can release
+  // those parameters (as a replacement for the removed partial_apply).
+  // TODO: maybe we can skip this restrication when we have semantic ARC.
+  for (unsigned Idx = NumArgs - numDeadParams; Idx < NumArgs; ++Idx) {
+    SILType ArgTy = EntryBB.getBBArg(Idx)->getType();
+    if (!ArgTy.isTrivial(M))
+      return nullptr;
+  }
+  SILFunction *Specialized = nullptr;
+  SILValue RetValue;
+  
+  // Check all instruction of the entry block.
+  for (SILInstruction &I : EntryBB) {
+    if (auto FAS = FullApplySite::isa(&I)) {
+      
+      // Check if this is the call of the specialized function.
+      // As the original function is not generic, also the specialized function
+      // must be not generic.
+      if (FAS.hasSubstitutions())
+        return nullptr;
+      // Is it the only call?
+      if (Specialized)
+        return nullptr;
+      
+      Specialized = FAS.getReferencedFunction();
+      if (!Specialized)
+        return nullptr;
+
+      // Check if parameters are passes 1-to-1
+      unsigned NumArgs = FAS.getNumArguments();
+      if (EntryBB.getNumBBArg() - numDeadParams != NumArgs)
+        return nullptr;
+
+      for (unsigned Idx = 0; Idx < NumArgs; ++Idx) {
+        if (FAS.getArgument(Idx) != (ValueBase *)EntryBB.getBBArg(Idx))
+          return nullptr;
+      }
+
+      if (TryApplyInst *TAI = dyn_cast<TryApplyInst>(&I)) {
+        // Check the normal and throw blocks of the try_apply.
+        if (onlyContainsReturnOrThrowOfArg(TAI->getNormalBB()) &&
+            onlyContainsReturnOrThrowOfArg(TAI->getErrorBB()))
+          return Specialized;
+        return nullptr;
+      }
+      assert(isa<ApplyInst>(&I) && "unknown FullApplySite instruction");
+      RetValue = &I;
+      continue;
+    }
+    if (auto *RI = dyn_cast<ReturnInst>(&I)) {
+      // Check if we return the result of the apply.
+      if (RI->getOperand() != RetValue)
+        return nullptr;
+      continue;
+    }
+    if (I.mayHaveSideEffects() || isa<TermInst>(&I))
+      return nullptr;
+  }
+  return Specialized;
+}
+
 bool CapturePropagation::optimizePartialApply(PartialApplyInst *PAI) {
   // Check if the partial_apply has generic substitutions.
   // FIXME: We could handle generic thunks if it's worthwhile.
   if (PAI->hasSubstitutions())
     return false;
 
-  auto *FRI = dyn_cast<FunctionRefInst>(PAI->getCallee());
-  if (!FRI)
+  SILFunction *SubstF = PAI->getReferencedFunction();
+  if (!SubstF)
+    return false;
+  if (SubstF->isExternalDeclaration())
     return false;
 
-  assert(!FRI->getFunctionType()->isPolymorphic() &&
+  assert(!SubstF->getLoweredFunctionType()->isPolymorphic() &&
          "cannot specialize generic partial apply");
 
+  // First possibility: Is it a partial_apply where all partially applied
+  // arguments are dead?
+  if (SILFunction *NewFunc = getSpecializedWithDeadParams(SubstF,
+                                                    PAI->getNumArguments())) {
+    rewritePartialApply(PAI, NewFunc);
+    return true;
+  }
+
+  // Second possibility: Are all partially applied arguments constant?
   for (auto Arg : PAI->getArguments()) {
     if (!isConstant(Arg))
       return false;
   }
-  SILFunction *SubstF = FRI->getReferencedFunction();
-  if (SubstF->isExternalDeclaration() || !isProfitable(SubstF))
+  if (!isProfitable(SubstF))
     return false;
 
   DEBUG(llvm::dbgs() << "Specializing closure for constant arguments:\n"
@@ -312,34 +406,34 @@
   ++NumCapturesPropagated;
   SILFunction *NewF = specializeConstClosure(PAI, SubstF);
   rewritePartialApply(PAI, NewF);
+
+  notifyPassManagerOfFunction(NewF, SubstF);
   return true;
 }
 
 void CapturePropagation::run() {
   DominanceAnalysis *DA = PM->getAnalysis<DominanceAnalysis>();
+  auto *F = getFunction();
   bool HasChanged = false;
-  for (auto &F : *getModule()) {
 
-    // Don't optimize functions that are marked with the opt.never attribute.
-    if (!F.shouldOptimize())
+  // Don't optimize functions that are marked with the opt.never attribute.
+  if (!F->shouldOptimize())
+    return;
+
+  // Cache cold blocks per function.
+  ColdBlockInfo ColdBlocks(DA);
+  for (auto &BB : *F) {
+    if (ColdBlocks.isCold(&BB))
       continue;
 
-    // Cache cold blocks per function.
-    ColdBlockInfo ColdBlocks(DA);
-    for (auto &BB : F) {
-      if (ColdBlocks.isCold(&BB))
-        continue;
-
-      auto I = BB.begin();
-      while (I != BB.end()) {
-        SILInstruction *Inst = &*I;
-        ++I;
-        if (PartialApplyInst *PAI = dyn_cast<PartialApplyInst>(Inst))
-          HasChanged |= optimizePartialApply(PAI);
-      }
+    auto I = BB.begin();
+    while (I != BB.end()) {
+      SILInstruction *Inst = &*I;
+      ++I;
+      if (PartialApplyInst *PAI = dyn_cast<PartialApplyInst>(Inst))
+        HasChanged |= optimizePartialApply(PAI);
     }
   }
-
   if (HasChanged) {
     invalidateAnalysis(SILAnalysis::InvalidationKind::Everything);
   }
diff --git a/lib/SILOptimizer/IPO/ClosureSpecializer.cpp b/lib/SILOptimizer/IPO/ClosureSpecializer.cpp
index bf5cb99..85297ce 100644
--- a/lib/SILOptimizer/IPO/ClosureSpecializer.cpp
+++ b/lib/SILOptimizer/IPO/ClosureSpecializer.cpp
@@ -426,25 +426,6 @@
   }
 }
 
-static void specializeClosure(ClosureInfo &CInfo,
-                              CallSiteDescriptor &CallDesc) {
-  auto NewFName = CallDesc.createName();
-  DEBUG(llvm::dbgs() << "    Perform optimizations with new name " << NewFName
-                     << '\n');
-
-  // Then see if we already have a specialized version of this function in our
-  // module.
-  SILFunction *NewF = CInfo.Closure->getModule().lookUpFunction(NewFName);
-
-  // If not, create a specialized version of ApplyCallee calling the closure
-  // directly.
-  if (!NewF)
-    NewF = ClosureSpecCloner::cloneFunction(CallDesc, NewFName);
-
-  // Rewrite the call
-  rewriteApplyInst(CallDesc, NewF);
-}
-
 static bool isSupportedClosure(const SILInstruction *Closure) {
   if (!isSupportedClosureKind(Closure))
     return false;
@@ -700,7 +681,7 @@
   void gatherCallSites(SILFunction *Caller,
                        llvm::SmallVectorImpl<ClosureInfo*> &ClosureCandidates,
                        llvm::DenseSet<FullApplySite> &MultipleClosureAI);
-  bool specialize(SILFunction *Caller);
+  bool specialize(SILFunction *Caller, SILFunctionTransform *SFT);
 
   ArrayRef<SILInstruction *> getPropagatedClosures() {
     if (IsPropagatedClosuresUniqued)
@@ -831,7 +812,8 @@
   }
 }
 
-bool ClosureSpecializer::specialize(SILFunction *Caller) {
+bool ClosureSpecializer::specialize(SILFunction *Caller,
+                                    SILFunctionTransform *SFT) {
   DEBUG(llvm::dbgs() << "Optimizing callsites that take closure argument in "
                      << Caller->getName() << '\n');
 
@@ -849,7 +831,24 @@
       if (MultipleClosureAI.count(CSDesc.getApplyInst()))
         continue;
 
-      specializeClosure(*CInfo, CSDesc);
+      auto NewFName = CSDesc.createName();
+      DEBUG(llvm::dbgs() << "    Perform optimizations with new name "
+                         << NewFName << '\n');
+
+      // Then see if we already have a specialized version of this function in
+      // our module.
+      SILFunction *NewF = CInfo->Closure->getModule().lookUpFunction(NewFName);
+
+      // If not, create a specialized version of ApplyCallee calling the closure
+      // directly.
+      if (!NewF) {
+        NewF = ClosureSpecCloner::cloneFunction(CSDesc, NewFName);
+        SFT->notifyPassManagerOfFunction(NewF, CSDesc.getApplyCallee());
+      }
+
+      // Rewrite the call
+      rewriteApplyInst(CSDesc, NewF);
+
       PropagatedClosures.push_back(CSDesc.getClosure());
       Changed = true;
     }
@@ -864,57 +863,48 @@
 
 namespace {
 
-class SILClosureSpecializerTransform : public SILModuleTransform {
+class SILClosureSpecializerTransform : public SILFunctionTransform {
 public:
   SILClosureSpecializerTransform() {}
 
   void run() override {
-    auto *BCA = getAnalysis<BasicCalleeAnalysis>();
+    SILFunction *F = getFunction();
 
-    bool Changed = false;
+    // Don't optimize functions that are marked with the opt.never
+    // attribute.
+    if (!F->shouldOptimize())
+      return;
+
+    // If F is an external declaration, there is nothing to specialize.
+    if (F->isExternalDeclaration())
+      return;
+
     ClosureSpecializer C;
+    if (!C.specialize(F, this))
+      return;
 
-    BottomUpFunctionOrder Ordering(*getModule(), BCA);
+    // If for testing purposes we were asked to not eliminate dead closures,
+    // return.
+    if (EliminateDeadClosures) {
+      // Otherwise, remove any local dead closures that are now dead since we
+      // specialized all of their uses.
+      DEBUG(llvm::dbgs() << "Trying to remove dead closures!\n");
+      for (SILInstruction *Closure : C.getPropagatedClosures()) {
+        DEBUG(llvm::dbgs() << "    Visiting: " << *Closure);
+        if (!tryDeleteDeadClosure(Closure)) {
+          DEBUG(llvm::dbgs() << "        Failed to delete closure!\n");
+          NumPropagatedClosuresNotEliminated++;
+          continue;
+        }
 
-    // Specialize going bottom-up.
-    for (auto *F : Ordering.getFunctions()) {
-      // Don't optimize functions that are marked with the opt.never
-      // attribute.
-      if (!F->shouldOptimize())
-        return;
-
-      // If F is an external declaration, there is nothing to specialize.
-      if (F->isExternalDeclaration())
-        continue;
-
-      Changed |= C.specialize(F);
+        DEBUG(llvm::dbgs() << "        Deleted closure!\n");
+        ++NumPropagatedClosuresEliminated;
+      }
     }
 
     // Invalidate everything since we delete calls as well as add new
     // calls and branches.
-    if (Changed) {
-      invalidateAnalysis(SILAnalysis::InvalidationKind::Everything);
-    }
-
-    // If for testing purposes we were asked to not eliminate dead closures,
-    // return.
-    if (!EliminateDeadClosures)
-      return;
-
-    // Otherwise, remove any local dead closures that are now dead since we
-    // specialized all of their uses.
-    DEBUG(llvm::dbgs() << "Trying to remove dead closures!\n");
-    for (SILInstruction *Closure : C.getPropagatedClosures()) {
-      DEBUG(llvm::dbgs() << "    Visiting: " << *Closure);
-      if (!tryDeleteDeadClosure(Closure)) {
-        DEBUG(llvm::dbgs() << "        Failed to delete closure!\n");
-        NumPropagatedClosuresNotEliminated++;
-        continue;
-      }
-
-      DEBUG(llvm::dbgs() << "        Deleted closure!\n");
-      ++NumPropagatedClosuresEliminated;
-    }
+    invalidateAnalysis(SILAnalysis::InvalidationKind::Everything);
   }
 
   StringRef getName() override { return "Closure Specialization"; }
diff --git a/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp b/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp
index 2c10fc5..c00d043 100644
--- a/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp
+++ b/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp
@@ -1107,15 +1107,30 @@
  }
 
   // This is a self.init call if structured like this:
+  //
   // (call_expr type='SomeClass'
   //   (dot_syntax_call_expr type='() -> SomeClass' self
   //     (other_constructor_ref_expr implicit decl=SomeClass.init)
   //     (decl_ref_expr type='SomeClass', "self"))
   //   (...some argument...)
-  if (auto AE = dyn_cast<ApplyExpr>(LocExpr)) {
-    if ((AE = dyn_cast<ApplyExpr>(AE->getFn())) &&
-        isa<OtherConstructorDeclRefExpr>(AE->getFn()))
-      return true;
+  //
+  // Or like this:
+  //
+  // (call_expr type='SomeClass'
+  //   (dot_syntax_call_expr type='() -> SomeClass' self
+  //     (decr_ref_expr implicit decl=SomeClass.init)
+  //     (decl_ref_expr type='SomeClass', "self"))
+  //   (...some argument...)
+  //
+  if (auto *AE = dyn_cast<ApplyExpr>(LocExpr)) {
+    if ((AE = dyn_cast<ApplyExpr>(AE->getFn()))) {
+      if (isa<OtherConstructorDeclRefExpr>(AE->getFn()))
+        return true;
+      if (auto *DRE = dyn_cast<DeclRefExpr>(AE->getFn()))
+        if (auto *CD = dyn_cast<ConstructorDecl>(DRE->getDecl()))
+          if (CD->isFactoryInit())
+            return true;
+    }
   }
   return false;
 }
@@ -1128,59 +1143,19 @@
   // of a throwing delegated init.
   auto *BB = Arg->getParent();
   auto *Pred = BB->getSinglePredecessor();
-  if (!Pred || !isa<TryApplyInst>(Pred->getTerminator()))
+
+  // The two interesting cases are where self.init throws, in which case
+  // the argument came from a try_apply, or if self.init is failable,
+  // in which case we have a switch_enum.
+  if (!Pred ||
+      (!isa<TryApplyInst>(Pred->getTerminator()) &&
+       !isa<SwitchEnumInst>(Pred->getTerminator())))
     return false;
+
   return isSelfInitUse(Pred->getTerminator());
 }
 
 
-/// Determine if this value_metatype instruction is part of a call to
-/// self.init when delegating to a factory initializer.
-///
-/// FIXME: This is only necessary due to our broken model for factory
-/// initializers.
-static bool isSelfInitUse(ValueMetatypeInst *Inst) {
-  // "Inst" is a ValueMetatype instruction.  Check to see if it is
-  // used by an apply that came from a call to self.init.
-  for (auto UI : Inst->getUses()) {
-    auto *User = UI->getUser();
-
-    // Check whether we're looking up a factory initializer with
-    // class_method.
-    if (auto *CMI = dyn_cast<ClassMethodInst>(User)) {
-      // Only works for allocating initializers...
-      auto Member = CMI->getMember();
-      if (Member.kind != SILDeclRef::Kind::Allocator)
-        return false;
-
-      // ... of factory initializers.
-      auto ctor = dyn_cast_or_null<ConstructorDecl>(Member.getDecl());
-      return ctor && ctor->isFactoryInit();
-    }
-
-    if (auto apply = ApplySite::isa(User)) {
-      auto *LocExpr = apply.getLoc().getAsASTNode<ApplyExpr>();
-      if (!LocExpr)
-        return false;
-
-      LocExpr = dyn_cast<ApplyExpr>(LocExpr->getFn());
-      if (!LocExpr || !isa<OtherConstructorDeclRefExpr>(LocExpr->getFn()))
-        return false;
-
-      return true;
-    }
-
-    // Ignore the thick_to_objc_metatype instruction.
-    if (isa<ThickToObjCMetatypeInst>(User)) {
-      continue;
-    }
-
-    return false;
-  }
-
-  return false;
-}
-
 void ElementUseCollector::
 collectClassSelfUses(SILValue ClassPointer, SILType MemorySILType,
                      llvm::SmallDenseMap<VarDecl*, unsigned> &EltNumbering) {
@@ -1233,18 +1208,12 @@
       recordFailableInitCall(User);
     }
 
-    // If this is a ValueMetatypeInst, check to see if it's part of a
-    // self.init call to a factory initializer in a delegating
-    // initializer.
-    if (auto *VMI = dyn_cast<ValueMetatypeInst>(User)) {
-      if (isSelfInitUse(VMI))
-        Kind = DIUseKind::SelfInit;
-      else
-        // Otherwise, this is a simple reference to "type(of:)", which is
-        // always fine, even if self is uninitialized.
-        continue;
-    }
-    
+    // If this is a ValueMetatypeInst, this is a simple reference
+    // to "type(of:)", which is always fine, even if self is
+    // uninitialized.
+    if (isa<ValueMetatypeInst>(User))
+      continue;
+
     // If this is a partial application of self, then this is an escape point
     // for it.
     if (isa<PartialApplyInst>(User))
@@ -1289,12 +1258,13 @@
       if (auto apply = dyn_cast<ApplyInst>(cast<AssignInst>(User)->getSrc())) {
         if (auto fn = apply->getCalleeFunction()) {
           if (fn->getRepresentation()
-                == SILFunctionTypeRepresentation::CFunctionPointer)
+                == SILFunctionTypeRepresentation::CFunctionPointer) {
             Uses.push_back(DIMemoryUse(User, DIUseKind::SelfInit, 0, 1));
+            continue;
+          }
         }
       }
 
-      continue;
     }
 
     // Stores *to* the allocation are writes.  If the value being stored is a
@@ -1302,14 +1272,12 @@
     if (auto *AI = dyn_cast<AssignInst>(User)) {
       if (auto *AssignSource = dyn_cast<SILInstruction>(AI->getOperand(0)))
         if (isSelfInitUse(AssignSource)) {
-          assert(isa<ArchetypeType>(TheMemory.getType()));
           Uses.push_back(DIMemoryUse(User, DIUseKind::SelfInit, 0, 1));
           continue;
         }
       if (auto *AssignSource = dyn_cast<SILArgument>(AI->getOperand(0)))
         if (AssignSource->getParent() == AI->getParent())
           if (isSelfInitUse(AssignSource)) {
-            assert(isa<ArchetypeType>(TheMemory.getType()));
             Uses.push_back(DIMemoryUse(User, DIUseKind::SelfInit, 0, 1));
             continue;
           }
@@ -1379,16 +1347,10 @@
           recordFailableInitCall(User);
         }
 
-        // If this is a ValueMetatypeInst, check to see if it's part of a
-        // self.init call to a factory initializer in a delegating
-        // initializer.
-        if (auto *VMI = dyn_cast<ValueMetatypeInst>(User)) {
-          if (isSelfInitUse(VMI))
-            Kind = DIUseKind::SelfInit;
-          else
-            // Otherwise, this is a simple reference to "type(of:)", which is
-            // always fine, even if self is uninitialized.
-            continue;
+        // A simple reference to "type(of:)" is always fine,
+        // even if self is uninitialized.
+        if (isa<ValueMetatypeInst>(User)) {
+          continue;
         }
 
         Uses.push_back(DIMemoryUse(User, Kind, 0, 1));
diff --git a/lib/SILOptimizer/Mandatory/DataflowDiagnostics.cpp b/lib/SILOptimizer/Mandatory/DataflowDiagnostics.cpp
index 26048b1..c88492e 100644
--- a/lib/SILOptimizer/Mandatory/DataflowDiagnostics.cpp
+++ b/lib/SILOptimizer/Mandatory/DataflowDiagnostics.cpp
@@ -46,16 +46,13 @@
     llvm_unreachable("unhandled case in MissingReturn");
   }
 
-  // No action required if the function returns 'Void' or that the
-  // function is marked 'noreturn'.
-  if (ResTy->isVoid() || F->isNoReturnFunction())
-    return;
-
   SILLocation L = UI->getLoc();
   assert(L && ResTy);
+  auto diagID = F->isNoReturnFunction() ? diag::missing_never_call
+                                        : diag::missing_return;
   diagnose(Context,
            L.getEndSourceLoc(),
-           diag::missing_return, ResTy,
+           diagID, ResTy,
            FLoc.isASTNode<ClosureExpr>() ? 1 : 0);
 }
 
diff --git a/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp b/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
index b5799aa..4f40fa8 100644
--- a/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
+++ b/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
@@ -35,39 +35,70 @@
   M.getASTContext().Diags.diagnose(loc.getSourceLoc(), Diagnostic(args...));
 }
 
+enum class PartialInitializationKind {
+  /// The box contains a fully-initialized value.
+  IsNotInitialization,
+
+  /// The box contains a class instance that we own, but the instance has
+  /// not been initialized and should be freed with a special SIL
+  /// instruction made for this purpose.
+  IsReinitialization,
+
+  /// The box contains an undefined value that should be ignored.
+  IsInitialization,
+};
+
 /// Emit the sequence that an assign instruction lowers to once we know
 /// if it is an initialization or an assignment.  If it is an assignment,
 /// a live-in value can be provided to optimize out the reload.
 static void LowerAssignInstruction(SILBuilder &B, AssignInst *Inst,
-                                   IsInitialization_t isInitialization) {
-  DEBUG(llvm::dbgs() << "  *** Lowering [isInit=" << (bool)isInitialization
+                                   PartialInitializationKind isInitialization) {
+  DEBUG(llvm::dbgs() << "  *** Lowering [isInit=" << unsigned(isInitialization)
                      << "]: " << *Inst << "\n");
 
   ++NumAssignRewritten;
 
   SILValue Src = Inst->getSrc();
+  SILLocation Loc = Inst->getLoc();
 
-  // If this is an initialization, or the storage type is trivial, we
-  // can just replace the assignment with a store.
-
-  // Otherwise, if it has trivial type, we can always just replace the
-  // assignment with a store.  If it has non-trivial type and is an
-  // initialization, we can also replace it with a store.
-  if (isInitialization == IsInitialization ||
+  if (isInitialization == PartialInitializationKind::IsInitialization ||
       Inst->getDest()->getType().isTrivial(Inst->getModule())) {
-    B.createStore(Inst->getLoc(), Src, Inst->getDest());
+
+    // If this is an initialization, or the storage type is trivial, we
+    // can just replace the assignment with a store.
+    assert(isInitialization != PartialInitializationKind::IsReinitialization);
+    B.createStore(Loc, Src, Inst->getDest());
+  } else if (isInitialization == PartialInitializationKind::IsReinitialization) {
+
+    // We have a case where a convenience initializer on a class
+    // delegates to a factory initializer from a protocol extension.
+    // Factory initializers give us a whole new instance, so the existing
+    // instance, which has not been initialized and never will be, must be
+    // freed using dealloc_partial_ref.
+    SILValue Pointer = B.createLoad(Loc, Inst->getDest());
+    B.createStore(Loc, Src, Inst->getDest());
+
+    auto MetatypeTy = CanMetatypeType::get(
+        Inst->getDest()->getType().getSwiftRValueType(),
+        MetatypeRepresentation::Thick);
+    auto SILMetatypeTy = SILType::getPrimitiveObjectType(MetatypeTy);
+    SILValue Metatype = B.createValueMetatype(Loc, SILMetatypeTy, Pointer);
+
+    B.createDeallocPartialRef(Loc, Pointer, Metatype);
   } else {
+    assert(isInitialization == PartialInitializationKind::IsNotInitialization);
+
     // Otherwise, we need to replace the assignment with the full
-    // load/store/release dance.  Note that the new value is already
+    // load/store/release dance. Note that the new value is already
     // considered to be retained (by the semantics of the storage type),
     // and we're transferring that ownership count into the destination.
 
     // This is basically TypeLowering::emitStoreOfCopy, except that if we have
     // a known incoming value, we can avoid the load.
-    SILValue IncomingVal = B.createLoad(Inst->getLoc(), Inst->getDest());
+    SILValue IncomingVal = B.createLoad(Loc, Inst->getDest());
     B.createStore(Inst->getLoc(), Src, Inst->getDest());
 
-    B.emitReleaseValueOperation(Inst->getLoc(), IncomingVal);
+    B.emitReleaseValueOperation(Loc, IncomingVal);
   }
 
   Inst->eraseFromParent();
@@ -1632,12 +1663,24 @@
     InstInfo.Inst = nullptr;
     NonLoadUses.erase(Inst);
 
+    PartialInitializationKind PartialInitKind;
+
+    if (TheMemory.isClassInitSelf() &&
+        Kind == DIUseKind::SelfInit) {
+      assert(InitKind == IsInitialization);
+      PartialInitKind = PartialInitializationKind::IsReinitialization;
+    } else {
+      PartialInitKind = (InitKind == IsInitialization
+                         ? PartialInitializationKind::IsInitialization
+                         : PartialInitializationKind::IsNotInitialization);
+    }
+
     unsigned FirstElement = InstInfo.FirstElement;
     unsigned NumElements = InstInfo.NumElements;
 
     SmallVector<SILInstruction*, 4> InsertedInsts;
     SILBuilderWithScope B(Inst, &InsertedInsts);
-    LowerAssignInstruction(B, AI, InitKind);
+    LowerAssignInstruction(B, AI, PartialInitKind);
 
     // If lowering of the assign introduced any new loads or stores, keep track
     // of them.
@@ -1646,7 +1689,11 @@
         NonLoadUses[I] = Uses.size();
         Uses.push_back(DIMemoryUse(I, Kind, FirstElement, NumElements));
       } else if (isa<LoadInst>(I)) {
-        Uses.push_back(DIMemoryUse(I, Load, FirstElement, NumElements));
+        // If we have a re-initialization, the value must be a class,
+        // and the load is just there so we can free the uninitialized
+        // object husk; it's not an actual use of 'self'.
+        if (PartialInitKind != PartialInitializationKind::IsReinitialization)
+          Uses.push_back(DIMemoryUse(I, Load, FirstElement, NumElements));
       }
     }
     return;
@@ -2541,7 +2588,8 @@
       // Unprocessed assigns just lower into assignments, not initializations.
       if (auto *AI = dyn_cast<AssignInst>(Inst)) {
         SILBuilderWithScope B(AI);
-        LowerAssignInstruction(B, AI, IsNotInitialization);
+        LowerAssignInstruction(B, AI,
+            PartialInitializationKind::IsNotInitialization);
         // Assign lowering may split the block. If it did,
         // reset our iteration range to the block after the insertion.
         if (B.getInsertionBB() != &BB)
diff --git a/lib/SILOptimizer/Mandatory/MandatoryInlining.cpp b/lib/SILOptimizer/Mandatory/MandatoryInlining.cpp
index d034f9f..8ac5794 100644
--- a/lib/SILOptimizer/Mandatory/MandatoryInlining.cpp
+++ b/lib/SILOptimizer/Mandatory/MandatoryInlining.cpp
@@ -37,6 +37,44 @@
   Context.Diags.diagnose(loc, diag, std::forward<U>(args)...);
 }
 
+namespace {
+
+/// A helper class to update an instruction iterator if
+/// removal of instructions would invalidate it.
+class DeleteInstructionsHandler : public DeleteNotificationHandler {
+  SILBasicBlock::iterator &CurrentI;
+  SILModule &Module;
+
+public:
+  DeleteInstructionsHandler(SILBasicBlock::iterator &I)
+      : CurrentI(I), Module(I->getModule()) {
+    Module.registerDeleteNotificationHandler(this);
+  }
+
+  ~DeleteInstructionsHandler() {
+     // Unregister the handler.
+    Module.removeDeleteNotificationHandler(this);
+  }
+
+  // Handling of instruction removal notifications.
+  bool needsNotifications() { return true; }
+
+  // Handle notifications about removals of instructions.
+  void handleDeleteNotification(swift::ValueBase *Value) {
+    if (auto DeletedI = dyn_cast<SILInstruction>(Value)) {
+      if (CurrentI == SILBasicBlock::iterator(DeletedI)) {
+        if (CurrentI != CurrentI->getParent()->begin()) {
+          --CurrentI;
+        } else {
+          ++CurrentI;
+        }
+      }
+    }
+  }
+};
+
+} // end of namespace
+
 /// \brief Fixup reference counts after inlining a function call (which is a
 /// no-op unless the function is a thick function). Note that this function
 /// makes assumptions about the release/retain convention of thick function
@@ -199,7 +237,7 @@
       // If we find the load instruction first, then the load is loading from
       // a non-initialized alloc; this shouldn't really happen but I'm not
       // making any assumptions
-      if (static_cast<SILInstruction*>(I) == LI)
+      if (&*I == LI)
         return nullptr;
       if ((SI = dyn_cast<StoreInst>(I)) && SI->getDest() == PBI) {
         // We found a store that we know dominates the load; now ensure there
@@ -388,6 +426,8 @@
         I = ApplyBlock->end();
 
       TypeSubstitutionMap ContextSubs;
+      ArchetypeConformanceMap ConformanceMap;
+
       std::vector<Substitution> ApplySubs(InnerAI.getSubstitutions());
 
       if (PAI) {
@@ -395,8 +435,13 @@
         ApplySubs.insert(ApplySubs.end(), PAISubs.begin(), PAISubs.end());
       }
 
-      ContextSubs.copyFrom(CalleeFunction->getContextGenericParams()
-                                         ->getSubstitutionMap(ApplySubs));
+      if (auto *params = CalleeFunction->getContextGenericParams()) {
+        auto sig = CalleeFunction->getLoweredFunctionType()
+            ->getGenericSignature();
+        params->getSubstitutionMap(F->getModule().getSwiftModule(),
+                                   sig, ApplySubs,
+                                   ContextSubs, ConformanceMap);
+      }
 
       SILOpenedArchetypesTracker OpenedArchetypesTracker(*F);
       F->getModule().registerDeleteNotificationHandler(
@@ -419,8 +464,9 @@
       // Reestablish our iterator if it wrapped.
       if (I == ApplyBlock->end())
         I = ApplyBlock->begin();
-      else
-        ++I;
+
+      // Update the iterator when instructions are removed.
+      DeleteInstructionsHandler DeletionHandler(I);
 
       // If the inlined apply was a thick function, then we need to balance the
       // reference counts for correctness.
@@ -433,8 +479,9 @@
 
       // Reposition iterators possibly invalidated by mutation.
       FI = SILFunction::iterator(ApplyBlock);
-      I = ApplyBlock->begin();
       E = ApplyBlock->end();
+      assert(FI == SILFunction::iterator(I->getParent()) &&
+             "Mismatch between the instruction and basic block");
       ++NumMandatoryInlines;
     }
   }
diff --git a/lib/SILOptimizer/PassManager/PassManager.cpp b/lib/SILOptimizer/PassManager/PassManager.cpp
index 72426f4..83701d9 100644
--- a/lib/SILOptimizer/PassManager/PassManager.cpp
+++ b/lib/SILOptimizer/PassManager/PassManager.cpp
@@ -49,10 +49,6 @@
     "sil-opt-pass-count", llvm::cl::init(UINT_MAX),
     llvm::cl::desc("Stop optimizing after <N> optimization passes"));
 
-llvm::cl::opt<unsigned> SILFunctionPassPipelineLimit("sil-pipeline-limit",
-                                                     llvm::cl::init(10),
-                                                     llvm::cl::desc(""));
-
 llvm::cl::opt<std::string> SILBreakOnFun(
     "sil-break-on-function", llvm::cl::init(""),
     llvm::cl::desc(
@@ -274,110 +270,92 @@
   return fnName == SILBreakOnFun && passName == SILBreakOnPass;
 }
 
-void SILPassManager::runPassesOnFunction(PassList FuncTransforms,
-                                         SILFunction *F,
-                                         bool runToCompletion) {
-
-  const SILOptions &Options = getOptions();
-
-  CompletedPasses &completedPasses = CompletedPassesMap[F];
+void SILPassManager::runPassOnFunction(SILFunctionTransform *SFT,
+                                       SILFunction *F) {
 
   assert(analysesUnlocked() && "Expected all analyses to be unlocked!");
 
-  for (auto SFT : FuncTransforms) {
-    PrettyStackTraceSILFunctionTransform X(SFT, NumPassesRun);
-    DebugPrintEnabler DebugPrint(NumPassesRun);
+  PrettyStackTraceSILFunctionTransform X(SFT, NumPassesRun);
+  DebugPrintEnabler DebugPrint(NumPassesRun);
 
-    SFT->injectPassManager(this);
-    SFT->injectFunction(F);
+  SFT->injectPassManager(this);
+  SFT->injectFunction(F);
 
-    // If nothing changed since the last run of this pass, we can skip this
-    // pass.
-    if (completedPasses.test((size_t)SFT->getPassKind()) &&
-        !SILDisableSkippingPasses) {
-      if (SILPrintPassName)
-        llvm::dbgs() << "(Skip) Stage: " << StageName
-                     << " Pass: " << SFT->getName()
-                     << ", Function: " << F->getName() << "\n";
-      continue;
-    }
-
-    if (isDisabled(SFT)) {
-      if (SILPrintPassName)
-        llvm::dbgs() << "(Disabled) Stage: " << StageName
-                     << " Pass: " << SFT->getName()
-                     << ", Function: " << F->getName() << "\n";
-      continue;
-    }
-
-    CurrentPassHasInvalidated = false;
-
+  // If nothing changed since the last run of this pass, we can skip this
+  // pass.
+  CompletedPasses &completedPasses = CompletedPassesMap[F];
+  if (completedPasses.test((size_t)SFT->getPassKind()) &&
+      !SILDisableSkippingPasses) {
     if (SILPrintPassName)
-      llvm::dbgs() << "#" << NumPassesRun << " Stage: " << StageName
+      llvm::dbgs() << "  (Skip) Stage: " << StageName
                    << " Pass: " << SFT->getName()
                    << ", Function: " << F->getName() << "\n";
-
-    if (doPrintBefore(SFT, F)) {
-      llvm::dbgs() << "*** SIL function before " << StageName << " "
-                   << SFT->getName() << " (" << NumOptimizationIterations
-                   << ") ***\n";
-      F->dump(Options.EmitVerboseSIL);
-    }
-
-    llvm::sys::TimeValue StartTime = llvm::sys::TimeValue::now();
-    Mod->registerDeleteNotificationHandler(SFT);
-    if (breakBeforeRunning(F->getName(), SFT->getName()))
-      LLVM_BUILTIN_DEBUGTRAP;
-    SFT->run();
-    assert(analysesUnlocked() && "Expected all analyses to be unlocked!");
-    Mod->removeDeleteNotificationHandler(SFT);
-
-    // Did running the transform result in new functions being added
-    // to the top of our worklist?
-    bool newFunctionsAdded = (F != FunctionWorklist.back());
-
-    if (SILPrintPassTime) {
-      auto Delta =
-          llvm::sys::TimeValue::now().nanoseconds() - StartTime.nanoseconds();
-      llvm::dbgs() << Delta << " (" << SFT->getName() << "," << F->getName()
-                   << ")\n";
-    }
-
-    // If this pass invalidated anything, print and verify.
-    if (doPrintAfter(SFT, F, CurrentPassHasInvalidated && SILPrintAll)) {
-      llvm::dbgs() << "*** SIL function after " << StageName << " "
-                   << SFT->getName() << " (" << NumOptimizationIterations
-                   << ") ***\n";
-      F->dump(Options.EmitVerboseSIL);
-    }
-
-    // Remember if this pass didn't change anything.
-    if (!CurrentPassHasInvalidated)
-      completedPasses.set((size_t)SFT->getPassKind());
-
-    if (Options.VerifyAll &&
-        (CurrentPassHasInvalidated || SILVerifyWithoutInvalidation)) {
-      F->verify();
-      verifyAnalyses(F);
-    }
-
-    ++NumPassesRun;
-
-    if (!continueTransforming())
-      return;
-
-    if (runToCompletion)
-      continue;
-
-    // If running the transform resulted in new functions on the top
-    // of the worklist, we'll return so that we can begin processing
-    // those new functions.
-    if (shouldRestartPipeline() || newFunctionsAdded)
-      return;
+    return;
   }
+
+  if (isDisabled(SFT)) {
+    if (SILPrintPassName)
+      llvm::dbgs() << "  (Disabled) Stage: " << StageName
+                   << " Pass: " << SFT->getName()
+                   << ", Function: " << F->getName() << "\n";
+    return;
+  }
+
+  CurrentPassHasInvalidated = false;
+
+  if (SILPrintPassName)
+    llvm::dbgs() << "  #" << NumPassesRun << " Stage: " << StageName
+                 << " Pass: " << SFT->getName()
+                 << ", Function: " << F->getName() << "\n";
+
+  if (doPrintBefore(SFT, F)) {
+    llvm::dbgs() << "*** SIL function before " << StageName << " "
+                 << SFT->getName() << " (" << NumOptimizationIterations
+                 << ") ***\n";
+    F->dump(getOptions().EmitVerboseSIL);
+  }
+
+  llvm::sys::TimeValue StartTime = llvm::sys::TimeValue::now();
+  Mod->registerDeleteNotificationHandler(SFT);
+  if (breakBeforeRunning(F->getName(), SFT->getName()))
+    LLVM_BUILTIN_DEBUGTRAP;
+  SFT->run();
+  assert(analysesUnlocked() && "Expected all analyses to be unlocked!");
+  Mod->removeDeleteNotificationHandler(SFT);
+
+  if (SILPrintPassTime) {
+    auto Delta =
+        llvm::sys::TimeValue::now().nanoseconds() - StartTime.nanoseconds();
+    llvm::dbgs() << Delta << " (" << SFT->getName() << "," << F->getName()
+                 << ")\n";
+  }
+
+  // If this pass invalidated anything, print and verify.
+  if (doPrintAfter(SFT, F, CurrentPassHasInvalidated && SILPrintAll)) {
+    llvm::dbgs() << "*** SIL function after " << StageName << " "
+                 << SFT->getName() << " (" << NumOptimizationIterations
+                 << ") ***\n";
+    F->dump(getOptions().EmitVerboseSIL);
+  }
+
+  // Remember if this pass didn't change anything.
+  if (!CurrentPassHasInvalidated)
+    completedPasses.set((size_t)SFT->getPassKind());
+
+  if (getOptions().VerifyAll &&
+      (CurrentPassHasInvalidated || SILVerifyWithoutInvalidation)) {
+    F->verify();
+    verifyAnalyses(F);
+  }
+
+  ++NumPassesRun;
 }
 
 void SILPassManager::runFunctionPasses(PassList FuncTransforms) {
+
+  if (FuncTransforms.empty())
+    return;
+
   BasicCalleeAnalysis *BCA = getAnalysis<BasicCalleeAnalysis>();
   BottomUpFunctionOrder BottomUpOrder(*Mod, BCA);
   auto BottomUpFunctions = BottomUpOrder.getFunctions();
@@ -395,82 +373,43 @@
       FunctionWorklist.push_back(*I);
   }
 
-  // Used to track how many times a given function has been
-  // (partially) optimized by the function pass pipeline in this
-  // invocation.
-  llvm::DenseMap<SILFunction *, unsigned> CountOptimized;
+  DerivationLevels.clear();
 
-  // Count of how many iterations we've had since any function was
-  // popped off the function worklist. This is used to ensure progress
-  // and eliminate the chance of going into an infinite loop in cases
-  // where (for example) we have recursive type-based specialization
+  // The maximum number of times the pass pipeline can be restarted for a
+  // function. This is used to ensure we are not going into an infinite loop in
+  // cases where (for example) we have recursive type-based specialization
   // happening.
-  unsigned IterationsWithoutProgress = 0;
+  const unsigned MaxNumRestarts = 20;
 
-  // The maximum number of functions we'll optimize without popping
-  // any off the worklist. This is expected to non-zero.
-  const unsigned MaxIterationsWithoutProgress = 20;
+  if (SILPrintPassName)
+    llvm::dbgs() << "Start function passes at stage: " << StageName << "\n";
 
-  // Pop functions off the worklist, and run all function transforms
-  // on each of them.
+  // Run all transforms for all functions, starting at the tail of the worklist.
   while (!FunctionWorklist.empty() && continueTransforming()) {
-    auto *F = FunctionWorklist.back();
+    unsigned TailIdx = FunctionWorklist.size() - 1;
+    unsigned PipelineIdx = FunctionWorklist[TailIdx].PipelineIdx;
+    SILFunction *F = FunctionWorklist[TailIdx].F;
 
-    // If we've done many iterations without progress, pop the current
-    // function and any other function we've run any optimizations on
-    // on from the stack and then continue.
-    if (IterationsWithoutProgress == (MaxIterationsWithoutProgress - 1)) {
-      // Pop the current (potentially not-yet-optimized) function off.
+    if (PipelineIdx >= FuncTransforms.size()) {
+      // All passes did already run for the function. Pop it off the worklist.
       FunctionWorklist.pop_back();
-      IterationsWithoutProgress = 0;
-
-      // Pop any remaining functions that have been optimized (at
-      // least through some portion of the pipeline).
-      while (!FunctionWorklist.empty() &&
-             CountOptimized[FunctionWorklist.back()] > 0)
-        FunctionWorklist.pop_back();
-
       continue;
     }
-
-    if (CountOptimized[F] > SILFunctionPassPipelineLimit) {
-      DEBUG(llvm::dbgs() << "*** Hit limit optimizing: " << F->getName()
-                         << '\n');
-      FunctionWorklist.pop_back();
-      IterationsWithoutProgress = 0;
-      continue;
-    }
-
-    assert(
-        !shouldRestartPipeline() &&
+    assert(!shouldRestartPipeline() &&
         "Did not expect function pipeline set up to restart from beginning!");
 
-    assert(CountOptimized[F] <= SILFunctionPassPipelineLimit &&
-           "Function optimization count exceeds limit!");
-    auto runToCompletion = CountOptimized[F] == SILFunctionPassPipelineLimit;
+    runPassOnFunction(FuncTransforms[PipelineIdx], F);
 
-    runPassesOnFunction(FuncTransforms, F, runToCompletion);
-    ++CountOptimized[F];
-    ++IterationsWithoutProgress;
-
-    if (runToCompletion) {
-      FunctionWorklist.pop_back();
-      IterationsWithoutProgress = 0;
-      clearRestartPipeline();
-      continue;
+    // Note: Don't get entry reference prior to runPassOnFunction().
+    // A pass can push a new function to the worklist which may cause a
+    // reallocation of the buffer and that would invalidate the reference.
+    WorklistEntry &Entry = FunctionWorklist[TailIdx];
+    if (shouldRestartPipeline() && Entry.NumRestarts < MaxNumRestarts) {
+      ++Entry.NumRestarts;
+      Entry.PipelineIdx = 0;
+    } else {
+      ++Entry.PipelineIdx;
     }
-
-
-    // If running the function transforms did not result in new
-    // functions being added to the top of the worklist, then we're
-    // done with this function and can pop it off and continue.
-    // Otherwise, we'll return to this function and reoptimize after
-    // processing the new functions that were added.
-    if (F == FunctionWorklist.back() && !shouldRestartPipeline()) {
-      FunctionWorklist.pop_back();
-      IterationsWithoutProgress = 0;
-    }
-
     clearRestartPipeline();
   }
 }
@@ -615,6 +554,33 @@
   }
 }
 
+void SILPassManager::addFunctionToWorklist(SILFunction *F,
+                                           SILFunction *DerivedFrom) {
+  assert(F && F->isDefinition() && F->shouldOptimize() &&
+         "Expected optimizable function definition!");
+
+  const int MaxDeriveLevels = 10;
+
+  int NewLevel = 1;
+  if (DerivedFrom) {
+    NewLevel = DerivationLevels[DerivedFrom] + 1;
+    // Limit the number of derivations, i.e. don't allow that a pass specializes
+    // a specialized function which is itself a specialized function, and so on.
+    if (NewLevel >= MaxDeriveLevels)
+      return;
+  }
+  int &StoredLevel = DerivationLevels[F];
+
+  // Only allow a function to be pushed on the worklist a single time
+  // (not counting the initial population of the worklist with the bottom-up
+  // function order).
+  if (StoredLevel > 0)
+    return;
+
+  StoredLevel = NewLevel;
+  FunctionWorklist.push_back(F);
+}
+
 void SILPassManager::restartWithCurrentFunction(SILTransform *T) {
   assert(isa<SILFunctionTransform>(T) &&
          "Can only restart the pipeline from function passes");
diff --git a/lib/SILOptimizer/PassManager/Passes.cpp b/lib/SILOptimizer/PassManager/Passes.cpp
index 1c62f69..9893140 100644
--- a/lib/SILOptimizer/PassManager/Passes.cpp
+++ b/lib/SILOptimizer/PassManager/Passes.cpp
@@ -307,6 +307,11 @@
   // Run an iteration of the mid-level SSA passes.
   PM.setStageName("MidLevel");
   AddSSAPasses(PM, OptimizationLevelKind::MidLevel);
+  
+  // Specialy partially applied functions with dead arguments as a preparation
+  // for CapturePropagation.
+  PM.addDeadArgSignatureOpt();
+
   PM.runOneIteration();
   PM.resetAndRemoveTransformations();
 
diff --git a/lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp b/lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp
index 8783d30..9cb4456 100644
--- a/lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp
+++ b/lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp
@@ -774,9 +774,9 @@
   }
 
   if (ConcreteType->isOpenedExistential()) {
-    assert(!InitExistential->getOpenedArchetypeOperands().empty() &&
+    assert(!InitExistential->getTypeDependentOperands().empty() &&
            "init_existential is supposed to have a typedef operand");
-    ConcreteTypeDef = InitExistential->getOpenedArchetypeOperands()[0].get();
+    ConcreteTypeDef = InitExistential->getTypeDependentOperands()[0].get();
   }
 
   // Find the conformance for the protocol we're interested in.
@@ -1038,13 +1038,6 @@
     Builder.createReleaseValue(Call->getLoc(), OnX, Atomicity::Atomic);
 }
 
-static bool isCastTypeKnownToSucceed(SILType Type, SILModule &Mod) {
-  auto *M = Mod.getSwiftModule();
-  return M->getASTContext()
-      .getBridgedToObjC(M, Type.getSwiftRValueType(), nullptr)
-      .hasValue();
-}
-
 /// Replace an application of a cast composition f_inverse(f(x)) by x.
 bool SILCombiner::optimizeIdentityCastComposition(ApplyInst *FInverse,
                                               StringRef FInverseName,
@@ -1057,12 +1050,6 @@
   if (!knowHowToEmitReferenceCountInsts(FInverse))
     return false;
 
-  // We need to know that the cast will succeed.
-  if (!isCastTypeKnownToSucceed(FInverse->getArgument(0)->getType(),
-                                FInverse->getModule()) ||
-      !isCastTypeKnownToSucceed(FInverse->getType(), FInverse->getModule()))
-    return false;
-
   // Need to have a matching 'f'.
   auto *F = dyn_cast<ApplyInst>(FInverse->getArgument(0));
   if (!F)
diff --git a/lib/SILOptimizer/Transforms/CSE.cpp b/lib/SILOptimizer/Transforms/CSE.cpp
index bb41f87..4342dbe 100644
--- a/lib/SILOptimizer/Transforms/CSE.cpp
+++ b/lib/SILOptimizer/Transforms/CSE.cpp
@@ -358,7 +358,7 @@
                               X->getMember().getHashCode(),
                               X->getConformance(),
                               X->getType(),
-                              !X->getOpenedArchetypeOperands().empty(),
+                              !X->getTypeDependentOperands().empty(),
                               llvm::hash_combine_range(
                               Operands.begin(),
                               Operands.end()));
@@ -645,7 +645,7 @@
   // that need to be replaced.
   for (auto Use : Inst->getUses()) {
     auto User = Use->getUser();
-    if (User->mayHaveOpenedArchetypeOperands()) {
+    if (!User->getTypeDependentOperands().empty()) {
       if (canHandle(User)) {
         auto It = AvailableValues->begin(User);
         if (It != AvailableValues->end()) {
@@ -685,7 +685,7 @@
   // by a dominating one.
   for (auto Candidate : Candidates) {
     Builder.getOpenedArchetypes().addOpenedArchetypeOperands(
-        Candidate->getOpenedArchetypeOperands());
+        Candidate->getTypeDependentOperands());
     Builder.setInsertionPoint(Candidate);
     auto NewI = Cloner.clone(Candidate);
     Candidate->replaceAllUsesWith(NewI);
@@ -884,7 +884,7 @@
   for (auto *UI : getNonDebugUses(OE)) {
     auto *User = UI->getUser();
     if (!isa<WitnessMethodInst>(User) &&
-        User->isOpenedArchetypeOperand(UI->getOperandNumber()))
+        User->isTypeDependentOperand(UI->getOperandNumber()))
       continue;
     // Check that we have a single Apply user.
     if (auto *AA = dyn_cast<ApplyInst>(User)) {
diff --git a/lib/SILOptimizer/Transforms/DeadStoreElimination.cpp b/lib/SILOptimizer/Transforms/DeadStoreElimination.cpp
index 3c38e2e..7041a82 100644
--- a/lib/SILOptimizer/Transforms/DeadStoreElimination.cpp
+++ b/lib/SILOptimizer/Transforms/DeadStoreElimination.cpp
@@ -62,7 +62,6 @@
 #include "swift/SIL/SILBuilder.h"
 #include "swift/SILOptimizer/Analysis/AliasAnalysis.h"
 #include "swift/SILOptimizer/Analysis/PostOrderAnalysis.h"
-#include "swift/SILOptimizer/Analysis/ValueTracking.h"
 #include "swift/SILOptimizer/PassManager/Passes.h"
 #include "swift/SILOptimizer/PassManager/Transforms.h"
 #include "swift/SILOptimizer/Utils/CFG.h"
@@ -77,15 +76,15 @@
 
 using namespace swift;
 
-/// If a large store is broken down to too many smaller stores, bail out.
-/// Currently, we only do partial dead store if we can form a single contiguous
-/// non-dead store.
-static llvm::cl::opt<unsigned>
-MaxPartialStoreCount("max-partial-store-count", llvm::cl::init(1), llvm::cl::Hidden);
-
 STATISTIC(NumDeadStores, "Number of dead stores removed");
 STATISTIC(NumPartialDeadStores, "Number of partial dead stores removed");
 
+/// If a large store is broken down to too many smaller stores, bail out.
+/// Currently, we only do partial dead store if we can form a single contiguous
+/// live store.
+static llvm::cl::opt<unsigned>
+MaxPartialStoreCount("max-partial-store-count", llvm::cl::init(1), llvm::cl::Hidden);
+
 /// ComputeMaxStoreSet - If we ignore all reads, what is the max store set that
 /// can reach a particular point in a basic block. This helps in generating
 /// the genset and killset. i.e. if there is no upward visible store that can
@@ -154,7 +153,6 @@
 //===----------------------------------------------------------------------===//
 
 namespace {
-
 /// If this function has too many basic blocks or too many locations, it may
 /// take a long time to compute the genset and killset. The number of memory
 /// behavior or alias query we need to do in worst case is roughly linear to
@@ -295,7 +293,6 @@
 //===----------------------------------------------------------------------===//
 
 namespace {
-
 /// The dead store elimination context, keep information about stores in a basic
 /// block granularity.
 class DSEContext {
@@ -326,7 +323,7 @@
   llvm::SpecificBumpPtrAllocator<BlockState> &BPA;
 
   /// The epilogue release matcher we are using.
-  ConsumedArgToEpilogueReleaseMatcher& ERM;
+  ConsumedArgToEpilogueReleaseMatcher &ERM;
 
   /// Map every basic block to its location state.
   llvm::SmallDenseMap<SILBasicBlock *, BlockState *> BBToLocState;
@@ -1099,7 +1096,7 @@
   // Generate the genset and killset for each basic block. We can process the
   // basic blocks in any order.
   // 
-  // We also Compute the max store set at the beginning of the basic block.
+  // We also compute the max store set at the beginning of the basic block.
   //
   auto *PO = PM->getAnalysis<PostOrderAnalysis>()->get(F);
   for (SILBasicBlock *B : PO->getPostOrder()) {
diff --git a/lib/SILOptimizer/Transforms/Devirtualizer.cpp b/lib/SILOptimizer/Transforms/Devirtualizer.cpp
index 1559fe4..9d1f390 100644
--- a/lib/SILOptimizer/Transforms/Devirtualizer.cpp
+++ b/lib/SILOptimizer/Transforms/Devirtualizer.cpp
@@ -111,7 +111,7 @@
     // be beneficial to rerun some earlier passes on the current
     // function now that we've made these direct references visible.
     if (CalleeFn->isDefinition() && CalleeFn->shouldOptimize())
-      notifyPassManagerOfFunction(CalleeFn);
+      notifyPassManagerOfFunction(CalleeFn, nullptr);
   }
 
   return Changed;
diff --git a/lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp b/lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp
index 6209889..81c7558 100644
--- a/lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp
+++ b/lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp
@@ -97,9 +97,6 @@
   /// The newly created function.
   SILFunction *NewF;
 
-  /// The pass manager we are using.
-  SILPassManager *PM;
-
   /// The alias analysis we are using.
   AliasAnalysis *AA;
 
@@ -123,24 +120,12 @@
   /// will use during our optimization.
   llvm::SmallVector<ResultDescriptor, 4> &ResultDescList;
 
-  /// May dynamically bind to self.
-  bool MayDynamicBindSelf;
-
-  /// Does this function have a caller inside current module
-  bool hasCaller;
-
   /// Return a function name based on ArgumentDescList and ResultDescList.
   std::string createOptimizedSILFunctionName();
 
   /// Return a function type based on ArgumentDescList and ResultDescList.
   CanSILFunctionType createOptimizedSILFunctionType();
 
-  // This implicitly asserts that a function binding dynamic self has a 
-  // self metadata argument or object from which self metadata can be obtained.
-  bool isArgumentABIRequired(SILArgument *Arg) {
-    return MayDynamicBindSelf && (F->getSelfMetadataArgument() == Arg);
-  }
-
 private:
   /// ----------------------------------------------------------///
   /// Dead argument transformation.                             ///
@@ -233,26 +218,32 @@
 
 public:
   /// Constructor.
-  FunctionSignatureTransform(SILFunction *F, bool hasCaller, SILPassManager *PM,
+  FunctionSignatureTransform(SILFunction *F,
                              AliasAnalysis *AA, RCIdentityAnalysis *RCIA,
                              FunctionSignatureSpecializationMangler &FM,
                              ArgumentIndexMap &AIM,
                              llvm::SmallVector<ArgumentDescriptor, 4> &ADL,
                              llvm::SmallVector<ResultDescriptor, 4> &RDL)
-    : F(F), NewF(nullptr), PM(PM), AA(AA), RCIA(RCIA), FM(FM),
+    : F(F), NewF(nullptr), AA(AA), RCIA(RCIA), FM(FM),
       AIM(AIM), shouldModifySelfArgument(false), ArgumentDescList(ADL),
-      ResultDescList(RDL), MayDynamicBindSelf(computeMayBindDynamicSelf(F)),
-      hasCaller(hasCaller) {}
+      ResultDescList(RDL) {}
 
   /// Return the optimized function.
   SILFunction *getOptimizedFunction() { return NewF; }
 
   /// Run the optimization.
-  bool run() {
+  bool run(bool hasCaller) {
     bool Changed = false;
+
+    if (!hasCaller && canBeCalledIndirectly(F->getRepresentation())) {
+      DEBUG(llvm::dbgs() << "  function has no caller -> abort\n");
+      return false;
+    }
+
     // Run OwnedToGuaranteed optimization.
     if (OwnedToGuaranteedAnalyze()) {
       Changed = true;
+      DEBUG(llvm::dbgs() << "  transform owned-to-guaranteed\n");
       OwnedToGuaranteedTransform();
     }
 
@@ -261,6 +252,7 @@
     // already created a thunk.
     if ((hasCaller || Changed) && DeadArgumentAnalyzeParameters()) {
       Changed = true;
+      DEBUG(llvm::dbgs() << "  remove dead arguments\n");
       DeadArgumentTransformFunction();
     }
 
@@ -283,10 +275,46 @@
     // Create the specialized function and invalidate the old function.
     if (Changed) {
       createFunctionSignatureOptimizedFunction();
-      PM->invalidateAnalysis(F, SILAnalysis::InvalidationKind::Everything);
     }
     return Changed;
   }
+
+  /// Run dead argument elimination of partially applied functions.
+  /// After this optimization CapturePropagation can replace the partial_apply
+  /// by a direct reference to the specialized function.
+  bool removeDeadArgs(int minPartialAppliedArgs) {
+    if (minPartialAppliedArgs < 1)
+      return false;
+
+    if (!DeadArgumentAnalyzeParameters())
+      return false;
+
+    // Check if at least the minimum number of partially applied arguments
+    // are dead. Otherwise no partial_apply can be removed anyway.
+    for (unsigned Idx = 0, Num = ArgumentDescList.size(); Idx < Num; ++Idx) {
+      if (Idx < Num - minPartialAppliedArgs) {
+        // Don't remove arguments other than the partial applied ones, even if
+        // they are dead.
+        ArgumentDescList[Idx].IsEntirelyDead = false;
+      } else {
+        // Is the partially applied argument dead?
+        if (!ArgumentDescList[Idx].IsEntirelyDead)
+          return false;
+        
+        // Currently we require that all dead parameters have trivial types.
+        // The reason is that it's very hard to find places where we can release
+        // those parameters (as a replacement for the removed partial_apply).
+        // TODO: maybe we can skip this restrication when we have semantic ARC.
+        if (!ArgumentDescList[Idx].Arg->getType().isTrivial(F->getModule()))
+          return false;
+      }
+    }
+
+    DEBUG(llvm::dbgs() << "  remove dead arguments for partial_apply\n");
+    DeadArgumentTransformFunction();
+    createFunctionSignatureOptimizedFunction();
+    return true;
+  }
 };
 
 std::string FunctionSignatureTransform::createOptimizedSILFunctionName() {
@@ -425,8 +453,14 @@
   // Create the optimized function !
   SILModule &M = F->getModule();
   std::string Name = getUniqueName(createOptimizedSILFunctionName(), M);
+  SILLinkage linkage = F->getLinkage();
+  if (isAvailableExternally(linkage))
+    linkage = SILLinkage::Shared;
+
+  DEBUG(llvm::dbgs() << "  -> create specialized function " << Name << "\n");
+  
   NewF = M.createFunction(
-      F->getLinkage(), Name,
+      linkage, Name,
       createOptimizedSILFunctionType(), nullptr, F->getLocation(), F->isBare(),
       F->isTransparent(), F->isFragile(), F->isThunk(), F->getClassVisibility(),
       F->getInlineStrategy(), F->getEffectsKind(), 0, F->getDebugScope(),
@@ -526,13 +560,11 @@
     }
 
     // Check whether argument is dead.
-    A.IsEntirelyDead = true;
-    A.IsEntirelyDead &= !isArgumentABIRequired(Args[i]);
-    A.IsEntirelyDead &= !hasNonTrivialNonDebugUse(Args[i]); 
-    SignatureOptimize |= A.IsEntirelyDead;
-
-    if (A.IsEntirelyDead && Args[i]->isSelf()) {
-      shouldModifySelfArgument = true;
+    if (!hasNonTrivialNonDebugUse(Args[i])) {
+      A.IsEntirelyDead = true;
+      SignatureOptimize = true;
+      if (Args[i]->isSelf())
+        shouldModifySelfArgument = true;
     }
   }
   return SignatureOptimize;
@@ -817,32 +849,39 @@
 //===----------------------------------------------------------------------===//
 namespace {
 class FunctionSignatureOpts : public SILFunctionTransform {
+  
+  /// If true, perform a special kind of dead argument elimination to enable
+  /// removal of partial_apply instructions where all partially applied
+  /// arguments are dead.
+  bool OptForPartialApply;
+
 public:
+
+  FunctionSignatureOpts(bool OptForPartialApply) :
+     OptForPartialApply(OptForPartialApply) { }
+
   void run() override {
     auto *F = getFunction();
-    // This is the function to optimize.
-    DEBUG(llvm::dbgs() << "*** FSO on function: " << F->getName() << " ***\n");
 
     // Don't optimize callees that should not be optimized.
     if (!F->shouldOptimize())
       return;
 
-    // Does this function have a caller inside this module.
-    bool hasCaller = PM->getAnalysis<CallerAnalysis>()->hasCaller(F);
-
-    // If this function does not have a direct caller in the current module
-    // and maybe called indirectly, e.g. from virtual table do not function
-    // signature specialize it, as this will introduce a thunk.
-    if (!hasCaller && canBeCalledIndirectly(F->getRepresentation()))
-      return; 
+    // This is the function to optimize.
+    DEBUG(llvm::dbgs() << "*** FSO on function: " << F->getName() << " ***\n");
 
     // Check the signature of F to make sure that it is a function that we
     // can specialize. These are conditions independent of the call graph.
-    if (!canSpecializeFunction(F))
+    if (!canSpecializeFunction(F)) {
+      DEBUG(llvm::dbgs() << "  cannot specialize function -> abort\n");
       return;
+    }
 
     auto *AA = PM->getAnalysis<AliasAnalysis>();
     auto *RCIA = getAnalysis<RCIdentityAnalysis>();
+    CallerAnalysis *CA = PM->getAnalysis<CallerAnalysis>();
+
+    const CallerAnalysis::FunctionInfo &FuncInfo = CA->getCallerInfo(F);
 
     // As we optimize the function more and more, the name of the function is
     // going to change, make sure the mangler is aware of all the changes done
@@ -871,15 +910,34 @@
     }
 
     // Owned to guaranteed optimization.
-    FunctionSignatureTransform FST(F, hasCaller, PM, AA, RCIA, FM, AIM,
+    FunctionSignatureTransform FST(F, AA, RCIA, FM, AIM,
                                    ArgumentDescList, ResultDescList);
-    if (FST.run()) {
+
+    bool Changed = false;
+    if (OptForPartialApply) {
+      Changed = FST.removeDeadArgs(FuncInfo.getMinPartialAppliedArgs());
+    } else {
+      Changed = FST.run(FuncInfo.hasCaller());
+    }
+    if (Changed) {
       ++ NumFunctionSignaturesOptimized;
       // The old function must be a thunk now.
       assert(F->isThunk() && "Old function should have been turned into a thunk");
+
+      PM->invalidateAnalysis(F, SILAnalysis::InvalidationKind::Everything);
+
       // Make sure the PM knows about this function. This will also help us
       // with self-recursion.
-      notifyPassManagerOfFunction(FST.getOptimizedFunction());
+      notifyPassManagerOfFunction(FST.getOptimizedFunction(), F);
+
+      if (!OptForPartialApply) {
+        // We have to restart the pipeline for this thunk in order to run the
+        // inliner (and other opts) again. This is important if the new
+        // specialized function (which is called from this thunk) is
+        // function-signature-optimized again and also becomes an
+        // always-inline-thunk.
+        restartPassPipeline();
+      }
     }
   }
 
@@ -889,5 +947,9 @@
 } // end anonymous namespace
 
 SILTransform *swift::createFunctionSignatureOpts() {
-  return new FunctionSignatureOpts();
+  return new FunctionSignatureOpts(/* OptForPartialApply */ false);
+}
+
+SILTransform *swift::createDeadArgSignatureOpt() {
+  return new FunctionSignatureOpts(/* OptForPartialApply */ true);
 }
diff --git a/lib/SILOptimizer/Transforms/GenericSpecializer.cpp b/lib/SILOptimizer/Transforms/GenericSpecializer.cpp
index dc3a74a..8299752 100644
--- a/lib/SILOptimizer/Transforms/GenericSpecializer.cpp
+++ b/lib/SILOptimizer/Transforms/GenericSpecializer.cpp
@@ -82,6 +82,8 @@
       auto *I = Applies.pop_back_val();
       auto Apply = ApplySite::isa(I);
       assert(Apply && "Expected an apply!");
+      SILFunction *Callee = Apply.getReferencedFunction();
+      assert(Callee && "Expected to have a known callee");
 
       // We have a call that can potentially be specialized, so
       // attempt to do so.
@@ -106,7 +108,7 @@
       // (as opposed to returning a previous specialization), we need to notify
       // the pass manager so that the new functions get optimized.
       for (SILFunction *NewF : reverse(NewFunctions)) {
-        notifyPassManagerOfFunction(NewF);
+        notifyPassManagerOfFunction(NewF, Callee);
       }
     }
   }
diff --git a/lib/SILOptimizer/Transforms/PerformanceInliner.cpp b/lib/SILOptimizer/Transforms/PerformanceInliner.cpp
index 3d61e94..790c754 100644
--- a/lib/SILOptimizer/Transforms/PerformanceInliner.cpp
+++ b/lib/SILOptimizer/Transforms/PerformanceInliner.cpp
@@ -1128,7 +1128,7 @@
 
   // We don't support inlining a function that binds dynamic self because we
   // have no mechanism to preserve the original function's local self metadata.
-  if (computeMayBindDynamicSelf(Callee)) {
+  if (mayBindDynamicSelf(Callee)) {
     // Check if passed Self is the same as the Self of the caller.
     // In this case, it is safe to inline because both functions
     // use the same Self.
diff --git a/lib/SILOptimizer/Transforms/RetainReleaseCodeMotion.cpp b/lib/SILOptimizer/Transforms/RetainReleaseCodeMotion.cpp
index f4d7d24..4a19c4f 100644
--- a/lib/SILOptimizer/Transforms/RetainReleaseCodeMotion.cpp
+++ b/lib/SILOptimizer/Transforms/RetainReleaseCodeMotion.cpp
@@ -93,6 +93,8 @@
 STATISTIC(NumReleasesHoisted, "Number of releases hoisted");
 
 llvm::cl::opt<bool> DisableRRCodeMotion("disable-rr-cm", llvm::cl::init(false));
+
+/// Disable optimization if we have to break critical edges in the function.
 llvm::cl::opt<bool>
 DisableIfWithCriticalEdge("disable-with-critical-edge", llvm::cl::init(false));
 
@@ -127,6 +129,7 @@
   /// RCRootVault. If this bit is set, that means this is potentially a retain
   /// or release that can be sunk or hoisted to this point. This is used to
   /// optimize the time for computing genset and killset.
+  ///
   /// NOTE: this vector contains an approximation of whether there will be a
   /// retain or release to a certain point of a basic block.
   llvm::SmallBitVector BBMaxSet;
@@ -275,6 +278,8 @@
   RetainBlockState(bool IsEntry, unsigned size, bool MultiIteration) {
     // Iterative forward data flow.
     BBSetIn.resize(size, false);
+    // Initilize to true if we are running optimistic data flow, i.e.
+    // MultiIteration is true.
     BBSetOut.resize(size, MultiIteration);
     BBMaxSet.resize(size, !IsEntry && MultiIteration);
   
@@ -316,7 +321,7 @@
   RetainCodeMotionContext(llvm::SpecificBumpPtrAllocator<BlockState> &BPA,
                           SILFunction *F, PostOrderFunctionInfo *PO,
                           AliasAnalysis *AA, RCIdentityFunctionInfo *RCFI)
-      : CodeMotionContext(BPA, F, PO, AA, RCFI) {
+    : CodeMotionContext(BPA, F, PO, AA, RCFI) {
     MultiIteration = requireIteration();
   }
 
@@ -597,6 +602,8 @@
   /// constructor.
   ReleaseBlockState(bool IsExit, unsigned size, bool MultiIteration) {
     // backward data flow.
+    // Initilize to true if we are running optimistic data flow, i.e.
+    // MultiIteration is true.
     BBSetIn.resize(size, MultiIteration);
     BBSetOut.resize(size, false);
     BBMaxSet.resize(size, !IsExit && MultiIteration);
@@ -645,10 +652,10 @@
                            AliasAnalysis *AA, RCIdentityFunctionInfo *RCFI,
                            bool FreezeEpilogueReleases,
                            ConsumedArgToEpilogueReleaseMatcher &ERM)
-      : CodeMotionContext(BPA, F, PO, AA, RCFI),
-        FreezeEpilogueReleases(FreezeEpilogueReleases), ERM(ERM) {
-    MultiIteration = requireIteration(); 
-  }
+    : CodeMotionContext(BPA, F, PO, AA, RCFI),
+      FreezeEpilogueReleases(FreezeEpilogueReleases), ERM(ERM) {
+    MultiIteration = requireIteration();
+  } 
 
   /// virtual destructor.
   virtual ~ReleaseCodeMotionContext() {}
@@ -717,16 +724,10 @@
   }
 
   // Initialize all the data flow bit vector for all basic blocks.
-  llvm::SmallPtrSet<SILBasicBlock *, 2> Exits;
-  auto Return = F->findReturnBB();
-  auto Throw = F->findThrowBB();
-  if (Return != F->end())
-    Exits.insert(&*Return);
-  if (Throw != F->end())
-    Exits.insert(&*Throw);
   for (auto &BB : *F) {
-    BlockStates[&BB] = new (BPA.Allocate()) ReleaseBlockState(Exits.count(&BB),
-                                            RCRootVault.size(), MultiIteration);
+    BlockStates[&BB] = new (BPA.Allocate())
+            ReleaseBlockState(BB.getTerminator()->isFunctionExiting(),
+                              RCRootVault.size(), MultiIteration);
   }
 }
 
@@ -1050,7 +1051,8 @@
   return new RRCodeMotion(CodeMotionKind::Retain, false);
 }
 
-/// Hoist releases, but not epilogue release.
+/// Hoist releases, but not epilogue release. ASO relies on epilogue releases
+/// to prove knownsafety on enclosed releases.
 SILTransform *swift::createReleaseHoisting() {
   return new RRCodeMotion(CodeMotionKind::Release, true);
 }
diff --git a/lib/SILOptimizer/UtilityPasses/CallerAnalysisPrinter.cpp b/lib/SILOptimizer/UtilityPasses/CallerAnalysisPrinter.cpp
index c5688fc..032dedf 100644
--- a/lib/SILOptimizer/UtilityPasses/CallerAnalysisPrinter.cpp
+++ b/lib/SILOptimizer/UtilityPasses/CallerAnalysisPrinter.cpp
@@ -32,8 +32,11 @@
   void run() override {
     auto *CA = getAnalysis<CallerAnalysis>();
     for (auto &F : *getModule()) {
-      const char *hasCaller = CA->hasCaller(&F) ? "true" : "false";
-      llvm::outs() << "Function " << F.getName() << " has caller: " << hasCaller << "\n";
+      const CallerAnalysis::FunctionInfo &FI = CA->getCallerInfo(&F);
+      const char *hasCaller = FI.hasCaller() ? "true" : "false";
+      llvm::outs() << "Function " << F.getName() << " has caller: "
+                   << hasCaller << ", partial applied args = "
+                   << FI.getMinPartialAppliedArgs() << "\n";
     }
   }
 
diff --git a/lib/SILOptimizer/Utils/FunctionSignatureOptUtils.cpp b/lib/SILOptimizer/Utils/FunctionSignatureOptUtils.cpp
index bb13075..2bf1ba7 100644
--- a/lib/SILOptimizer/Utils/FunctionSignatureOptUtils.cpp
+++ b/lib/SILOptimizer/Utils/FunctionSignatureOptUtils.cpp
@@ -75,13 +75,6 @@
   if (F->getLoweredFunctionType()->hasIndirectResults())
     return false;
 
-  // Do not specialize functions that are available externally. If an external
-  // function was able to be specialized, it would have been specialized in its
-  // own module. We will inline the original function as a thunk. The thunk will
-  // call the specialized function.
-  if (F->isAvailableExternally())
-    return false;
-
   // Do not specialize the signature of always inline functions. We
   // will just inline them and specialize each one of the individual
   // functions that these sorts of functions are inlined into.
diff --git a/lib/SILOptimizer/Utils/Generics.cpp b/lib/SILOptimizer/Utils/Generics.cpp
index d47e48f..737dbf2 100644
--- a/lib/SILOptimizer/Utils/Generics.cpp
+++ b/lib/SILOptimizer/Utils/Generics.cpp
@@ -187,9 +187,14 @@
 
   assert(GenericFunc->isDefinition() && "Expected definition to specialize!");
 
-  if (GenericFunc->getContextGenericParams())
-    ContextSubs = GenericFunc->getContextGenericParams()
-      ->getSubstitutionMap(ParamSubs);
+  if (auto *params = GenericFunc->getContextGenericParams()) {
+    auto sig = GenericFunc->getLoweredFunctionType()->getGenericSignature();
+
+    ArchetypeConformanceMap conformanceMap;
+    params->getSubstitutionMap(M.getSwiftModule(), sig,
+                               ParamSubs, ContextSubs,
+                               conformanceMap);
+  }
 
   Mangle::Mangler Mangler;
   GenericSpecializationMangler GenericMangler(Mangler, GenericFunc,
diff --git a/lib/SILOptimizer/Utils/Local.cpp b/lib/SILOptimizer/Utils/Local.cpp
index 0c45e20..844082f 100644
--- a/lib/SILOptimizer/Utils/Local.cpp
+++ b/lib/SILOptimizer/Utils/Local.cpp
@@ -356,16 +356,19 @@
   return false;
 }
 
-bool swift::computeMayBindDynamicSelf(SILFunction *F) {
-  for (auto &BB : *F)
-    for (auto &I : BB) {
-      if (auto AI = FullApplySite::isa(&I))
-        if (hasDynamicSelfTypes(AI.getSubstitutions()))
-          return true;
-      if (auto MI = dyn_cast<MetatypeInst>(&I))
-        if (MI->getType().getSwiftRValueType()->hasDynamicSelfType())
-          return true;
+bool swift::mayBindDynamicSelf(SILFunction *F) {
+  if (!F->hasSelfMetadataParam())
+    return false;
+
+  SILValue MDArg = F->getSelfMetadataArgument();
+
+  for (Operand *MDUse : F->getSelfMetadataArgument()->getUses()) {
+    SILInstruction *MDUser = MDUse->getUser();
+    for (Operand &TypeDepOp : MDUser->getTypeDependentOperands()) {
+      if (TypeDepOp.get() == MDArg)
+        return true;
     }
+  }
   return false;
 }
 
@@ -1372,11 +1375,7 @@
 /// return the ObjC type it bridges to.
 /// If target is an ObjC type, return this type.
 static Type getCastFromObjC(SILModule &M, CanType source, CanType target) {
-  Optional<Type> BridgedTy = M.getASTContext().getBridgedToObjC(
-      M.getSwiftModule(), target, nullptr);
-  if (!BridgedTy.hasValue() || !BridgedTy.getValue())
-    return Type();
-  return BridgedTy.getValue();
+  return M.getASTContext().getBridgedToObjC(M.getSwiftModule(), target);
 }
 
 /// Create a call of _forceBridgeFromObjectiveC_bridgeable or
diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp
index fe596c2..df17a73 100644
--- a/lib/Sema/CSApply.cpp
+++ b/lib/Sema/CSApply.cpp
@@ -60,6 +60,9 @@
 }
 
 /// Determine whether the given type is an opened AnyObject.
+///
+/// This comes up in computeSubstitutions() when accessing
+/// members via dynamic lookup.
 static bool isOpenedAnyObject(Type type) {
   auto archetype = type->getAs<ArchetypeType>();
   if (!archetype)
@@ -79,122 +82,65 @@
        Type origType, DeclContext *dc,
        Type openedType,
        ConstraintLocator *locator,
-       SmallVectorImpl<Substitution> &substitutions) const {
+       SmallVectorImpl<Substitution> &result) const {
   auto &tc = getConstraintSystem().getTypeChecker();
-  auto &ctx = tc.Context;
 
   // Gather the substitutions from dependent types to concrete types.
   auto openedTypes = OpenedTypes.find(locator);
   assert(openedTypes != OpenedTypes.end() && "Missing opened type information");
-  TypeSubstitutionMap typeSubstitutions;
+  TypeSubstitutionMap subs;
   for (const auto &opened : openedTypes->second) {
-    typeSubstitutions[opened.first.getPointer()] = getFixedType(opened.second);
+    subs[opened.first.getPointer()] = getFixedType(opened.second);
   }
 
   // Produce the concrete form of the opened type.
   auto type = openedType.transform([&](Type type) -> Type {
-                if (auto tv = dyn_cast<TypeVariableType>(type.getPointer())) {
-                  auto archetype = tv->getImpl().getArchetype();
-                  auto simplified = getFixedType(tv);
-                  return SubstitutedType::get(archetype, simplified,
-                                              tc.Context);
-                }
+    if (auto tv = dyn_cast<TypeVariableType>(type.getPointer())) {
+      auto archetype = tv->getImpl().getArchetype();
+      auto simplified = getFixedType(tv);
+      return SubstitutedType::get(archetype, simplified,
+                                  tc.Context);
+    }
 
-                return type;
-              });
+    return type;
+  });
 
-  auto currentModule = getConstraintSystem().DC->getParentModule();
-  ArchetypeType *currentArchetype = nullptr;
-  Type currentReplacement;
-  SmallVector<ProtocolConformanceRef, 4> currentConformances;
-
-  ArrayRef<Requirement> requirements;
+  auto mod = getConstraintSystem().DC->getParentModule();
+  GenericSignature *sig;
   if (auto genericFn = origType->getAs<GenericFunctionType>()) {
-    requirements = genericFn->getRequirements();
+    sig = genericFn->getGenericSignature();
   } else {
-    requirements = dc->getGenericSignatureOfContext()->getRequirements();
+    sig = dc->getGenericSignatureOfContext();
   }
 
-  for (const auto &req : requirements) {
-    // Drop requirements for parameters that have been constrained away to
-    // concrete types.
-    auto firstArchetype
-      = ArchetypeBuilder::mapTypeIntoContext(dc, req.getFirstType(), &tc)
-        ->getAs<ArchetypeType>();
-    if (!firstArchetype)
-      continue;
-    
-    switch (req.getKind()) {
-    case RequirementKind::Conformance: {
-      // Get the conformance and record it.
-      auto protoType = req.getSecondType()->castTo<ProtocolType>();
-      assert(firstArchetype == currentArchetype
-             && "Archetype out-of-sync");
-      ProtocolConformance *conformance = nullptr;
-      Type replacement = currentReplacement;
-      bool conforms = tc.conformsToProtocol(
-                        replacement,
-                        protoType->getDecl(),
-                        getConstraintSystem().DC,
-                        (ConformanceCheckFlags::InExpression|
-                         ConformanceCheckFlags::Used),
-                        &conformance);
-      (void)isOpenedAnyObject;
-      assert((conforms ||
-              replacement->is<ErrorType>() ||
-              firstArchetype->getIsRecursive() ||
-              isOpenedAnyObject(replacement) ||
-              replacement->is<GenericTypeParamType>()) &&
-             "Constraint system missed a conformance?");
-      (void)conforms;
+  auto lookupConformanceFn =
+      [&](Type replacement, ProtocolType *protoType)
+          -> ProtocolConformanceRef {
+    ProtocolConformance *conformance = nullptr;
 
-      assert(conformance ||
-             replacement->is<ErrorType>() ||
-             replacement->hasDependentProtocolConformances());
-      currentConformances.push_back(
-                  ProtocolConformanceRef(protoType->getDecl(), conformance));
-      break;
-    }
+    bool conforms = tc.conformsToProtocol(
+                      replacement,
+                      protoType->getDecl(),
+                      getConstraintSystem().DC,
+                      (ConformanceCheckFlags::InExpression|
+                       ConformanceCheckFlags::Used),
+                      &conformance);
+    (void)isOpenedAnyObject;
+    assert((conforms ||
+            replacement->is<ErrorType>() ||
+            isOpenedAnyObject(replacement) ||
+            replacement->is<GenericTypeParamType>()) &&
+           "Constraint system missed a conformance?");
+    (void)conforms;
 
-    case RequirementKind::Superclass:
-      // Superclass requirements aren't recorded in substitutions.
-      break;
+    assert(conformance ||
+           replacement->is<ErrorType>() ||
+           replacement->hasDependentProtocolConformances());
 
-    case RequirementKind::SameType:
-      // Same-type requirements aren't recorded in substitutions.
-      break;
+    return ProtocolConformanceRef(protoType->getDecl(), conformance);
+  };
 
-    case RequirementKind::WitnessMarker:
-      // Flush the current conformances.
-      if (currentArchetype) {
-        substitutions.push_back({
-          currentReplacement,
-          ctx.AllocateCopy(currentConformances)
-        });
-        currentConformances.clear();
-      }
-
-      // Each witness marker starts a new substitution.
-      currentArchetype = firstArchetype;
-      currentReplacement = req.getFirstType().subst(currentModule,
-                                                    typeSubstitutions,
-                                                    None);
-      if (!currentReplacement)
-        currentReplacement = tc.Context.TheErrorType;
-
-      break;
-    }
-  }
-  
-  // Flush the final conformances.
-  if (currentArchetype) {
-    substitutions.push_back({
-      currentReplacement,
-      ctx.AllocateCopy(currentConformances),
-    });
-    currentConformances.clear();
-  }
-
+  sig->getSubstitutions(*mod, subs, lookupConformanceFn, result);
   return type;
 }
 
@@ -2514,8 +2460,6 @@
         // in an ambiguity tolerant mode used for diagnostic generation.  Just
         // leave this as whatever type of member reference it already is.
         Type resultTy = simplifyType(expr->getType());
-        assert(resultTy->hasUnresolvedType() &&
-               "Should have a selected member if we got a type");
         expr->setType(resultTy);
         return expr;
       }
@@ -2534,8 +2478,9 @@
 
         if (auto baseMetaTy = baseTy->getAs<MetatypeType>()) {
           auto &tc = cs.getTypeChecker();
-          auto classTy = tc.getBridgedToObjC(cs.DC,
-                                             baseMetaTy->getInstanceType());
+          auto &ctx = tc.Context;
+          auto classTy = ctx.getBridgedToObjC(cs.DC,
+                                              baseMetaTy->getInstanceType());
           
           // FIXME: We're dropping side effects in the base here!
           base = TypeExpr::createImplicitHack(base->getLoc(), classTy, 
@@ -3007,9 +2952,7 @@
         break;
       case CheckedCastKind::ArrayDowncast:
       case CheckedCastKind::DictionaryDowncast:
-      case CheckedCastKind::DictionaryDowncastBridged:
       case CheckedCastKind::SetDowncast:
-      case CheckedCastKind::SetDowncastBridged:
       case CheckedCastKind::BridgeFromObjectiveC:
         // Valid checks.
         expr->setCastKind(castKind);
@@ -3034,9 +2977,7 @@
       if (fromOptionals.size() != toOptionals.size() ||
           castKind == CheckedCastKind::ArrayDowncast ||
           castKind == CheckedCastKind::DictionaryDowncast ||
-          castKind == CheckedCastKind::DictionaryDowncastBridged ||
-          castKind == CheckedCastKind::SetDowncast ||
-          castKind == CheckedCastKind::SetDowncastBridged) {
+          castKind == CheckedCastKind::SetDowncast) {
         auto toOptType = OptionalType::get(toType);
         ConditionalCheckedCastExpr *cast
           = new (tc.Context) ConditionalCheckedCastExpr(
@@ -3281,9 +3222,7 @@
       // Valid casts.
       case CheckedCastKind::ArrayDowncast:
       case CheckedCastKind::DictionaryDowncast:
-      case CheckedCastKind::DictionaryDowncastBridged:
       case CheckedCastKind::SetDowncast:
-      case CheckedCastKind::SetDowncastBridged:
       case CheckedCastKind::ValueCast:
       case CheckedCastKind::BridgeFromObjectiveC:
         expr->setCastKind(castKind);
@@ -3350,9 +3289,7 @@
       // Valid casts.
       case CheckedCastKind::ArrayDowncast:
       case CheckedCastKind::DictionaryDowncast:
-      case CheckedCastKind::DictionaryDowncastBridged:
       case CheckedCastKind::SetDowncast:
-      case CheckedCastKind::SetDowncastBridged:
       case CheckedCastKind::ValueCast:
       case CheckedCastKind::BridgeFromObjectiveC:
         expr->setCastKind(castKind);
@@ -5149,16 +5086,13 @@
                        ConstraintLocatorBuilder locator,
                        unsigned typeArgIndex) {
   // We don't need this stuff unless we've got generalized casts.
-  auto &ctx = rewriter.cs.getASTContext();
-  if (!ctx.LangOpts.EnableExperimentalCollectionCasts)
-    return {};
-
   Type srcType = srcCollectionType->castTo<BoundGenericType>()
                                   ->getGenericArgs()[typeArgIndex];
   Type destType = destCollectionType->castTo<BoundGenericType>()
                                     ->getGenericArgs()[typeArgIndex];
 
   // Build the conversion.
+  ASTContext &ctx = rewriter.getConstraintSystem().getASTContext();
   auto opaque = new (ctx) OpaqueValueExpr(SourceLoc(), srcType);
   auto conversion =
     rewriter.coerceToType(opaque, destType,
@@ -5323,11 +5257,8 @@
         buildElementConversion(*this, expr->getType(), toType, locator, 0);
 
       // Form the upcast.
-      bool isBridged = !cs.getBaseTypeForArrayType(fromType.getPointer())
-                          ->isBridgeableObjectType();
       return new (tc.Context) CollectionUpcastConversionExpr(expr, toType,
-                                                             {}, conv,
-                                                             isBridged);
+                                                             {}, conv);
     }
 
     case ConversionRestrictionKind::HashableToAnyHashable: {
@@ -5337,11 +5268,16 @@
         expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy, locator);
       }
 
+      // We want to check conformance on the rvalue, as that's what has
+      // the Hashable conformance
+      expr = tc.coerceToRValue(expr);
+
       // Find the conformance of the source type to Hashable.
       auto hashable = tc.Context.getProtocol(KnownProtocolKind::Hashable);
       ProtocolConformance *conformance;
       bool conforms = tc.conformsToProtocol(expr->getType(), hashable, cs.DC,
-                                            ConformanceCheckFlags::InExpression,
+                                            ConformanceCheckFlags::InExpression |
+                                            ConformanceCheckFlags::Used,
                                             &conformance);
       assert(conforms && "must conform to Hashable");
       (void)conforms;
@@ -5369,11 +5305,9 @@
       Type sourceKey, sourceValue;
       std::tie(sourceKey, sourceValue) = *cs.isDictionaryType(expr->getType());
 
-      bool isBridged = !sourceKey->isBridgeableObjectType() ||
-                       !sourceValue->isBridgeableObjectType();
       return new (tc.Context) CollectionUpcastConversionExpr(expr, toType,
-                                                             keyConv, valueConv,
-                                                             isBridged);
+                                                             keyConv,
+                                                             valueConv);
     }
 
     case ConversionRestrictionKind::SetUpcast: {
@@ -5387,11 +5321,8 @@
       auto conv =
         buildElementConversion(*this, expr->getType(), toType, locator, 0);
 
-      bool isBridged = !cs.getBaseTypeForSetType(fromType.getPointer())
-                          ->isBridgeableObjectType();
       return new (tc.Context) CollectionUpcastConversionExpr(expr, toType,
-                                                             {}, conv,
-                                                             isBridged);
+                                                             {}, conv);
     }
 
     case ConversionRestrictionKind::InoutToPointer: {
@@ -6464,7 +6395,7 @@
         // Coerce the pattern, in case we resolved something.
         auto fnType = closure->getType()->castTo<FunctionType>();
         auto *params = closure->getParameters();
-        if (tc.coerceParameterListToType(params, closure, fnType->getInput()))
+        if (tc.coerceParameterListToType(params, closure, fnType))
           return { false, nullptr };
 
         // If this is a single-expression closure, convert the expression
@@ -6694,9 +6625,7 @@
       // Valid casts.
       case CheckedCastKind::ArrayDowncast:
       case CheckedCastKind::DictionaryDowncast:
-      case CheckedCastKind::DictionaryDowncastBridged:
       case CheckedCastKind::SetDowncast:
-      case CheckedCastKind::SetDowncastBridged:
       case CheckedCastKind::ValueCast:
       case CheckedCastKind::BridgeFromObjectiveC:
         TC.diagnose(coerceExpr->getLoc(), diag::missing_forced_downcast,
diff --git a/lib/Sema/CSDiag.cpp b/lib/Sema/CSDiag.cpp
index dfca15e..edd5b46 100644
--- a/lib/Sema/CSDiag.cpp
+++ b/lib/Sema/CSDiag.cpp
@@ -1982,6 +1982,7 @@
 
   bool visitExpr(Expr *E);
   bool visitIdentityExpr(IdentityExpr *E);
+  bool visitTryExpr(TryExpr *E);
   bool visitTupleExpr(TupleExpr *E);
   
   bool visitUnresolvedMemberExpr(UnresolvedMemberExpr *E);
@@ -2349,14 +2350,32 @@
                                    SourceLoc loc) {
   SourceRange baseRange = baseExpr ? baseExpr->getSourceRange() : SourceRange();
 
+  Optional<InFlightDiagnostic> Diag;
+
   // If the base of the lookup is a protocol metatype, suggest
   // to replace the metatype with 'Self'
   // error saying the lookup cannot be on a protocol metatype
   if (auto metatypeTy = baseObjTy->getAs<MetatypeType>()) {
-    auto Diag = diagnose(loc,
-                         diag::could_not_use_type_member_on_protocol_metatype,
-                         baseObjTy, memberName);
-    Diag.highlight(baseRange).highlight(nameLoc.getSourceRange());
+    assert(metatypeTy->getInstanceType()->isExistentialType());
+
+    // Give a customized message if we're accessing a member type
+    // of a protocol -- otherwise a diagnostic talking about
+    // static members doesn't make a whole lot of sense
+    if (isa<TypeAliasDecl>(member)) {
+      Diag.emplace(diagnose(loc,
+                            diag::typealias_outside_of_protocol,
+                            memberName.getBaseName()));
+    } else if (isa<AssociatedTypeDecl>(member)) {
+      Diag.emplace(diagnose(loc,
+                            diag::assoc_type_outside_of_protocol,
+                            memberName.getBaseName()));
+    } else {
+      Diag.emplace(diagnose(loc,
+                            diag::could_not_use_type_member_on_protocol_metatype,
+                            baseObjTy, memberName));
+    }
+
+    Diag->highlight(baseRange).highlight(nameLoc.getSourceRange());
 
     // See through function decl context
     if (auto parent = CS->DC->getInnermostTypeContext()) {
@@ -2365,7 +2384,7 @@
       if (auto extensionContext = parent->getAsProtocolExtensionContext()) {
         if (extensionContext->getDeclaredType()->getCanonicalType()
             == metatypeTy->getInstanceType()->getCanonicalType()) {
-          Diag.fixItReplace(baseRange, "Self");
+          Diag->fixItReplace(baseRange, "Self");
         }
       }
     }
@@ -2373,10 +2392,6 @@
     return;
   }
 
-  // Otherwise the static member lookup was invalid because it was
-  // called on an instance
-  Optional<InFlightDiagnostic> Diag;
-
   if (isa<EnumElementDecl>(member))
     Diag.emplace(diagnose(loc, diag::could_not_use_enum_element_on_instance,
                           memberName));
@@ -2914,6 +2929,27 @@
     }
     return true;
   }
+
+  // Due to migration reasons, types used to conform to BooleanType, which
+  // contain a member var 'boolValue', now does not convert to Bool. This block
+  // tries to add a specific diagnosis/fixit to explicitly invoke 'boolValue'.
+  if (toType->isBool()) {
+    auto LookupResult = CS->TC.lookupMember(CS->DC, fromType,
+      DeclName(CS->TC.Context.getIdentifier("boolValue")));
+    if (!LookupResult.empty()) {
+      if (isa<VarDecl>(LookupResult.begin()->Decl)) {
+        if (anchor->canAppendCallParentheses())
+          diagnose(anchor->getLoc(), diag::types_not_convertible_use_bool_value,
+                   fromType, toType).fixItInsertAfter(anchor->getEndLoc(),
+                                                      ".boolValue");
+        else
+          diagnose(anchor->getLoc(), diag::types_not_convertible_use_bool_value,
+            fromType, toType).fixItInsert(anchor->getStartLoc(), "(").
+              fixItInsertAfter(anchor->getEndLoc(), ").boolValue");
+        return true;
+      }
+    }
+  }
   
   diagnose(anchor->getLoc(), diag::types_not_convertible,
            constraint->getKind() == ConstraintKind::Subtype,
@@ -3136,6 +3172,17 @@
                "didn't see this OVE in a containing OpenExistentialExpr?");
         return { true, value->second };
       }
+
+      // Handle collection upcasts specially so that we don't blow up on
+      // their embedded OVEs.
+      if (auto CDE = dyn_cast<CollectionUpcastConversionExpr>(expr)) {
+        if (auto result = CDE->getSubExpr()->walk(*this)) {
+          CDE->setSubExpr(result);
+          return { false, CDE };
+        } else {
+          return { true, CDE };
+        }
+      }
       
       return { true, expr };
     }
@@ -3664,17 +3711,17 @@
   // Need to be referencing a parameter of function type
   auto declRef = dyn_cast<DeclRefExpr>(expr);
   if (!declRef || !isa<ParamDecl>(declRef->getDecl()) ||
-      !declRef->getType()->is<FunctionType>())
+      !declRef->getType()->is<AnyFunctionType>())
     return false;
 
-  // Must be from non-escaping function to escaping function
-  auto srcFT = srcType->getAs<FunctionType>();
-  auto destFT = dstType->getAs<FunctionType>();
-  if (!srcFT || !destFT || !srcFT->isNoEscape() || destFT->isNoEscape())
-    return false;
+  // Must be from non-escaping function to escaping function. For the
+  // destination type, we read through optionality to give better diagnostics in
+  // the event of an implicit promotion.
+  auto srcFT = srcType->getAs<AnyFunctionType>();
+  auto dstFT =
+      dstType->lookThroughAllAnyOptionalTypes()->getAs<AnyFunctionType>();
 
-  // Function types must be equivalent modulo @escaping, @convention, etc.
-  if (!destFT->isEqual(srcFT->withExtInfo(destFT->getExtInfo())))
+  if (!srcFT || !dstFT || !srcFT->isNoEscape() || dstFT->isNoEscape())
     return false;
 
   // Pick a specific diagnostic for the specific use
@@ -4014,6 +4061,9 @@
   case CTP_ArrayElement:
   case CTP_DictionaryKey:
   case CTP_DictionaryValue:
+  case CTP_AssignSource:
+  case CTP_Initialization:
+  case CTP_ReturnStmt:
     tryRawRepresentableFixIts(diag, CS, exprType, contextualType,
                               KnownProtocolKind::ExpressibleByIntegerLiteral,
                               expr) ||
@@ -4726,6 +4776,12 @@
   if (!baseExpr) return true;
   auto baseType = baseExpr->getType();
   
+  if (isa<NilLiteralExpr>(baseExpr)) {
+    diagnose(baseExpr->getLoc(), diag::cannot_subscript_nil_literal)
+      .highlight(baseExpr->getSourceRange());
+    return true;
+  }
+
   auto locator =
     CS->getConstraintLocator(SE, ConstraintLocator::SubscriptMember);
 
@@ -4987,6 +5043,10 @@
   if (InitType.isNull() || ArgType.isNull())
     return false;
 
+  // unwrap one level of Optional
+  if (auto ArgOptType = ArgType->getOptionalObjectType())
+    ArgType = ArgOptType;
+
   auto *InitNom = InitType->getAnyNominal();
   if (!InitNom)
     return false;
@@ -5594,11 +5654,11 @@
       // don't confuse the issue.
       fnType = FunctionType::get(fnType->getInput(), fnType->getResult());
       diagnose(params->getStartLoc(), diag::closure_argument_list_tuple,
-               fnType, inferredArgCount, actualArgCount);
+               fnType, inferredArgCount, actualArgCount, (actualArgCount == 1));
       return true;
     }
 
-    if (CS->TC.coerceParameterListToType(params, CE, inferredArgType))
+    if (CS->TC.coerceParameterListToType(params, CE, fnType))
       return true;
 
     expectedResultType = fnType->getResult();
@@ -6222,6 +6282,12 @@
   return false;
 }
 
+/// A TryExpr doesn't change it's argument, nor does it change the contextual
+/// type.
+bool FailureDiagnosis::visitTryExpr(TryExpr *E) {
+  return visit(E->getSubExpr());
+}
+
 bool FailureDiagnosis::visitExpr(Expr *E) {
   // Check each of our immediate children to see if any of them are
   // independently invalid.
@@ -6276,7 +6342,7 @@
   // inconsistent state.
   simplify(/*ContinueAfterFailures*/true);
 
-  // Look through RebindSelfInConstructorExpr to avoid weird sema issues.
+  // Look through RebindSelfInConstructorExpr to avoid weird Sema issues.
   if (auto *RB = dyn_cast<RebindSelfInConstructorExpr>(expr))
     expr = RB->getSubExpr();
   
diff --git a/lib/Sema/CSRanking.cpp b/lib/Sema/CSRanking.cpp
index cc8cae3..0673a37 100644
--- a/lib/Sema/CSRanking.cpp
+++ b/lib/Sema/CSRanking.cpp
@@ -64,9 +64,6 @@
     case SK_CollectionUpcastConversion:
       log << "collection upcast conversion";
       break;
-    case SK_CollectionBridgedConversion:
-      log << "collection bridged conversion";
-      break;
         
     case SK_ValueToOptional:
       log << "value to optional";
diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp
index ea0a169..11c655b 100644
--- a/lib/Sema/CSSimplify.cpp
+++ b/lib/Sema/CSSimplify.cpp
@@ -1127,7 +1127,8 @@
 /// NSString.
 static bool allowsBridgingFromObjC(TypeChecker &tc, DeclContext *dc,
                                    Type type) {
-  auto objcType = tc.getBridgedToObjC(dc, type);
+  ASTContext &ctx = tc.Context;
+  auto objcType = ctx.getBridgedToObjC(dc, type);
   if (!objcType)
     return false;
 
@@ -1579,6 +1580,17 @@
       conversionsOrFixes.push_back(ConversionRestrictionKind::Superclass);
     }
     
+    // T -> AnyHashable.
+    if (isAnyHashableType(desugar2)) {
+      // Don't allow this in operator contexts or we'll end up allowing
+      // 'T() == U()' for unrelated T and U that just happen to be Hashable.
+      // We can remove this special case when we implement operator hiding.
+      if (kind != TypeMatchKind::OperatorArgumentConversion) {
+        conversionsOrFixes.push_back(
+                              ConversionRestrictionKind::HashableToAnyHashable);
+      }
+    }
+
     // Metatype to object conversion.
     //
     // Class and protocol metatypes are interoperable with certain Objective-C
@@ -1649,15 +1661,6 @@
       } else if (isSetType(desugar1) && isSetType(desugar2)) {
         conversionsOrFixes.push_back(
           ConversionRestrictionKind::SetUpcast);
-      // T -> AnyHashable.
-      } else if (isAnyHashableType(desugar2)) {
-        // Don't allow this in operator contexts or we'll end up allowing
-        // 'T() == U()' for unrelated T and U that just happen to be Hashable.
-        // We can remove this special case when we implement operator hiding.
-        if (kind != TypeMatchKind::OperatorArgumentConversion) {
-          conversionsOrFixes.push_back(
-            ConversionRestrictionKind::HashableToAnyHashable);
-        }
       }
     }
   }
@@ -1706,11 +1709,8 @@
         // NSError and Error.
         if (isBridgeableTargetType) {
           Type bridgedValueType;
-          if (auto bridgedToObjCClass =
-                     TC.Context.getBridgedToObjC(DC, type1, &TC,
-                                                 &bridgedValueType)) {
-            if (*bridgedToObjCClass &&
-                (kind >= TypeMatchKind::ExplicitConversion ||
+          if (TC.Context.getBridgedToObjC(DC, type1, &bridgedValueType)) {
+            if ((kind >= TypeMatchKind::ExplicitConversion ||
                  bridgedValueType->getAnyNominal() !=
                    TC.Context.getErrorDecl()))
               conversionsOrFixes.push_back(
@@ -1722,8 +1722,7 @@
       // Anything can be explicitly converted to AnyObject using the universal
       // bridging conversion.
       if (auto protoType2 = type2->getAs<ProtocolType>()) {
-        if (TC.Context.LangOpts.EnableIdAsAny
-            && TC.Context.LangOpts.EnableObjCInterop
+        if (TC.Context.LangOpts.EnableObjCInterop
             && protoType2->getDecl()
               == TC.Context.getProtocol(KnownProtocolKind::AnyObject)
             && !type1->mayHaveSuperclass()
@@ -2425,8 +2424,7 @@
                   getConstraintLocator(locator));
     return SolutionKind::Solved;
   }
-  case CheckedCastKind::DictionaryDowncast:
-  case CheckedCastKind::DictionaryDowncastBridged: {
+  case CheckedCastKind::DictionaryDowncast: {
     Type fromKeyType, fromValueType;
     std::tie(fromKeyType, fromValueType) = *isDictionaryType(fromType);
 
@@ -2471,8 +2469,7 @@
     }
   }
 
-  case CheckedCastKind::SetDowncast:
-  case CheckedCastKind::SetDowncastBridged: {
+  case CheckedCastKind::SetDowncast: {
     auto fromBaseType = getBaseTypeForSetType(fromType.getPointer());
     auto toBaseType = getBaseTypeForSetType(toType.getPointer());
     // FIXME: Deal with from/to base types that haven't been solved
@@ -2911,7 +2908,7 @@
   Type bridgedClass;
   Type bridgedType;
   if (instanceTy->getAnyNominal() == TC.Context.getStringDecl()) {
-    if (Type classType = TC.getBridgedToObjC(DC, instanceTy)) {
+    if (Type classType = TC.Context.getBridgedToObjC(DC, instanceTy)) {
       bridgedClass = classType;
       bridgedType = isMetatype ? MetatypeType::get(classType) : classType;
     }
@@ -2962,7 +2959,16 @@
         result.addUnviable(cand, MemberLookupResult::UR_InstanceMemberOnType);
         return;
       }
-      
+
+    // If the underlying type of a typealias is fully concrete, it is legal
+    // to access the type with a protocol metatype base.
+    } else if (isExistential &&
+               isa<TypeAliasDecl>(cand) &&
+               !cast<TypeAliasDecl>(cand)->getInterfaceType()->getCanonicalType()
+                  ->hasTypeParameter()) {
+
+      /* We're OK */
+
     } else {
       if (!hasStaticMembers) {
         result.addUnviable(cand, MemberLookupResult::UR_TypeMemberOnInstance);
@@ -3289,22 +3295,6 @@
 }
 
 ConstraintSystem::SolutionKind
-ConstraintSystem::simplifyBridgedToObjectiveCConstraint(
-  const Constraint &constraint)
-{
-  auto baseTy = simplifyForTypePropertyConstraint(*this,
-                                                  constraint.getFirstType());
-  if (!baseTy)
-    return SolutionKind::Unsolved;
-  
-  if (TC.getBridgedToObjC(DC, baseTy)) {
-    increaseScore(SK_UserConversion);
-    return SolutionKind::Solved;
-  }
-  return SolutionKind::Error;
-}
-
-ConstraintSystem::SolutionKind
 ConstraintSystem::simplifyDefaultableConstraint(const Constraint &constraint) {
   // Leave the constraint around if the first variable is still opaque.
   auto baseTy = simplifyForTypePropertyConstraint(*this,
@@ -3522,7 +3512,6 @@
       
   case ConstraintKind::Archetype:
   case ConstraintKind::Class:
-  case ConstraintKind::BridgedToObjectiveC:
   case ConstraintKind::Defaultable:
     llvm_unreachable("Type properties don't involve type matches");
 
@@ -3821,56 +3810,13 @@
     Type baseType1 = getBaseTypeForArrayType(t1);
     Type baseType2 = getBaseTypeForArrayType(t2);
 
-    if (TC.getLangOpts().EnableExperimentalCollectionCasts) {
-      increaseScore(SK_CollectionUpcastConversion);
-      return matchTypes(baseType1,
-                        baseType2,
-                        matchKind,
-                        subFlags,
-                        locator.withPathElement(
-                      ConstraintLocator::PathElement::getGenericArgument(0)));
-    }
-
-    // Look through type variables in the first element type; we need to know
-    // it's structure before we can decide whether this can be an array upcast.
-    TypeVariableType *baseTypeVar1;
-    baseType1 = getFixedTypeRecursive(baseType1, baseTypeVar1, false, false);
-    if (baseTypeVar1) {
-      if (flags & TMF_GenerateConstraints) {
-        addConstraint(
-          Constraint::createRestricted(*this, getConstraintKind(matchKind),
-                                       restriction, type1, type2,
-                                       getConstraintLocator(locator)));
-        return SolutionKind::Solved;
-      }
-
-      return SolutionKind::Unsolved;
-    }
-
-    bool isSimpleUpcast = baseType1->isBridgeableObjectType();
-    if (isSimpleUpcast) {
-      increaseScore(SK_CollectionUpcastConversion);
-    } else {
-      // Check whether this is a bridging upcast.
-      Type bridgedType1 = TC.getBridgedToObjC(DC, baseType1);
-      if (!bridgedType1) {
-        // FIXME: Record error.
-        return SolutionKind::Error;
-      }
-
-      // Replace the base type so we perform the appropriate subtype check.
-      baseType1 = bridgedType1;
-      increaseScore(SK_CollectionBridgedConversion);
-    }
-
-    addContextualScore();
-    assert(matchKind >= TypeMatchKind::Conversion);
-
+    increaseScore(SK_CollectionUpcastConversion);
     return matchTypes(baseType1,
                       baseType2,
-                      TypeMatchKind::Subtype,
+                      matchKind,
                       subFlags,
-                      locator);
+                      locator.withPathElement(
+                    ConstraintLocator::PathElement::getGenericArgument(0)));
   }
 
   // K1 < K2 && V1 < V2 || K1 bridges to K2 && V1 bridges to V2 ===> 
@@ -3884,118 +3830,19 @@
     Type key2, value2;
     std::tie(key2, value2) = *isDictionaryType(t2);
 
-    if (TC.getLangOpts().EnableExperimentalCollectionCasts) {
-      auto subMatchKind = matchKind; // TODO: Restrict this?
-      increaseScore(SK_CollectionUpcastConversion);
-      // The source key and value types must be subtypes of the destination
-      // key and value types, respectively.
-      auto result = matchTypes(key1, key2, subMatchKind, subFlags,
-                               locator.withPathElement(
-                      ConstraintLocator::PathElement::getGenericArgument(0)));
-      if (result == SolutionKind::Error)
-        return result;
-
-      switch (matchTypes(value1, value2, subMatchKind, subFlags,
-                         locator.withPathElement(
-                    ConstraintLocator::PathElement::getGenericArgument(1)))) {
-      case SolutionKind::Solved:
-        return result;
-
-      case SolutionKind::Unsolved:
-        return SolutionKind::Unsolved;
-
-      case SolutionKind::Error:
-        return SolutionKind::Error;
-      }
-    }
-
-    // Look through type variables in the first key and value type; we
-    // need to know their structure before we can decide whether this
-    // can be an upcast.
-    TypeVariableType *keyTypeVar1 = nullptr;
-    TypeVariableType *valueTypeVar1 = nullptr;    
-    key1 = getFixedTypeRecursive(key1, keyTypeVar1, false, false);
-    if (!keyTypeVar1) {
-      value1 = getFixedTypeRecursive(value1, valueTypeVar1, false, false);
-    }
-
-    if (keyTypeVar1 || valueTypeVar1) {
-      if (flags & TMF_GenerateConstraints) {
-        addConstraint(
-          Constraint::createRestricted(*this, getConstraintKind(matchKind),
-                                       restriction, type1, type2,
-                                       getConstraintLocator(locator)));
-        return SolutionKind::Solved;
-      }
-
-      return SolutionKind::Unsolved;
-    }
-
-    // If both the first key and value types are bridgeable object
-    // types, this can only be an upcast.
-    bool isUpcast = key1->isBridgeableObjectType() && 
-                    value1->isBridgeableObjectType();
-
-    if (isUpcast) {
-      increaseScore(SK_CollectionUpcastConversion);
-    } else {
-      // This might be a bridged upcast.
-      Type bridgedKey1 = TC.getBridgedToObjC(DC, key1);
-      Type bridgedValue1;
-      if (bridgedKey1) {
-        bridgedValue1 = TC.getBridgedToObjC(DC, value1);
-      }
-
-      // Both the key and value types need to be bridged.
-      if (!bridgedKey1 || !bridgedValue1) {
-        // FIXME: Record failure.
-        return SolutionKind::Error;
-      }
-
-      // Look through the destination key and value types. We need
-      // their structure to determine whether we'll be bridging or
-      // upcasting the key and value.
-      TypeVariableType *keyTypeVar2 = nullptr;
-      TypeVariableType *valueTypeVar2 = nullptr;    
-      key2 = getFixedTypeRecursive(key2, keyTypeVar2, false, false);
-      if (!keyTypeVar2) {
-        value2 = getFixedTypeRecursive(value2, valueTypeVar2, false, false);
-      }
-      
-      // If either the destination key or value type is a type
-      // variable, we can't simplify this now.
-      if (keyTypeVar2 || valueTypeVar2) {
-        if (flags & TMF_GenerateConstraints) {
-          addConstraint(
-            Constraint::createRestricted(*this, getConstraintKind(matchKind),
-                                         restriction, type1, type2,
-                                         getConstraintLocator(locator)));
-          return SolutionKind::Solved;
-        }
-        
-        return SolutionKind::Unsolved;
-      }
-
-      // This can be a bridging upcast.
-      if (key2->isBridgeableObjectType())
-        key1 = bridgedKey1;
-      if (value2->isBridgeableObjectType())
-        value1 = bridgedValue1;
-      increaseScore(SK_CollectionBridgedConversion);
-    }
-
-    addContextualScore();
-    assert(matchKind >= TypeMatchKind::Conversion);
-
+    auto subMatchKind = matchKind; // TODO: Restrict this?
+    increaseScore(SK_CollectionUpcastConversion);
     // The source key and value types must be subtypes of the destination
     // key and value types, respectively.
-    auto result = matchTypes(key1, key2, TypeMatchKind::Subtype, subFlags, 
-                             locator);
+    auto result = matchTypes(key1, key2, subMatchKind, subFlags,
+                             locator.withPathElement(
+                    ConstraintLocator::PathElement::getGenericArgument(0)));
     if (result == SolutionKind::Error)
       return result;
 
-    switch (matchTypes(value1, value2, TypeMatchKind::Subtype, subFlags, 
-                       locator)) {
+    switch (matchTypes(value1, value2, subMatchKind, subFlags,
+                       locator.withPathElement(
+                  ConstraintLocator::PathElement::getGenericArgument(1)))) {
     case SolutionKind::Solved:
       return result;
 
@@ -4015,78 +3862,13 @@
     auto t2 = type2->getDesugaredType();
     Type baseType2 = getBaseTypeForSetType(t2);
 
-    if (TC.getLangOpts().EnableExperimentalCollectionCasts) {
-      increaseScore(SK_CollectionUpcastConversion);
-      return matchTypes(baseType1,
-                        baseType2,
-                        matchKind,
-                        subFlags,
-                        locator.withPathElement(
-                      ConstraintLocator::PathElement::getGenericArgument(0)));
-    }
-
-    // Look through type variables in the first base type; we need to know
-    // their structure before we can decide whether this can be an upcast.
-    TypeVariableType *baseTypeVar1 = nullptr;
-    baseType1 = getFixedTypeRecursive(baseType1, baseTypeVar1, false, false);
-
-    if (baseTypeVar1) {
-      if (flags & TMF_GenerateConstraints) {
-        addConstraint(
-          Constraint::createRestricted(*this, getConstraintKind(matchKind),
-                                       restriction, type1, type2,
-                                       getConstraintLocator(locator)));
-        return SolutionKind::Solved;
-      }
-
-      return SolutionKind::Unsolved;
-    }
-
-    // If the first base type is a bridgeable object type, this can only be an
-    // upcast.
-    bool isUpcast = baseType1->isBridgeableObjectType();
-
-    if (isUpcast) {
-      increaseScore(SK_CollectionUpcastConversion);
-    } else {
-      // This might be a bridged upcast.
-      Type bridgedBaseType1 = TC.getBridgedToObjC(DC, baseType1);
-      if (!bridgedBaseType1) {
-        // FIXME: Record failure.
-        return SolutionKind::Error;
-      }
-
-      // Look through the destination base type. We need its structure to
-      // determine whether we'll be bridging or upcasting the base type.
-      TypeVariableType *baseTypeVar2 = nullptr;
-      baseType2 = getFixedTypeRecursive(baseType2, baseTypeVar2, false, false);
-      
-      // If the destination base type is a type variable, we can't simplify
-      // this now.
-      if (baseTypeVar2) {
-        if (flags & TMF_GenerateConstraints) {
-          addConstraint(
-            Constraint::createRestricted(*this, getConstraintKind(matchKind),
-                                         restriction, type1, type2,
-                                         getConstraintLocator(locator)));
-          return SolutionKind::Solved;
-        }
-        
-        return SolutionKind::Unsolved;
-      }
-
-      // This can be a bridging upcast.
-      if (baseType2->isBridgeableObjectType())
-        baseType1 = bridgedBaseType1;
-      increaseScore(SK_CollectionBridgedConversion);
-    }
-
-    addContextualScore();
-    assert(matchKind >= TypeMatchKind::Conversion);
-
-    // The source base type must be a subtype of the destination base type.
-    return matchTypes(baseType1, baseType2, TypeMatchKind::Subtype, subFlags,
-                      locator);
+    increaseScore(SK_CollectionUpcastConversion);
+    return matchTypes(baseType1,
+                      baseType2,
+                      matchKind,
+                      subFlags,
+                      locator.withPathElement(
+                    ConstraintLocator::PathElement::getGenericArgument(0)));
   }
 
   // T1 <c T2 && T2 : Hashable ===> T1 <c AnyHashable
@@ -4124,13 +3906,12 @@
 
   // T bridges to C and C < U ===> T <c U
   case ConversionRestrictionKind::BridgeToObjC: {
-    auto objcClass = TC.getBridgedToObjC(DC, type1);
+    auto objcClass = TC.Context.getBridgedToObjC(DC, type1);
     // If the type doesn't bridge any other way, we can still go straight to
     // AnyObject by universal bridging.
     if (!objcClass) {
-      assert(TC.Context.LangOpts.EnableIdAsAny
-             && TC.Context.LangOpts.EnableObjCInterop
-             && "should only happen in id-as-any mode");
+      assert(TC.Context.LangOpts.EnableObjCInterop
+             && "should only happen in Objective-C mode");
       objcClass = TC.Context.getProtocol(KnownProtocolKind::AnyObject)
         ->getDeclaredType();
     }
@@ -4141,27 +3922,6 @@
       return SolutionKind::Error;
     }
 
-    // TODO: Under id-as-any, container bridging is unconstrained. This check
-    // can go away.
-    if (!TC.Context.LangOpts.EnableIdAsAny) {
-      // If the bridged value type is generic, the generic arguments
-      // must be bridged to Objective-C for bridging to succeed.
-      if (auto bgt1 = type1->getAs<BoundGenericType>()) {
-        unsigned argIdx = 0;
-        for (auto arg: bgt1->getGenericArgs()) {
-          addConstraint(
-            Constraint::create(*this,
-                               ConstraintKind::BridgedToObjectiveC,
-                               arg, Type(), DeclName(),
-                               FunctionRefKind::Compound,
-                               getConstraintLocator(
-                                 locator.withPathElement(
-                                   LocatorPathElt::getGenericArgument(
-                                     argIdx++)))));
-        }
-      }
-    }
-    
     return matchTypes(objcClass, type2, TypeMatchKind::Subtype, subFlags,
                       locator);
   }
@@ -4169,8 +3929,7 @@
   // U bridges to C and T < C ===> T <c U
   case ConversionRestrictionKind::BridgeFromObjC: {
     Type bridgedValueType;
-    auto objcClass = *TC.Context.getBridgedToObjC(DC, type2, &TC,
-                                                  &bridgedValueType);
+    auto objcClass = TC.Context.getBridgedToObjC(DC, type2, &bridgedValueType);
     assert(objcClass && "type is not bridged to Objective-C?");
     addContextualScore();
     increaseScore(SK_UserConversion); // FIXME: Use separate score kind?
@@ -4434,9 +4193,6 @@
   case ConstraintKind::Archetype:
     return simplifyArchetypeConstraint(constraint);
   
-  case ConstraintKind::BridgedToObjectiveC:
-    return simplifyBridgedToObjectiveCConstraint(constraint);
-
   case ConstraintKind::Class:
     return simplifyClassConstraint(constraint);
 
diff --git a/lib/Sema/CSSolver.cpp b/lib/Sema/CSSolver.cpp
index b4e442d..db62afd 100644
--- a/lib/Sema/CSSolver.cpp
+++ b/lib/Sema/CSSolver.cpp
@@ -20,6 +20,8 @@
 #include "llvm/Support/SaveAndRestore.h"
 #include <memory>
 #include <tuple>
+#include <stack>
+#include <queue>
 using namespace swift;
 using namespace constraints;
 
@@ -47,7 +49,8 @@
 ///
 /// \returns the type to bind to, if the binding is okay.
 static Optional<Type> checkTypeOfBinding(ConstraintSystem &cs, 
-                                         TypeVariableType *typeVar, Type type) {
+                                         TypeVariableType *typeVar, Type type,
+                                         bool *isNilLiteral = nullptr) {
   if (!type)
     return None;
 
@@ -63,8 +66,15 @@
   // If the type is a type variable itself, don't permit the binding.
   // FIXME: This is a hack. We need to be smarter about whether there's enough
   // structure in the type to produce an interesting binding, or not.
-  if (type->getRValueType()->is<TypeVariableType>())
+  if (auto bindingTypeVar = type->getRValueType()->getAs<TypeVariableType>()) {
+    if (isNilLiteral &&
+        bindingTypeVar->getImpl().literalConformanceProto &&
+        bindingTypeVar->getImpl().literalConformanceProto->isSpecificProtocol(
+          KnownProtocolKind::ExpressibleByNilLiteral))
+      *isNilLiteral = true;
+    
     return None;
+  }
 
   // Okay, allow the binding (with the simplified type).
   return type;
@@ -294,16 +304,6 @@
     }
   }
 
-  if (auto functionTy = type->getAs<FunctionType>()) {
-    // FIXME: Can weaken input type, but we really don't want to get in the
-    // business of strengthening the result type.
-
-    // An @autoclosure function type can be viewed as scalar of the result
-    // type.
-    if (functionTy->isAutoClosure())
-      result.push_back(functionTy->getResult());
-  }
-
   if (type->mayHaveSuperclass()) {
     // FIXME: Can also weaken to the set of protocol constraints, but only
     // if there are any protocols that the type conforms to but the superclass
@@ -319,10 +319,6 @@
   if (auto iot = type->getAs<InOutType>())
     result.push_back(iot->getObjectType());
 
-  // Try to unwrap implicitly unwrapped optional types.
-  if (auto objectType = type->getImplicitlyUnwrappedOptionalObjectType())
-    result.push_back(objectType);
-
   // FIXME: lots of other cases to consider!
   return result;
 }
@@ -682,7 +678,6 @@
   case ConstraintKind::TypeMember:
   case ConstraintKind::Archetype:
   case ConstraintKind::Class:
-  case ConstraintKind::BridgedToObjectiveC:
   case ConstraintKind::Defaultable:
   case ConstraintKind::Disjunction:
     llvm_unreachable("shouldBindToValueType() may only be called on "
@@ -709,20 +704,22 @@
 
   // Local function to add a potential binding to the list of bindings,
   // coalescing supertype bounds when we are able to compute the meet.
-  auto addPotentialBinding = [&](PotentialBinding binding) {
+  auto addPotentialBinding = [&](PotentialBinding binding,
+                                 bool allowJoinMeet = true) {
     // If this is a non-defaulted supertype binding, check whether we can
-    // combine it with another supertype binding by computing the 'meet' of the
+    // combine it with another supertype binding by computing the 'join' of the
     // types.
     if (binding.Kind == AllowedBindingKind::Supertypes &&
         !binding.BindingType->hasTypeVariable() &&
         !binding.DefaultedProtocol &&
-        !binding.IsDefaultableBinding) {
+        !binding.IsDefaultableBinding &&
+        allowJoinMeet) {
       if (lastSupertypeIndex) {
-        // Can we compute a meet?
+        // Can we compute a join?
         auto &lastBinding = result.Bindings[*lastSupertypeIndex];
         if (auto meet =
-                Type::meet(lastBinding.BindingType, binding.BindingType)) {
-          // Replace the last supertype binding with the meet. We're done.
+                Type::join(lastBinding.BindingType, binding.BindingType)) {
+          // Replace the last supertype binding with the join. We're done.
           lastBinding.BindingType = meet;
           return;
         }
@@ -739,6 +736,7 @@
   llvm::SmallPtrSet<CanType, 4> exactTypes;
   llvm::SmallPtrSet<ProtocolDecl *, 4> literalProtocols;
   SmallVector<Constraint *, 2> defaultableConstraints;
+  bool addOptionalSupertypeBindings = false;
   auto &tc = cs.getTypeChecker();
   for (auto constraint : constraints) {
     // Only visit each constraint once.
@@ -768,7 +766,6 @@
     case ConstraintKind::DynamicTypeOf:
     case ConstraintKind::Archetype:
     case ConstraintKind::Class:
-    case ConstraintKind::BridgedToObjectiveC:
       // Constraints from which we can't do anything.
       // FIXME: Record this somehow?
       continue;
@@ -917,11 +914,18 @@
 
     // Check whether we can perform this binding.
     // FIXME: this has a super-inefficient extraneous simplifyType() in it.
-    if (auto boundType = checkTypeOfBinding(cs, typeVar, type)) {
+    bool isNilLiteral = false;
+    if (auto boundType = checkTypeOfBinding(cs, typeVar, type, &isNilLiteral)) {
       type = *boundType;
       if (type->hasTypeVariable())
         result.InvolvesTypeVariables = true;
     } else {
+      // If the bound is a 'nil' literal type, add optional supertype bindings.
+      if (isNilLiteral && kind == AllowedBindingKind::Supertypes) {
+        addOptionalSupertypeBindings = true;
+        continue;
+      }
+
       result.InvolvesTypeVariables = true;
       continue;
     }
@@ -980,7 +984,7 @@
       addPotentialBinding({type, kind, None});
     if (alternateType &&
         exactTypes.insert(alternateType->getCanonicalType()).second)
-      addPotentialBinding({alternateType, kind, None});
+      addPotentialBinding({alternateType, kind, None}, /*allowJoinMeet=*/false);
   }
 
   // If we have any literal constraints, check whether there is already a
@@ -1071,6 +1075,30 @@
                          binding.Kind == AllowedBindingKind::Subtypes;
                 });
 
+  // If we're supposed to add optional supertype bindings, do so now.
+  if (addOptionalSupertypeBindings) {
+    for (unsigned i : indices(result.Bindings)) {
+      // Only interested in supertype bindings.
+      auto &binding = result.Bindings[i];
+      if (binding.Kind != AllowedBindingKind::Supertypes) continue;
+
+      // If the type doesn't conform to ExpressibleByNilLiteral,
+      // produce an optional of that type as a potential binding. We
+      // overwrite the binding in place because the non-optional type
+      // will fail to type-check against the nil-literal conformance.
+      auto nominalBindingDecl = binding.BindingType->getAnyNominal();
+      if (!nominalBindingDecl) continue;
+      SmallVector<ProtocolConformance *, 2> conformances;
+      if (!nominalBindingDecl->lookupConformance(
+            cs.DC->getParentModule(),
+            cs.getASTContext().getProtocol(
+              KnownProtocolKind::ExpressibleByNilLiteral),
+            conformances)) {
+        binding.BindingType = OptionalType::get(binding.BindingType);
+      }
+    }
+  }
+
   return result;
 }
 
@@ -1307,6 +1335,321 @@
   return std::move(solutions[0]);
 }
 
+bool ConstraintSystem::Candidate::solve() {
+  // Cleanup after constraint system generation/solving,
+  // because it would assign types to expressions, which
+  // might interfere with solving higher-level expressions.
+  ExprCleaner cleaner(E);
+
+  // Allocate new constraint system for sub-expression.
+  ConstraintSystem cs(TC, DC, None);
+
+  // Set contextual type if present. This is done before constraint generation
+  // to give a "hint" to that operation about possible optimizations.
+  if (!CT.isNull())
+    cs.setContextualType(E, CT, CTP);
+
+  // Generate constraints for the new system.
+  if (auto generatedExpr = cs.generateConstraints(E)) {
+    E = generatedExpr;
+  } else {
+    // Failure to generate constraint system for sub-expression means we can't
+    // continue solving sub-expressions.
+    return true;
+  }
+
+  // If there is contextual type present, add an explicit "conversion"
+  // constraint to the system.
+  if (!CT.isNull()) {
+    auto constraintKind = ConstraintKind::Conversion;
+    if (CTP == CTP_CallArgument)
+      constraintKind = ConstraintKind::ArgumentConversion;
+
+    cs.addConstraint(constraintKind, E->getType(), CT.getType(),
+                     cs.getConstraintLocator(E), /*isFavored=*/true);
+  }
+
+  // Try to solve the system and record all available solutions.
+  llvm::SmallVector<Solution, 2> solutions;
+  {
+    SolverState state(cs);
+    cs.solverState = &state;
+
+    // Use solveRec() instead of solve() in here, because solve()
+    // would try to deduce the best solution, which we don't
+    // really want. Instead, we want the reduced set of domain choices.
+    cs.solveRec(solutions, FreeTypeVariableBinding::Allow);
+
+    cs.solverState = nullptr;
+  }
+
+  // No solutions for the sub-expression means that either main expression
+  // needs salvaging or it's inconsistent (read: doesn't have solutions).
+  if (solutions.empty())
+    return true;
+
+  // Record found solutions as suggestions.
+  this->applySolutions(solutions);
+  return false;
+}
+
+void ConstraintSystem::Candidate::applySolutions(
+                            llvm::SmallVectorImpl<Solution> &solutions) const {
+  // A collection of OSRs with their newly reduced domains,
+  // it's domains are sets because multiple solutions can have the same
+  // choice for one of the type variables, and we want no duplication.
+  llvm::SmallDenseMap<OverloadSetRefExpr *, llvm::SmallSet<ValueDecl *, 2>>
+    domains;
+  for (auto &solution : solutions) {
+    for (auto choice : solution.overloadChoices) {
+      // Some of the choices might not have locators.
+      if (!choice.getFirst())
+        continue;
+
+      auto anchor = choice.getFirst()->getAnchor();
+      // Anchor is not available or expression is not an overload set.
+      if (!anchor || !isa<OverloadSetRefExpr>(anchor))
+        continue;
+
+      auto OSR = cast<OverloadSetRefExpr>(anchor);
+      auto overload = choice.getSecond().choice;
+      auto type = overload.getDecl()->getInterfaceType();
+
+      // One of the solutions has polymorphic type assigned with one of it's
+      // type variables. Such functions can only be properly resolved
+      // via complete expression, so we'll have to forget solutions
+      // we have already recorded. They might not include all viable overload
+      // choices.
+      if (type->is<GenericFunctionType>()) {
+        return;
+      }
+
+      domains[OSR].insert(overload.getDecl());
+    }
+  }
+
+  // Reduce the domains.
+  for (auto &domain : domains) {
+    auto OSR = domain.getFirst();
+    auto &choices = domain.getSecond();
+
+    // If the domain wasn't reduced, skip it.
+    if (OSR->getDecls().size() == choices.size()) continue;
+
+    // Update the expression with the reduced domain.
+    MutableArrayRef<ValueDecl *> decls
+      = TC.Context.AllocateUninitialized<ValueDecl *>(choices.size());
+    std::uninitialized_copy(choices.begin(), choices.end(), decls.begin());
+    OSR->setDecls(decls);
+  }
+}
+
+void ConstraintSystem::shrink(Expr *expr) {
+  typedef llvm::SmallDenseMap<Expr *, ArrayRef<ValueDecl *>> DomainMap;
+
+  // A collection of original domains of all of the expressions,
+  // so they can be restored in case of failure.
+  DomainMap domains;
+
+  struct ExprCollector : public ASTWalker {
+    // The primary constraint system.
+    ConstraintSystem &CS;
+
+    // All of the sub-expressions of certain type (binary/unary/calls) in
+    // depth-first order.
+    std::queue<Candidate> &SubExprs;
+
+    // Counts the number of overload sets present in the tree so far.
+    // Note that the traversal is depth-first.
+    std::stack<std::pair<ApplyExpr *, unsigned>,
+               llvm::SmallVector<std::pair<ApplyExpr *, unsigned>, 4>>
+      ApplyExprs;
+
+    // A collection of original domains of all of the expressions,
+    // so they can be restored in case of failure.
+    DomainMap &Domains;
+
+    ExprCollector(ConstraintSystem &cs,
+                  std::queue<Candidate> &container,
+                  DomainMap &domains)
+      : CS(cs), SubExprs(container), Domains(domains) { }
+
+    std::pair<bool, Expr *> walkToExprPre(Expr *expr) override {
+      // A dictionary expression is just a set of tuples; try to solve ones
+      // that have overload sets.
+      if (auto dictionaryExpr = dyn_cast<DictionaryExpr>(expr)) {
+        for (auto element : dictionaryExpr->getElements()) {
+          unsigned numOverlaods = 0;
+          element->walk(OverloadSetCounter(numOverlaods));
+
+          // There are no overload sets in the element; skip it.
+          if (numOverlaods == 0)
+            continue;
+
+          // FIXME: Could we avoid creating a separate dictionary expression
+          // here by introducing a contextual type on the element?
+          auto dict = DictionaryExpr::create(CS.getASTContext(),
+                                             dictionaryExpr->getLBracketLoc(),
+                                             { element },
+                                             dictionaryExpr->getRBracketLoc(),
+                                             dictionaryExpr->getType());
+
+          // Make each of the dictionary elements an independent dictionary,
+          // such makes it easy to type-check everything separately.
+          SubExprs.push(Candidate(CS, dict));
+        }
+
+        // Don't try to walk into the dictionary.
+        return { false, expr };
+      }
+
+      // Let's not attempt to type-check closures or default values,
+      // which has already been type checked anyway.
+      if (isa<ClosureExpr>(expr) || isa<DefaultValueExpr>(expr)) {
+        return { false, expr };
+      }
+
+      // Coerce to type expressions are only viable if they have
+      // a single child expression.
+      if (auto coerceExpr = dyn_cast<CoerceExpr>(expr)) {
+        if (!coerceExpr->getSubExpr()) {
+          return { false, expr };
+        }
+      }
+
+      if (auto OSR = dyn_cast<OverloadSetRefExpr>(expr)) {
+        Domains[OSR] = OSR->getDecls();
+      }
+
+      if (auto applyExpr = dyn_cast<ApplyExpr>(expr)) {
+        auto func = applyExpr->getFn();
+        // Let's record this function application for post-processing
+        // as well as if it contains overload set, see walkToExprPost.
+        ApplyExprs.push({ applyExpr, isa<OverloadSetRefExpr>(func) });
+      }
+
+      return { true, expr };
+    }
+
+    Expr *walkToExprPost(Expr *expr) override {
+      if (!isa<ApplyExpr>(expr))
+        return expr;
+
+      unsigned numOverloadSets = 0;
+      // Let's count how many overload sets do we have.
+      while (!ApplyExprs.empty()) {
+        auto application = ApplyExprs.top();
+        auto applyExpr = application.first;
+
+        // Add overload sets tracked by current expression.
+        numOverloadSets += application.second;
+        ApplyExprs.pop();
+
+        // We've found the current expression, so record the number of
+        // overloads.
+        if (expr == applyExpr) {
+          ApplyExprs.push({ applyExpr, numOverloadSets });
+          break;
+        }
+      }
+
+      // If there are fewer than two overloads in the chain
+      // there is no point of solving this expression,
+      // because we won't be able to reduce it's domain.
+      if (numOverloadSets > 1)
+        SubExprs.push(Candidate(CS, expr));
+
+      return expr;
+    }
+  };
+
+  std::queue<Candidate> expressions;
+  ExprCollector collector(*this, expressions, domains);
+
+  // Collect all of the binary/unary and call sub-expressions
+  // so we can start solving them separately.
+  expr->walk(collector);
+
+  while (!expressions.empty()) {
+    auto &candidate = expressions.front();
+
+    // If there are no results, let's forget everything we know about the
+    // system so far. This actually is ok, because some of the expressions
+    // might require manual salvaging.
+    if (candidate.solve()) {
+      // Let's restore all of the original OSR domains.
+      for (auto &domain : domains) {
+        if (auto OSR = dyn_cast<OverloadSetRefExpr>(domain.getFirst())) {
+          OSR->setDecls(domain.getSecond());
+        }
+      }
+      break;
+    }
+
+    expressions.pop();
+  }
+}
+
+ConstraintSystem::SolutionKind
+ConstraintSystem::solve(Expr *&expr,
+                        Type convertType,
+                        ExprTypeCheckListener *listener,
+                        SmallVectorImpl<Solution> &solutions,
+                        FreeTypeVariableBinding allowFreeTypeVariables) {
+  assert(!solverState && "use solveRec for recursive calls");
+
+  // Try to shrink the system by reducing disjunction domains. This
+  // goes through every sub-expression and generate it's own sub-system, to
+  // try to reduce the domains of those subexpressions.
+  shrink(expr);
+
+  // Generate constraints for the main system.
+  if (auto generatedExpr = generateConstraints(expr))
+    expr = generatedExpr;
+  else {
+    return SolutionKind::Error;
+  }
+
+  // If there is a type that we're expected to convert to, add the conversion
+  // constraint.
+  if (convertType) {
+    auto constraintKind = ConstraintKind::Conversion;
+    if (getContextualTypePurpose() == CTP_CallArgument)
+      constraintKind = ConstraintKind::ArgumentConversion;
+
+    if (allowFreeTypeVariables == FreeTypeVariableBinding::UnresolvedType) {
+      convertType = convertType.transform([&](Type type) -> Type {
+        if (type->is<UnresolvedType>())
+          return createTypeVariable(getConstraintLocator(expr), 0);
+        return type;
+      });
+    }
+
+    addConstraint(constraintKind, expr->getType(), convertType,
+                  getConstraintLocator(expr), /*isFavored*/ true);
+  }
+
+  // Notify the listener that we've built the constraint system.
+  if (listener && listener->builtConstraints(*this, expr)) {
+    return SolutionKind::Error;
+  }
+
+  if (TC.getLangOpts().DebugConstraintSolver) {
+    auto &log = getASTContext().TypeCheckerDebug->getStream();
+    log << "---Initial constraints for the given expression---\n";
+    expr->print(log);
+    log << "\n";
+    print(log);
+  }
+
+  // Try to solve the constraint system using computed suggestions.
+  solve(solutions, allowFreeTypeVariables);
+
+  // If there are no solutions let's mark system as unsolved,
+  // and solved otherwise even if there are multiple solutions still present.
+  return solutions.empty() ? SolutionKind::Unsolved : SolutionKind::Solved;
+}
+
 bool ConstraintSystem::solve(SmallVectorImpl<Solution> &solutions,
                              FreeTypeVariableBinding allowFreeTypeVariables) {
   assert(!solverState && "use solveRec for recursive calls");
@@ -1330,7 +1673,7 @@
 
   // Remove the solver state.
   this->solverState = nullptr;
-  
+
   // We fail if there is no solution.
   return solutions.empty();
 }
diff --git a/lib/Sema/CodeSynthesis.cpp b/lib/Sema/CodeSynthesis.cpp
index d387481..08b0253 100644
--- a/lib/Sema/CodeSynthesis.cpp
+++ b/lib/Sema/CodeSynthesis.cpp
@@ -1271,9 +1271,9 @@
   
   // Add the witnesses to the conformance.
   ArrayRef<Substitution> MemberSubs;
-  if (DC->isGenericContext()) {
+  if (auto *sig = DC->getGenericSignatureOfContext()) {
     MemberSubs = DC->getGenericParamsOfContext()
-                   ->getForwardingSubstitutions(Context);
+                   ->getForwardingSubstitutions(sig);
   }
   
   BehaviorConformance->setWitness(BehaviorStorage,
@@ -1440,9 +1440,9 @@
 
   // Add the witnesses to the conformance.
   ArrayRef<Substitution> MemberSubs;
-  if (DC->isGenericContext()) {
+  if (auto *sig = DC->getGenericSignatureOfContext()) {
     MemberSubs = DC->getGenericParamsOfContext()
-    ->getForwardingSubstitutions(Context);
+    ->getForwardingSubstitutions(sig);
   }
 
   BehaviorConformance->setWitness(BehaviorParameter,
diff --git a/lib/Sema/Constraint.cpp b/lib/Sema/Constraint.cpp
index c5c11f0..59b5e04 100644
--- a/lib/Sema/Constraint.cpp
+++ b/lib/Sema/Constraint.cpp
@@ -83,7 +83,6 @@
 
   case ConstraintKind::Archetype:
   case ConstraintKind::Class:
-  case ConstraintKind::BridgedToObjectiveC:
     assert(!Member && "Type property cannot have a member");
     assert(Second.isNull() && "Type property with second type");
     break;
@@ -187,7 +186,6 @@
 
   case ConstraintKind::Archetype:
   case ConstraintKind::Class:
-  case ConstraintKind::BridgedToObjectiveC:
     return create(cs, getKind(), getFirstType(), Type(), DeclName(),
                   FunctionRefKind::Compound, getLocator());
 
@@ -308,10 +306,6 @@
     Out << " is a class";
     skipSecond = true;
     break;
-  case ConstraintKind::BridgedToObjectiveC:
-    Out << " is bridged to an Objective-C type";
-    skipSecond = true;
-    break;
   case ConstraintKind::Defaultable:
     Out << " can default to ";
     break;
@@ -491,7 +485,6 @@
   case ConstraintKind::Archetype:
   case ConstraintKind::BindOverload:
   case ConstraintKind::Class:
-  case ConstraintKind::BridgedToObjectiveC:
   case ConstraintKind::ConformsTo:
   case ConstraintKind::SelfObjectOfProtocol:
     constraint->getFirstType()->getTypeVariables(typeVars);
diff --git a/lib/Sema/Constraint.h b/lib/Sema/Constraint.h
index b6d19d6..64ebe93 100644
--- a/lib/Sema/Constraint.h
+++ b/lib/Sema/Constraint.h
@@ -117,8 +117,6 @@
   /// \brief The first type is a class or an archetype of a class-bound
   /// protocol.
   Class,
-  /// \brief The first type implements the _BridgedToObjectiveC protocol.
-  BridgedToObjectiveC,
   /// \brief The first type can be defaulted to the second (which currently
   /// cannot be dependent).  This is more like a type property than a
   /// relational constraint.
@@ -489,7 +487,6 @@
 
     case ConstraintKind::Archetype:
     case ConstraintKind::Class:
-    case ConstraintKind::BridgedToObjectiveC:
     case ConstraintKind::DynamicTypeOf:
     case ConstraintKind::Defaultable:
       return ConstraintClassification::TypeProperty;
diff --git a/lib/Sema/ConstraintSystem.cpp b/lib/Sema/ConstraintSystem.cpp
index f0f38f9..b91db5c 100644
--- a/lib/Sema/ConstraintSystem.cpp
+++ b/lib/Sema/ConstraintSystem.cpp
@@ -1197,6 +1197,16 @@
                               functionRefKind, locator, base);
   }
 
+  // Don't open existentials when accessing typealias members of
+  // protocols.
+  if (auto *alias = dyn_cast<TypeAliasDecl>(value)) {
+    if (baseObjTy->isExistentialType()) {
+      auto memberTy = alias->getUnderlyingType();
+      auto openedType = FunctionType::get(baseObjTy, memberTy);
+      return { openedType, memberTy };
+    }
+  }
+
   // Handle associated type lookup as a special case, horribly.
   // FIXME: This is an awful hack.
   if (auto assocType = dyn_cast<AssociatedTypeDecl>(value)) {
diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h
index 33f8671..13d6408 100644
--- a/lib/Sema/ConstraintSystem.h
+++ b/lib/Sema/ConstraintSystem.h
@@ -27,6 +27,7 @@
 #include "swift/Basic/LLVM.h"
 #include "swift/Basic/OptionSet.h"
 #include "swift/AST/ASTVisitor.h"
+#include "swift/AST/ASTWalker.h"
 #include "swift/AST/NameLookup.h"
 #include "swift/AST/Types.h"
 #include "swift/AST/TypeCheckerDebugConsumer.h"
@@ -446,8 +447,6 @@
   SK_FunctionConversion,
   /// A literal expression bound to a non-default literal type.
   SK_NonDefaultLiteral,
-  /// An implicit bridged conversion between collection types.
-  SK_CollectionBridgedConversion,
   /// An implicit upcast conversion between collection types.
   SK_CollectionUpcastConversion,
   /// A value-to-optional conversion.
@@ -1017,6 +1016,40 @@
     DictionaryElementTypeVariables;
 
 private:
+  /// \brief Describe the candidate expression for partial solving.
+  /// This class used used by shrink & solve methods which apply
+  /// variation of directional path consistency algorithm in attempt
+  /// to reduce scopes of the overload sets (disjunctions) in the system.
+  class Candidate {
+    Expr *E;
+    TypeChecker &TC;
+    DeclContext *DC;
+    TypeLoc CT;
+    ContextualTypePurpose CTP;
+
+  public:
+    Candidate(ConstraintSystem &cs, Expr *expr)
+    : E(expr),
+      TC(cs.TC),
+      DC(cs.DC),
+      CT(cs.getContextualTypeLoc()),
+      CTP(cs.getContextualTypePurpose())
+    {}
+
+    /// \brief Try to solve this candidate sub-expression
+    /// and re-write it's OSR domains afterwards.
+    ///
+    /// \returs true on solver failure, false otherwise.
+    bool solve();
+
+    /// \brief Apply solutions found by solver as reduced OSR sets for
+    /// for current and all of it's sub-expressions.
+    ///
+    /// \param solutions The solutions found by running solver on the
+    /// this candidate expression.
+    void applySolutions(llvm::SmallVectorImpl<Solution> &solutions) const;
+  };
+
   /// \brief Describes the current solver state.
   struct SolverState {
     SolverState(ConstraintSystem &cs);
@@ -1949,10 +1982,6 @@
   /// \brief Attempt to simplify the given class constraint.
   SolutionKind simplifyClassConstraint(const Constraint &constraint);
   
-  /// \brief Attempt to simplify the given bridge constraint.
-  SolutionKind simplifyBridgedToObjectiveCConstraint(const Constraint
-                                                                &constraint);
-
   /// \brief Attempt to simplify the given defaultable constraint.
   SolutionKind simplifyDefaultableConstraint(const Constraint &c);
 
@@ -2001,7 +2030,36 @@
   /// \returns true if an error occurred, false otherwise.
   bool solveSimplified(SmallVectorImpl<Solution> &solutions,
                        FreeTypeVariableBinding allowFreeTypeVariables);
+
+  /// \brief Find reduced domains of disjunction constraints for given
+  /// expression, this is achived to solving individual sub-expressions
+  /// and combining resolving types. Such algorithm is called directional
+  /// path consistency because it goes from children to parents for all
+  /// related sub-expressions taking union of their domains.
+  ///
+  /// \param expr The expression to find reductions for.
+  void shrink(Expr *expr);
+
  public:
+
+  /// \brief Solve the system of constraints generated from provided expression.
+  ///
+  /// \param expr The expression to generate constraints from.
+  /// \param convertType The expected type of the expression.
+  /// \param listener The callback to check solving progress.
+  /// \param solutions The set of solutions to the system of constraints.
+  /// \param allowFreeTypeVariables How to bind free type variables in
+  /// the solution.
+  ///
+  /// \returns Error is an error occured, Solved is system is consistent
+  /// and solutions were found, Unsolved otherwise.
+  SolutionKind solve(Expr *&expr,
+                     Type convertType,
+                     ExprTypeCheckListener *listener,
+                     SmallVectorImpl<Solution> &solutions,
+                     FreeTypeVariableBinding allowFreeTypeVariables
+                       = FreeTypeVariableBinding::Disallow);
+
   /// \brief Solve the system of constraints.
   ///
   /// \param solutions The set of solutions to this system of constraints.
@@ -2278,6 +2336,90 @@
 /// underlying forced downcast expression.
 ForcedCheckedCastExpr *findForcedDowncast(ASTContext &ctx, Expr *expr);
 
+/// ExprCleaner - This class is used by shrink to ensure that in
+/// no situation will an expr node be left with a dangling type variable stuck
+/// to it.  Often type checking will create new AST nodes and replace old ones
+/// (e.g. by turning an UnresolvedDotExpr into a MemberRefExpr).  These nodes
+/// might be left with pointers into the temporary constraint system through
+/// their type variables, and we don't want pointers into the original AST to
+/// dereference these now-dangling types.
+class ExprCleaner {
+  llvm::SmallDenseMap<Expr *, Type> Exprs;
+  llvm::SmallDenseMap<TypeLoc *, Type> TypeLocs;
+  llvm::SmallDenseMap<Pattern *, Type> Patterns;
+public:
+
+  ExprCleaner(Expr *E) {
+    struct ExprCleanserImpl : public ASTWalker {
+      ExprCleaner *TS;
+      ExprCleanserImpl(ExprCleaner *TS) : TS(TS) {}
+
+      std::pair<bool, Expr *> walkToExprPre(Expr *expr) override {
+        TS->Exprs.insert({ expr, expr->getType() });
+        return { true, expr };
+      }
+
+      bool walkToTypeLocPre(TypeLoc &TL) override {
+        TS->TypeLocs.insert({ &TL, TL.getType() });
+        return true;
+      }
+
+      std::pair<bool, Pattern*> walkToPatternPre(Pattern *P) override {
+        TS->Patterns.insert({ P, P->getType() });
+        return { true, P };
+      }
+
+      // Don't walk into statements.  This handles the BraceStmt in
+      // non-single-expr closures, so we don't walk into their body.
+      std::pair<bool, Stmt *> walkToStmtPre(Stmt *S) override {
+        return { false, S };
+      }
+    };
+
+    E->walk(ExprCleanserImpl(this));
+  }
+
+  ~ExprCleaner() {
+    // Check each of the expression nodes to verify that there are no type
+    // variables hanging out.  If so, just nuke the type.
+    for (auto E : Exprs) {
+      E.getFirst()->setType(E.getSecond());
+    }
+
+    for (auto TL : TypeLocs) {
+      TL.getFirst()->setType(TL.getSecond(), false);
+    }
+
+    for (auto P : Patterns) {
+      P.getFirst()->setType(P.getSecond());
+    }
+  }
+};
+
+/**
+ * Count the number of overload sets present
+ * in the expression and all of the children.
+ */
+class OverloadSetCounter : public ASTWalker {
+  unsigned &NumOverloads;
+
+public:
+  OverloadSetCounter(unsigned &overloads)
+  : NumOverloads(overloads)
+  {}
+
+  std::pair<bool, Expr *> walkToExprPre(Expr *expr) override {
+    if (auto applyExpr = dyn_cast<ApplyExpr>(expr)) {
+      // If we've found function application and it's
+      // function is an overload set, count it.
+      if (isa<OverloadSetRefExpr>(applyExpr->getFn()))
+        ++NumOverloads;
+    }
+
+    // Always recur into the children.
+    return { true, expr };
+  }
+};
 } // end namespace swift
 
 #endif // LLVM_SWIFT_SEMA_CONSTRAINT_SYSTEM_H
diff --git a/lib/Sema/DerivedConformanceRawRepresentable.cpp b/lib/Sema/DerivedConformanceRawRepresentable.cpp
index a02147b..2a87972 100644
--- a/lib/Sema/DerivedConformanceRawRepresentable.cpp
+++ b/lib/Sema/DerivedConformanceRawRepresentable.cpp
@@ -82,11 +82,12 @@
 
   Type rawTy = enumDecl->getRawType();
   assert(rawTy);
+  rawTy = ArchetypeBuilder::mapTypeIntoContext(toRawDecl, rawTy);
+
   for (auto elt : enumDecl->getAllElements()) {
-    if (!elt->getTypeCheckedRawValueExpr() ||
-        !elt->getTypeCheckedRawValueExpr()->getType()->isEqual(rawTy)) {
-      return;
-    }
+    assert(elt->getTypeCheckedRawValueExpr() &&
+		"Enum element has no literal - missing a call to checkEnumRawValues()");
+    assert(elt->getTypeCheckedRawValueExpr()->getType()->isEqual(rawTy));
   }
 
   Type enumType = parentDC->getDeclaredTypeInContext();
@@ -186,10 +187,9 @@
   rawTy = ArchetypeBuilder::mapTypeIntoContext(initDecl, rawTy);
   
   for (auto elt : enumDecl->getAllElements()) {
-    if (!elt->getTypeCheckedRawValueExpr() ||
-        !elt->getTypeCheckedRawValueExpr()->getType()->isEqual(rawTy)) {
-      return;
-    }
+    assert(elt->getTypeCheckedRawValueExpr() &&
+		"Enum element has no literal - missing a call to checkEnumRawValues()");
+    assert(elt->getTypeCheckedRawValueExpr()->getType()->isEqual(rawTy));
   }
 
   Type enumType = parentDC->getDeclaredTypeInContext();
@@ -257,18 +257,11 @@
   auto rawType = ArchetypeBuilder::mapTypeIntoContext(parentDC,
                                                       rawInterfaceType);
 
-  // Make sure that the raw type is Equatable. We need it to ensure that we have
-  // a suitable ~= for the switch.
   auto equatableProto = tc.getProtocol(enumDecl->getLoc(),
                                        KnownProtocolKind::Equatable);
-  if (!equatableProto)
-    return nullptr;
-
-  if (!tc.conformsToProtocol(rawType, equatableProto, enumDecl, None)) {
-    SourceLoc loc = enumDecl->getInherited()[0].getSourceRange().Start;
-    tc.diagnose(loc, diag::enum_raw_type_not_equatable, rawType);
-    return nullptr;
-  }
+  assert(equatableProto);
+  assert(tc.conformsToProtocol(rawType, equatableProto, enumDecl, None));
+  (void)equatableProto;
 
   Type enumType = parentDC->getDeclaredTypeInContext();
   auto *selfDecl = ParamDecl::createUnboundSelf(SourceLoc(), parentDC,
@@ -353,31 +346,62 @@
   return initDecl;
 }
 
+static bool canSynthesizeRawRepresentable(TypeChecker &tc, Decl *parentDecl, EnumDecl *enumDecl) {
+
+  // It must have a valid raw type.
+  Type rawType = enumDecl->getRawType();
+  if (!rawType)
+    return false;
+  auto parentDC = cast<DeclContext>(parentDecl);
+  rawType       = ArchetypeBuilder::mapTypeIntoContext(parentDC, rawType);
+
+  if (!enumDecl->getInherited().empty() &&
+      enumDecl->getInherited().front().isError())
+    return false;
+
+  // The raw type must be Equatable, so that we have a suitable ~= for synthesized switch statements.
+  auto equatableProto = tc.getProtocol(enumDecl->getLoc(),
+                                       KnownProtocolKind::Equatable);
+  if (!equatableProto)
+    return false;
+
+  if (!tc.conformsToProtocol(rawType, equatableProto, enumDecl, None)) {
+    SourceLoc loc = enumDecl->getInherited()[0].getSourceRange().Start;
+    tc.diagnose(loc, diag::enum_raw_type_not_equatable, rawType);
+    return false;
+  }
+  
+  // There must be enum elements.
+  if (enumDecl->getAllElements().empty())
+    return false;
+
+  // Have the type-checker validate that:
+  // - the enum elements all have the same type
+  // - they all match the enum type
+  for (auto elt : enumDecl->getAllElements()) {
+    tc.validateDecl(elt);
+    if (elt->isInvalid()) {
+      return false;
+    }
+  }
+
+  // If it meets all of those requirements, we can synthesize RawRepresentable conformance.
+  return true;
+}
+
 ValueDecl *DerivedConformance::deriveRawRepresentable(TypeChecker &tc,
                                                       Decl *parentDecl,
                                                       NominalTypeDecl *type,
                                                       ValueDecl *requirement) {
-  // Check preconditions. These should already have been diagnosed by
-  // type-checking but we may still get here after recovery.
-  
-  // The type must be an enum.
+
+  // We can only synthesize RawRepresentable for enums.
   auto enumDecl = dyn_cast<EnumDecl>(type);
   if (!enumDecl)
     return nullptr;
-  
-  // It must have a valid raw type.
-  if (!enumDecl->hasRawType())
-    return nullptr;
-  if (!enumDecl->getInherited().empty() &&
-      enumDecl->getInherited().front().isError())
-    return nullptr;
-  
-  // There must be enum elements.
-  if (enumDecl->getAllElements().empty())
-    return nullptr;
 
-  for (auto elt : enumDecl->getAllElements())
-    tc.validateDecl(elt);
+  // Check other preconditions for synthesized conformance.
+  if (!canSynthesizeRawRepresentable(tc, parentDecl, enumDecl))
+    return nullptr;
 
   if (requirement->getName() == tc.Context.Id_rawValue)
     return deriveRawRepresentable_raw(tc, parentDecl, enumDecl);
@@ -394,27 +418,15 @@
                                                 Decl *parentDecl,
                                                 NominalTypeDecl *type,
                                                 AssociatedTypeDecl *assocType) {
-  // Check preconditions. These should already have been diagnosed by
-  // type-checking but we may still get here after recovery.
-  
-  // The type must be an enum.
+
+  // We can only synthesize RawRepresentable for enums.
   auto enumDecl = dyn_cast<EnumDecl>(type);
   if (!enumDecl)
     return nullptr;
-  
-  // It must have a valid raw type.
-  if (!enumDecl->hasRawType())
-    return nullptr;
-  if (!enumDecl->getInherited().empty() &&
-      enumDecl->getInherited().front().isError())
-    return nullptr;
-  
-  // There must be enum elements.
-  if (enumDecl->getAllElements().empty())
-    return nullptr;
 
-  for (auto elt : enumDecl->getAllElements())
-    tc.validateDecl(elt);
+  // Check other preconditions for synthesized conformance.
+  if (!canSynthesizeRawRepresentable(tc, parentDecl, enumDecl))
+    return nullptr;
 
   if (assocType->getName() == tc.Context.Id_RawValue) {
     return deriveRawRepresentable_Raw(tc, parentDecl, enumDecl);
diff --git a/lib/Sema/MiscDiagnostics.cpp b/lib/Sema/MiscDiagnostics.cpp
index 29af6b1..9ed780d 100644
--- a/lib/Sema/MiscDiagnostics.cpp
+++ b/lib/Sema/MiscDiagnostics.cpp
@@ -262,9 +262,6 @@
       if (auto *MRE = dyn_cast<MemberRefExpr>(Base)) {
         if (isa<TypeDecl>(MRE->getMember().getDecl()))
           checkUseOfMetaTypeName(Base);
-
-        // Check whether there are needless words that could be omitted.
-        TC.checkOmitNeedlessWords(MRE);
       }
       if (isa<TypeExpr>(Base))
         checkUseOfMetaTypeName(Base);
@@ -340,9 +337,6 @@
           if (auto *DRE = dyn_cast<DeclRefExpr>(arg))
             checkNoEscapeParameterUse(DRE, Call);
         }
-
-        // Check whether there are needless words that could be omitted.
-        TC.checkOmitNeedlessWords(Call);
       }
       
       // If we have an assignment expression, scout ahead for acceptable _'s.
@@ -1130,8 +1124,8 @@
   // override uses a reference type, and the value type is bridged to the
   // reference type. This is a way to migrate code that makes use of types
   // that previously were not bridged to value types.
-  auto checkType = [&](Type overrideTy, Type baseTy,
-                       SourceRange typeRange) -> bool {
+  auto checkValueReferenceType = [&](Type overrideTy, Type baseTy,
+                                     SourceRange typeRange) -> bool {
     if (typeRange.isInvalid())
       return false;
 
@@ -1145,13 +1139,11 @@
     // Is the base type bridged?
     Type normalizedBaseTy = normalizeType(baseTy);
     const DeclContext *DC = decl->getDeclContext();
-    Optional<Type> maybeBridged =
-        TC.Context.getBridgedToObjC(DC, normalizedBaseTy, &TC);
 
     // ...and just knowing that it's bridged isn't good enough if we don't
     // know what it's bridged /to/. Also, don't do this check for trivial
     // bridging---that doesn't count.
-    Type bridged = maybeBridged.getValueOr(Type());
+    Type bridged = TC.Context.getBridgedToObjC(DC, normalizedBaseTy);
     if (!bridged || bridged->isEqual(normalizedBaseTy))
       return false;
 
@@ -1184,6 +1176,34 @@
     return true;
   };
 
+  // Check if overriding fails because we lack @escaping attribute on the function
+  // type repr.
+  auto checkTypeMissingEscaping = [&](Type overrideTy, Type baseTy,
+                                      SourceRange typeRange) -> bool {
+    // Fix-it needs position to apply.
+    if (typeRange.isInvalid())
+      return false;
+    auto overrideFnTy = overrideTy->getAs<AnyFunctionType>();
+    auto baseFnTy = baseTy->getAs<AnyFunctionType>();
+
+    // Both types should be function.
+    if (overrideFnTy && baseFnTy &&
+        // The overriding function type should be no escaping.
+        overrideFnTy->getExtInfo().isNoEscape() &&
+        // The overriden function type should be escaping.
+        !baseFnTy->getExtInfo().isNoEscape()) {
+      diag.fixItInsert(typeRange.Start, "@escaping ");
+      return true;
+    }
+    return false;
+  };
+
+  auto checkType = [&](Type overrideTy, Type baseTy,
+                       SourceRange typeRange) -> bool {
+    return checkValueReferenceType(overrideTy, baseTy, typeRange) ||
+      checkTypeMissingEscaping(overrideTy, baseTy, typeRange);
+  };
+
   if (auto *var = dyn_cast<VarDecl>(decl)) {
     SourceRange typeRange = var->getTypeSourceRangeForDiagnostics();
     return checkType(var->getType(), base->getType(), typeRange);
@@ -1369,18 +1389,18 @@
     if (parsed.isMember()) {
       diag.fixItReplace(call->getFn()->getSourceRange(), parsed.ContextName);
 
-    } else {
-      auto *dotCall = dyn_cast<DotSyntaxCallExpr>(call->getFn());
-      if (!dotCall)
-        return;
-
+    } else if (auto *dotCall = dyn_cast<DotSyntaxCallExpr>(call->getFn())) {
       SourceLoc removeLoc = dotCall->getDotLoc();
       if (removeLoc.isInvalid())
         return;
 
       diag.fixItRemove(SourceRange(removeLoc, dotCall->getFn()->getEndLoc()));
+    } else if (!isa<ConstructorRefCallExpr>(call->getFn())) {
+      return;
     }
 
+    // Continue on to diagnose any constructor argument label renames.
+    
   } else {
     // Just replace the base name.
     SmallString<64> baseReplace;
@@ -2045,9 +2065,6 @@
     TC.diagnoseDeprecated(R, DC, Attr, D->getFullName(), call);
   }
 
-  if (TC.getLangOpts().DisableAvailabilityChecking)
-    return false;
-
   // Diagnose for potential unavailability
   auto maybeUnavail = TC.checkDeclarationAvailability(D, R.Start, DC);
   if (maybeUnavail.hasValue()) {
@@ -2150,9 +2167,6 @@
       .Case("sizeof", {"size", false})
       .Case("alignof", {"alignment", false})
       .Case("strideof", {"stride", false})
-      .Case("sizeofValue", {"size", true})
-      .Case("alignofValue", {"alignment", true})
-      .Case("strideofValue", {"stride", true})
       .Default({});
 
   if (KindValue.first.empty())
@@ -2167,7 +2181,7 @@
 
   auto subject = args->getSubExpr();
   if (!isValue) {
-    // sizeof(x.dynamicType) is equivalent to sizeofValue(x)
+    // sizeof(type(of: x)) is equivalent to sizeofValue(x)
     if (auto DTE = dyn_cast<DynamicTypeExpr>(subject)) {
       subject = DTE->getBase();
       isValue = true;
@@ -2184,14 +2198,14 @@
   if (isValue) {
     auto valueType = subject->getType()->getRValueType();
     if (!valueType || valueType->is<ErrorType>()) {
-        // If we dont have good argument, We cannot emit fix-it.
-        return true;
+      // If we don't have a suitable argument, we cannot emit a fix-it.
+      return true;
     }
 
     // NOTE: We are destructively replacing the source text here.
-    // For instance, `sizeof(x.doSomethig())` => `MemoryLayout<T>.size` where
-    // T is return type of `doSomething()`. If that function have any
-    // side effects, it will break the source.
+    // `sizeof(type(of: doSomething()))` => `MemoryLayout<T>.size`, where T is
+    // the return type of `doSomething()`. If that function has any side
+    // effects, this replacement will break the source.
     diag.fixItReplace(call->getSourceRange(),
       (Prefix + valueType->getString() + Suffix + Kind).str());
   } else {
@@ -3582,7 +3596,8 @@
   diagSyntacticUseRestrictions(TC, E, DC, isExprStmt);
   diagRecursivePropertyAccess(TC, E, DC);
   diagnoseImplicitSelfUseInClosure(TC, E, DC);
-  diagAvailability(TC, E, const_cast<DeclContext*>(DC));
+  if (!TC.getLangOpts().DisableAvailabilityChecking)
+    diagAvailability(TC, E, const_cast<DeclContext*>(DC));
   if (TC.Context.LangOpts.EnableObjCInterop)
     diagDeprecatedObjCSelectors(TC, DC, E);
 }
@@ -3608,6 +3623,19 @@
 // Utility functions
 //===----------------------------------------------------------------------===//
 
+
+Accessibility
+swift::accessibilityFromScopeForDiagnostics(const DeclContext *accessScope) {
+  if (!accessScope)
+    return Accessibility::Public;
+  if (isa<ModuleDecl>(accessScope))
+    return Accessibility::Internal;
+  if (accessScope->isModuleScopeContext()) {
+    return Accessibility::FilePrivate;
+  }
+  return Accessibility::Private;
+}
+
 void swift::fixItAccessibility(InFlightDiagnostic &diag, ValueDecl *VD,
                                Accessibility desiredAccess, bool isForSetter) {
   StringRef fixItString;
@@ -3620,7 +3648,7 @@
   }
 
   DeclAttributes &attrs = VD->getAttrs();
-  DeclAttribute *attr;
+  AbstractAccessibilityAttr *attr;
   if (isForSetter) {
     attr = attrs.getAttribute<SetterAccessibilityAttr>();
     cast<AbstractStorageDecl>(VD)->overwriteSetterAccessibility(desiredAccess);
@@ -3648,10 +3676,18 @@
     diag.fixItRemove(attr->Range);
 
   } else if (attr) {
-    // This uses getLocation() instead of getRange() because we don't want to
-    // replace the "(set)" part of a setter attribute.
-    diag.fixItReplace(attr->getLocation(), fixItString.drop_back());
-    attr->setInvalid();
+    // If the formal access already matches the desired access, the problem
+    // must be in a parent scope. Don't emit a fix-it.
+    // FIXME: It's also possible for access to already be /broader/ than what's
+    // desired, in which case the problem is also in a parent scope. However,
+    // this function is sometimes called to make access narrower, so assuming
+    // that a broader scope is acceptable breaks some diagnostics.
+    if (attr->getAccess() != desiredAccess) {
+      // This uses getLocation() instead of getRange() because we don't want to
+      // replace the "(set)" part of a setter attribute.
+      diag.fixItReplace(attr->getLocation(), fixItString.drop_back());
+      attr->setInvalid();
+    }
 
   } else if (auto var = dyn_cast<VarDecl>(VD)) {
     if (auto PBD = var->getParentPatternBinding())
@@ -3918,307 +3954,3 @@
 
   return None;
 }
-
-void TypeChecker::checkOmitNeedlessWords(AbstractFunctionDecl *afd) {
-  if (!Context.LangOpts.WarnOmitNeedlessWords)
-    return;
-
-  auto newName = omitNeedlessWords(afd);
-  if (!newName)
-    return;
-
-  auto name = afd->getFullName();
-  InFlightDiagnostic diag = diagnose(afd->getLoc(), diag::omit_needless_words,
-                                     name, *newName);
-  fixDeclarationName(diag, afd, *newName);
-}
-
-void TypeChecker::checkOmitNeedlessWords(VarDecl *var) {
-  if (!Context.LangOpts.WarnOmitNeedlessWords)
-    return;
-
-  auto newName = omitNeedlessWords(var);
-  if (!newName)
-    return;
-
-  auto name = var->getName();
-  diagnose(var->getLoc(), diag::omit_needless_words, name, *newName)
-    .fixItReplace(var->getLoc(), newName->str());
-}
-
-/// Find the source ranges of extraneous default arguments within a
-/// call to the given function.
-static bool hasExtraneousDefaultArguments(AbstractFunctionDecl *afd,
-                                          Expr *arg, DeclName name,
-                                          SmallVectorImpl<SourceRange> &ranges,
-                                      SmallVectorImpl<unsigned> &removedArgs) {
-  if (!afd->getClangDecl())
-    return false;
-
-  if (afd->isInvalid())
-    return false;
-
-  if (auto shuffle = dyn_cast<TupleShuffleExpr>(arg))
-    arg = shuffle->getSubExpr();
-    
-  TupleExpr *argTuple = dyn_cast<TupleExpr>(arg);
-  ParenExpr *argParen = dyn_cast<ParenExpr>(arg);
-  
-  ASTContext &ctx = afd->getASTContext();
-  // Skip over the implicit 'self'.
-  auto *bodyParams = afd->getParameterList(afd->getImplicitSelfDecl()?1:0);
-
-  Optional<unsigned> firstRemoved;
-  Optional<unsigned> lastRemoved;
-  unsigned numElementsInParens;
-  if (argTuple) {
-    numElementsInParens = (argTuple->getNumElements() -
-                           argTuple->hasTrailingClosure());
-  } else if (argParen) {
-    numElementsInParens = 1 - argParen->hasTrailingClosure();
-  } else {
-    numElementsInParens = 0;
-  }
-
-  for (unsigned i = 0; i != numElementsInParens; ++i) {
-    auto param = bodyParams->get(i);
-    if (!param->isDefaultArgument())
-      continue;
-
-    auto defaultArg = param->getDefaultArgumentKind();
-
-    // Never consider removing the first argument for a "set" method
-    // with an unnamed first argument.
-    if (i == 0 &&
-        !name.getBaseName().empty() &&
-        camel_case::getFirstWord(name.getBaseName().str()) == "set" &&
-        name.getArgumentNames().size() > 0 &&
-        name.getArgumentNames()[0].empty())
-      continue;
-
-    SourceRange removalRange;
-    if (argTuple && i < argTuple->getNumElements()) {
-      // Check whether the supplied argument is the same as the
-      // default argument.
-      if (defaultArg != inferDefaultArgumentKind(argTuple->getElement(i)))
-        continue;
-
-      // Figure out where to start removing this argument.
-      if (i == 0) {
-        // Start removing right after the opening parenthesis.
-        removalRange.Start = argTuple->getLParenLoc();
-      } else {
-        // Start removing right after the preceding argument, so we
-        // consume the comma as well.
-        removalRange.Start = argTuple->getElement(i-1)->getEndLoc();
-      }
-
-      // Adjust to the end of the starting token.
-      removalRange.Start
-        = Lexer::getLocForEndOfToken(ctx.SourceMgr, removalRange.Start);
-
-      // Figure out where to finish removing this element.
-      if (i == 0 && i < numElementsInParens - 1) {
-        // We're the first of several arguments; consume the
-        // following comma as well.
-        removalRange.End = argTuple->getElementNameLoc(i+1);
-        if (removalRange.End.isInvalid())
-          removalRange.End = argTuple->getElement(i+1)->getStartLoc();
-      } else if (i < numElementsInParens - 1) {
-        // We're in the middle; consume through the end of this
-        // element.
-        removalRange.End
-          = Lexer::getLocForEndOfToken(ctx.SourceMgr,
-                                       argTuple->getElement(i)->getEndLoc());
-      } else {
-        // We're at the end; consume up to the closing parentheses.
-        removalRange.End = argTuple->getRParenLoc();
-      }
-    } else if (argParen) {
-      // Check whether we have a default argument.
-      if (defaultArg != inferDefaultArgumentKind(argParen->getSubExpr()))
-        continue;
-
-      removalRange = SourceRange(argParen->getSubExpr()->getStartLoc(),
-                                 argParen->getRParenLoc());
-    } else {
-      continue;
-    }
-
-    if (removalRange.isInvalid())
-      continue;
-
-    // Note that we're removing this argument.
-    removedArgs.push_back(i);
-
-    // If we hadn't removed anything before, this is the first
-    // removal.
-    if (!firstRemoved) {
-      ranges.push_back(removalRange);
-      firstRemoved = i;
-      lastRemoved = i;
-      continue;
-    }
-
-    // If the previous removal range was the previous argument,
-    // combine the ranges.
-    if (*lastRemoved == i - 1) {
-      ranges.back().End = removalRange.End;
-      lastRemoved = i;
-      continue;
-    }
-
-    // Otherwise, add this new removal range.
-    ranges.push_back(removalRange);
-    lastRemoved = i;
-  }
-
-  // If there is a single removal range that covers everything but
-  // the trailing closure at the end, also zap the parentheses.
-  if (ranges.size() == 1 &&
-      *firstRemoved == 0 && *lastRemoved == bodyParams->size() - 2 &&
-      argTuple && argTuple->hasTrailingClosure()) {
-    ranges.front().Start = argTuple->getLParenLoc();
-    ranges.front().End
-      = Lexer::getLocForEndOfToken(ctx.SourceMgr, argTuple->getRParenLoc());
-  }
-
-  return !ranges.empty();
-}
-
-void TypeChecker::checkOmitNeedlessWords(ApplyExpr *apply) {
-  if (!Context.LangOpts.WarnOmitNeedlessWords)
-    return;
-
-  // Find the callee.
-  ApplyExpr *innermostApply = apply;
-  unsigned numApplications = 0;
-  while (auto fnApply = dyn_cast<ApplyExpr>(
-                          innermostApply->getFn()->getValueProvidingExpr())) {
-    innermostApply = fnApply;
-    ++numApplications;
-  }
-  if (numApplications != 1)
-    return;
-
-  DeclRefExpr *fnRef
-    = dyn_cast<DeclRefExpr>(innermostApply->getFn()->getValueProvidingExpr());
-  if (!fnRef)
-    return;
-
-  auto *afd = dyn_cast<AbstractFunctionDecl>(fnRef->getDecl());
-  if (!afd)
-    return;
-
-  // Determine whether the callee has any needless words in it.
-  auto newName = omitNeedlessWords(afd);
-
-  bool renamed;
-  if (!newName) {
-    newName = afd->getFullName();
-    renamed = false;
-  } else {
-    renamed = true;
-  }
-
-  // Determine whether there are any extraneous default arguments to be zapped.
-  SmallVector<SourceRange, 2> removedDefaultArgRanges;
-  SmallVector<unsigned, 2> removedArgs;
-  bool anyExtraneousDefaultArgs
-    = hasExtraneousDefaultArguments(afd, apply->getArg(), *newName,
-                                    removedDefaultArgRanges,
-                                    removedArgs);
-
-  if (!renamed && !anyExtraneousDefaultArgs)
-    return;
-
-  // Make sure to apply the fix at the right application level.
-  auto name = afd->getFullName();
-
-  // Dig out the argument tuple.
-  Expr *arg = apply->getArg();
-  if (auto shuffle = dyn_cast<TupleShuffleExpr>(arg))
-    arg = shuffle->getSubExpr();
-  TupleExpr *argTuple = dyn_cast<TupleExpr>(arg);
-  ParenExpr *argParen = dyn_cast<ParenExpr>(arg);
-
-  if (argParen && !argTuple)
-    arg = argParen->getSubExpr();
-
-  InFlightDiagnostic diag
-    = renamed ? diagnose(fnRef->getLoc(), diag::omit_needless_words,
-                         name, *newName)
-              : diagnose(fnRef->getLoc(), diag::extraneous_default_args_in_call,
-                         name);
-
-  // Fix the base name.
-  if (newName->getBaseName() != name.getBaseName()) {
-    diag.fixItReplace(fnRef->getLoc(), newName->getBaseName().str());
-  }
-
-  // Fix the argument names.
-  auto oldArgNames = name.getArgumentNames();
-  auto newArgNames = newName->getArgumentNames();
-  unsigned currentRemovedArg = 0;
-  if (argTuple) {
-    for (unsigned i = 0, n = newArgNames.size(); i != n; ++i) {
-      // If this argument was completely removed, don't emit any
-      // Fix-Its for it.
-      if (currentRemovedArg < removedArgs.size() &&
-          removedArgs[currentRemovedArg] == i) {
-        ++currentRemovedArg;
-        continue;
-      }
-
-      // Check whether the name changed.
-      auto newArgName = newArgNames[i];
-      if (oldArgNames[i] == newArgName) continue;
-
-      if (i >= argTuple->getNumElements()) break;
-      if (argTuple->getElementName(i) != oldArgNames[i]) continue;
-
-      auto nameLoc = argTuple->getElementNameLoc(i);
-      if (nameLoc.isInvalid()) {
-        // Add the argument label.
-        diag.fixItInsert(argTuple->getElement(i)->getStartLoc(),
-                         (newArgName.str() + ": ").str());
-      } else if (newArgName.empty()) {
-        // Delete the argument label.
-        diag.fixItRemoveChars(nameLoc, argTuple->getElement(i)->getStartLoc());
-      } else {
-        // Fix the argument label.
-        diag.fixItReplace(nameLoc, newArgName.str());
-      }
-    }
-  } else if (newArgNames.size() > 0 && !newArgNames[0].empty() &&
-             (!argParen || !argParen->hasTrailingClosure()) &&
-             removedArgs.empty()) {
-    // Add the argument label.
-    auto newArgName = newArgNames[0];
-    diag.fixItInsert(arg->getStartLoc(), (newArgName.str() + ": ").str());
-  }
-
-  // Remove all of the defaulted arguments.
-  for (auto extraneous : removedDefaultArgRanges) {
-    diag.fixItRemoveChars(extraneous.Start, extraneous.End);
-  }
-}
-
-void TypeChecker::checkOmitNeedlessWords(MemberRefExpr *memberRef) {
-  if (!Context.LangOpts.WarnOmitNeedlessWords)
-    return;
-
-  auto var = dyn_cast<VarDecl>(memberRef->getMember().getDecl());
-  if (!var)
-    return;
-
-  // Check whether any needless words were omitted.
-  auto newName = omitNeedlessWords(var);
-  if (!newName)
-    return;
-
-  // Fix the name.
-  auto name = var->getName();
-  diagnose(memberRef->getNameLoc(), diag::omit_needless_words, name, *newName)
-    .fixItReplace(memberRef->getNameLoc().getSourceRange(), newName->str());
-}
diff --git a/lib/Sema/MiscDiagnostics.h b/lib/Sema/MiscDiagnostics.h
index 73104ac..55f05a4 100644
--- a/lib/Sema/MiscDiagnostics.h
+++ b/lib/Sema/MiscDiagnostics.h
@@ -31,6 +31,13 @@
   class TypeChecker;
   class ValueDecl;
 
+/// Returns the access level associated with \p accessScope, for diagnostic
+/// purposes.
+///
+/// \sa ValueDecl::getFormalAccessScope
+Accessibility
+accessibilityFromScopeForDiagnostics(const DeclContext *accessScope);
+
 /// \brief Emit diagnostics for syntactic restrictions on a given expression.
 void performSyntacticExprDiagnostics(TypeChecker &TC, const Expr *E,
                                      const DeclContext *DC,
diff --git a/lib/Sema/PlaygroundTransform.cpp b/lib/Sema/PlaygroundTransform.cpp
index 69bfcbe..ac3d3b6 100644
--- a/lib/Sema/PlaygroundTransform.cpp
+++ b/lib/Sema/PlaygroundTransform.cpp
@@ -611,15 +611,19 @@
                   Elements.insert(Elements.begin() + (EI + 1), *Log);
                   ++EI;
                 }
-              }
-            } else if (DeclRefExpr *DRE = digForInoutDeclRef(AE->getArg())) {
-              Added<Stmt *> Log = logDeclOrMemberRef(DRE);
-              if (*Log) {
-                Elements.insert(Elements.begin() + (EI + 1), *Log);
-                ++EI;
+                Handled = true;
               }
             }
-            Handled = true;
+            if (!Handled) {
+              if (DeclRefExpr *DRE = digForInoutDeclRef(AE->getArg())) {
+                Added<Stmt *> Log = logDeclOrMemberRef(DRE);
+                if (*Log) {
+                  Elements.insert(Elements.begin() + (EI + 1), *Log);
+                  ++EI;
+                }
+              }
+            }
+            Handled = true; // Never log ()
           }
           if (!Handled) {
             // do the same as for all other expressions
diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp
index f7c993f..9f8db09 100644
--- a/lib/Sema/TypeCheckAttr.cpp
+++ b/lib/Sema/TypeCheckAttr.cpp
@@ -72,7 +72,6 @@
   IGNORED_ATTR(Rethrows)
   IGNORED_ATTR(Semantics)
   IGNORED_ATTR(Specialize)
-  IGNORED_ATTR(Swift3Migration)
   IGNORED_ATTR(SwiftNativeObjCRuntimeBase)
   IGNORED_ATTR(SynthesizedProtocol)
   IGNORED_ATTR(Testable)
@@ -343,7 +342,7 @@
 
 static Optional<Diag<bool,Type>>
 isAcceptableOutletType(Type type, bool &isArray, TypeChecker &TC) {
-  if (type->isObjCExistentialType())
+  if (type->isObjCExistentialType() || type->isAny())
     return None; // @objc existential types are okay
 
   auto nominal = type->getAnyNominal();
@@ -739,7 +738,6 @@
     IGNORED_ATTR(SynthesizedProtocol)
     IGNORED_ATTR(RequiresStoredPropertyInits)
     IGNORED_ATTR(SILStored)
-    IGNORED_ATTR(Swift3Migration)
     IGNORED_ATTR(Testable)
     IGNORED_ATTR(WarnUnqualifiedAccess)
     IGNORED_ATTR(ShowInInterface)
@@ -800,8 +798,8 @@
         .highlight(param->getSourceRange());
       return true;
     }
-  } else if (ty->isObjCExistentialType()) {
-    // @objc existential types are okay
+  } else if (ty->isObjCExistentialType() || ty->isAny()) {
+    // @objc existential types are okay, as is Any.
     // Nothing to do.
   } else {
     // No other types are permitted.
@@ -1368,11 +1366,6 @@
     TC.computeDefaultAccessibility(extension);
     Accessibility maxAccess = extension->getMaxAccessibility();
     if (std::min(attr->getAccess(), Accessibility::Public) > maxAccess) {
-      if (maxAccess == Accessibility::FilePrivate &&
-          !TC.Context.LangOpts.EnableSwift3Private) {
-        maxAccess = Accessibility::Private;
-      }
-
       // FIXME: It would be nice to say what part of the requirements actually
       // end up being problematic.
       auto diag =
diff --git a/lib/Sema/TypeCheckCaptures.cpp b/lib/Sema/TypeCheckCaptures.cpp
index a601874..ff83e11 100644
--- a/lib/Sema/TypeCheckCaptures.cpp
+++ b/lib/Sema/TypeCheckCaptures.cpp
@@ -75,7 +75,29 @@
 
     // We want to look through type aliases here.
     type = type->getCanonicalType();
-
+    
+    class TypeCaptureWalker : public TypeWalker {
+      AnyFunctionRef AFR;
+      llvm::function_ref<void(Type)> Callback;
+    public:
+      explicit TypeCaptureWalker(AnyFunctionRef AFR,
+                                 llvm::function_ref<void(Type)> callback)
+        : AFR(AFR), Callback(callback) {}
+    
+      Action walkToTypePre(Type ty) override {
+        Callback(ty);
+        // Pseudogeneric classes don't use their generic parameters so we
+        // don't need to visit them.
+        if (AFR.isObjC()) {
+          if (auto clas = dyn_cast_or_null<ClassDecl>(ty->getAnyNominal())) {
+            if (clas->usesObjCGenericsModel()) {
+              return Action::SkipChildren;
+            }
+          }
+        }
+        return Action::Continue;
+      }
+    };
     // If the type contains dynamic 'Self', conservatively assume we will
     // need 'Self' metadata at runtime. We could generalize the analysis
     // used below for usages of generic parameters in Objective-C
@@ -88,14 +110,14 @@
     // retainable pointer. Similarly stored property access does not
     // need it, etc.
     if (type->hasDynamicSelfType()) {
-      type.visit([&](Type t) {
+      type.walk(TypeCaptureWalker(AFR, [&](Type t) {
         if (auto *dynamicSelf = t->getAs<DynamicSelfType>()) {
           if (DynamicSelfCaptureLoc.isInvalid()) {
             DynamicSelfCaptureLoc = loc;
             DynamicSelf = dynamicSelf;
           }
         }
-      });
+      }));
     }
 
     // Similar to dynamic 'Self', IRGen doesn't really need type metadata
@@ -106,13 +128,13 @@
     // instead, but even there we don't really have enough information to
     // perform it accurately.
     if (type->hasArchetype()) {
-      type.visit([&](Type t) {
+      type.walk(TypeCaptureWalker(AFR, [&](Type t) {
         if (t->is<ArchetypeType>() &&
             !t->isOpenedExistential() &&
           GenericParamCaptureLoc.isInvalid()) {
           GenericParamCaptureLoc = loc;
         }
-      });
+      }));
     }
   }
 
@@ -177,6 +199,13 @@
   std::pair<bool, Expr *> walkToDeclRefExpr(DeclRefExpr *DRE) {
     auto *D = DRE->getDecl();
 
+    // Capture the generic parameters of the decl.
+    if (!AFR.isObjC() || !D->isObjC() || isa<ConstructorDecl>(D)) {
+      for (auto sub : DRE->getDeclRef().getSubstitutions()) {
+        checkType(sub.getReplacement(), DRE->getLoc());
+      }
+    }
+
     // DC is the DeclContext where D was defined
     // CurDC is the DeclContext where D was referenced
     auto DC = D->getDeclContext();
@@ -397,8 +426,10 @@
     // doesn't require its type metadata.
     if (auto declRef = dyn_cast<DeclRefExpr>(E))
       return (!declRef->getDecl()->isObjC()
-              && !E->getType()->hasRetainablePointerRepresentation()
-              && !E->getType()->is<AnyMetatypeType>());
+              && !E->getType()->getLValueOrInOutObjectType()
+                              ->hasRetainablePointerRepresentation()
+              && !E->getType()->getLValueOrInOutObjectType()
+                              ->is<AnyMetatypeType>());
 
     // Loading classes or metatypes doesn't require their metadata.
     if (isa<LoadExpr>(E))
@@ -406,17 +437,22 @@
               && !E->getType()->is<AnyMetatypeType>());
 
     // Accessing @objc members doesn't require type metadata.
+    // rdar://problem/27796375 -- allocating init entry points for ObjC
+    // initializers are generated as true Swift generics, so reify type
+    // parameters.
     if (auto memberRef = dyn_cast<MemberRefExpr>(E))
       return !memberRef->getMember().getDecl()->hasClangNode();
 
     if (auto applyExpr = dyn_cast<ApplyExpr>(E)) {
       if (auto methodApply = dyn_cast<ApplyExpr>(applyExpr->getFn())) {
         if (auto callee = dyn_cast<DeclRefExpr>(methodApply->getFn())) {
-          return !callee->getDecl()->isObjC();
+          return !callee->getDecl()->isObjC()
+            || isa<ConstructorDecl>(callee->getDecl());
         }
       }
       if (auto callee = dyn_cast<DeclRefExpr>(applyExpr->getFn())) {
-        return !callee->getDecl()->isObjC();
+        return !callee->getDecl()->isObjC()
+          || isa<ConstructorDecl>(callee->getDecl());
       }
     }
 
@@ -475,6 +511,14 @@
       if (E->getType()->isObjCExistentialType()
           || E->getType()->is<AnyMetatypeType>())
         return false;
+      
+      // We also special case Any erasure in pseudogeneric contexts
+      // not to rely on concrete type metadata by erasing from AnyObject
+      // as a waypoint.
+      if (E->getType()->isAny()
+          && erasure->getSubExpr()->getType()->is<ArchetypeType>())
+        return false;
+
       // Erasure to a Swift protocol always captures the type metadata from
       // its subexpression.
       checkType(erasure->getSubExpr()->getType(),
@@ -482,11 +526,28 @@
       return true;
     }
 
+    
     // Converting an @objc metatype to AnyObject doesn't require type
     // metadata.
     if (isa<ClassMetatypeToObjectExpr>(E)
         || isa<ExistentialMetatypeToObjectExpr>(E))
       return false;
+    
+    // Casting to an ObjC class doesn't require the metadata of its type
+    // parameters, if any.
+    if (auto cast = dyn_cast<CheckedCastExpr>(E)) {
+      if (auto clas = dyn_cast_or_null<ClassDecl>(
+                         cast->getCastTypeLoc().getType()->getAnyNominal())) {
+        if (clas->usesObjCGenericsModel()) {
+          return false;
+        }
+      }
+    }
+    
+    // Assigning an object doesn't require type metadata.
+    if (auto assignment = dyn_cast<AssignExpr>(E))
+      return !assignment->getSrc()->getType()
+        ->hasRetainablePointerRepresentation();
 
     return true;
   }
diff --git a/lib/Sema/TypeCheckConstraints.cpp b/lib/Sema/TypeCheckConstraints.cpp
index 1141990..701ea69 100644
--- a/lib/Sema/TypeCheckConstraints.cpp
+++ b/lib/Sema/TypeCheckConstraints.cpp
@@ -1347,54 +1347,27 @@
                    ExprTypeCheckListener *listener, ConstraintSystem &cs,
                    SmallVectorImpl<Solution> &viable,
                    TypeCheckExprOptions options) {
-
   // First, pre-check the expression, validating any types that occur in the
   // expression and folding sequence expressions.
   if (preCheckExpression(*this, expr, dc))
     return true;
 
-  if (auto generatedExpr = cs.generateConstraints(expr))
-    expr = generatedExpr;
-  else {
-    return true;
-  }
-
-  // If there is a type that we're expected to convert to, add the conversion
-  // constraint.
-  if (convertType) {
-    auto constraintKind = ConstraintKind::Conversion;
-    if (cs.getContextualTypePurpose() == CTP_CallArgument)
-      constraintKind = ConstraintKind::ArgumentConversion;
-      
-    if (allowFreeTypeVariables == FreeTypeVariableBinding::UnresolvedType) {
-      convertType = convertType.transform([&](Type type) -> Type {
-        if (type->is<UnresolvedType>())
-          return cs.createTypeVariable(cs.getConstraintLocator(expr), 0);
-        return type;
-      });
-    }
-    
-    cs.addConstraint(constraintKind, expr->getType(), convertType,
-                     cs.getConstraintLocator(expr), /*isFavored*/ true);
-  }
-
-  // Notify the listener that we've built the constraint system.
-  if (listener && listener->builtConstraints(cs, expr)) {
-    return true;
-  }
-
-  if (getLangOpts().DebugConstraintSolver) {
-    auto &log = Context.TypeCheckerDebug->getStream();
-    log << "---Initial constraints for the given expression---\n";
-    expr->print(log);
-    log << "\n";
-    cs.print(log);
-  }
-
   // Attempt to solve the constraint system.
-  if (cs.solve(viable, allowFreeTypeVariables) ||
-      (viable.size() != 1 &&
-       !options.contains(TypeCheckExprFlags::AllowUnresolvedTypeVariables))) {
+  auto solution = cs.solve(expr,
+                           convertType,
+                           listener,
+                           viable,
+                           allowFreeTypeVariables);
+
+  // The constraint system has failed
+  if (solution == ConstraintSystem::SolutionKind::Error)
+    return true;
+
+  // If the system is unsolved or there are multiple solutions present but
+  // type checker options do not allow unresolved types, let's try to salvage
+  if (solution == ConstraintSystem::SolutionKind::Unsolved
+      || (viable.size() != 1 &&
+          !options.contains(TypeCheckExprFlags::AllowUnresolvedTypeVariables))) {
     if (options.contains(TypeCheckExprFlags::SuppressDiagnostics))
       return true;
 
@@ -1523,6 +1496,24 @@
          convertType.getType()->hasUnresolvedType())) {
       convertType = TypeLoc();
       convertTypePurpose = CTP_Unused;
+    } else if (auto closure = dyn_cast<ClosureExpr>(expr)) {
+      auto *P = closure->getParameters();
+      
+      if (P->size() == 1 && convertType.getType()->is<FunctionType>()) {
+        auto hintFnType = convertType.getType()->castTo<FunctionType>();
+        auto hintFnInputType = hintFnType->getInput();
+        
+        // Cannot use hintFnInputType->is<TupleType>() since it would desugar ParenType
+        if (isa<TupleType>(hintFnInputType.getPointer())) {
+          TupleType *tupleTy = hintFnInputType->castTo<TupleType>();
+          
+          if (tupleTy->getNumElements() >= 2) {
+            diagnose(P->getStartLoc(), diag::closure_argument_list_single_tuple,
+                     hintFnInputType, P->size(), P->size() > 1);
+            return true;
+          }
+        }
+      }
     }
   }
 
@@ -2969,27 +2960,11 @@
     return CheckedCastKind::ArrayDowncast;
   }
 
-  if (auto toDict = cs.isDictionaryType(toType)) {
-    if (auto fromDict = cs.isDictionaryType(fromType)) {
-      if (toDict->first->isBridgeableObjectType() &&
-          toDict->second->isBridgeableObjectType() &&
-          fromDict->first->isBridgeableObjectType() &&
-          fromDict->second->isBridgeableObjectType())
-        return CheckedCastKind::DictionaryDowncast;
-      
-      return CheckedCastKind::DictionaryDowncastBridged;
-    }
-  }
+  if (cs.isDictionaryType(toType) && cs.isDictionaryType(fromType))
+    return CheckedCastKind::DictionaryDowncast;
 
-  if (cs.isSetType(toType) && cs.isSetType(fromType)) {
-    auto toBaseType = cs.getBaseTypeForSetType(toType.getPointer());
-    auto fromBaseType = cs.getBaseTypeForSetType(fromType.getPointer());
-    if (toBaseType->isBridgeableObjectType() &&
-        fromBaseType->isBridgeableObjectType()) {
-      return CheckedCastKind::SetDowncast;
-    }
-    return CheckedCastKind::SetDowncastBridged;
-  }
+  if (cs.isSetType(toType) && cs.isSetType(fromType))
+    return CheckedCastKind::SetDowncast;
 
   if (cs.isAnyHashableType(toType) || cs.isAnyHashableType(fromType)) {
     return CheckedCastKind::ValueCast;
diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp
index 51ea75a..ed845ab 100644
--- a/lib/Sema/TypeCheckDecl.cpp
+++ b/lib/Sema/TypeCheckDecl.cpp
@@ -1388,7 +1388,8 @@
       validateAccessibility(generic);
       Accessibility access = Accessibility::Internal;
       if (isa<ProtocolDecl>(generic))
-        access = std::max(access, generic->getFormalAccess());
+        access = std::max(Accessibility::FilePrivate,
+                          generic->getFormalAccess());
       D->setAccessibility(access);
       break;
     }
@@ -1396,10 +1397,6 @@
       auto extension = cast<ExtensionDecl>(DC);
       computeDefaultAccessibility(extension);
       auto access = extension->getDefaultAccessibility();
-      if (access == Accessibility::FilePrivate &&
-          !Context.LangOpts.EnableSwift3Private) {
-        access = Accessibility::Private;
-      }
       D->setAccessibility(access);
     }
     }
@@ -1538,23 +1535,6 @@
   }
 }
 
-/// Returns the access level associated with \p accessScope, for diagnostic
-/// purposes.
-///
-/// \sa ValueDecl::getFormalAccessScope
-static Accessibility
-accessibilityFromScopeForDiagnostics(const DeclContext *accessScope) {
-  if (!accessScope)
-    return Accessibility::Public;
-  if (isa<ModuleDecl>(accessScope))
-    return Accessibility::Internal;
-  if (accessScope->isModuleScopeContext() &&
-      accessScope->getASTContext().LangOpts.EnableSwift3Private) {
-    return Accessibility::FilePrivate;
-  }
-  return Accessibility::Private;
-}
-
 static void checkGenericParamAccessibility(TypeChecker &TC,
                                            const GenericParamList *params,
                                            const Decl *owner,
@@ -2078,6 +2058,8 @@
     return ObjCReason::WitnessToObjC;
   else if (VD->isInvalid())
     return None;
+  else if (VD->isOperator())
+    return None;
   // Implicitly generated declarations are not @objc, except for constructors.
   else if (!allowImplicit && VD->isImplicit())
     return None;
@@ -2589,6 +2571,7 @@
                   diag::enum_with_raw_type_case_with_argument);
       TC.diagnose(ED->getInherited().front().getSourceRange().Start,
                   diag::enum_raw_type_here, rawTy);
+      elt->setInvalid();
       continue;
     }
     
@@ -2607,6 +2590,7 @@
       // is the first element.
       auto nextValue = getAutomaticRawValueExpr(TC, valueKind, elt, prevValue);
       if (!nextValue) {
+        elt->setInvalid();
         break;
       }
       elt->setRawValueExpr(nextValue);
@@ -3512,7 +3496,6 @@
     }
 
     TC.checkDeclAttributes(VD);
-    TC.checkOmitNeedlessWords(VD);
   }
 
 
@@ -4356,6 +4339,8 @@
                         dc->getDeclaredInterfaceType())
               .fixItInsert(FD->getAttributeInsertionLoc(/*forModifier=*/true),
                            "static ");
+
+            FD->setStatic();
           } else {
             TC.diagnose(FD->getLoc(), diag::nonfinal_operator_in_class,
                         operatorName, dc->getDeclaredInterfaceType())
@@ -4371,6 +4356,7 @@
                     dc->getDeclaredInterfaceType())
           .fixItInsert(FD->getAttributeInsertionLoc(/*forModifier=*/true),
                        "static ");
+        FD->setStatic();
       }
     } else if (!dc->isModuleScopeContext()) {
       TC.diagnose(FD, diag::operator_in_local_scope);
@@ -4646,7 +4632,6 @@
 
     if (IsSecondPass) {
       checkAccessibility(TC, FD);
-      TC.checkOmitNeedlessWords(FD);
       return;
     }
 
@@ -5565,11 +5550,12 @@
         std::min(classDecl->getFormalAccess(), overriddenAccess);
       if (requiredAccess == Accessibility::Open && decl->isFinal())
         requiredAccess = Accessibility::Public;
+      else if (requiredAccess == Accessibility::Private)
+        requiredAccess = Accessibility::FilePrivate;
 
       bool shouldDiagnose = false;
       bool shouldDiagnoseSetter = false;
-      if (requiredAccess > Accessibility::Private &&
-          !isa<ConstructorDecl>(decl)) {
+      if (!isa<ConstructorDecl>(decl)) {
         shouldDiagnose = (decl->getFormalAccess() < requiredAccess);
 
         if (!shouldDiagnose && matchDecl->isSettable(classDecl)) {
@@ -5579,6 +5565,8 @@
             const DeclContext *accessDC = nullptr;
             if (requiredAccess == Accessibility::Internal)
               accessDC = classDecl->getParentModule();
+            else if (requiredAccess == Accessibility::FilePrivate)
+              accessDC = classDecl->getDeclContext();
             shouldDiagnoseSetter = ASD->isSettable(accessDC) &&
                                    !ASD->isSetterAccessibleFrom(accessDC);
           }
@@ -5853,19 +5841,6 @@
         Override->getAttrs().add(
                                 new (TC.Context) DynamicAttr(/*implicit*/true));
     }
-
-    void visitSwift3MigrationAttr(Swift3MigrationAttr *attr) {
-      if (!Override->getAttrs().hasAttribute<Swift3MigrationAttr>()) {
-        // Inherit swift3_migration attribute.
-        Override->getAttrs().add(new (TC.Context) Swift3MigrationAttr(
-                                                    SourceLoc(), SourceLoc(),
-                                                    SourceLoc(),
-                                                    attr->getRenamed(),
-                                                    attr->getMessage(),
-                                                    SourceLoc(),
-                                                    /*implicit=*/true));
-      }
-    }
   };
 
   /// Determine whether overriding the given declaration requires a keyword.
@@ -6330,7 +6305,6 @@
 
     if (IsSecondPass) {
       checkAccessibility(TC, CD);
-      TC.checkOmitNeedlessWords(CD);
       return;
     }
     if (CD->hasType())
@@ -6511,11 +6485,14 @@
 
     if (CD->isRequired() && ContextTy) {
       if (auto nominal = ContextTy->getAnyNominal()) {
-        if (CD->getFormalAccess() <
-            std::min(nominal->getFormalAccess(), Accessibility::Public)) {
+        auto requiredAccess = std::min(nominal->getFormalAccess(),
+                                       Accessibility::Public);
+        if (requiredAccess == Accessibility::Private)
+          requiredAccess = Accessibility::FilePrivate;
+        if (CD->getFormalAccess() < requiredAccess) {
           auto diag = TC.diagnose(CD,
                                   diag::required_initializer_not_accessible);
-          fixItAccessibility(diag, CD, nominal->getFormalAccess());
+          fixItAccessibility(diag, CD, requiredAccess);
         }
       }
     }
@@ -8134,12 +8111,11 @@
         error = diag::objc_enum_case_req_objc_enum;
       else if (objcAttr->hasName() && EED->getParentCase()->getElements().size() > 1)
         error = diag::objc_enum_case_multi;
-    } else if (isa<FuncDecl>(D)) {
-      auto func = cast<FuncDecl>(D);
+    } else if (auto *func = dyn_cast<FuncDecl>(D)) {
       if (!checkObjCDeclContext(D))
         error = diag::invalid_objc_decl_context;
       else if (func->isOperator())
-        error = diag::invalid_objc_decl;
+        error = diag::objc_operator;
       else if (func->isAccessor() && !func->isGetterOrSetter())
         error = diag::objc_observing_accessor;
     } else if (isa<ConstructorDecl>(D) ||
diff --git a/lib/Sema/TypeCheckError.cpp b/lib/Sema/TypeCheckError.cpp
index 7881957..2f25a1a 100644
--- a/lib/Sema/TypeCheckError.cpp
+++ b/lib/Sema/TypeCheckError.cpp
@@ -406,6 +406,12 @@
     SmallVector<Expr*, 4> args;
     auto fnRef = AbstractFunction::decomposeApply(E, args);
 
+    // If any of the arguments didn't type check, fail.
+    for (auto arg : args) {
+      if (!arg->getType() || arg->getType()->is<ErrorType>())
+        return Classification::forInvalidCode();
+    }
+
     // If we're applying more arguments than the natural argument
     // count, then this is a call to the opaque value returned from
     // the function.
diff --git a/lib/Sema/TypeCheckExprObjC.cpp b/lib/Sema/TypeCheckExprObjC.cpp
index 9aa8fbe..9f33ee9 100644
--- a/lib/Sema/TypeCheckExprObjC.cpp
+++ b/lib/Sema/TypeCheckExprObjC.cpp
@@ -171,7 +171,7 @@
     // a bridged value type, this will be the Objective-C class to
     // which it is bridged.
     Type lookupType;
-    if (auto bridgedClass = getBridgedToObjC(dc, currentType))
+    if (auto bridgedClass = Context.getBridgedToObjC(dc, currentType))
       lookupType = bridgedClass;
     else
       lookupType = currentType;
diff --git a/lib/Sema/TypeCheckGeneric.cpp b/lib/Sema/TypeCheckGeneric.cpp
index 4528de7..3ef2858 100644
--- a/lib/Sema/TypeCheckGeneric.cpp
+++ b/lib/Sema/TypeCheckGeneric.cpp
@@ -271,10 +271,8 @@
   for (auto param : *genericParams) {
     param->setDepth(depth);
 
-    if (builder) {
-      if (builder->addGenericParameter(param))
-        invalid = true;
-    }
+    if (builder)
+      builder->addGenericParameter(param);
   }
 
   // Now, check the inheritance clauses of each parameter.
@@ -815,7 +813,8 @@
 
 #ifndef NDEBUG
   // Record archetype contexts.
-  for (auto archetype : genericParams->getAllArchetypes()) {
+  for (auto *param : genericParams->getParams()) {
+    auto *archetype = param->getArchetype();
     if (Context.ArchetypeContexts.count(archetype) == 0)
       Context.ArchetypeContexts[archetype] = dc;
   }
diff --git a/lib/Sema/TypeCheckPattern.cpp b/lib/Sema/TypeCheckPattern.cpp
index 91bb12d..0f87567 100644
--- a/lib/Sema/TypeCheckPattern.cpp
+++ b/lib/Sema/TypeCheckPattern.cpp
@@ -1305,9 +1305,7 @@
     // Valid checks.
     case CheckedCastKind::ArrayDowncast:
     case CheckedCastKind::DictionaryDowncast:
-    case CheckedCastKind::DictionaryDowncastBridged:
     case CheckedCastKind::SetDowncast:
-    case CheckedCastKind::SetDowncastBridged:
       return coercePatternViaConditionalDowncast(
                *this, P, dc, type,
                subOptions|TR_FromNonInferredPattern);
@@ -1457,8 +1455,10 @@
 
   case PatternKind::OptionalSome: {
     auto *OP = cast<OptionalSomePattern>(P);
-    auto *enumDecl = type->getEnumOrBoundGenericEnum();
-    if (!enumDecl) {
+    OptionalTypeKind optionalKind;
+    Type elementType = type->getAnyOptionalObjectType(optionalKind);
+
+    if (elementType.isNull()) {
       auto diagID = diag::optional_element_pattern_not_valid_type;
       SourceLoc loc = OP->getQuestionLoc();
       // Produce tailored diagnostic for if/let and other conditions.
@@ -1471,35 +1471,10 @@
       return true;
     }
 
-    // If the element decl was not resolved (because it was spelled without a
-    // type as `.Foo`), resolve it now that we have a type.
-    if (!OP->getElementDecl()) {
-      auto *element = lookupEnumMemberElement(*this, dc, type, Context.Id_some,
-                                              OP->getLoc());
-      if (!element) {
-        diagnose(OP->getLoc(), diag::enum_element_pattern_member_not_found,
-                 "Some", type);
-        return true;
-      }
-      OP->setElementDecl(element);
-    }
+    EnumElementDecl *elementDecl = Context.getOptionalSomeDecl(optionalKind);
+    assert(elementDecl && "missing optional some decl?!");
+    OP->setElementDecl(elementDecl);
 
-    EnumElementDecl *elt = OP->getElementDecl();
-    // Is the enum element actually part of the enum type we're matching?
-    if (elt->getParentEnum() != enumDecl) {
-      diagnose(OP->getLoc(), diag::enum_element_pattern_not_member_of_enum,
-               "Some", type);
-      return true;
-    }
-
-    // Check the subpattern & push the enum element type down onto it.
-    Type elementType;
-    if (elt->hasArgumentType())
-      elementType = type->getTypeOfMember(elt->getModuleContext(),
-                                          elt, this,
-                                          elt->getArgumentInterfaceType());
-    else
-      elementType = TupleType::getEmpty(Context);
     Pattern *sub = OP->getSubPattern();
     if (coercePatternToType(sub, dc, elementType,
                             subOptions|TR_FromNonInferredPattern|TR_EnumPatternPayload,
@@ -1526,8 +1501,9 @@
 /// TODO: These diagnostics should be a lot better now that we know this is
 /// all specific to closures.
 ///
-bool TypeChecker::coerceParameterListToType(ParameterList *P, DeclContext *DC,
-                                            Type paramListType) {
+bool TypeChecker::coerceParameterListToType(ParameterList *P, ClosureExpr *CE,
+                                            AnyFunctionType *FN) {
+  Type paramListType = FN->getInput();
   bool hadError = paramListType->is<ErrorType>();
 
   // Sometimes a scalar type gets applied to a single-argument parameter list.
@@ -1536,7 +1512,7 @@
     
     // Check that the type, if explicitly spelled, is ok.
     if (param->getTypeLoc().getTypeRepr()) {
-      hadError |= validateParameterType(param, DC, TypeResolutionOptions(),
+      hadError |= validateParameterType(param, CE, TypeResolutionOptions(),
                                         nullptr, *this);
       
       // Now that we've type checked the explicit argument type, see if it
@@ -1564,6 +1540,22 @@
     return hadError;
   };
 
+  // Check if paramListType only contains one single tuple.
+  // If it is, then paramListType would be sugared ParenType
+  // with a single underlying TupleType. In that case, check if
+  // the closure argument is also one to avoid the tuple splat
+  // from happening.
+  if (!hadError && isa<ParenType>(paramListType.getPointer())) {
+    auto underlyingTy = paramListType->getCanonicalType();
+    
+    if (underlyingTy->is<TupleType>()) {
+      if (P->size() == 1) {
+        return handleParameter(P->get(0), underlyingTy);
+      }
+    }
+    
+    //pass
+  }
   
   // The context type must be a tuple.
   TupleType *tupleTy = paramListType->getAs<TupleType>();
@@ -1578,11 +1570,9 @@
   // The number of elements must match exactly.
   // TODO: incomplete tuple patterns, with some syntax.
   if (!hadError && tupleTy->getNumElements() != P->size()) {
-    if (P->size() == 1)
-      return handleParameter(P->get(0), paramListType);
-    
-    diagnose(P->getStartLoc(), diag::tuple_pattern_length_mismatch,
-             paramListType);
+    auto fnType = FunctionType::get(paramListType->getDesugaredType(), FN->getResult());
+    diagnose(P->getStartLoc(), diag::closure_argument_list_tuple,
+             fnType, tupleTy->getNumElements(), P->size(), (P->size() == 1));
     hadError = true;
   }
 
diff --git a/lib/Sema/TypeCheckProtocol.cpp b/lib/Sema/TypeCheckProtocol.cpp
index a5387ba..ec2639d 100644
--- a/lib/Sema/TypeCheckProtocol.cpp
+++ b/lib/Sema/TypeCheckProtocol.cpp
@@ -68,7 +68,7 @@
                          unsigned &bestIdx,
                          bool &doNotDiagnoseMatches);
 
-    bool checkWitnessAccessibility(Accessibility *requiredAccess,
+    bool checkWitnessAccessibility(const DeclContext *&requiredAccessScope,
                                    ValueDecl *requirement,
                                    ValueDecl *witness,
                                    bool *isSetter);
@@ -77,7 +77,7 @@
                                   ValueDecl *witness,
                                   AvailabilityContext *requirementInfo);
 
-    RequirementCheck checkWitness(Accessibility requiredAccess,
+    RequirementCheck checkWitness(const DeclContext *requiredAccessScope,
                                   ValueDecl *requirement,
                                   RequirementMatch match);
   };
@@ -392,24 +392,24 @@
   struct RequirementCheck {
     CheckKind Kind;
 
-    /// The required accessibility, if the check failed due to the
+    /// The required access scope, if the check failed due to the
     /// witness being less accessible than the requirement.
-    Accessibility RequiredAccess;
+    const DeclContext *RequiredAccessScope;
 
     /// The required availability, if the check failed due to the
     /// witness being less available than the requirement.
     AvailabilityContext RequiredAvailability;
 
     RequirementCheck(CheckKind kind)
-      : Kind(kind), RequiredAccess(Accessibility::Public),
+      : Kind(kind), RequiredAccessScope(nullptr),
         RequiredAvailability(AvailabilityContext::alwaysAvailable()) { }
 
-    RequirementCheck(CheckKind kind, Accessibility requiredAccess)
-      : Kind(kind), RequiredAccess(requiredAccess),
+    RequirementCheck(CheckKind kind, const DeclContext *requiredAccessScope)
+      : Kind(kind), RequiredAccessScope(requiredAccessScope),
         RequiredAvailability(AvailabilityContext::alwaysAvailable()) { }
 
     RequirementCheck(CheckKind kind, AvailabilityContext requiredAvailability)
-      : Kind(kind), RequiredAccess(Accessibility::Public),
+      : Kind(kind), RequiredAccessScope(nullptr),
         RequiredAvailability(requiredAvailability) { }
   };
 }
@@ -1218,48 +1218,35 @@
 }
 
 bool WitnessChecker::
-checkWitnessAccessibility(Accessibility *requiredAccess,
+checkWitnessAccessibility(const DeclContext *&requiredAccessScope,
                           ValueDecl *requirement,
                           ValueDecl *witness,
                           bool *isSetter) {
   *isSetter = false;
 
-  *requiredAccess = std::min(Proto->getFormalAccess(), *requiredAccess);
-  if (TC.getLangOpts().EnableSwift3Private)
-    *requiredAccess = std::max(*requiredAccess, Accessibility::FilePrivate);
+  const DeclContext *protoAccessScope = Proto->getFormalAccessScope(DC);
 
-  Accessibility witnessAccess = witness->getFormalAccess(DC);
-
-  // Leave a hole for old-style top-level operators to be declared 'private' for
-  // a fileprivate conformance.
-  if (witnessAccess == Accessibility::Private &&
-      witness->getDeclContext()->isModuleScopeContext()) {
-    witnessAccess = Accessibility::FilePrivate;
+  // FIXME: This is the same operation as TypeCheckDecl.cpp's
+  // TypeAccessScopeChecker::intersectAccess.
+  if (!requiredAccessScope) {
+    requiredAccessScope = protoAccessScope;
+  } else if (protoAccessScope) {
+    if (protoAccessScope->isChildContextOf(requiredAccessScope)) {
+      requiredAccessScope = protoAccessScope;
+    } else {
+      assert(requiredAccessScope == protoAccessScope ||
+             requiredAccessScope->isChildContextOf(protoAccessScope));
+    }
   }
 
-  if (witnessAccess < *requiredAccess)
+  if (!witness->isAccessibleFrom(requiredAccessScope))
     return true;
 
   if (requirement->isSettable(DC)) {
     *isSetter = true;
 
     auto ASD = cast<AbstractStorageDecl>(witness);
-    const DeclContext *accessDC;
-    switch (*requiredAccess) {
-    case Accessibility::Open:
-    case Accessibility::Public:
-      accessDC = nullptr;
-      break;
-    case Accessibility::Internal:
-      accessDC = DC->getParentModule();
-      break;
-    case Accessibility::FilePrivate:
-    case Accessibility::Private:
-      accessDC = DC->getModuleScopeContext();
-      break;
-    }
-
-    if (!ASD->isSetterAccessibleFrom(accessDC))
+    if (!ASD->isSetterAccessibleFrom(requiredAccessScope))
       return true;
   }
 
@@ -1276,19 +1263,19 @@
 }
 
 RequirementCheck WitnessChecker::
-checkWitness(Accessibility requiredAccess,
+checkWitness(const DeclContext *requiredAccessScope,
              ValueDecl *requirement,
              RequirementMatch match) {
   if (!match.OptionalAdjustments.empty())
     return CheckKind::OptionalityConflict;
 
   bool isSetter = false;
-  if (checkWitnessAccessibility(&requiredAccess, requirement,
+  if (checkWitnessAccessibility(requiredAccessScope, requirement,
                                 match.Witness, &isSetter)) {
     CheckKind kind = (isSetter
                       ? CheckKind::AccessibilityOfSetter
                       : CheckKind::Accessibility);
-    return RequirementCheck(kind, requiredAccess);
+    return RequirementCheck(kind, requiredAccessScope);
   }
 
   auto requiredAvailability = AvailabilityContext::alwaysAvailable();
@@ -1914,17 +1901,23 @@
 
   if (typeDecl) {
     // Check access.
-    Accessibility requiredAccess = Adoptee->getAnyNominal()->getFormalAccess();
+    const DeclContext *requiredAccessScope =
+        Adoptee->getAnyNominal()->getFormalAccessScope(DC);
     bool isSetter = false;
-    if (checkWitnessAccessibility(&requiredAccess, assocType, typeDecl,
+    if (checkWitnessAccessibility(requiredAccessScope, assocType, typeDecl,
                                   &isSetter)) {
       assert(!isSetter);
 
+      // Avoid relying on the lifetime of 'this'.
+      const DeclContext *DC = this->DC;
       diagnoseOrDefer(assocType, false,
-        [typeDecl, requiredAccess, assocType](
+        [DC, typeDecl, requiredAccessScope, assocType](
           TypeChecker &tc, NormalProtocolConformance *conformance) {
+        Accessibility requiredAccess =
+            accessibilityFromScopeForDiagnostics(requiredAccessScope);
         auto proto = conformance->getProtocol();
-        bool protoForcesAccess = (requiredAccess == proto->getFormalAccess());
+        bool protoForcesAccess =
+            (requiredAccessScope == proto->getFormalAccessScope(DC));
         auto diagKind = protoForcesAccess
                           ? diag::type_witness_not_accessible_proto
                           : diag::type_witness_not_accessible_type;
@@ -2014,6 +2007,8 @@
 static void diagnoseNoWitness(ValueDecl *Requirement, Type RequirementType,
                               NormalProtocolConformance *Conformance,
                               TypeChecker &TC) {
+  // FIXME: Try an ignore-access lookup?
+
   SourceLoc FixitLocation;
   SourceLoc TypeLoc;
   if (auto Extension = dyn_cast<ExtensionDecl>(Conformance->getDeclContext())) {
@@ -2162,8 +2157,9 @@
         });
     }
 
-    Accessibility requiredAccess = Adoptee->getAnyNominal()->getFormalAccess();
-    auto check = checkWitness(requiredAccess, requirement, best);
+    const DeclContext *nominalAccessScope =
+        Adoptee->getAnyNominal()->getFormalAccessScope(DC);
+    auto check = checkWitness(nominalAccessScope, requirement, best);
 
     switch (check.Kind) {
     case CheckKind::Success:
@@ -2171,12 +2167,17 @@
 
     case CheckKind::Accessibility:
     case CheckKind::AccessibilityOfSetter: {
+      // Avoid relying on the lifetime of 'this'.
+      const DeclContext *DC = this->DC;
       diagnoseOrDefer(requirement, false,
-        [witness, check, requirement](
+        [DC, witness, check, requirement](
           TypeChecker &tc, NormalProtocolConformance *conformance) {
+        Accessibility requiredAccess =
+            accessibilityFromScopeForDiagnostics(check.RequiredAccessScope);
+
         auto proto = conformance->getProtocol();
         bool protoForcesAccess =
-            (check.RequiredAccess == proto->getFormalAccess());
+            (check.RequiredAccessScope == proto->getFormalAccessScope(DC));
         auto diagKind = protoForcesAccess
                           ? diag::witness_not_accessible_proto
                           : diag::witness_not_accessible_type;
@@ -2186,9 +2187,9 @@
                                 getRequirementKind(requirement),
                                 witness->getFullName(),
                                 isSetter,
-                                check.RequiredAccess,
+                                requiredAccess,
                                 proto->getName());
-        fixItAccessibility(diag, witness, check.RequiredAccess, isSetter);
+        fixItAccessibility(diag, witness, requiredAccess, isSetter);
       });
       break;
     }
@@ -3923,13 +3924,25 @@
     return;
   }
 
-  // As a special case, diagnose conversion to ExpressibleByNilLiteral, since we
+  // Special case: diagnose conversion to ExpressibleByNilLiteral, since we
   // know this is something involving 'nil'.
   if (Proto->isSpecificProtocol(KnownProtocolKind::ExpressibleByNilLiteral)) {
     TC.diagnose(ComplainLoc, diag::cannot_use_nil_with_this_type, T);
     return;
   }
 
+  // Special case: for enums with a raw type, explain that the failing
+  // conformance to RawRepresentable was inferred.
+  if (auto enumDecl = T->getEnumOrBoundGenericEnum()) {
+	if (Proto->isSpecificProtocol(KnownProtocolKind::RawRepresentable) &&
+		enumDecl->derivesProtocolConformance(Proto) && enumDecl->hasRawType()) {
+
+      TC.diagnose(enumDecl->getInherited()[0].getSourceRange().Start,
+                  diag::enum_raw_type_nonconforming_and_nonsynthable,
+                  T, enumDecl->getRawType());
+      return;
+    }
+  }
 
   TC.diagnose(ComplainLoc, diag::type_does_not_conform,
               T, Proto->getDeclaredType());
@@ -4245,13 +4258,25 @@
       : TC(tc), DC(dc), Proto(proto) { }
 
     virtual Action walkToTypePre(Type ty) {
+      ConformanceCheckOptions options = ConformanceCheckFlags::InExpression
+          | ConformanceCheckFlags::Used
+          | ConformanceCheckFlags::SuppressDependencyTracking;
+
       // If we have a nominal type, "use" its conformance to
       // _ObjectiveCBridgeable if it has one.
-      if (ty->getAnyNominal()) {
-        ConformanceCheckOptions options = ConformanceCheckFlags::InExpression
-            | ConformanceCheckFlags::Used
-            | ConformanceCheckFlags::SuppressDependencyTracking;
+      if (auto *nominalDecl = ty->getAnyNominal()) {
         (void)TC.conformsToProtocol(ty, Proto, DC, options);
+
+        if (nominalDecl == TC.Context.getSetDecl() ||
+            nominalDecl == TC.Context.getDictionaryDecl()) {
+          auto args = ty->castTo<BoundGenericType>()->getGenericArgs();
+          if (!args.empty()) {
+            auto keyType = args[0];
+            auto *hashableProto =
+              TC.Context.getProtocol(KnownProtocolKind::Hashable);
+            (void)TC.conformsToProtocol(keyType, hashableProto, DC, options);
+          }
+        }
       }
 
       return Action::Continue;
@@ -4705,6 +4730,19 @@
              dc->getDeclaredTypeInContext(),
              diag.Protocol->getName());
 
+    // Special case: explain that 'RawRepresentable' conformance
+    // is implied for enums which already declare a raw type.
+    if (auto enumDecl = dyn_cast<EnumDecl>(existingDecl)) {
+      if (diag.Protocol->isSpecificProtocol(KnownProtocolKind::RawRepresentable) &&
+          enumDecl->derivesProtocolConformance(diag.Protocol) &&
+          enumDecl->hasRawType()) {
+        diagnose(enumDecl->getInherited()[0].getSourceRange().Start,
+                 diag::enum_declares_rawrep_with_raw_type,
+                 dc->getDeclaredTypeInContext(), enumDecl->getRawType());
+        continue;
+      }
+    }
+
     diagnose(existingDecl, diag::declared_protocol_conformance_here,
              dc->getDeclaredTypeInContext(),
              static_cast<unsigned>(diag.ExistingKind),
@@ -4968,7 +5006,7 @@
 
     // Perform the same checks as conformance witness matching, but silently
     // ignore the candidate instead of diagnosing anything.
-    auto check = checkWitness(Accessibility::Public, requirement, best);
+    auto check = checkWitness(/*access: public*/nullptr, requirement, best);
     if (check.Kind != CheckKind::Success)
       return ResolveWitnessResult::ExplicitFailed;
 
diff --git a/lib/Sema/TypeCheckStmt.cpp b/lib/Sema/TypeCheckStmt.cpp
index 4840bc5..3a79328 100644
--- a/lib/Sema/TypeCheckStmt.cpp
+++ b/lib/Sema/TypeCheckStmt.cpp
@@ -765,10 +765,14 @@
 
       // If someone is using an unlabeled break inside of an 'if' or 'do'
       // statement, produce a more specific error.
-      if (S->getTargetName().empty() && !ActiveLabeledStmts.empty() &&
-          (isa<IfStmt>(ActiveLabeledStmts.back()) ||
-           isa<DoStmt>(ActiveLabeledStmts.back())))
+      if (S->getTargetName().empty() &&
+          std::any_of(ActiveLabeledStmts.rbegin(),
+                      ActiveLabeledStmts.rend(),
+                      [&](Stmt *S) -> bool {
+                        return isa<IfStmt>(S) || isa<DoStmt>(S);
+                      })) {
         diagid = diag::unlabeled_break_outside_loop;
+      }
 
       TC.diagnose(S->getLoc(), diagid);
       return nullptr;
@@ -1001,7 +1005,7 @@
 
 static bool isDiscardableType(Type type) {
   return (type->is<ErrorType>() ||
-          type->isNever() ||
+          type->isUninhabited() ||
           type->lookThroughAllAnyOptionalTypes()->isVoid());
 }
 
diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp
index 3c14304..c9d4098 100644
--- a/lib/Sema/TypeCheckType.cpp
+++ b/lib/Sema/TypeCheckType.cpp
@@ -165,12 +165,6 @@
                                   dc);
 }
 
-Type TypeChecker::getBridgedToObjC(const DeclContext *dc, Type type) {
-  if (auto bridged = Context.getBridgedToObjC(dc, type, this))
-    return *bridged;
-  return nullptr;
-}
-
 Type
 TypeChecker::getDynamicBridgedThroughObjCClass(DeclContext *dc,
                                                Type dynamicType,
@@ -184,7 +178,7 @@
   if (!valueType->isPotentiallyBridgedValueType())
     return Type();
 
-  return getBridgedToObjC(dc, valueType);
+  return Context.getBridgedToObjC(dc, valueType);
 }
 
 void TypeChecker::forceExternalDeclMembers(NominalTypeDecl *nominalDecl) {
@@ -1228,14 +1222,14 @@
 
     return ErrorType::get(TC.Context);
   }
-  if (auto alias = dyn_cast<TypeAliasDecl>(member)) {
-    if (parentTy->isExistentialType() && memberType->hasTypeParameter()) {
-      if (diagnoseErrors)
-        TC.diagnose(comp->getIdLoc(), diag::typealias_to_assoc_type_outside_of_protocol,
-                    comp->getIdentifier(), alias->getUnderlyingTypeLoc());
 
-      return ErrorType::get(TC.Context);
-    }
+  if (parentTy->isExistentialType() && isa<TypeAliasDecl>(member) &&
+      memberType->hasTypeParameter()) {
+    if (diagnoseErrors)
+      TC.diagnose(comp->getIdLoc(), diag::typealias_outside_of_protocol,
+                  comp->getIdentifier());
+
+    return ErrorType::get(TC.Context);
   }
 
   // If there are generic arguments, apply them now.
@@ -1402,6 +1396,42 @@
   return false;
 }
 
+/// Whether the given DC is a noescape-by-default context, i.e. not a property
+/// setter
+static bool isDefaultNoEscapeContext(const DeclContext *DC) {
+  auto funcDecl = dyn_cast<FuncDecl>(DC);
+  return !funcDecl || !funcDecl->isSetter();
+}
+
+// Hack to apply context-specific @escaping to an AST function type.
+static Type applyNonEscapingFromContext(DeclContext *DC,
+                                        Type ty,
+                                        TypeResolutionOptions options) {
+  // Remember whether this is a function parameter.
+  bool isFunctionParam =
+    options.contains(TR_FunctionInput) ||
+    options.contains(TR_ImmediateFunctionInput);
+
+  bool defaultNoEscape = isFunctionParam && isDefaultNoEscapeContext(DC);
+
+  // Desugar here
+  auto *funcTy = ty->castTo<FunctionType>();
+  auto extInfo = funcTy->getExtInfo();
+  if (defaultNoEscape && !extInfo.isNoEscape()) {
+    extInfo = extInfo.withNoEscape();
+
+    // We lost the sugar to flip the isNoEscape bit.
+    //
+    // FIXME: It would be better to add a new AttributedType sugared type,
+    // which would wrap the NameAliasType or ParenType, and apply the
+    // isNoEscape bit when de-sugaring.
+    return FunctionType::get(funcTy->getInput(), funcTy->getResult(), extInfo);
+  }
+
+  // Note: original sugared type
+  return ty;
+}
+
 /// \brief Returns a valid type or ErrorType in case of an error.
 Type TypeChecker::resolveIdentifierType(
        DeclContext *DC,
@@ -1432,6 +1462,11 @@
     return ErrorType::get(Context);
   }
 
+  // Hack to apply context-specific @escaping to a typealias with an underlying
+  // function type.
+  if (result->is<FunctionType>())
+    result = applyNonEscapingFromContext(DC, result, options);
+
   // We allow a type to conform to a protocol that is less available than
   // the type itself. This enables a type to retroactively model or directly
   // conform to a protocol only available on newer OSes and yet still be used on
@@ -1441,8 +1476,8 @@
   bool AllowPotentiallyUnavailableProtocol =
       options.contains(TR_InheritanceClause);
 
-  // Check the availability of the type. Skip checking for SIL.
-  if (!(options & TR_SILType) && !(options & TR_AllowUnavailable) &&
+  // Check the availability of the type.
+  if (!(options & TR_AllowUnavailable) &&
       diagnoseAvailability(result, IdType,
                            Components.back()->getIdLoc(), DC, *this,
                            AllowPotentiallyUnavailableProtocol)) {
@@ -1637,13 +1672,6 @@
   return result;
 }
 
-/// Whether the given DC is a noescape-by-default context, i.e. not a property
-/// setter
-static bool isDefaultNoEscapeContext(const DeclContext *DC) {
-  auto funcDecl = dyn_cast<FuncDecl>(DC);
-  return !funcDecl || !funcDecl->isSetter();
-}
-
 Type TypeResolver::resolveType(TypeRepr *repr, TypeResolutionOptions options) {
   assert(repr && "Cannot validate null TypeReprs!");
 
@@ -1651,19 +1679,20 @@
   // error type.
   if (repr->isInvalid()) return ErrorType::get(TC.Context);
 
-  // Remember whether this is a function parameter.
-  bool isFunctionParam =
-    options.contains(TR_FunctionInput) ||
-    options.contains(TR_ImmediateFunctionInput);
-
   // Strip the "is function input" bits unless this is a type that knows about
   // them.
-  if (!isa<InOutTypeRepr>(repr) && !isa<TupleTypeRepr>(repr) &&
-      !isa<AttributedTypeRepr>(repr)) {
+  if (!isa<InOutTypeRepr>(repr) &&
+      !isa<TupleTypeRepr>(repr) &&
+      !isa<AttributedTypeRepr>(repr) &&
+      !isa<FunctionTypeRepr>(repr) &&
+      !isa<IdentTypeRepr>(repr)) {
     options -= TR_ImmediateFunctionInput;
     options -= TR_FunctionInput;
   }
 
+  if (Context.LangOpts.DisableAvailabilityChecking)
+    options |= TR_AllowUnavailable;
+
   switch (repr->getKind()) {
   case TypeReprKind::Error:
     return ErrorType::get(Context);
@@ -1683,11 +1712,10 @@
   case TypeReprKind::Function:
     if (!(options & TR_SILType)) {
       // Default non-escaping for closure parameters
-      auto info = AnyFunctionType::ExtInfo().withNoEscape(
-          isFunctionParam &&
-          isDefaultNoEscapeContext(DC));
-      return resolveASTFunctionType(cast<FunctionTypeRepr>(repr), options,
-                                    info);
+      auto result = resolveASTFunctionType(cast<FunctionTypeRepr>(repr), options);
+      if (result && result->is<FunctionType>())
+        return applyNonEscapingFromContext(DC, result, options);
+      return result;
     }
     return resolveSILFunctionType(cast<FunctionTypeRepr>(repr), options);
 
@@ -1758,8 +1786,6 @@
   bool isFunctionParam =
     options.contains(TR_FunctionInput) ||
     options.contains(TR_ImmediateFunctionInput);
-  options -= TR_ImmediateFunctionInput;
-  options -= TR_FunctionInput;
 
   // The type we're working with, in case we want to build it differently
   // based on the attributes we see.
@@ -1782,9 +1808,12 @@
 
         if (base) {
           Optional<MetatypeRepresentation> storedRepr;
-          // The instance type is not a SIL type. We still want to allow
-          // unavailable references, though.
-          auto instanceOptions = options - TR_SILType | TR_AllowUnavailable;
+          // The instance type is not a SIL type.
+          auto instanceOptions = options;
+          instanceOptions -= TR_SILType;
+          instanceOptions -= TR_ImmediateFunctionInput;
+          instanceOptions -= TR_FunctionInput;
+
           auto instanceTy = resolveType(base, instanceOptions);
           if (!instanceTy || instanceTy->is<ErrorType>())
             return instanceTy;
@@ -1913,10 +1942,6 @@
 
     ty = resolveSILFunctionType(fnRepr, options, extInfo, calleeConvention);
     if (!ty || ty->is<ErrorType>()) return ty;
-
-    for (auto i : FunctionAttrs)
-      attrs.clearAttribute(i);
-    attrs.convention = None;
   } else if (hasFunctionAttr && fnRepr) {
 
     FunctionType::Representation rep = FunctionType::Representation::Swift;
@@ -1960,29 +1985,50 @@
           .fixItReplace(resultRange, "Never");
     }
 
-    bool defaultNoEscape = false;
-    if (isFunctionParam && !attrs.has(TAK_escaping)) {
-      defaultNoEscape = isDefaultNoEscapeContext(DC);
-    }
-
-    if (isFunctionParam && attrs.has(TAK_noescape) &&
-        isDefaultNoEscapeContext(DC)) {
-      // FIXME: diagnostic to tell user this is redundant and drop it
-    }
-
     // Resolve the function type directly with these attributes.
     FunctionType::ExtInfo extInfo(rep,
                                   attrs.has(TAK_autoclosure),
-                                  defaultNoEscape | attrs.has(TAK_noescape),
+                                  attrs.has(TAK_noescape),
                                   fnRepr->throws());
 
     ty = resolveASTFunctionType(fnRepr, options, extInfo);
     if (!ty || ty->is<ErrorType>()) return ty;
+  }
 
-    for (auto i : FunctionAttrs)
-      attrs.clearAttribute(i);
-    attrs.convention = None;
-  } else if (hasFunctionAttr) {
+  auto instanceOptions = options;
+  instanceOptions -= TR_ImmediateFunctionInput;
+  instanceOptions -= TR_FunctionInput;
+
+  // If we didn't build the type differently above, we might have
+  // a typealias pointing at a function type with the @escaping
+  // attribute. Resolve the type as if it were in non-parameter
+  // context, and then set isNoEscape if @escaping is not present.
+  if (!ty) ty = resolveType(repr, instanceOptions);
+  if (!ty || ty->is<ErrorType>()) return ty;
+
+  // Handle @escaping
+  if (hasFunctionAttr && ty->is<FunctionType>()) {
+    if (attrs.has(TAK_escaping)) {
+      // The attribute is meaningless except on parameter types.
+      if (!isFunctionParam) {
+        auto &SM = TC.Context.SourceMgr;
+        auto loc = attrs.getLoc(TAK_escaping);
+        auto attrRange = SourceRange(
+          loc.getAdvancedLoc(-1),
+          Lexer::getLocForEndOfToken(SM, loc));
+
+        TC.diagnose(loc, diag::escaping_function_type)
+            .fixItRemove(attrRange);
+      }
+
+      attrs.clearAttribute(TAK_escaping);
+    } else {
+      // No attribute; set the isNoEscape bit if we're in parameter context.
+      ty = applyNonEscapingFromContext(DC, ty, options);
+    }
+  }
+
+  if (hasFunctionAttr && !fnRepr) {
     // @autoclosure usually auto-implies @noescape, don't complain about both
     // of them.
     if (attrs.has(TAK_autoclosure))
@@ -1995,11 +2041,12 @@
         attrs.clearAttribute(i);
       }
     }
-  } 
-
-  // If we didn't build the type differently above, build it normally now.
-  if (!ty) ty = resolveType(repr, options);
-  if (!ty || ty->is<ErrorType>()) return ty;
+  } else if (hasFunctionAttr && fnRepr) {
+    // Remove the function attributes from the set so that we don't diagnose.
+    for (auto i : FunctionAttrs)
+      attrs.clearAttribute(i);
+    attrs.convention = None;
+  }
 
   // In SIL, handle @opened (n), which creates an existential archetype.
   if (attrs.has(TAK_opened)) {
@@ -2054,6 +2101,9 @@
 Type TypeResolver::resolveASTFunctionType(FunctionTypeRepr *repr,
                                           TypeResolutionOptions options,
                                           FunctionType::ExtInfo extInfo) {
+  options -= TR_ImmediateFunctionInput;
+  options -= TR_FunctionInput;
+
   Type inputTy = resolveType(repr->getArgsTypeRepr(),
                              options | TR_ImmediateFunctionInput);
   if (!inputTy || inputTy->is<ErrorType>()) return inputTy;
@@ -2118,6 +2168,9 @@
                                           TypeResolutionOptions options,
                                           SILFunctionType::ExtInfo extInfo,
                                           ParameterConvention callee) {
+  options -= TR_ImmediateFunctionInput;
+  options -= TR_FunctionInput;
+
   bool hasError = false;
 
   SmallVector<SILParameterInfo, 4> params;
@@ -2446,9 +2499,17 @@
   
   // If this is the top level of a function input list, peel off the
   // ImmediateFunctionInput marker and install a FunctionInput one instead.
-  auto elementOptions = withoutContext(options);
-  if (options & TR_ImmediateFunctionInput)
-    elementOptions |= TR_FunctionInput;
+  //
+  // If we have a single ParenType though, don't clear these bits; we
+  // still want to parse the type contained therein as if it were in
+  // parameter position, meaning function types are not @escaping by
+  // default.
+  auto elementOptions = options;
+  if (!repr->isParenType()) {
+    elementOptions = withoutContext(elementOptions);
+    if (options & TR_ImmediateFunctionInput)
+      elementOptions |= TR_FunctionInput;
+  }
   
   for (auto tyR : repr->getElements()) {
     NamedTypeRepr *namedTyR = dyn_cast<NamedTypeRepr>(tyR);
@@ -2866,13 +2927,12 @@
 
   // Determine whether this type is bridged to Objective-C.
   ASTContext &ctx = type->getASTContext();
-  Optional<Type> bridged = ctx.getBridgedToObjC(dc, type,
-                                                ctx.getLazyResolver());
+  Type bridged = ctx.getBridgedToObjC(dc, type);
   if (!bridged)
     return false;
 
   // Check whether we're bridging to a class.
-  auto classDecl = (*bridged)->getClassOrBoundGenericClass();
+  auto classDecl = bridged->getClassOrBoundGenericClass();
   if (!classDecl)
     return false;
 
@@ -2901,6 +2961,13 @@
   if (checkObjCInExtensionContext(*this, AFD, Diagnose))
     return false;
 
+  if (AFD->isOperator()) {
+    assert(isa<ProtocolDecl>(AFD->getDeclContext()) &&
+           "all other cases should be caught earlier");
+    diagnose(AFD, diag::objc_operator_proto);
+    return false;
+  }
+
   if (auto *FD = dyn_cast<FuncDecl>(AFD)) {
     if (FD->isAccessor()) {
       // Accessors can only be @objc if the storage declaration is.
@@ -3025,8 +3092,19 @@
       // Functions that return nothing (void) can be throwing; they indicate
       // failure with a 'false' result.
       kind = ForeignErrorConvention::ZeroResult;
-      errorResultType = Context.getBoolDecl()
-                          ->getDeclaredInterfaceType()->getCanonicalType();
+      NominalTypeDecl *boolDecl = Context.getObjCBoolDecl();
+      // On Linux, we might still run @objc tests even though there's
+      // no ObjectiveC Foundation, so use Swift.Bool instead of crapping
+      // out.
+      if (boolDecl == nullptr)
+        boolDecl = Context.getBoolDecl();
+
+      if (boolDecl == nullptr) {
+        diagnose(AFD->getLoc(), diag::broken_bool);
+        return false;
+      }
+
+      errorResultType = boolDecl->getDeclaredType()->getCanonicalType();
     } else if (!resultType->getAnyOptionalObjectType() &&
                isBridgedToObjectiveCClass(dc, resultType)) {
       // Functions that return a (non-optional) type bridged to Objective-C
diff --git a/lib/Sema/TypeChecker.cpp b/lib/Sema/TypeChecker.cpp
index 56523b9..d3c5f2b 100644
--- a/lib/Sema/TypeChecker.cpp
+++ b/lib/Sema/TypeChecker.cpp
@@ -243,13 +243,13 @@
       getStdlibModule(dc)->lookupValue({}, Context.getIdentifier("Bool"),
                                        NLKind::QualifiedLookup, results);
       if (results.size() != 1) {
-        diagnose(SourceLoc(), diag::bool_type_broken);
+        diagnose(SourceLoc(), diag::broken_bool);
         return Type();
       }
 
       auto tyDecl = dyn_cast<TypeDecl>(results.front());
       if (!tyDecl) {
-        diagnose(SourceLoc(), diag::bool_type_broken);
+        diagnose(SourceLoc(), diag::broken_bool);
         return Type();
       }
 
diff --git a/lib/Sema/TypeChecker.h b/lib/Sema/TypeChecker.h
index db8064b..0694cb7 100644
--- a/lib/Sema/TypeChecker.h
+++ b/lib/Sema/TypeChecker.h
@@ -44,6 +44,7 @@
 
 namespace constraints {
   enum class ConstraintKind : char;
+  enum class SolutionKind : char;
   class ConstraintSystem;
   class Solution;
 }
@@ -1329,18 +1330,6 @@
                                        std::function<bool(Type)> convertToType,
                                        bool suppressDiagnostics);
 
-  /// Retrieves the Objective-C type to which the given value type is
-  /// bridged.
-  ///
-  /// \param dc The declaration context from which we will look for
-  /// bridging.
-  ///
-  /// \param type The value type being queried, e.g., String.
-  ///
-  /// \returns the class type to which the given type is bridged, or null if it
-  /// is not bridged.
-  Type getBridgedToObjC(const DeclContext *dc, Type type);
-
   /// Find the Objective-C class that bridges between a value of the given
   /// dynamic type and the given value type.
   ///
@@ -1404,7 +1393,7 @@
   /// contextual type.
   ///
   /// \returns true if an error occurred, false otherwise.
-  bool coerceParameterListToType(ParameterList *P, DeclContext *dc, Type type);
+  bool coerceParameterListToType(ParameterList *P, ClosureExpr *CE, AnyFunctionType *FN);
 
   
   /// Type-check an initialized variable pattern declaration.
@@ -1982,19 +1971,6 @@
   /// Attempt to omit needless words from the name of the given declaration.
   Optional<Identifier> omitNeedlessWords(VarDecl *var);
 
-  /// Check for needless words in the name of the given function/constructor.
-  void checkOmitNeedlessWords(AbstractFunctionDecl *afd);
-
-  /// Check for needless words in the name of the given variable.
-  void checkOmitNeedlessWords(VarDecl *var);
-
-  /// Check for needless words in the name of the function/constructor being
-  /// called.
-  void checkOmitNeedlessWords(ApplyExpr *apply);
-
-  /// Check for needless words in the member reference.
-  void checkOmitNeedlessWords(MemberRefExpr *memberRef);
-
   /// Check for a typo correction.
   void performTypoCorrection(DeclContext *DC,
                              DeclRefKind refKind,
diff --git a/lib/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp
index bf66ee8..f704e4c 100644
--- a/lib/Serialization/Deserialization.cpp
+++ b/lib/Serialization/Deserialization.cpp
@@ -2066,22 +2066,6 @@
         break;
       }
 
-      case decls_block::Swift3Migration_DECL_ATTR: {
-        bool isImplicit;
-        uint64_t renameLength;
-        uint64_t messageLength;
-        serialization::decls_block::Swift3MigrationDeclAttrLayout::readRecord(
-          scratch, isImplicit, renameLength, messageLength);
-        StringRef renameStr = blobData.substr(0, renameLength);
-        StringRef message = blobData.substr(renameLength,
-                                            renameLength + messageLength);
-        DeclName renamed = parseDeclName(getContext(), renameStr);
-        Attr = new (ctx) Swift3MigrationAttr(SourceLoc(), SourceLoc(),
-                                             SourceLoc(), renamed,
-                                             message, SourceLoc(), isImplicit);
-        break;
-      }
-
       case decls_block::Specialize_DECL_ATTR: {
         ArrayRef<uint64_t> rawTypeIDs;
         serialization::decls_block::SpecializeDeclAttrLayout::readRecord(
@@ -3832,19 +3816,9 @@
     auto nominal = cast<NominalTypeDecl>(getDecl(declID));
     auto parentTy = getType(parentID);
 
-    // Check the first ID to decide if we are using indices to the Decl's
-    // Archetypes. 
     SmallVector<Type, 8> genericArgs;
-    if (rawArgumentIDs.size() > 1 && rawArgumentIDs[0] == INT32_MAX) {
-      for (unsigned i = 1; i < rawArgumentIDs.size(); i++) {
-        auto index = rawArgumentIDs[i];
-        genericArgs.push_back(nominal->getGenericParams()
-                                     ->getAllArchetypes()[index]);
-      }
-    } else {
-      for (TypeID type : rawArgumentIDs)
-        genericArgs.push_back(getType(type));
-    }
+    for (TypeID type : rawArgumentIDs)
+      genericArgs.push_back(getType(type));
 
     auto boundTy = BoundGenericType::get(nominal, parentTy, genericArgs);
     typeOrOffset = boundTy;
diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp
index 1785d5c..f67b222 100644
--- a/lib/Serialization/Serialization.cpp
+++ b/lib/Serialization/Serialization.cpp
@@ -1758,30 +1758,6 @@
     return;
   }
 
-  case DAK_Swift3Migration: {
-    auto *theAttr = cast<Swift3MigrationAttr>(DA);
-
-    llvm::SmallString<32> blob;
-
-    unsigned renameLength = 0;
-    if (auto newName = theAttr->getRenamed()) {
-      llvm::raw_svector_ostream os(blob);
-      newName.print(os);
-      renameLength = os.str().size();
-    }
-
-    blob.append(theAttr->getMessage());
-
-    auto abbrCode = DeclTypeAbbrCodes[Swift3MigrationDeclAttrLayout::Code];
-    Swift3MigrationDeclAttrLayout::emitRecord(
-                                        Out, ScratchRecord, abbrCode,
-                                        theAttr->isImplicit(),
-                                        renameLength,
-                                        theAttr->getMessage().size(),
-                                        blob);
-    return;
-  }
-
   case DAK_Specialize: {
     auto abbrCode = DeclTypeAbbrCodes[SpecializeDeclAttrLayout::Code];
     SmallVector<TypeID, 8> typeIDs;
@@ -3097,9 +3073,9 @@
   }
 
   case TypeKind::Optional: {
-    auto sliceTy = cast<OptionalType>(ty.getPointer());
+    auto optionalTy = cast<OptionalType>(ty.getPointer());
 
-    Type base = sliceTy->getBaseType();
+    Type base = optionalTy->getBaseType();
 
     unsigned abbrCode = DeclTypeAbbrCodes[OptionalTypeLayout::Code];
     OptionalTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
@@ -3108,13 +3084,13 @@
   }
 
   case TypeKind::ImplicitlyUnwrappedOptional: {
-    auto sliceTy = cast<ImplicitlyUnwrappedOptionalType>(ty.getPointer());
+    auto optionalTy = cast<ImplicitlyUnwrappedOptionalType>(ty.getPointer());
 
-    Type base = sliceTy->getBaseType();
+    Type base = optionalTy->getBaseType();
 
     unsigned abbrCode = DeclTypeAbbrCodes[ImplicitlyUnwrappedOptionalTypeLayout::Code];
     ImplicitlyUnwrappedOptionalTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
-                                            addTypeRef(base));
+                                                      addTypeRef(base));
     break;
   }
 
@@ -3175,58 +3151,10 @@
   case TypeKind::BoundGenericEnum:
   case TypeKind::BoundGenericStruct: {
     auto generic = cast<BoundGenericType>(ty.getPointer());
-
-    // We don't want two copies of Archetype being serialized, one by
-    // serializing genericArgs, the other by serializing the Decl. The reason
-    // is that it is likely the Decl's Archetype can be serialized in
-    // a different module, causing two copies being constructed at
-    // deserialization, one in the other module, one in this module as
-    // genericArgs. The fix is to check if genericArgs exist in the Decl's
-    // Archetypes, if they all exist, we use indices to the Decl's
-    // Archetypes..
-    bool allGenericArgsInDecl = true;
-#ifndef NDEBUG
-    bool someGenericArgsInDecl = false;
-#endif
     SmallVector<TypeID, 8> genericArgIDs;
-    // Push in a special number to say that IDs are indices to the Archetypes.
-    if (!generic->getGenericArgs().empty())
-      genericArgIDs.push_back(INT32_MAX);
-    for (auto next : generic->getGenericArgs()) {
-      bool found = false;
-      if (auto arche = dyn_cast<ArchetypeType>(next.getPointer())) {
-        auto genericParams = generic->getDecl()->getGenericParams();
-        unsigned idx = 0;
-        // Check if next exists in the Decl.
-        for (auto archetype : genericParams->getAllArchetypes()) {
-          if (archetype == arche) {
-            found = true;
-            genericArgIDs.push_back(idx);
-#ifndef NDEBUG
-            someGenericArgsInDecl = true;
-#endif
-            break;
-          }
-          idx++;
-        }
-      }
 
-      if (!found) {
-        allGenericArgsInDecl = false;
-        break;
-      }
-    }
-
-    if (!allGenericArgsInDecl) {
-#ifndef NDEBUG
-      if (someGenericArgsInDecl && isDeclXRef(generic->getDecl()))
-        // Emit warning message. 
-        llvm::errs() << "Serialization: we may have two copied of Archetype\n";
-#endif
-      genericArgIDs.clear();
-      for (auto next : generic->getGenericArgs())
-        genericArgIDs.push_back(addTypeRef(next));
-    }
+    for (auto next : generic->getGenericArgs())
+      genericArgIDs.push_back(addTypeRef(next));
 
     unsigned abbrCode = DeclTypeAbbrCodes[BoundGenericTypeLayout::Code];
     BoundGenericTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
diff --git a/lib/Serialization/SerializeSIL.cpp b/lib/Serialization/SerializeSIL.cpp
index c92cf13..90ec7f4 100644
--- a/lib/Serialization/SerializeSIL.cpp
+++ b/lib/Serialization/SerializeSIL.cpp
@@ -521,7 +521,7 @@
 /// Write an instruction that looks exactly like a conversion: all
 /// important information is encoded in the operand and the result type.
 void SILSerializer::writeConversionLikeInstruction(const SILInstruction *I) {
-  assert(I->getNumOperands() - I->getOpenedArchetypeOperands().size() == 1);
+  assert(I->getNumOperands() - I->getTypeDependentOperands().size() == 1);
   writeOneTypeOneOperandLayout(I->getKind(), 0, I->getType(),
                                I->getOperand(0));
 }
@@ -1170,7 +1170,7 @@
     break;
   }
   case ValueKind::PointerToAddressInst: {
-    assert(SI.getNumOperands() - SI.getOpenedArchetypeOperands().size() == 1);
+    assert(SI.getNumOperands() - SI.getTypeDependentOperands().size() == 1);
     unsigned attrs = cast<PointerToAddressInst>(SI).isStrict() ? 1 : 0;
     writeOneTypeOneOperandLayout(SI.getKind(), attrs, SI.getType(),
                                  SI.getOperand(0));
diff --git a/stdlib/private/StdlibCollectionUnittest/CheckCollectionType.swift.gyb b/stdlib/private/StdlibCollectionUnittest/CheckCollectionType.swift.gyb
index d0c1b8b..ab70847 100644
--- a/stdlib/private/StdlibCollectionUnittest/CheckCollectionType.swift.gyb
+++ b/stdlib/private/StdlibCollectionUnittest/CheckCollectionType.swift.gyb
@@ -486,6 +486,9 @@
     return '''    
     C : %(protocol)s,
     CollectionWithEquatableElement : %(protocol)s,
+    CollectionWithEquatableElement.SubSequence : Collection,
+    CollectionWithEquatableElement.SubSequence.Iterator.Element
+      == CollectionWithEquatableElement.Iterator.Element,
     C.SubSequence : %(protocol)s,
     C.SubSequence.Iterator.Element == C.Iterator.Element,
     C.SubSequence.Index == C.Index,
@@ -511,8 +514,8 @@
     wrapValueIntoEquatable: @escaping (
       MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
 
-    extractValueFromEquatable:
-      ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping (
+      CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue,
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1,
diff --git a/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb b/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb
index 5944408..86fae85 100644
--- a/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb
+++ b/stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift.gyb
@@ -92,11 +92,11 @@
 
     makeCollectionOfEquatable: @escaping ([CollectionWithEquatableElement.Iterator.Element]) -> CollectionWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     makeCollectionOfComparable: @escaping ([CollectionWithComparableElement.Iterator.Element]) -> CollectionWithComparableElement,
     wrapValueIntoComparable: @escaping (MinimalComparableValue) -> CollectionWithComparableElement.Iterator.Element,
-    extractValueFromComparable: ((CollectionWithComparableElement.Iterator.Element) -> MinimalComparableValue),
+    extractValueFromComparable: @escaping ((CollectionWithComparableElement.Iterator.Element) -> MinimalComparableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1,
@@ -115,6 +115,9 @@
     C.Indices.Index == C.Index,
     C.Indices.SubSequence == C.Indices,
     CollectionWithEquatableElement.Iterator.Element : Equatable,
+    CollectionWithEquatableElement.SubSequence : Collection,
+    CollectionWithEquatableElement.SubSequence.Iterator.Element
+      == CollectionWithEquatableElement.Iterator.Element,
     CollectionWithComparableElement.Iterator.Element : Comparable {
 
     var testNamePrefix = testNamePrefix
@@ -502,8 +505,8 @@
 
 func checkSort_${'Predicate' if predicate else 'WhereElementIsComparable'}(
   sequence: [Int],
-  equalImpl: ((Int, Int) -> Bool),
-  lessImpl: ((Int, Int) -> Bool),
+  equalImpl: @escaping ((Int, Int) -> Bool),
+  lessImpl: @escaping ((Int, Int) -> Bool),
   verifyOrder: Bool
 ) {
 %   if predicate:
@@ -683,11 +686,11 @@
 
     makeCollectionOfEquatable: @escaping ([CollectionWithEquatableElement.Iterator.Element]) -> CollectionWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     makeCollectionOfComparable: @escaping ([CollectionWithComparableElement.Iterator.Element]) -> CollectionWithComparableElement,
     wrapValueIntoComparable: @escaping (MinimalComparableValue) -> CollectionWithComparableElement.Iterator.Element,
-    extractValueFromComparable: ((CollectionWithComparableElement.Iterator.Element) -> MinimalComparableValue),
+    extractValueFromComparable: @escaping ((CollectionWithComparableElement.Iterator.Element) -> MinimalComparableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1,
@@ -705,6 +708,9 @@
     C.Indices.Index == C.Index,
     C.Indices.SubSequence == C.Indices,
     CollectionWithEquatableElement.Iterator.Element : Equatable,
+    CollectionWithEquatableElement.SubSequence : Collection,
+    CollectionWithEquatableElement.SubSequence.Iterator.Element
+      == CollectionWithEquatableElement.Iterator.Element,
     CollectionWithComparableElement.Iterator.Element : Comparable {
     
     var testNamePrefix = testNamePrefix
@@ -836,11 +842,11 @@
 
     makeCollectionOfEquatable: @escaping ([CollectionWithEquatableElement.Iterator.Element]) -> CollectionWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     makeCollectionOfComparable: @escaping ([CollectionWithComparableElement.Iterator.Element]) -> CollectionWithComparableElement,
     wrapValueIntoComparable: @escaping (MinimalComparableValue) -> CollectionWithComparableElement.Iterator.Element,
-    extractValueFromComparable: ((CollectionWithComparableElement.Iterator.Element) -> MinimalComparableValue),
+    extractValueFromComparable: @escaping ((CollectionWithComparableElement.Iterator.Element) -> MinimalComparableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1,
@@ -858,6 +864,9 @@
     C.Indices.Index == C.Index,
     C.Indices.SubSequence == C.Indices,
     CollectionWithEquatableElement.Iterator.Element : Equatable,
+    CollectionWithEquatableElement.SubSequence : Collection,
+    CollectionWithEquatableElement.SubSequence.Iterator.Element
+      == CollectionWithEquatableElement.Iterator.Element,
     CollectionWithComparableElement.Iterator.Element : Comparable,
     CollectionWithComparableElement.SubSequence.Indices.Iterator.Element == CollectionWithComparableElement.Index {
     
@@ -919,8 +928,8 @@
 
 func checkSortInPlace_${'Predicate' if predicate else 'WhereElementIsComparable'}(
   sequence: [Int],
-  equalImpl: ((Int, Int) -> Bool),
-  lessImpl: ((Int, Int) -> Bool),
+  equalImpl: @escaping ((Int, Int) -> Bool),
+  lessImpl: @escaping ((Int, Int) -> Bool),
   verifyOrder: Bool
 ) {
 %   if predicate:
diff --git a/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableCollectionType.swift b/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableCollectionType.swift
index e6ba928..1d9dfb6 100644
--- a/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableCollectionType.swift
+++ b/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableCollectionType.swift
@@ -456,7 +456,7 @@
 
     makeCollectionOfEquatable: @escaping ([CollectionWithEquatableElement.Iterator.Element]) -> CollectionWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1,
@@ -471,7 +471,10 @@
     C.Indices.Iterator.Element == C.Index,
     C.Indices.Index == C.Index,
     C.Indices.SubSequence == C.Indices,
-    CollectionWithEquatableElement.Iterator.Element : Equatable {
+    CollectionWithEquatableElement.Iterator.Element : Equatable,
+    CollectionWithEquatableElement.SubSequence : Collection,
+    CollectionWithEquatableElement.SubSequence.Iterator.Element
+      == CollectionWithEquatableElement.Iterator.Element {
 
     var testNamePrefix = testNamePrefix
 
@@ -1168,7 +1171,7 @@
 
     makeCollectionOfEquatable: @escaping ([CollectionWithEquatableElement.Iterator.Element]) -> CollectionWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1
@@ -1182,7 +1185,10 @@
     C.Indices.Iterator.Element == C.Index,
     C.Indices.Index == C.Index,
     C.Indices.SubSequence == C.Indices,
-    CollectionWithEquatableElement.Iterator.Element : Equatable {
+    CollectionWithEquatableElement.Iterator.Element : Equatable,
+    CollectionWithEquatableElement.SubSequence : Collection,
+    CollectionWithEquatableElement.SubSequence.Iterator.Element
+      == CollectionWithEquatableElement.Iterator.Element {
 
     var testNamePrefix = testNamePrefix
 
@@ -1297,7 +1303,7 @@
 
     makeCollectionOfEquatable: @escaping ([CollectionWithEquatableElement.Iterator.Element]) -> CollectionWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1
@@ -1311,7 +1317,10 @@
     C.Indices.Iterator.Element == C.Index,
     C.Indices.Index == C.Index,
     C.Indices.SubSequence == C.Indices,
-    CollectionWithEquatableElement.Iterator.Element : Equatable {
+    CollectionWithEquatableElement.Iterator.Element : Equatable,
+    CollectionWithEquatableElement.SubSequence : Collection,
+    CollectionWithEquatableElement.SubSequence.Iterator.Element
+      == CollectionWithEquatableElement.Iterator.Element {
 
     var testNamePrefix = testNamePrefix
 
diff --git a/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableSliceType.swift b/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableSliceType.swift
index 565a0cb..7549761 100644
--- a/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableSliceType.swift
+++ b/stdlib/private/StdlibCollectionUnittest/CheckRangeReplaceableSliceType.swift
@@ -26,7 +26,7 @@
 
     makeCollectionOfEquatable: @escaping ([CollectionWithEquatableElement.Iterator.Element]) -> CollectionWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1,
@@ -162,7 +162,7 @@
 
     makeCollectionOfEquatable: @escaping ([CollectionWithEquatableElement.Iterator.Element]) -> CollectionWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1
@@ -310,7 +310,7 @@
 
     makeCollectionOfEquatable: @escaping ([CollectionWithEquatableElement.Iterator.Element]) -> CollectionWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> CollectionWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((CollectionWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all,
     outOfBoundsIndexOffset: Int = 1
diff --git a/stdlib/private/StdlibCollectionUnittest/CheckSequenceType.swift b/stdlib/private/StdlibCollectionUnittest/CheckSequenceType.swift
index ff0cc3e..a0a9b90 100644
--- a/stdlib/private/StdlibCollectionUnittest/CheckSequenceType.swift
+++ b/stdlib/private/StdlibCollectionUnittest/CheckSequenceType.swift
@@ -97,7 +97,7 @@
 public struct FilterTest {
   public let expected: [Int]
   public let sequence: [Int]
-  public let includeElement: @escaping (Int) -> Bool
+  public let includeElement: (Int) -> Bool
   public let loc: SourceLoc
 
   public init(
@@ -136,10 +136,54 @@
   }
 }
 
+public struct CollectionBinaryOperationTest {
+  public let expected: [MinimalEquatableValue]
+  public let lhs: [MinimalEquatableValue]
+  public let rhs: [MinimalEquatableValue]
+  public let loc: SourceLoc
+
+  public init(
+    expected: [Int], lhs: [Int], rhs: [Int],
+    file: String = #file, line: UInt = #line
+  ) {
+    self.expected = expected.enumerated().map {
+      return MinimalEquatableValue($1, identity: $0) 
+    }
+    self.lhs = lhs.map {
+      return MinimalEquatableValue($0, identity: $0) 
+    }
+    self.rhs = rhs.map {
+      return MinimalEquatableValue($0, identity: $0) 
+    }
+    self.loc = SourceLoc(file, line, comment: "test data")
+  }
+}
+
+public struct CollectionPredicateTest {
+  public let expected: Bool
+  public let lhs: [MinimalEquatableValue]
+  public let rhs: [MinimalEquatableValue]
+  public let loc: SourceLoc
+
+  public init(
+    expected: Bool, lhs: [Int], rhs: [Int],
+    file: String = #file, line: UInt = #line
+  ) {
+    self.expected = expected
+    self.lhs = lhs.enumerated().map {
+      return MinimalEquatableValue($1, identity: $0) 
+    }
+    self.rhs = rhs.enumerated().map {
+      return MinimalEquatableValue($1, identity: $0) 
+    }
+    self.loc = SourceLoc(file, line, comment: "test data")
+  }
+}
+
 public struct FlatMapTest {
   public let expected: [Int32]
   public let sequence: [Int]
-  public let transform: @escaping (Int) -> [Int32]
+  public let transform: (Int) -> [Int32]
   public let loc: SourceLoc
 
   public init(
@@ -158,7 +202,7 @@
 public struct FlatMapToOptionalTest {
   public let expected: [Int32]
   public let sequence: [Int]
-  public let transform: @escaping (Int) -> Int32?
+  public let transform: (Int) -> Int32?
   public let loc: SourceLoc
 
   public init(
@@ -224,7 +268,7 @@
 public struct MapTest {
   public let expected: [Int32]
   public let sequence: [Int]
-  public let transform: @escaping (Int) -> Int32
+  public let transform: (Int) -> Int32
   public let loc: SourceLoc
 
   public init(
@@ -489,6 +533,32 @@
     expectedLeftoverSequence: [ 3030, 2020, 4040 ]),
 ]
 
+public let unionTests = [
+  CollectionBinaryOperationTest(expected: [1, 2, 3, 4, 5], lhs: [1, 3, 5], rhs: [2, 4]),
+  CollectionBinaryOperationTest(expected: [3, 5], lhs: [3], rhs: [5])
+]
+
+public let intersectionTests = [
+  CollectionBinaryOperationTest(expected: [1, 5], lhs: [1, 3, 5], rhs: [1, 2, 5])
+]
+
+public let symmetricDifferenceTests = [
+  CollectionBinaryOperationTest(expected: [1, 3, 5], lhs: [1, 2, 3, 4], rhs: [2, 4, 5])
+]
+
+public let subtractTests = [
+  CollectionBinaryOperationTest(expected: [1, 3], lhs: [1, 2, 3, 4], rhs: [2, 4, 5])
+]
+
+public let subtractingTests = [
+  CollectionBinaryOperationTest(expected: [1, 3, 4], lhs: [1, 2, 3, 4, 5], rhs: [2, 5, 6, 7])
+]
+
+public let strictSupersetTests = [
+  CollectionPredicateTest(expected: true, lhs: [1, 2, 3, 4, 5, 6], rhs: [1, 2, 3, 4]),
+  CollectionPredicateTest(expected: false, lhs: [1, 2], rhs: [1, 2, 4])
+]
+
 /// For a number of form `NNN_MMM`, returns an array of `NNN` numbers that all
 /// have `MMM` as their last three digits.
 func flatMapTransformation(_ x: Int) -> [Int32] {
@@ -1458,11 +1528,14 @@
 
     makeSequenceOfEquatable: @escaping ([SequenceWithEquatableElement.Iterator.Element]) -> SequenceWithEquatableElement,
     wrapValueIntoEquatable: @escaping (MinimalEquatableValue) -> SequenceWithEquatableElement.Iterator.Element,
-    extractValueFromEquatable: ((SequenceWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
+    extractValueFromEquatable: @escaping ((SequenceWithEquatableElement.Iterator.Element) -> MinimalEquatableValue),
 
     resiliencyChecks: CollectionMisuseResiliencyChecks = .all
   ) where
     SequenceWithEquatableElement.Iterator.Element : Equatable,
+    SequenceWithEquatableElement.SubSequence : Sequence,
+    SequenceWithEquatableElement.SubSequence.Iterator.Element
+      == SequenceWithEquatableElement.Iterator.Element,
     S.SubSequence : Sequence,
     S.SubSequence.Iterator.Element == S.Iterator.Element,
     S.SubSequence.SubSequence == S.SubSequence {
@@ -1616,6 +1689,25 @@
 }
 
 //===----------------------------------------------------------------------===//
+// drop(while:)
+//===----------------------------------------------------------------------===//
+
+self.test("\(testNamePrefix).drop(while:)/semantics").forEach(in: findTests) {
+  test in
+  let s = makeWrappedSequenceWithEquatableElement(test.sequence)
+  let closureLifetimeTracker = LifetimeTracked(0)
+  let remainingSequence = s.drop {
+    _blackHole(closureLifetimeTracker)
+    return $0 != wrapValueIntoEquatable(test.element)
+  }
+  let remaining = Array(remainingSequence)
+  let expectedSuffix = test.sequence.suffix(
+    from: test.expected ?? test.sequence.endIndex)
+  expectEqual(expectedSuffix.count, remaining.count)
+  expectEqualSequence(expectedSuffix.map(wrapValueIntoEquatable), remaining)
+}
+
+//===----------------------------------------------------------------------===//
 // prefix()
 //===----------------------------------------------------------------------===//
 
@@ -1655,6 +1747,25 @@
 }
 
 //===----------------------------------------------------------------------===//
+// prefix(while:)
+//===----------------------------------------------------------------------===//
+
+self.test("\(testNamePrefix).prefix(while:)/semantics").forEach(in: findTests) {
+  test in
+  let s = makeWrappedSequenceWithEquatableElement(test.sequence)
+  let closureLifetimeTracker = LifetimeTracked(0)
+  let remainingSequence = s.prefix {
+    _blackHole(closureLifetimeTracker)
+    return $0 != wrapValueIntoEquatable(test.element)
+  }
+  let expectedPrefix = test.sequence.prefix(
+    upTo: test.expected ?? test.sequence.endIndex)
+  let remaining = Array(remainingSequence)
+  expectEqual(expectedPrefix.count, remaining.count)
+  expectEqualSequence(expectedPrefix.map(wrapValueIntoEquatable), remaining)
+}
+
+//===----------------------------------------------------------------------===//
 // suffix()
 //===----------------------------------------------------------------------===//
 
diff --git a/stdlib/private/StdlibCollectionUnittest/LoggingWrappers.swift.gyb b/stdlib/private/StdlibCollectionUnittest/LoggingWrappers.swift.gyb
index 5e15402..3b53729 100644
--- a/stdlib/private/StdlibCollectionUnittest/LoggingWrappers.swift.gyb
+++ b/stdlib/private/StdlibCollectionUnittest/LoggingWrappers.swift.gyb
@@ -85,6 +85,8 @@
   public static var first = TypeIndexed(0)
   public static var dropFirst = TypeIndexed(0)
   public static var dropLast = TypeIndexed(0)
+  public static var dropWhile = TypeIndexed(0)
+  public static var prefixWhile = TypeIndexed(0)
   public static var prefixMaxLength = TypeIndexed(0)
   public static var suffixMaxLength = TypeIndexed(0)
   public static var split = TypeIndexed(0)
@@ -262,11 +264,25 @@
     Log.dropLast[selfType] += 1
     return base.dropLast(n)
   }
+  
+  public func drop(
+    while predicate: (Base.Iterator.Element) throws -> Bool
+  ) rethrows -> SubSequence {
+    Log.dropWhile[selfType] += 1
+    return try base.drop(while: predicate)
+  }
 
   public func prefix(_ maxLength: Int) -> SubSequence {
     Log.prefixMaxLength[selfType] += 1
     return base.prefix(maxLength)
   }
+  
+  public func prefix(
+    while predicate: (Base.Iterator.Element) throws -> Bool
+  ) rethrows -> SubSequence {
+    Log.prefixWhile[selfType] += 1
+    return try base.prefix(while: predicate)
+  }
 
   public func suffix(_ maxLength: Int) -> SubSequence {
     Log.suffixMaxLength[selfType] += 1
diff --git a/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift b/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift
index 40541fc..24531f5 100644
--- a/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift
+++ b/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift
@@ -116,7 +116,7 @@
 
     // If execve() encountered an error, we write the errno encountered to the
     // parent write pipe.
-    let errnoSize = MemoryLayout._ofInstance(errno).size
+    let errnoSize = MemoryLayout.size(ofValue: errno)
     var execveErrno = errno
     let writtenBytes = withUnsafePointer(to: &execveErrno) {
       write(childToParentPipe.writeFD, UnsafePointer($0), errnoSize)
diff --git a/stdlib/public/Platform/glibc.modulemap.gyb b/stdlib/public/Platform/glibc.modulemap.gyb
index 7d26a80..a0f7987 100644
--- a/stdlib/public/Platform/glibc.modulemap.gyb
+++ b/stdlib/public/Platform/glibc.modulemap.gyb
@@ -351,6 +351,10 @@
         header "${GLIBC_ARCH_INCLUDE_PATH}/sys/select.h"
         export *
       }
+      module sendfile {
+        header "${GLIBC_ARCH_INCLUDE_PATH}/sys/sendfile.h"
+        export *
+      }
       module socket {
         header "${GLIBC_ARCH_INCLUDE_PATH}/sys/socket.h"
         export *
diff --git a/stdlib/public/Reflection/TypeLowering.cpp b/stdlib/public/Reflection/TypeLowering.cpp
index cd78d25..b435ec6 100644
--- a/stdlib/public/Reflection/TypeLowering.cpp
+++ b/stdlib/public/Reflection/TypeLowering.cpp
@@ -908,19 +908,23 @@
       Kind = RecordKind::SinglePayloadEnum;
       addCase(PayloadCases[0].Name, CaseTR, CaseTI);
 
-      // Below logic should match the runtime function
-      // swift_initEnumValueWitnessTableSinglePayload().
-      NumExtraInhabitants = CaseTI->getNumExtraInhabitants();
-      if (NumExtraInhabitants >= NoPayloadCases) {
-        // Extra inhabitants can encode all no-payload cases.
-        NumExtraInhabitants -= NoPayloadCases;
-      } else {
-        // Not enough extra inhabitants for all cases. We have to add an
-        // extra tag field.
-        NumExtraInhabitants = 0;
-        Size += getNumTagBytes(Size,
-                               NoPayloadCases - NumExtraInhabitants,
-                               /*payloadCases=*/1);
+      // If we were unable to lower the payload type, do not proceed
+      // further.
+      if (CaseTI != nullptr) {
+        // Below logic should match the runtime function
+        // swift_initEnumValueWitnessTableSinglePayload().
+        NumExtraInhabitants = CaseTI->getNumExtraInhabitants();
+        if (NumExtraInhabitants >= NoPayloadCases) {
+          // Extra inhabitants can encode all no-payload cases.
+          NumExtraInhabitants -= NoPayloadCases;
+        } else {
+          // Not enough extra inhabitants for all cases. We have to add an
+          // extra tag field.
+          NumExtraInhabitants = 0;
+          Size += getNumTagBytes(Size,
+                                 NoPayloadCases - NumExtraInhabitants,
+                                 /*payloadCases=*/1);
+        }
       }
 
     // MultiPayloadEnumImplStrategy
@@ -1213,27 +1217,29 @@
   }
 
   const TypeInfo *visitOpaqueTypeRef(const OpaqueTypeRef *O) {
-    unreachable("Can't lower opaque TypeRef");
+    DEBUG(std::cerr << "Can't lower opaque TypeRef");
     return nullptr;
   }
 };
 
 const TypeInfo *TypeConverter::getTypeInfo(const TypeRef *TR) {
+  // See if we already computed the result
   auto found = Cache.find(TR);
-  if (found != Cache.end()) {
-    auto *TI = found->second;
-    assert(TI != nullptr && "TypeRef recursion detected");
-    return TI;
+  if (found != Cache.end())
+    return found->second;
+
+  // Detect invalid recursive value types (IRGen should not emit
+  // them in the first place, but there might be bugs)
+  if (!RecursionCheck.insert(TR).second) {
+    DEBUG(std::cerr << "TypeRef recursion detected");
+    return nullptr;
   }
 
-  // Detect recursion
-  Cache[TR] = nullptr;
-
+  // Compute the result and cache it
   auto *TI = LowerType(*this).visit(TR);
+  Cache[TR] = TI;
 
-  // Cache the result
-  if (TI != nullptr)
-    Cache[TR] = TI;
+  RecursionCheck.erase(TR);
 
   return TI;
 }
diff --git a/stdlib/public/SDK/AppKit/NSError.swift b/stdlib/public/SDK/AppKit/NSError.swift
index 4f91936..d89a267 100644
--- a/stdlib/public/SDK/AppKit/NSError.swift
+++ b/stdlib/public/SDK/AppKit/NSError.swift
@@ -1,58 +1,138 @@
 extension CocoaError.Code {
+  public static var textReadInapplicableDocumentType: CocoaError.Code {
+    return CocoaError.Code(rawValue: 65806)
+  }
+  public static var textWriteInapplicableDocumentType: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66062)
+  }
+  public static var serviceApplicationNotFound: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66560)
+  }
+  public static var serviceApplicationLaunchFailed: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66561)
+  }
+  public static var serviceRequestTimedOut: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66562)
+  }
+  public static var serviceInvalidPasteboardData: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66563)
+  }
+  public static var serviceMalformedServiceDictionary: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66564)
+  }
+  public static var serviceMiscellaneous: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66800)
+  }
+  public static var sharingServiceNotConfigured: CocoaError.Code {
+    return CocoaError.Code(rawValue: 67072)
+  }
+}
+
+// Names deprecated late in Swift 3
+extension CocoaError.Code {
+  @available(*, deprecated, renamed: "textReadInapplicableDocumentType")
   public static var textReadInapplicableDocumentTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 65806)
   }
+  @available(*, deprecated, renamed: "textWriteInapplicableDocumentType")
   public static var textWriteInapplicableDocumentTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66062)
   }
+  @available(*, deprecated, renamed: "serviceApplicationNotFound")
   public static var serviceApplicationNotFoundError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66560)
   }
+  @available(*, deprecated, renamed: "serviceApplicationLaunchFailed")
   public static var serviceApplicationLaunchFailedError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66561)
   }
+  @available(*, deprecated, renamed: "serviceRequestTimedOut")
   public static var serviceRequestTimedOutError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66562)
   }
+  @available(*, deprecated, renamed: "serviceInvalidPasteboardData")
   public static var serviceInvalidPasteboardDataError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66563)
   }
+  @available(*, deprecated, renamed: "serviceMalformedServiceDictionary")
   public static var serviceMalformedServiceDictionaryError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66564)
   }
+  @available(*, deprecated, renamed: "serviceMiscellaneous")
   public static var serviceMiscellaneousError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66800)
   }
+  @available(*, deprecated, renamed: "sharingServiceNotConfigured")
   public static var sharingServiceNotConfiguredError: CocoaError.Code {
     return CocoaError.Code(rawValue: 67072)
   }
 }
 
 extension CocoaError {
+  public static var textReadInapplicableDocumentType: CocoaError.Code {
+    return CocoaError.Code(rawValue: 65806)
+  }
+  public static var textWriteInapplicableDocumentType: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66062)
+  }
+  public static var serviceApplicationNotFound: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66560)
+  }
+  public static var serviceApplicationLaunchFailed: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66561)
+  }
+  public static var serviceRequestTimedOut: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66562)
+  }
+  public static var serviceInvalidPasteboardData: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66563)
+  }
+  public static var serviceMalformedServiceDictionary: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66564)
+  }
+  public static var serviceMiscellaneous: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66800)
+  }
+  public static var sharingServiceNotConfigured: CocoaError.Code {
+    return CocoaError.Code(rawValue: 67072)
+  }
+}
+
+// Names deprecated late in Swift 3
+extension CocoaError {
+  @available(*, deprecated, renamed: "textReadInapplicableDocumentType")
   public static var textReadInapplicableDocumentTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 65806)
   }
+  @available(*, deprecated, renamed: "textWriteInapplicableDocumentType")
   public static var textWriteInapplicableDocumentTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66062)
   }
+  @available(*, deprecated, renamed: "serviceApplicationNotFound")
   public static var serviceApplicationNotFoundError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66560)
   }
+  @available(*, deprecated, renamed: "serviceApplicationLaunchFailed")
   public static var serviceApplicationLaunchFailedError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66561)
   }
+  @available(*, deprecated, renamed: "serviceRequestTimedOut")
   public static var serviceRequestTimedOutError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66562)
   }
+  @available(*, deprecated, renamed: "serviceInvalidPasteboardData")
   public static var serviceInvalidPasteboardDataError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66563)
   }
+  @available(*, deprecated, renamed: "serviceMalformedServiceDictionary")
   public static var serviceMalformedServiceDictionaryError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66564)
   }
+  @available(*, deprecated, renamed: "serviceMiscellaneous")
   public static var serviceMiscellaneousError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66800)
   }
+  @available(*, deprecated, renamed: "sharingServiceNotConfigured")
   public static var sharingServiceNotConfiguredError: CocoaError.Code {
     return CocoaError.Code(rawValue: 67072)
   }
@@ -72,40 +152,79 @@
   }
 }
 
-extension CocoaError.Code {
-  @swift3_migration(renamed: "textReadInapplicableDocumentTypeError")
+extension CocoaError {
+  @available(*, deprecated, renamed: "textReadInapplicableDocumentType")
   public static var TextReadInapplicableDocumentTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 65806)
   }
-  @swift3_migration(renamed: "textWriteInapplicableDocumentTypeError")
+  @available(*, deprecated, renamed: "textWriteInapplicableDocumentType")
   public static var TextWriteInapplicableDocumentTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66062)
   }
-  @swift3_migration(renamed: "serviceApplicationNotFoundError")
+  @available(*, deprecated, renamed: "serviceApplicationNotFound")
   public static var ServiceApplicationNotFoundError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66560)
   }
-  @swift3_migration(renamed: "serviceApplicationLaunchFailedError")
+  @available(*, deprecated, renamed: "serviceApplicationLaunchFailed")
   public static var ServiceApplicationLaunchFailedError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66561)
   }
-  @swift3_migration(renamed: "serviceRequestTimedOutError")
+  @available(*, deprecated, renamed: "serviceRequestTimedOut")
   public static var ServiceRequestTimedOutError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66562)
   }
-  @swift3_migration(renamed: "serviceInvalidPasteboardDataError")
+  @available(*, deprecated, renamed: "serviceInvalidPasteboardData")
   public static var ServiceInvalidPasteboardDataError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66563)
   }
-  @swift3_migration(renamed: "serviceMalformedServiceDictionaryError")
+  @available(*, deprecated, renamed: "serviceMalformedServiceDictionary")
   public static var ServiceMalformedServiceDictionaryError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66564)
   }
-  @swift3_migration(renamed: "serviceMiscellaneousError")
+  @available(*, deprecated, renamed: "serviceMiscellaneous")
   public static var ServiceMiscellaneousError: CocoaError.Code {
     return CocoaError.Code(rawValue: 66800)
   }
-  @swift3_migration(renamed: "sharingServiceNotConfiguredError")
+  @available(*, deprecated, renamed: "sharingServiceNotConfigured")
+  public static var SharingServiceNotConfiguredError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 67072)
+  }
+}
+
+extension CocoaError.Code {
+  @available(*, deprecated, renamed: "textReadInapplicableDocumentType")
+  public static var TextReadInapplicableDocumentTypeError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 65806)
+  }
+  @available(*, deprecated, renamed: "textWriteInapplicableDocumentType")
+  public static var TextWriteInapplicableDocumentTypeError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66062)
+  }
+  @available(*, deprecated, renamed: "serviceApplicationNotFound")
+  public static var ServiceApplicationNotFoundError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66560)
+  }
+  @available(*, deprecated, renamed: "serviceApplicationLaunchFailed")
+  public static var ServiceApplicationLaunchFailedError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66561)
+  }
+  @available(*, deprecated, renamed: "serviceRequestTimedOut")
+  public static var ServiceRequestTimedOutError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66562)
+  }
+  @available(*, deprecated, renamed: "serviceInvalidPasteboardData")
+  public static var ServiceInvalidPasteboardDataError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66563)
+  }
+  @available(*, deprecated, renamed: "serviceMalformedServiceDictionary")
+  public static var ServiceMalformedServiceDictionaryError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66564)
+  }
+  @available(*, deprecated, renamed: "serviceMiscellaneous")
+  public static var ServiceMiscellaneousError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 66800)
+  }
+  @available(*, deprecated, renamed: "sharingServiceNotConfigured")
   public static var SharingServiceNotConfiguredError: CocoaError.Code {
     return CocoaError.Code(rawValue: 67072)
   }
diff --git a/stdlib/public/SDK/CallKit/CXProviderConfiguration.swift b/stdlib/public/SDK/CallKit/CXProviderConfiguration.swift
index d11678b..cdb7dd2 100644
--- a/stdlib/public/SDK/CallKit/CXProviderConfiguration.swift
+++ b/stdlib/public/SDK/CallKit/CXProviderConfiguration.swift
@@ -16,10 +16,10 @@
 @available(iOS 10.0, *)
 extension CXProviderConfiguration {
   @nonobjc
-  public final var supportedHandleTypes: Set<CXHandleType> {
+  public final var supportedHandleTypes: Set<CXHandle.HandleType> {
     get {
       return Set(__supportedHandleTypes.map {
-        CXHandleType(rawValue: $0.intValue)!
+        CXHandle.HandleType(rawValue: $0.intValue)!
       })
     }
     set {
diff --git a/stdlib/public/SDK/CoreData/CoreData.swift b/stdlib/public/SDK/CoreData/CoreData.swift
index dddd996..2ec91aa 100644
--- a/stdlib/public/SDK/CoreData/CoreData.swift
+++ b/stdlib/public/SDK/CoreData/CoreData.swift
@@ -1,259 +1,605 @@
 @_exported import CoreData
 import Foundation
 
+// Code constants
 extension CocoaError.Code {
+  public static var managedObjectValidation: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1550)
+  }
+  public static var validationMultipleErrors: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1560)
+  }
+  public static var validationMissingMandatoryProperty: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1570)
+  }
+  public static var validationRelationshipLacksMinimumCount: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1580)
+  }
+  public static var validationRelationshipExceedsMaximumCount: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1590)
+  }
+  public static var validationRelationshipDeniedDelete: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1600)
+  }
+  public static var validationNumberTooLarge: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1610)
+  }
+  public static var validationNumberTooSmall: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1620)
+  }
+  public static var validationDateTooLate: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1630)
+  }
+  public static var validationDateTooSoon: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1640)
+  }
+  public static var validationInvalidDate: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1650)
+  }
+  public static var validationStringTooLong: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1660)
+  }
+  public static var validationStringTooShort: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1670)
+  }
+  public static var validationStringPatternMatching: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1680)
+  }
+  public static var managedObjectContextLocking: CocoaError.Code {
+    return CocoaError.Code(rawValue: 132000)
+  }
+  public static var persistentStoreCoordinatorLocking: CocoaError.Code {
+    return CocoaError.Code(rawValue: 132010)
+  }
+  public static var managedObjectReferentialIntegrity: CocoaError.Code {
+    return CocoaError.Code(rawValue: 133000)
+  }
+  public static var managedObjectExternalRelationship: CocoaError.Code {
+    return CocoaError.Code(rawValue: 133010)
+  }
+  public static var managedObjectMerge: CocoaError.Code {
+    return CocoaError.Code(rawValue: 133020)
+  }
+  public static var managedObjectConstraintMerge: CocoaError.Code {
+    return CocoaError.Code(rawValue: 133021)
+  }
+  public static var persistentStoreInvalidType: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134000)
+  }
+  public static var persistentStoreTypeMismatch: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134010)
+  }
+  public static var persistentStoreIncompatibleSchema: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134020)
+  }
+  public static var persistentStoreSave: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134030)
+  }
+  public static var persistentStoreIncompleteSave: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134040)
+  }
+  public static var persistentStoreSaveConflicts: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134050)
+  }
+  public static var coreData: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134060)
+  }
+  public static var persistentStoreOperation: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134070)
+  }
+  public static var persistentStoreOpen: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134080)
+  }
+  public static var persistentStoreTimeout: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134090)
+  }
+  public static var persistentStoreUnsupportedRequestType: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134091)
+  }
+  public static var persistentStoreIncompatibleVersionHash: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134100)
+  }
+  public static var migration: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134110)
+  }
+  public static var migrationCancelled: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134120)
+  }
+  public static var migrationMissingSourceModel: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134130)
+  }
+  public static var migrationMissingMappingModel: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134140)
+  }
+  public static var migrationManagerSourceStore: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134150)
+  }
+  public static var migrationManagerDestinationStore: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134160)
+  }
+  public static var entityMigrationPolicy: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134170)
+  }
+  public static var sqlite: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134180)
+  }
+  public static var inferredMappingModel: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134190)
+  }
+  public static var externalRecordImport: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134200)
+  }
+}
+
+// Code constants with names deprecated late in Swift 3
+extension CocoaError.Code {
+  @available(*, deprecated, renamed: "managedObjectValidation")
   public static var managedObjectValidationError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1550)
   }
+  @available(*, deprecated, renamed: "validationMultipleErrors")
   public static var validationMultipleErrorsError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1560)
   }
+  @available(*, deprecated, renamed: "validationMissingMandatoryProperty")
   public static var validationMissingMandatoryPropertyError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1570)
   }
+  @available(*, deprecated, renamed: "validationRelationshipLacksMinimumCount")
   public static var validationRelationshipLacksMinimumCountError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1580)
   }
+  @available(*, deprecated, renamed: "validationRelationshipExceedsMaximumCount")
   public static var validationRelationshipExceedsMaximumCountError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1590)
   }
-  public static var validationRelationshipDeniedDevareError: CocoaError.Code {
+  @available(*, deprecated, renamed: "validationRelationshipDeniedDelete")
+  public static var validationRelationshipDeniedDeleteError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1600)
   }
+  @available(*, deprecated, renamed: "validationNumberTooLarge")
   public static var validationNumberTooLargeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1610)
   }
+  @available(*, deprecated, renamed: "validationNumberTooSmall")
   public static var validationNumberTooSmallError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1620)
   }
+  @available(*, deprecated, renamed: "validationDateTooLate")
   public static var validationDateTooLateError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1630)
   }
+  @available(*, deprecated, renamed: "validationDateTooSoon")
   public static var validationDateTooSoonError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1640)
   }
+  @available(*, deprecated, renamed: "validationInvalidDate")
   public static var validationInvalidDateError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1650)
   }
+  @available(*, deprecated, renamed: "validationStringTooLong")
   public static var validationStringTooLongError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1660)
   }
+  @available(*, deprecated, renamed: "validationStringTooShort")
   public static var validationStringTooShortError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1670)
   }
+  @available(*, deprecated, renamed: "validationStringPatternMatching")
   public static var validationStringPatternMatchingError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1680)
   }
+  @available(*, deprecated, renamed: "managedObjectContextLocking")
   public static var managedObjectContextLockingError: CocoaError.Code {
     return CocoaError.Code(rawValue: 132000)
   }
+  @available(*, deprecated, renamed: "persistentStoreCoordinatorLocking")
   public static var persistentStoreCoordinatorLockingError: CocoaError.Code {
     return CocoaError.Code(rawValue: 132010)
   }
+  @available(*, deprecated, renamed: "managedObjectReferentialIntegrity")
   public static var managedObjectReferentialIntegrityError: CocoaError.Code {
     return CocoaError.Code(rawValue: 133000)
   }
+  @available(*, deprecated, renamed: "managedObjectExternalRelationship")
   public static var managedObjectExternalRelationshipError: CocoaError.Code {
     return CocoaError.Code(rawValue: 133010)
   }
+  @available(*, deprecated, renamed: "managedObjectMerge")
   public static var managedObjectMergeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 133020)
   }
+  @available(*, deprecated, renamed: "managedObjectConstraintMerge")
   public static var managedObjectConstraintMergeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 133021)
   }
+  @available(*, deprecated, renamed: "persistentStoreInvalidType")
   public static var persistentStoreInvalidTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134000)
   }
+  @available(*, deprecated, renamed: "persistentStoreTypeMismatch")
   public static var persistentStoreTypeMismatchError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134010)
   }
+  @available(*, deprecated, renamed: "persistentStoreIncompatibleSchema")
   public static var persistentStoreIncompatibleSchemaError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134020)
   }
+  @available(*, deprecated, renamed: "persistentStoreSave")
   public static var persistentStoreSaveError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134030)
   }
-  public static var persistentStoreIncompvareSaveError: CocoaError.Code {
+  @available(*, deprecated, renamed: "persistentStoreIncompleteSave")
+  public static var persistentStoreIncompleteSaveError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134040)
   }
+  @available(*, deprecated, renamed: "persistentStoreSaveConflicts")
   public static var persistentStoreSaveConflictsError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134050)
   }
+  @available(*, deprecated, renamed: "coreData")
   public static var coreDataError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134060)
   }
+  @available(*, deprecated, renamed: "persistentStoreOperation")
   public static var persistentStoreOperationError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134070)
   }
+  @available(*, deprecated, renamed: "persistentStoreOpen")
   public static var persistentStoreOpenError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134080)
   }
+  @available(*, deprecated, renamed: "persistentStoreTimeout")
   public static var persistentStoreTimeoutError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134090)
   }
+  @available(*, deprecated, renamed: "persistentStoreUnsupportedRequestType")
   public static var persistentStoreUnsupportedRequestTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134091)
   }
+  @available(*, deprecated, renamed: "persistentStoreIncompatibleVersionHash")
   public static var persistentStoreIncompatibleVersionHashError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134100)
   }
+  @available(*, deprecated, renamed: "migration")
   public static var migrationError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134110)
   }
+  @available(*, deprecated, renamed: "migrationCancelled")
   public static var migrationCancelledError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134120)
   }
+  @available(*, deprecated, renamed: "migrationMissingSourceModel")
   public static var migrationMissingSourceModelError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134130)
   }
+  @available(*, deprecated, renamed: "migrationMissingMappingModel")
   public static var migrationMissingMappingModelError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134140)
   }
+  @available(*, deprecated, renamed: "migrationManagerSourceStore")
   public static var migrationManagerSourceStoreError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134150)
   }
+  @available(*, deprecated, renamed: "migrationManagerDestinationStore")
   public static var migrationManagerDestinationStoreError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134160)
   }
+  @available(*, deprecated, renamed: "entityMigrationPolicy")
   public static var entityMigrationPolicyError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134170)
   }
+  @available(*, deprecated, renamed: "sqlite")
   public static var sqliteError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134180)
   }
+  @available(*, deprecated, renamed: "inferredMappingModel")
   public static var inferredMappingModelError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134190)
   }
+  @available(*, deprecated, renamed: "externalRecordImport")
   public static var externalRecordImportError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134200)
   }
 }
 
+// Code constants
 extension CocoaError {
+  public static var managedObjectValidation: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1550)
+  }
+  public static var validationMultipleErrors: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1560)
+  }
+  public static var validationMissingMandatoryProperty: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1570)
+  }
+  public static var validationRelationshipLacksMinimumCount: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1580)
+  }
+  public static var validationRelationshipExceedsMaximumCount: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1590)
+  }
+  public static var validationRelationshipDeniedDelete: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1600)
+  }
+  public static var validationNumberTooLarge: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1610)
+  }
+  public static var validationNumberTooSmall: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1620)
+  }
+  public static var validationDateTooLate: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1630)
+  }
+  public static var validationDateTooSoon: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1640)
+  }
+  public static var validationInvalidDate: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1650)
+  }
+  public static var validationStringTooLong: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1660)
+  }
+  public static var validationStringTooShort: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1670)
+  }
+  public static var validationStringPatternMatching: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1680)
+  }
+  public static var managedObjectContextLocking: CocoaError.Code {
+    return CocoaError.Code(rawValue: 132000)
+  }
+  public static var persistentStoreCoordinatorLocking: CocoaError.Code {
+    return CocoaError.Code(rawValue: 132010)
+  }
+  public static var managedObjectReferentialIntegrity: CocoaError.Code {
+    return CocoaError.Code(rawValue: 133000)
+  }
+  public static var managedObjectExternalRelationship: CocoaError.Code {
+    return CocoaError.Code(rawValue: 133010)
+  }
+  public static var managedObjectMerge: CocoaError.Code {
+    return CocoaError.Code(rawValue: 133020)
+  }
+  public static var managedObjectConstraintMerge: CocoaError.Code {
+    return CocoaError.Code(rawValue: 133021)
+  }
+  public static var persistentStoreInvalidType: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134000)
+  }
+  public static var persistentStoreTypeMismatch: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134010)
+  }
+  public static var persistentStoreIncompatibleSchema: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134020)
+  }
+  public static var persistentStoreSave: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134030)
+  }
+  public static var persistentStoreIncompleteSave: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134040)
+  }
+  public static var persistentStoreSaveConflicts: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134050)
+  }
+  public static var coreData: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134060)
+  }
+  public static var persistentStoreOperation: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134070)
+  }
+  public static var persistentStoreOpen: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134080)
+  }
+  public static var persistentStoreTimeout: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134090)
+  }
+  public static var persistentStoreUnsupportedRequestType: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134091)
+  }
+  public static var persistentStoreIncompatibleVersionHash: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134100)
+  }
+  public static var migration: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134110)
+  }
+  public static var migrationCancelled: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134120)
+  }
+  public static var migrationMissingSourceModel: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134130)
+  }
+  public static var migrationMissingMappingModel: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134140)
+  }
+  public static var migrationManagerSourceStore: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134150)
+  }
+  public static var migrationManagerDestinationStore: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134160)
+  }
+  public static var entityMigrationPolicy: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134170)
+  }
+  public static var sqlite: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134180)
+  }
+  public static var inferredMappingModel: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134190)
+  }
+  public static var externalRecordImport: CocoaError.Code {
+    return CocoaError.Code(rawValue: 134200)
+  }
+}
+
+// Code constants with names deprecated late in Swift 3
+extension CocoaError {
+  @available(*, deprecated, renamed: "managedObjectValidation")
   public static var managedObjectValidationError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1550)
   }
+  @available(*, deprecated, renamed: "validationMultipleErrors")
   public static var validationMultipleErrorsError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1560)
   }
+  @available(*, deprecated, renamed: "validationMissingMandatoryProperty")
   public static var validationMissingMandatoryPropertyError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1570)
   }
+  @available(*, deprecated, renamed: "validationRelationshipLacksMinimumCount")
   public static var validationRelationshipLacksMinimumCountError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1580)
   }
+  @available(*, deprecated, renamed: "validationRelationshipExceedsMaximumCount")
   public static var validationRelationshipExceedsMaximumCountError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1590)
   }
-  public static var validationRelationshipDeniedDevareError: CocoaError.Code {
+  @available(*, deprecated, renamed: "validationRelationshipDeniedDelete")
+  public static var validationRelationshipDeniedDeleteError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1600)
   }
+  @available(*, deprecated, renamed: "validationNumberTooLarge")
   public static var validationNumberTooLargeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1610)
   }
+  @available(*, deprecated, renamed: "validationNumberTooSmall")
   public static var validationNumberTooSmallError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1620)
   }
+  @available(*, deprecated, renamed: "validationDateTooLate")
   public static var validationDateTooLateError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1630)
   }
+  @available(*, deprecated, renamed: "validationDateTooSoon")
   public static var validationDateTooSoonError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1640)
   }
+  @available(*, deprecated, renamed: "validationInvalidDate")
   public static var validationInvalidDateError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1650)
   }
+  @available(*, deprecated, renamed: "validationStringTooLong")
   public static var validationStringTooLongError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1660)
   }
+  @available(*, deprecated, renamed: "validationStringTooShort")
   public static var validationStringTooShortError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1670)
   }
+  @available(*, deprecated, renamed: "validationStringPatternMatching")
   public static var validationStringPatternMatchingError: CocoaError.Code {
     return CocoaError.Code(rawValue: 1680)
   }
+  @available(*, deprecated, renamed: "managedObjectContextLocking")
   public static var managedObjectContextLockingError: CocoaError.Code {
     return CocoaError.Code(rawValue: 132000)
   }
+  @available(*, deprecated, renamed: "persistentStoreCoordinatorLocking")
   public static var persistentStoreCoordinatorLockingError: CocoaError.Code {
     return CocoaError.Code(rawValue: 132010)
   }
+  @available(*, deprecated, renamed: "managedObjectReferentialIntegrity")
   public static var managedObjectReferentialIntegrityError: CocoaError.Code {
     return CocoaError.Code(rawValue: 133000)
   }
+  @available(*, deprecated, renamed: "managedObjectExternalRelationship")
   public static var managedObjectExternalRelationshipError: CocoaError.Code {
     return CocoaError.Code(rawValue: 133010)
   }
+  @available(*, deprecated, renamed: "managedObjectMerge")
   public static var managedObjectMergeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 133020)
   }
+  @available(*, deprecated, renamed: "managedObjectConstraintMerge")
   public static var managedObjectConstraintMergeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 133021)
   }
+  @available(*, deprecated, renamed: "persistentStoreInvalidType")
   public static var persistentStoreInvalidTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134000)
   }
+  @available(*, deprecated, renamed: "persistentStoreTypeMismatch")
   public static var persistentStoreTypeMismatchError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134010)
   }
+  @available(*, deprecated, renamed: "persistentStoreIncompatibleSchema")
   public static var persistentStoreIncompatibleSchemaError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134020)
   }
+  @available(*, deprecated, renamed: "persistentStoreSave")
   public static var persistentStoreSaveError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134030)
   }
-  public static var persistentStoreIncompvareSaveError: CocoaError.Code {
+  @available(*, deprecated, renamed: "persistentStoreIncompleteSave")
+  public static var persistentStoreIncompleteSaveError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134040)
   }
+  @available(*, deprecated, renamed: "persistentStoreSaveConflicts")
   public static var persistentStoreSaveConflictsError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134050)
   }
+  @available(*, deprecated, renamed: "coreData")
   public static var coreDataError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134060)
   }
+  @available(*, deprecated, renamed: "persistentStoreOperation")
   public static var persistentStoreOperationError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134070)
   }
+  @available(*, deprecated, renamed: "persistentStoreOpen")
   public static var persistentStoreOpenError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134080)
   }
+  @available(*, deprecated, renamed: "persistentStoreTimeout")
   public static var persistentStoreTimeoutError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134090)
   }
+  @available(*, deprecated, renamed: "persistentStoreUnsupportedRequestType")
   public static var persistentStoreUnsupportedRequestTypeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134091)
   }
+  @available(*, deprecated, renamed: "persistentStoreIncompatibleVersionHash")
   public static var persistentStoreIncompatibleVersionHashError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134100)
   }
+  @available(*, deprecated, renamed: "migration")
   public static var migrationError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134110)
   }
+  @available(*, deprecated, renamed: "migrationCancelled")
   public static var migrationCancelledError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134120)
   }
+  @available(*, deprecated, renamed: "migrationMissingSourceModel")
   public static var migrationMissingSourceModelError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134130)
   }
+  @available(*, deprecated, renamed: "migrationMissingMappingModel")
   public static var migrationMissingMappingModelError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134140)
   }
+  @available(*, deprecated, renamed: "migrationManagerSourceStore")
   public static var migrationManagerSourceStoreError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134150)
   }
+  @available(*, deprecated, renamed: "migrationManagerDestinationStore")
   public static var migrationManagerDestinationStoreError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134160)
   }
+  @available(*, deprecated, renamed: "entityMigrationPolicy")
   public static var entityMigrationPolicyError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134170)
   }
+  @available(*, deprecated, renamed: "sqlite")
   public static var sqliteError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134180)
   }
+  @available(*, deprecated, renamed: "inferredMappingModel")
   public static var inferredMappingModelError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134190)
   }
+  @available(*, deprecated, renamed: "externalRecordImport")
   public static var externalRecordImportError: CocoaError.Code {
     return CocoaError.Code(rawValue: 134200)
   }
@@ -298,172 +644,173 @@
   }
 }
 
+// Swift 2 names of code constants, removed from Swift 3
 extension CocoaError {
-  @available(*, unavailable, renamed: "managedObjectValidationError")
+  @available(*, unavailable, renamed: "managedObjectValidation")
   public static var ManagedObjectValidationError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationMultipleErrorsError")
+  @available(*, unavailable, renamed: "validationMultipleErrors")
   public static var ValidationMultipleErrorsError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationMissingMandatoryPropertyError")
+  @available(*, unavailable, renamed: "validationMissingMandatoryProperty")
   public static var ValidationMissingMandatoryPropertyError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationRelationshipLacksMinimumCountError")
+  @available(*, unavailable, renamed: "validationRelationshipLacksMinimumCount")
   public static var ValidationRelationshipLacksMinimumCountError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationRelationshipExceedsMaximumCountError")
+  @available(*, unavailable, renamed: "validationRelationshipExceedsMaximumCount")
   public static var ValidationRelationshipExceedsMaximumCountError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationRelationshipDeniedDevareError")
-  public static var ValidationRelationshipDeniedDevareError: CocoaError.Code {
+  @available(*, unavailable, renamed: "validationRelationshipDeniedDelete")
+  public static var ValidationRelationshipDeniedDeleteError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationNumberTooLargeError")
+  @available(*, unavailable, renamed: "validationNumberTooLarge")
   public static var ValidationNumberTooLargeError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationNumberTooSmallError")
+  @available(*, unavailable, renamed: "validationNumberTooSmall")
   public static var ValidationNumberTooSmallError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationDateTooLateError")
+  @available(*, unavailable, renamed: "validationDateTooLate")
   public static var ValidationDateTooLateError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationDateTooSoonError")
+  @available(*, unavailable, renamed: "validationDateTooSoon")
   public static var ValidationDateTooSoonError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationInvalidDateError")
+  @available(*, unavailable, renamed: "validationInvalidDate")
   public static var ValidationInvalidDateError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationStringTooLongError")
+  @available(*, unavailable, renamed: "validationStringTooLong")
   public static var ValidationStringTooLongError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationStringTooShortError")
+  @available(*, unavailable, renamed: "validationStringTooShort")
   public static var ValidationStringTooShortError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "validationStringPatternMatchingError")
+  @available(*, unavailable, renamed: "validationStringPatternMatching")
   public static var ValidationStringPatternMatchingError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "managedObjectContextLockingError")
+  @available(*, unavailable, renamed: "managedObjectContextLocking")
   public static var ManagedObjectContextLockingError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreCoordinatorLockingError")
+  @available(*, unavailable, renamed: "persistentStoreCoordinatorLocking")
   public static var PersistentStoreCoordinatorLockingError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "managedObjectReferentialIntegrityError")
+  @available(*, unavailable, renamed: "managedObjectReferentialIntegrity")
   public static var ManagedObjectReferentialIntegrityError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "managedObjectExternalRelationshipError")
+  @available(*, unavailable, renamed: "managedObjectExternalRelationship")
   public static var ManagedObjectExternalRelationshipError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "managedObjectMergeError")
+  @available(*, unavailable, renamed: "managedObjectMerge")
   public static var ManagedObjectMergeError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "managedObjectConstraintMergeError")
+  @available(*, unavailable, renamed: "managedObjectConstraintMerge")
   public static var ManagedObjectConstraintMergeError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreInvalidTypeError")
+  @available(*, unavailable, renamed: "persistentStoreInvalidType")
   public static var PersistentStoreInvalidTypeError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreTypeMismatchError")
+  @available(*, unavailable, renamed: "persistentStoreTypeMismatch")
   public static var PersistentStoreTypeMismatchError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreIncompatibleSchemaError")
+  @available(*, unavailable, renamed: "persistentStoreIncompatibleSchema")
   public static var PersistentStoreIncompatibleSchemaError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreSaveError")
+  @available(*, unavailable, renamed: "persistentStoreSave")
   public static var PersistentStoreSaveError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreIncompvareSaveError")
-  public static var PersistentStoreIncompvareSaveError: CocoaError.Code {
+  @available(*, unavailable, renamed: "persistentStoreIncompleteSave")
+  public static var PersistentStoreIncompleteSaveError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreSaveConflictsError")
+  @available(*, unavailable, renamed: "persistentStoreSaveConflicts")
   public static var PersistentStoreSaveConflictsError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "coreDataError")
+  @available(*, unavailable, renamed: "coreData")
   public static var CoreDataError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreOperationError")
+  @available(*, unavailable, renamed: "persistentStoreOperation")
   public static var PersistentStoreOperationError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreOpenError")
+  @available(*, unavailable, renamed: "persistentStoreOpen")
   public static var PersistentStoreOpenError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreTimeoutError")
+  @available(*, unavailable, renamed: "persistentStoreTimeout")
   public static var PersistentStoreTimeoutError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreUnsupportedRequestTypeError")
+  @available(*, unavailable, renamed: "persistentStoreUnsupportedRequestType")
   public static var PersistentStoreUnsupportedRequestTypeError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "persistentStoreIncompatibleVersionHashError")
+  @available(*, unavailable, renamed: "persistentStoreIncompatibleVersionHash")
   public static var PersistentStoreIncompatibleVersionHashError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "migrationError")
+  @available(*, unavailable, renamed: "migration")
   public static var MigrationError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "migrationCancelledError")
+  @available(*, unavailable, renamed: "migrationCancelled")
   public static var MigrationCancelledError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "migrationMissingSourceModelError")
+  @available(*, unavailable, renamed: "migrationMissingSourceModel")
   public static var MigrationMissingSourceModelError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "migrationMissingMappingModelError")
+  @available(*, unavailable, renamed: "migrationMissingMappingModel")
   public static var MigrationMissingMappingModelError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "migrationManagerSourceStoreError")
+  @available(*, unavailable, renamed: "migrationManagerSourceStore")
   public static var MigrationManagerSourceStoreError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "migrationManagerDestinationStoreError")
+  @available(*, unavailable, renamed: "migrationManagerDestinationStore")
   public static var MigrationManagerDestinationStoreError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "entityMigrationPolicyError")
+  @available(*, unavailable, renamed: "entityMigrationPolicy")
   public static var EntityMigrationPolicyError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "sqliteError")
+  @available(*, unavailable, renamed: "sqlite")
   public static var SQLiteError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "inferredMappingModelError")
+  @available(*, unavailable, renamed: "inferredMappingModel")
   public static var InferredMappingModelError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
-  @available(*, unavailable, renamed: "externalRecordImportError")
+  @available(*, unavailable, renamed: "externalRecordImport")
   public static var ExternalRecordImportError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
diff --git a/stdlib/public/SDK/Foundation/CharacterSet.swift b/stdlib/public/SDK/Foundation/CharacterSet.swift
index 8469e6e..dd0dd28 100644
--- a/stdlib/public/SDK/Foundation/CharacterSet.swift
+++ b/stdlib/public/SDK/Foundation/CharacterSet.swift
@@ -11,6 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 @_exported import Foundation // Clang module
+import CoreFoundation
 
 private func _utfRangeToNSRange(_ inRange : Range<UnicodeScalar>) -> NSRange {
     return NSMakeRange(Int(inRange.lowerBound.value), Int(inRange.upperBound.value - inRange.lowerBound.value))
@@ -483,28 +484,37 @@
     
     // Immutable
     
+    @objc(bitmapRepresentation)
     var bitmapRepresentation: Data {
         return _mapUnmanaged { $0.bitmapRepresentation }
     }
     
+    @objc(invertedSet)
     var inverted : CharacterSet {
         return _mapUnmanaged { $0.inverted }
     }
     
+    @objc(hasMemberInPlane:)
     func hasMember(inPlane plane: UInt8) -> Bool {
         return _mapUnmanaged {$0.hasMemberInPlane(plane) }
     }
     
+    @objc(characterIsMember:)
     func characterIsMember(_ member: unichar) -> Bool {
         return _mapUnmanaged { $0.characterIsMember(member) }
     }
     
+    @objc(longCharacterIsMember:)
     func longCharacterIsMember(_ member: UTF32Char) -> Bool {
         return _mapUnmanaged { $0.longCharacterIsMember(member) }
     }
     
+    @objc(isSupersetOfSet:)
     func isSuperset(of other: CharacterSet) -> Bool {
-        return _mapUnmanaged { $0.isSuperset(of: other) }
+        return _mapUnmanaged {
+            // this is a work around for <rdar://problem/27768939>
+            return CFCharacterSetIsSupersetOfSet($0 as CFCharacterSet, (other as NSCharacterSet).copy() as! CFCharacterSet)
+        }
     }
     
 }
diff --git a/stdlib/public/SDK/Foundation/Data.swift b/stdlib/public/SDK/Foundation/Data.swift
index ca7bc6e..22e0dcc 100644
--- a/stdlib/public/SDK/Foundation/Data.swift
+++ b/stdlib/public/SDK/Foundation/Data.swift
@@ -669,7 +669,7 @@
         public mutating func next() -> UInt8? {
             guard _idx < _endIdx else { return nil }
             defer { _idx += 1 }
-            let bufferSize = MemoryLayout._ofInstance(_buffer).size
+            let bufferSize = MemoryLayout.size(ofValue: _buffer)
             return withUnsafeMutablePointer(to: &_buffer) { ptr_ in
                 let ptr = UnsafeMutableRawPointer(ptr_).assumingMemoryBound(to: UInt8.self)
                 let bufferIdx = _idx % bufferSize
diff --git a/stdlib/public/SDK/Foundation/Foundation.swift b/stdlib/public/SDK/Foundation/Foundation.swift
index bfd1ffe..cf0e0dd 100644
--- a/stdlib/public/SDK/Foundation/Foundation.swift
+++ b/stdlib/public/SDK/Foundation/Foundation.swift
@@ -158,11 +158,6 @@
   _ value: CGFloat
 ) -> NSNumber
 
-@_silgen_name("_swift_Foundation_TypePreservingNSNumberWithBool")
-internal func _swift_Foundation_TypePreservingNSNumberWithBool(
-  _ value: Bool
-) -> NSNumber
-
 @_silgen_name("_swift_Foundation_TypePreservingNSNumberGetKind")
 internal func _swift_Foundation_TypePreservingNSNumberGetKind(
   _ value: NSNumber
@@ -204,11 +199,6 @@
   _ value: NSNumber
 ) -> CGFloat
 
-@_silgen_name("_swift_Foundation_TypePreservingNSNumberGetAsBool")
-internal func _swift_Foundation_TypePreservingNSNumberGetAsBool(
-  _ value: NSNumber
-) -> Bool
-
 // Conversions between NSNumber and various numeric types. The
 // conversion to NSNumber is automatic (auto-boxing), while conversion
 // back to a specific numeric type requires a cast.
@@ -348,7 +338,7 @@
 
   @_semantics("convertToObjectiveC")
   public func _bridgeToObjectiveC() -> NSNumber {
-    return _swift_Foundation_TypePreservingNSNumberWithBool(self)
+    return NSNumber(value: self)
   }
 
   public static func _forceBridgeFromObjectiveC(
@@ -456,7 +446,7 @@
     case .CoreGraphicsCGFloat:
       return AnyHashable(_swift_Foundation_TypePreservingNSNumberGetAsCGFloat(self))
     case .SwiftBool:
-      return AnyHashable(_swift_Foundation_TypePreservingNSNumberGetAsBool(self))
+      return AnyHashable(self.boolValue)
     }
   }
 }
@@ -1007,7 +997,12 @@
     set {
       // FIXME: Unfortunate that the `NSCopying` check has to be done at
       // runtime.
-      self.setObject(newValue, forKey: key as AnyObject as! NSCopying)
+      let copyingKey = key as AnyObject as! NSCopying
+      if let newValue = newValue {
+        self.setObject(newValue, forKey: copyingKey)
+      } else {
+        self.removeObject(forKey: copyingKey)
+      }
     }
   }
 }
diff --git a/stdlib/public/SDK/Foundation/NSError.swift b/stdlib/public/SDK/Foundation/NSError.swift
index fa16466..5ec736f 100644
--- a/stdlib/public/SDK/Foundation/NSError.swift
+++ b/stdlib/public/SDK/Foundation/NSError.swift
@@ -136,6 +136,9 @@
   }
 }
 
+internal let _errorDomainUserInfoProviderQueue = DispatchQueue(
+  label: "SwiftFoundation._errorDomainUserInfoProviderQueue")
+
 /// Retrieve the default userInfo dictionary for a given error.
 @_silgen_name("swift_Foundation_getErrorDefaultUserInfo")
 public func _swift_Foundation_getErrorDefaultUserInfo(_ error: Error)
@@ -149,7 +152,8 @@
     // user-info value providers.
     let domain = error._domain
     if domain != NSCocoaErrorDomain {
-      if NSError.userInfoValueProvider(forDomain: domain) == nil {
+      _errorDomainUserInfoProviderQueue.sync {
+        if NSError.userInfoValueProvider(forDomain: domain) != nil { return }
         NSError.setUserInfoValueProvider(forDomain: domain) { (nsError, key) in
           let error = nsError as Error
 
@@ -570,146 +574,146 @@
 }
 
 extension CocoaError.Code {
-  public static var fileNoSuchFileError: CocoaError.Code {
+  public static var fileNoSuchFile: CocoaError.Code {
     return CocoaError.Code(rawValue: 4)
   }
-  public static var fileLockingError: CocoaError.Code {
+  public static var fileLocking: CocoaError.Code {
     return CocoaError.Code(rawValue: 255)
   }
-  public static var fileReadUnknownError: CocoaError.Code {
+  public static var fileReadUnknown: CocoaError.Code {
     return CocoaError.Code(rawValue: 256)
   }
-  public static var fileReadNoPermissionError: CocoaError.Code {
+  public static var fileReadNoPermission: CocoaError.Code {
     return CocoaError.Code(rawValue: 257)
   }
-  public static var fileReadInvalidFileNameError: CocoaError.Code {
+  public static var fileReadInvalidFileName: CocoaError.Code {
     return CocoaError.Code(rawValue: 258)
   }
-  public static var fileReadCorruptFileError: CocoaError.Code {
+  public static var fileReadCorruptFile: CocoaError.Code {
     return CocoaError.Code(rawValue: 259)
   }
-  public static var fileReadNoSuchFileError: CocoaError.Code {
+  public static var fileReadNoSuchFile: CocoaError.Code {
     return CocoaError.Code(rawValue: 260)
   }
-  public static var fileReadInapplicableStringEncodingError: CocoaError.Code {
+  public static var fileReadInapplicableStringEncoding: CocoaError.Code {
     return CocoaError.Code(rawValue: 261)
   }
-  public static var fileReadUnsupportedSchemeError: CocoaError.Code {
+  public static var fileReadUnsupportedScheme: CocoaError.Code {
     return CocoaError.Code(rawValue: 262)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var fileReadTooLargeError: CocoaError.Code {
+  public static var fileReadTooLarge: CocoaError.Code {
     return CocoaError.Code(rawValue: 263)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var fileReadUnknownStringEncodingError: CocoaError.Code {
+  public static var fileReadUnknownStringEncoding: CocoaError.Code {
     return CocoaError.Code(rawValue: 264)
   }
 
-  public static var fileWriteUnknownError: CocoaError.Code {
+  public static var fileWriteUnknown: CocoaError.Code {
     return CocoaError.Code(rawValue: 512)
   }
-  public static var fileWriteNoPermissionError: CocoaError.Code {
+  public static var fileWriteNoPermission: CocoaError.Code {
     return CocoaError.Code(rawValue: 513)
   }
-  public static var fileWriteInvalidFileNameError: CocoaError.Code {
+  public static var fileWriteInvalidFileName: CocoaError.Code {
     return CocoaError.Code(rawValue: 514)
   }
 
   @available(OSX, introduced: 10.7) @available(iOS, introduced: 5.0)
-  public static var fileWriteFileExistsError: CocoaError.Code {
+  public static var fileWriteFileExists: CocoaError.Code {
     return CocoaError.Code(rawValue: 516)
   }
 
-  public static var fileWriteInapplicableStringEncodingError: CocoaError.Code {
+  public static var fileWriteInapplicableStringEncoding: CocoaError.Code {
     return CocoaError.Code(rawValue: 517)
   }
-  public static var fileWriteUnsupportedSchemeError: CocoaError.Code {
+  public static var fileWriteUnsupportedScheme: CocoaError.Code {
     return CocoaError.Code(rawValue: 518)
   }
-  public static var fileWriteOutOfSpaceError: CocoaError.Code {
+  public static var fileWriteOutOfSpace: CocoaError.Code {
     return CocoaError.Code(rawValue: 640)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var fileWriteVolumeReadOnlyError: CocoaError.Code {
+  public static var fileWriteVolumeReadOnly: CocoaError.Code {
     return CocoaError.Code(rawValue: 642)
   }
 
   @available(OSX, introduced: 10.11) @available(iOS, unavailable)
-  public static var fileManagerUnmountUnknownError: CocoaError.Code {
+  public static var fileManagerUnmountUnknown: CocoaError.Code {
     return CocoaError.Code(rawValue: 768)
   }
 
   @available(OSX, introduced: 10.11) @available(iOS, unavailable)
-  public static var fileManagerUnmountBusyError: CocoaError.Code {
+  public static var fileManagerUnmountBusy: CocoaError.Code {
     return CocoaError.Code(rawValue: 769)
   }
 
-  public static var keyValueValidationError: CocoaError.Code {
+  public static var keyValueValidation: CocoaError.Code {
     return CocoaError.Code(rawValue: 1024)
   }
-  public static var formattingError: CocoaError.Code {
+  public static var formatting: CocoaError.Code {
     return CocoaError.Code(rawValue: 2048)
   }
-  public static var userCancelledError: CocoaError.Code {
+  public static var userCancelled: CocoaError.Code {
     return CocoaError.Code(rawValue: 3072)
   }
 
   @available(OSX, introduced: 10.8) @available(iOS, introduced: 6.0)
-  public static var featureUnsupportedError: CocoaError.Code {
+  public static var featureUnsupported: CocoaError.Code {
     return CocoaError.Code(rawValue: 3328)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableNotLoadableError: CocoaError.Code {
+  public static var executableNotLoadable: CocoaError.Code {
     return CocoaError.Code(rawValue: 3584)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableArchitectureMismatchError: CocoaError.Code {
+  public static var executableArchitectureMismatch: CocoaError.Code {
     return CocoaError.Code(rawValue: 3585)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableRuntimeMismatchError: CocoaError.Code {
+  public static var executableRuntimeMismatch: CocoaError.Code {
     return CocoaError.Code(rawValue: 3586)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableLoadError: CocoaError.Code {
+  public static var executableLoad: CocoaError.Code {
     return CocoaError.Code(rawValue: 3587)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableLinkError: CocoaError.Code {
+  public static var executableLink: CocoaError.Code {
     return CocoaError.Code(rawValue: 3588)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var propertyListReadCorruptError: CocoaError.Code {
+  public static var propertyListReadCorrupt: CocoaError.Code {
     return CocoaError.Code(rawValue: 3840)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var propertyListReadUnknownVersionError: CocoaError.Code {
+  public static var propertyListReadUnknownVersion: CocoaError.Code {
     return CocoaError.Code(rawValue: 3841)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var propertyListReadStreamError: CocoaError.Code {
+  public static var propertyListReadStream: CocoaError.Code {
     return CocoaError.Code(rawValue: 3842)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var propertyListWriteStreamError: CocoaError.Code {
+  public static var propertyListWriteStream: CocoaError.Code {
     return CocoaError.Code(rawValue: 3851)
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
-  public static var propertyListWriteInvalidError: CocoaError.Code {
+  public static var propertyListWriteInvalid: CocoaError.Code {
     return CocoaError.Code(rawValue: 3852)
   }
 
@@ -729,12 +733,12 @@
   }
 
   @available(OSX, introduced: 10.9) @available(iOS, introduced: 7.0)
-  public static var ubiquitousFileUnavailableError: CocoaError.Code {
+  public static var ubiquitousFileUnavailable: CocoaError.Code {
     return CocoaError.Code(rawValue: 4353)
   }
 
   @available(OSX, introduced: 10.9) @available(iOS, introduced: 7.0)
-  public static var ubiquitousFileNotUploadedDueToQuotaError: CocoaError.Code {
+  public static var ubiquitousFileNotUploadedDueToQuota: CocoaError.Code {
     return CocoaError.Code(rawValue: 4354)
   }
 
@@ -744,177 +748,411 @@
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  public static var userActivityHandoffFailed: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4608)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  public static var userActivityConnectionUnavailable: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4609)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  public static var userActivityRemoteApplicationTimedOut: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4610)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  public static var userActivityHandoffUserInfoTooLarge: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4611)
+  }
+
+  @available(OSX, introduced: 10.11) @available(iOS, introduced: 9.0)
+  public static var coderReadCorrupt: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4864)
+  }
+
+  @available(OSX, introduced: 10.11) @available(iOS, introduced: 9.0)
+  public static var coderValueNotFound: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4865)
+  }
+}
+
+extension CocoaError.Code {
+  @available(*, deprecated, renamed: "fileNoSuchFile")
+  public static var fileNoSuchFileError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4)
+  }
+  @available(*, deprecated, renamed: "fileLocking")
+  public static var fileLockingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 255)
+  }
+  @available(*, deprecated, renamed: "fileReadUnknown")
+  public static var fileReadUnknownError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 256)
+  }
+  @available(*, deprecated, renamed: "fileReadNoPermission")
+  public static var fileReadNoPermissionError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 257)
+  }
+  @available(*, deprecated, renamed: "fileReadInvalidFileName")
+  public static var fileReadInvalidFileNameError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 258)
+  }
+  @available(*, deprecated, renamed: "fileReadCorruptFile")
+  public static var fileReadCorruptFileError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 259)
+  }
+  @available(*, deprecated, renamed: "fileReadNoSuchFile")
+  public static var fileReadNoSuchFileError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 260)
+  }
+  @available(*, deprecated, renamed: "fileReadInapplicableStringEncoding")
+  public static var fileReadInapplicableStringEncodingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 261)
+  }
+  @available(*, deprecated, renamed: "fileReadUnsupportedScheme")
+  public static var fileReadUnsupportedSchemeError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 262)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "fileReadTooLarge")
+  public static var fileReadTooLargeError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 263)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "fileReadUnknownStringEncoding")
+  public static var fileReadUnknownStringEncodingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 264)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteUnknown")
+  public static var fileWriteUnknownError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 512)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteNoPermission")
+  public static var fileWriteNoPermissionError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 513)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteInvalidFileName")
+  public static var fileWriteInvalidFileNameError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 514)
+  }
+
+  @available(OSX, introduced: 10.7) @available(iOS, introduced: 5.0)
+  @available(*, deprecated, renamed: "fileWriteFileExists")
+  public static var fileWriteFileExistsError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 516)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteInapplicableStringEncoding")
+  public static var fileWriteInapplicableStringEncodingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 517)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteUnsupportedScheme")
+  public static var fileWriteUnsupportedSchemeError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 518)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteOutOfSpace")
+  public static var fileWriteOutOfSpaceError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 640)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "fileWriteVolumeReadOnly")
+  public static var fileWriteVolumeReadOnlyError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 642)
+  }
+
+  @available(OSX, introduced: 10.11) @available(iOS, unavailable)
+  @available(*, deprecated, renamed: "fileManagerUnmountUnknown")
+  public static var fileManagerUnmountUnknownError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 768)
+  }
+
+  @available(OSX, introduced: 10.11) @available(iOS, unavailable)
+  @available(*, deprecated, renamed: "fileManagerUnmountBusy")
+  public static var fileManagerUnmountBusyError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 769)
+  }
+
+  @available(*, deprecated, renamed: "keyValueValidation")
+  public static var keyValueValidationError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1024)
+  }
+
+  @available(*, deprecated, renamed: "formatting")
+  public static var formattingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 2048)
+  }
+
+  @available(*, deprecated, renamed: "userCancelled")
+  public static var userCancelledError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3072)
+  }
+
+  @available(OSX, introduced: 10.8) @available(iOS, introduced: 6.0)
+  @available(*, deprecated, renamed: "featureUnsupported")
+  public static var featureUnsupportedError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3328)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableNotLoadable")
+  public static var executableNotLoadableError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3584)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableArchitectureMismatch")
+  public static var executableArchitectureMismatchError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3585)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableRuntimeMismatch")
+  public static var executableRuntimeMismatchError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3586)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableLoad")
+  public static var executableLoadError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3587)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableLink")
+  public static var executableLinkError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3588)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "propertyListReadCorrupt")
+  public static var propertyListReadCorruptError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3840)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "propertyListReadUnknownVersion")
+  public static var propertyListReadUnknownVersionError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3841)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "propertyListReadStream")
+  public static var propertyListReadStreamError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3842)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "propertyListWriteStream")
+  public static var propertyListWriteStreamError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3851)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "propertyListWriteInvalid")
+  public static var propertyListWriteInvalidError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3852)
+  }
+
+  @available(OSX, introduced: 10.9) @available(iOS, introduced: 7.0)
+  @available(*, deprecated, renamed: "ubiquitousFileUnavailable")
+  public static var ubiquitousFileUnavailableError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4353)
+  }
+
+  @available(OSX, introduced: 10.9) @available(iOS, introduced: 7.0)
+  @available(*, deprecated, renamed: "ubiquitousFileNotUploadedDueToQuota")
+  public static var ubiquitousFileNotUploadedDueToQuotaError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4354)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "userActivityHandoffFailed")
   public static var userActivityHandoffFailedError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4608)
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "userActivityConnectionUnavailable")
   public static var userActivityConnectionUnavailableError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4609)
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "userActivityRemoteApplicationTimedOut")
   public static var userActivityRemoteApplicationTimedOutError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4610)
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "userActivityHandoffUserInfoTooLarge")
   public static var userActivityHandoffUserInfoTooLargeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4611)
   }
 
   @available(OSX, introduced: 10.11) @available(iOS, introduced: 9.0)
+  @available(*, deprecated, renamed: "coderReadCorrupt")
   public static var coderReadCorruptError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4864)
   }
 
   @available(OSX, introduced: 10.11) @available(iOS, introduced: 9.0)
+  @available(*, deprecated, renamed: "coderValueNotFound")
   public static var coderValueNotFoundError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4865)
   }
 }
 
 extension CocoaError {
-  public static var fileNoSuchFileError: CocoaError.Code {
+  public static var fileNoSuchFile: CocoaError.Code {
     return CocoaError.Code(rawValue: 4)
   }
-  public static var fileLockingError: CocoaError.Code {
+  public static var fileLocking: CocoaError.Code {
     return CocoaError.Code(rawValue: 255)
   }
-  public static var fileReadUnknownError: CocoaError.Code {
+  public static var fileReadUnknown: CocoaError.Code {
     return CocoaError.Code(rawValue: 256)
   }
-  public static var fileReadNoPermissionError: CocoaError.Code {
+  public static var fileReadNoPermission: CocoaError.Code {
     return CocoaError.Code(rawValue: 257)
   }
-  public static var fileReadInvalidFileNameError: CocoaError.Code {
+  public static var fileReadInvalidFileName: CocoaError.Code {
     return CocoaError.Code(rawValue: 258)
   }
-  public static var fileReadCorruptFileError: CocoaError.Code {
+  public static var fileReadCorruptFile: CocoaError.Code {
     return CocoaError.Code(rawValue: 259)
   }
-  public static var fileReadNoSuchFileError: CocoaError.Code {
+  public static var fileReadNoSuchFile: CocoaError.Code {
     return CocoaError.Code(rawValue: 260)
   }
-  public static var fileReadInapplicableStringEncodingError: CocoaError.Code {
+  public static var fileReadInapplicableStringEncoding: CocoaError.Code {
     return CocoaError.Code(rawValue: 261)
   }
-  public static var fileReadUnsupportedSchemeError: CocoaError.Code {
+  public static var fileReadUnsupportedScheme: CocoaError.Code {
     return CocoaError.Code(rawValue: 262)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var fileReadTooLargeError: CocoaError.Code {
+  public static var fileReadTooLarge: CocoaError.Code {
     return CocoaError.Code(rawValue: 263)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var fileReadUnknownStringEncodingError: CocoaError.Code {
+  public static var fileReadUnknownStringEncoding: CocoaError.Code {
     return CocoaError.Code(rawValue: 264)
   }
 
-  public static var fileWriteUnknownError: CocoaError.Code {
+  public static var fileWriteUnknown: CocoaError.Code {
     return CocoaError.Code(rawValue: 512)
   }
-  public static var fileWriteNoPermissionError: CocoaError.Code {
+  public static var fileWriteNoPermission: CocoaError.Code {
     return CocoaError.Code(rawValue: 513)
   }
-  public static var fileWriteInvalidFileNameError: CocoaError.Code {
+  public static var fileWriteInvalidFileName: CocoaError.Code {
     return CocoaError.Code(rawValue: 514)
   }
 
   @available(OSX, introduced: 10.7) @available(iOS, introduced: 5.0)
-  public static var fileWriteFileExistsError: CocoaError.Code {
+  public static var fileWriteFileExists: CocoaError.Code {
     return CocoaError.Code(rawValue: 516)
   }
 
-  public static var fileWriteInapplicableStringEncodingError: CocoaError.Code {
+  public static var fileWriteInapplicableStringEncoding: CocoaError.Code {
     return CocoaError.Code(rawValue: 517)
   }
-  public static var fileWriteUnsupportedSchemeError: CocoaError.Code {
+  public static var fileWriteUnsupportedScheme: CocoaError.Code {
     return CocoaError.Code(rawValue: 518)
   }
-  public static var fileWriteOutOfSpaceError: CocoaError.Code {
+  public static var fileWriteOutOfSpace: CocoaError.Code {
     return CocoaError.Code(rawValue: 640)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var fileWriteVolumeReadOnlyError: CocoaError.Code {
+  public static var fileWriteVolumeReadOnly: CocoaError.Code {
     return CocoaError.Code(rawValue: 642)
   }
 
   @available(OSX, introduced: 10.11) @available(iOS, unavailable)
-  public static var fileManagerUnmountUnknownError: CocoaError.Code {
+  public static var fileManagerUnmountUnknown: CocoaError.Code {
     return CocoaError.Code(rawValue: 768)
   }
 
   @available(OSX, introduced: 10.11) @available(iOS, unavailable)
-  public static var fileManagerUnmountBusyError: CocoaError.Code {
+  public static var fileManagerUnmountBusy: CocoaError.Code {
     return CocoaError.Code(rawValue: 769)
   }
 
-  public static var keyValueValidationError: CocoaError.Code {
+  public static var keyValueValidation: CocoaError.Code {
     return CocoaError.Code(rawValue: 1024)
   }
-  public static var formattingError: CocoaError.Code {
+  public static var formatting: CocoaError.Code {
     return CocoaError.Code(rawValue: 2048)
   }
-  public static var userCancelledError: CocoaError.Code {
+  public static var userCancelled: CocoaError.Code {
     return CocoaError.Code(rawValue: 3072)
   }
 
   @available(OSX, introduced: 10.8) @available(iOS, introduced: 6.0)
-  public static var featureUnsupportedError: CocoaError.Code {
+  public static var featureUnsupported: CocoaError.Code {
     return CocoaError.Code(rawValue: 3328)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableNotLoadableError: CocoaError.Code {
+  public static var executableNotLoadable: CocoaError.Code {
     return CocoaError.Code(rawValue: 3584)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableArchitectureMismatchError: CocoaError.Code {
+  public static var executableArchitectureMismatch: CocoaError.Code {
     return CocoaError.Code(rawValue: 3585)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableRuntimeMismatchError: CocoaError.Code {
+  public static var executableRuntimeMismatch: CocoaError.Code {
     return CocoaError.Code(rawValue: 3586)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableLoadError: CocoaError.Code {
+  public static var executableLoad: CocoaError.Code {
     return CocoaError.Code(rawValue: 3587)
   }
 
   @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
-  public static var executableLinkError: CocoaError.Code {
+  public static var executableLink: CocoaError.Code {
     return CocoaError.Code(rawValue: 3588)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var propertyListReadCorruptError: CocoaError.Code {
+  public static var propertyListReadCorrupt: CocoaError.Code {
     return CocoaError.Code(rawValue: 3840)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var propertyListReadUnknownVersionError: CocoaError.Code {
+  public static var propertyListReadUnknownVersion: CocoaError.Code {
     return CocoaError.Code(rawValue: 3841)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var propertyListReadStreamError: CocoaError.Code {
+  public static var propertyListReadStream: CocoaError.Code {
     return CocoaError.Code(rawValue: 3842)
   }
 
   @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
-  public static var propertyListWriteStreamError: CocoaError.Code {
+  public static var propertyListWriteStream: CocoaError.Code {
     return CocoaError.Code(rawValue: 3851)
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
-  public static var propertyListWriteInvalidError: CocoaError.Code {
+  public static var propertyListWriteInvalid: CocoaError.Code {
     return CocoaError.Code(rawValue: 3852)
   }
 
@@ -934,12 +1172,12 @@
   }
 
   @available(OSX, introduced: 10.9) @available(iOS, introduced: 7.0)
-  public static var ubiquitousFileUnavailableError: CocoaError.Code {
+  public static var ubiquitousFileUnavailable: CocoaError.Code {
     return CocoaError.Code(rawValue: 4353)
   }
 
   @available(OSX, introduced: 10.9) @available(iOS, introduced: 7.0)
-  public static var ubiquitousFileNotUploadedDueToQuotaError: CocoaError.Code {
+  public static var ubiquitousFileNotUploadedDueToQuota: CocoaError.Code {
     return CocoaError.Code(rawValue: 4354)
   }
 
@@ -949,31 +1187,265 @@
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  public static var userActivityHandoffFailed: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4608)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  public static var userActivityConnectionUnavailable: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4609)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  public static var userActivityRemoteApplicationTimedOut: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4610)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  public static var userActivityHandoffUserInfoTooLarge: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4611)
+  }
+
+  @available(OSX, introduced: 10.11) @available(iOS, introduced: 9.0)
+  public static var coderReadCorrupt: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4864)
+  }
+
+  @available(OSX, introduced: 10.11) @available(iOS, introduced: 9.0)
+  public static var coderValueNotFound: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4865)
+  }
+}
+
+extension CocoaError {
+  @available(*, deprecated, renamed: "fileNoSuchFile")
+  public static var fileNoSuchFileError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4)
+  }
+  @available(*, deprecated, renamed: "fileLocking")
+  public static var fileLockingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 255)
+  }
+  @available(*, deprecated, renamed: "fileReadUnknown")
+  public static var fileReadUnknownError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 256)
+  }
+  @available(*, deprecated, renamed: "fileReadNoPermission")
+  public static var fileReadNoPermissionError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 257)
+  }
+  @available(*, deprecated, renamed: "fileReadInvalidFileName")
+  public static var fileReadInvalidFileNameError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 258)
+  }
+  @available(*, deprecated, renamed: "fileReadCorruptFile")
+  public static var fileReadCorruptFileError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 259)
+  }
+  @available(*, deprecated, renamed: "fileReadNoSuchFile")
+  public static var fileReadNoSuchFileError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 260)
+  }
+  @available(*, deprecated, renamed: "fileReadInapplicableStringEncoding")
+  public static var fileReadInapplicableStringEncodingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 261)
+  }
+  @available(*, deprecated, renamed: "fileReadUnsupportedScheme")
+  public static var fileReadUnsupportedSchemeError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 262)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "fileReadTooLarge")
+  public static var fileReadTooLargeError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 263)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "fileReadUnknownStringEncoding")
+  public static var fileReadUnknownStringEncodingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 264)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteUnknown")
+  public static var fileWriteUnknownError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 512)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteNoPermission")
+  public static var fileWriteNoPermissionError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 513)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteInvalidFileName")
+  public static var fileWriteInvalidFileNameError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 514)
+  }
+
+  @available(OSX, introduced: 10.7) @available(iOS, introduced: 5.0)
+  @available(*, deprecated, renamed: "fileWriteFileExists")
+  public static var fileWriteFileExistsError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 516)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteInapplicableStringEncoding")
+  public static var fileWriteInapplicableStringEncodingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 517)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteUnsupportedScheme")
+  public static var fileWriteUnsupportedSchemeError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 518)
+  }
+
+  @available(*, deprecated, renamed: "fileWriteOutOfSpace")
+  public static var fileWriteOutOfSpaceError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 640)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "fileWriteVolumeReadOnly")
+  public static var fileWriteVolumeReadOnlyError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 642)
+  }
+
+  @available(OSX, introduced: 10.11) @available(iOS, unavailable)
+  @available(*, deprecated, renamed: "fileManagerUnmountUnknown")
+  public static var fileManagerUnmountUnknownError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 768)
+  }
+
+  @available(OSX, introduced: 10.11) @available(iOS, unavailable)
+  @available(*, deprecated, renamed: "fileManagerUnmountBusy")
+  public static var fileManagerUnmountBusyError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 769)
+  }
+
+  @available(*, deprecated, renamed: "keyValueValidation")
+  public static var keyValueValidationError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 1024)
+  }
+
+  @available(*, deprecated, renamed: "formatting")
+  public static var formattingError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 2048)
+  }
+
+  @available(*, deprecated, renamed: "userCancelled")
+  public static var userCancelledError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3072)
+  }
+
+  @available(OSX, introduced: 10.8) @available(iOS, introduced: 6.0)
+  @available(*, deprecated, renamed: "featureUnsupported")
+  public static var featureUnsupportedError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3328)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableNotLoadable")
+  public static var executableNotLoadableError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3584)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableArchitectureMismatch")
+  public static var executableArchitectureMismatchError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3585)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableRuntimeMismatch")
+  public static var executableRuntimeMismatchError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3586)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableLoad")
+  public static var executableLoadError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3587)
+  }
+
+  @available(OSX, introduced: 10.5) @available(iOS, introduced: 2.0)
+  @available(*, deprecated, renamed: "executableLink")
+  public static var executableLinkError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3588)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "propertyListReadCorrupt")
+  public static var propertyListReadCorruptError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3840)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "propertyListReadUnknownVersion")
+  public static var propertyListReadUnknownVersionError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3841)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "propertyListReadStream")
+  public static var propertyListReadStreamError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3842)
+  }
+
+  @available(OSX, introduced: 10.6) @available(iOS, introduced: 4.0)
+  @available(*, deprecated, renamed: "propertyListWriteStream")
+  public static var propertyListWriteStreamError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3851)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "propertyListWriteInvalid")
+  public static var propertyListWriteInvalidError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 3852)
+  }
+
+  @available(OSX, introduced: 10.9) @available(iOS, introduced: 7.0)
+  @available(*, deprecated, renamed: "ubiquitousFileUnavailable")
+  public static var ubiquitousFileUnavailableError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4353)
+  }
+
+  @available(OSX, introduced: 10.9) @available(iOS, introduced: 7.0)
+  @available(*, deprecated, renamed: "ubiquitousFileNotUploadedDueToQuota")
+  public static var ubiquitousFileNotUploadedDueToQuotaError: CocoaError.Code {
+    return CocoaError.Code(rawValue: 4354)
+  }
+
+  @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "userActivityHandoffFailed")
   public static var userActivityHandoffFailedError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4608)
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "userActivityConnectionUnavailable")
   public static var userActivityConnectionUnavailableError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4609)
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "userActivityRemoteApplicationTimedOut")
   public static var userActivityRemoteApplicationTimedOutError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4610)
   }
 
   @available(OSX, introduced: 10.10) @available(iOS, introduced: 8.0)
+  @available(*, deprecated, renamed: "userActivityHandoffUserInfoTooLarge")
   public static var userActivityHandoffUserInfoTooLargeError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4611)
   }
 
   @available(OSX, introduced: 10.11) @available(iOS, introduced: 9.0)
+  @available(*, deprecated, renamed: "coderReadCorrupt")
   public static var coderReadCorruptError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4864)
   }
 
   @available(OSX, introduced: 10.11) @available(iOS, introduced: 9.0)
+  @available(*, deprecated, renamed: "coderValueNotFound")
   public static var coderValueNotFoundError: CocoaError.Code {
     return CocoaError.Code(rawValue: 4865)
   }
@@ -1024,177 +1496,177 @@
 }
 
 extension CocoaError.Code {
-  @available(*, unavailable, renamed: "fileNoSuchFileError")
+  @available(*, unavailable, renamed: "fileNoSuchFile")
   public static var FileNoSuchFileError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileLockingError")
+  @available(*, unavailable, renamed: "fileLocking")
   public static var FileLockingError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileReadUnknownError")
+  @available(*, unavailable, renamed: "fileReadUnknown")
   public static var FileReadUnknownError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileReadNoPermissionError")
+  @available(*, unavailable, renamed: "fileReadNoPermission")
   public static var FileReadNoPermissionError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileReadInvalidFileNameError")
+  @available(*, unavailable, renamed: "fileReadInvalidFileName")
   public static var FileReadInvalidFileNameError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileReadCorruptFileError")
+  @available(*, unavailable, renamed: "fileReadCorruptFile")
   public static var FileReadCorruptFileError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileReadNoSuchFileError")
+  @available(*, unavailable, renamed: "fileReadNoSuchFile")
   public static var FileReadNoSuchFileError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileReadInapplicableStringEncodingError")
+  @available(*, unavailable, renamed: "fileReadInapplicableStringEncoding")
   public static var FileReadInapplicableStringEncodingError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileReadUnsupportedSchemeError")
+  @available(*, unavailable, renamed: "fileReadUnsupportedScheme")
   public static var FileReadUnsupportedSchemeError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileReadTooLargeError")
+  @available(*, unavailable, renamed: "fileReadTooLarge")
   public static var FileReadTooLargeError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileReadUnknownStringEncodingError")
+  @available(*, unavailable, renamed: "fileReadUnknownStringEncoding")
   public static var FileReadUnknownStringEncodingError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileWriteUnknownError")
+  @available(*, unavailable, renamed: "fileWriteUnknown")
   public static var FileWriteUnknownError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileWriteNoPermissionError")
+  @available(*, unavailable, renamed: "fileWriteNoPermission")
   public static var FileWriteNoPermissionError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileWriteInvalidFileNameError")
+  @available(*, unavailable, renamed: "fileWriteInvalidFileName")
   public static var FileWriteInvalidFileNameError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileWriteFileExistsError")
+  @available(*, unavailable, renamed: "fileWriteFileExists")
   public static var FileWriteFileExistsError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileWriteInapplicableStringEncodingError")
+  @available(*, unavailable, renamed: "fileWriteInapplicableStringEncoding")
   public static var FileWriteInapplicableStringEncodingError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileWriteUnsupportedSchemeError")
+  @available(*, unavailable, renamed: "fileWriteUnsupportedScheme")
   public static var FileWriteUnsupportedSchemeError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileWriteOutOfSpaceError")
+  @available(*, unavailable, renamed: "fileWriteOutOfSpace")
   public static var FileWriteOutOfSpaceError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileWriteVolumeReadOnlyError")
+  @available(*, unavailable, renamed: "fileWriteVolumeReadOnly")
   public static var FileWriteVolumeReadOnlyError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileManagerUnmountUnknownError")
+  @available(*, unavailable, renamed: "fileManagerUnmountUnknown")
   public static var FileManagerUnmountUnknownError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "fileManagerUnmountBusyError")
+  @available(*, unavailable, renamed: "fileManagerUnmountBusy")
   public static var FileManagerUnmountBusyError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "keyValueValidationError")
+  @available(*, unavailable, renamed: "keyValueValidation")
   public static var KeyValueValidationError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "formattingError")
+  @available(*, unavailable, renamed: "formatting")
   public static var FormattingError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "userCancelledError")
+  @available(*, unavailable, renamed: "userCancelled")
   public static var UserCancelledError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "featureUnsupportedError")
+  @available(*, unavailable, renamed: "featureUnsupported")
   public static var FeatureUnsupportedError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "executableNotLoadableError")
+  @available(*, unavailable, renamed: "executableNotLoadable")
   public static var ExecutableNotLoadableError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "executableArchitectureMismatchError")
+  @available(*, unavailable, renamed: "executableArchitectureMismatch")
   public static var ExecutableArchitectureMismatchError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "executableRuntimeMismatchError")
+  @available(*, unavailable, renamed: "executableRuntimeMismatch")
   public static var ExecutableRuntimeMismatchError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "executableLoadError")
+  @available(*, unavailable, renamed: "executableLoad")
   public static var ExecutableLoadError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "executableLinkError")
+  @available(*, unavailable, renamed: "executableLink")
   public static var ExecutableLinkError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "propertyListReadCorruptError")
+  @available(*, unavailable, renamed: "propertyListReadCorrupt")
   public static var PropertyListReadCorruptError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "propertyListReadUnknownVersionError")
+  @available(*, unavailable, renamed: "propertyListReadUnknownVersion")
   public static var PropertyListReadUnknownVersionError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "propertyListReadStreamError")
+  @available(*, unavailable, renamed: "propertyListReadStream")
   public static var PropertyListReadStreamError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "propertyListWriteStreamError")
+  @available(*, unavailable, renamed: "propertyListWriteStream")
   public static var PropertyListWriteStreamError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "propertyListWriteInvalidError")
+  @available(*, unavailable, renamed: "propertyListWriteInvalid")
   public static var PropertyListWriteInvalidError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
@@ -1214,12 +1686,12 @@
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "ubiquitousFileUnavailableError")
+  @available(*, unavailable, renamed: "ubiquitousFileUnavailable")
   public static var UbiquitousFileUnavailableError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "ubiquitousFileNotUploadedDueToQuotaError")
+  @available(*, unavailable, renamed: "ubiquitousFileNotUploadedDueToQuota")
   public static var UbiquitousFileNotUploadedDueToQuotaError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
@@ -1229,32 +1701,32 @@
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "userActivityHandoffFailedError")
+  @available(*, unavailable, renamed: "userActivityHandoffFailed")
   public static var UserActivityHandoffFailedError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "userActivityConnectionUnavailableError")
+  @available(*, unavailable, renamed: "userActivityConnectionUnavailable")
   public static var UserActivityConnectionUnavailableError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "userActivityRemoteApplicationTimedOutError")
+  @available(*, unavailable, renamed: "userActivityRemoteApplicationTimedOut")
   public static var UserActivityRemoteApplicationTimedOutError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "userActivityHandoffUserInfoTooLargeError")
+  @available(*, unavailable, renamed: "userActivityHandoffUserInfoTooLarge")
   public static var UserActivityHandoffUserInfoTooLargeError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "coderReadCorruptError")
+  @available(*, unavailable, renamed: "coderReadCorrupt")
   public static var CoderReadCorruptError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
 
-  @available(*, unavailable, renamed: "coderValueNotFoundError")
+  @available(*, unavailable, renamed: "coderValueNotFound")
   public static var CoderValueNotFoundError: CocoaError.Code {
     fatalError("unavailable accessor can't be called")
   }
diff --git a/stdlib/public/SDK/Foundation/TypePreservingNSNumber.mm b/stdlib/public/SDK/Foundation/TypePreservingNSNumber.mm
index 38cdbd9..8a590e2 100644
--- a/stdlib/public/SDK/Foundation/TypePreservingNSNumber.mm
+++ b/stdlib/public/SDK/Foundation/TypePreservingNSNumber.mm
@@ -76,11 +76,13 @@
   case SwiftCGFloat:
     return @encode(CGFloat);
   case SwiftBool:
-    return @encode(bool);
+    // Bool is represented by CFBoolean.
+    break;
   }
   swift::swift_reportError(
       /* flags = */ 0,
       "_SwiftTypePreservingNSNumber.tag is corrupted.\n");
+  abort();
 }
 
 - (void)getValue:(void *)value {
@@ -102,12 +104,13 @@
     memcpy(value, self->storage, sizeof(CGFloat));
     return;
   case SwiftBool:
-    memcpy(value, self->storage, sizeof(bool));
-    return;
+    // Bool is represented by CFBoolean.
+    break;
   }
   swift::swift_reportError(
       /* flags = */ 0,
       "_SwiftTypePreservingNSNumber.tag is corrupted.\n");
+  abort();
 }
 
 #define DEFINE_ACCESSOR(C_TYPE, METHOD_NAME) \
@@ -139,14 +142,14 @@
       return result; \
     } \
     case SwiftBool: { \
-      bool result; \
-      memcpy(&result, self->storage, sizeof(result)); \
-      return result; \
+      /* Bool is represented by CFBoolean. */ \
+      break; \
     } \
     } \
     swift::swift_reportError( \
         /* flags = */ 0, \
         "_SwiftTypePreservingNSNumber.tag is corrupted.\n"); \
+    abort(); \
   }
 
 DEFINE_ACCESSOR(char, charValue)
@@ -178,7 +181,6 @@
 DEFINE_INIT(float, Float)
 DEFINE_INIT(double, Double)
 DEFINE_INIT(CGFloat, CGFloat)
-DEFINE_INIT(bool, Bool)
 
 #undef DEFINE_INIT
 
@@ -186,8 +188,10 @@
 _swift_Foundation_TypePreservingNSNumberGetKind(
   NSNumber *NS_RELEASES_ARGUMENT _Nonnull self_) {
   uint32_t result = 0;
-  if ([self_ isKindOfClass: [_SwiftTypePreservingNSNumber class]]) {
+  if ([self_ isKindOfClass:[_SwiftTypePreservingNSNumber class]]) {
     result = ((_SwiftTypePreservingNSNumber *) self_)->tag;
+  } else if (CFGetTypeID(self_) == CFBooleanGetTypeID()) {
+    result = SwiftBool;
   }
   [self_ release];
   return result;
@@ -212,7 +216,6 @@
 DEFINE_GETTER(float, Float)
 DEFINE_GETTER(double, Double)
 DEFINE_GETTER(CGFloat, CGFloat)
-DEFINE_GETTER(bool, Bool)
 
 #undef DEFINE_GETTER
 
diff --git a/stdlib/public/core/ArrayBuffer.swift b/stdlib/public/core/ArrayBuffer.swift
index 4ec63b9..0dd308e 100644
--- a/stdlib/public/core/ArrayBuffer.swift
+++ b/stdlib/public/core/ArrayBuffer.swift
@@ -112,7 +112,7 @@
 
   /// Convert to an NSArray.
   ///
-  /// O(1) if the element type is bridged verbatim, O(N) otherwise.
+  /// O(1) if the element type is bridged verbatim, O(*n*) otherwise.
   internal func _asCocoaArray() -> _NSArrayCore {
     return _fastPath(_isNative) ? _native._asCocoaArray() : _nonNative
   }
diff --git a/stdlib/public/core/ArrayCast.swift b/stdlib/public/core/ArrayCast.swift
index 0fd6fbe..e193bb1 100644
--- a/stdlib/public/core/ArrayCast.swift
+++ b/stdlib/public/core/ArrayCast.swift
@@ -47,7 +47,7 @@
     return Array(_immutableCocoaArray: source._buffer._asCocoaArray())
   }
 #endif
-  return _arrayConditionalCast(source)!
+  return source.map { $0 as! TargetElement }
 }
 
 internal struct _UnwrappingFailed : Error {}
diff --git a/stdlib/public/core/ArrayType.swift b/stdlib/public/core/ArrayType.swift
index fa73850..0c15f3c 100644
--- a/stdlib/public/core/ArrayType.swift
+++ b/stdlib/public/core/ArrayType.swift
@@ -60,7 +60,7 @@
   ///
   /// - returns: The removed element.
   ///
-  /// - Complexity: Worst case O(N).
+  /// - Complexity: Worst case O(*n*).
   ///
   /// - Precondition: `count > index`.
   @discardableResult
diff --git a/stdlib/public/core/Arrays.swift.gyb b/stdlib/public/core/Arrays.swift.gyb
index 4913744..f06ba63 100644
--- a/stdlib/public/core/Arrays.swift.gyb
+++ b/stdlib/public/core/Arrays.swift.gyb
@@ -169,8 +169,8 @@
 ///
 /// Arrays are one of the most commonly used data types in an app. You use
 /// arrays to organize your app's data. Specifically, you use the `Array` type
-/// to hold elements of a single type, the array's `Element` type. An array's
-/// elements can be anything from an integer to a string to a class.
+/// to hold elements of a single type, the array's `Element` type. An array
+/// can store any kind of elements---from integers to strings to classes.
 ///
 /// Swift makes it easy to create arrays in your code using an array literal:
 /// simply surround a comma separated list of values with square brackets.
@@ -261,8 +261,8 @@
 ///     var students = ["Ben", "Ivy", "Jordell"]
 ///
 /// To add single elements to the end of an array, use the `append(_:)` method.
-/// Add multiple elements at once by passing another array or a sequence of
-/// any kind to the `append(contentsOf:)` method.
+/// Add multiple elements at the same time by passing another array or a
+/// sequence of any kind to the `append(contentsOf:)` method.
 ///
 ///     students.append("Maxime")
 ///     students.append(contentsOf: ["Shakia", "William"])
@@ -271,8 +271,8 @@
 /// You can add new elements in the middle of an array by using the
 /// `insert(_:at:)` method for single elements and by using
 /// `insert(contentsOf:at:)` to insert multiple elements from another
-/// collection or array literal. The elements at that index and later are
-/// shifted back to make room.
+/// collection or array literal. The elements at that index and later indices
+/// are shifted back to make room.
 ///
 ///     students.insert("Liam", at: 3)
 ///     // ["Ben", "Ivy", "Jordell", "Liam", "Maxime", "Shakia", "William"]
@@ -288,8 +288,8 @@
 ///     students.removeLast()
 ///     // ["Ivy", "Jordell", "Liam", "Maxime", "Shakia"]
 ///
-/// You can replace an existing element with a new value by assigning to the
-/// subscript.
+/// You can replace an existing element with a new value by assigning the new
+/// value to the subscript.
 ///
 ///     if let i = students.index(of: "Maxime") {
 ///         students[i] = "Max"
@@ -423,7 +423,7 @@
 ///
 /// Bridging from `Array` to `NSArray` takes O(1) time and O(1) space if the
 /// array's elements are already instances of a class or an `@objc` protocol;
-/// otherwise, it takes O(n) time and space.
+/// otherwise, it takes O(*n*) time and space.
 ///
 /// Bridging from `NSArray` to `Array` first calls the `copy(with:)`
 /// (`- copyWithZone:` in Objective-C) method on the array to get an immutable
diff --git a/stdlib/public/core/BridgeObjectiveC.swift b/stdlib/public/core/BridgeObjectiveC.swift
index ff03fc3..79af11b 100644
--- a/stdlib/public/core/BridgeObjectiveC.swift
+++ b/stdlib/public/core/BridgeObjectiveC.swift
@@ -162,6 +162,20 @@
 @_silgen_name("_swift_bridgeAnythingNonVerbatimToObjectiveC")
 public func _bridgeAnythingNonVerbatimToObjectiveC<T>(_ x: T) -> AnyObject
 
+/// Convert a purportedly-nonnull `id` value from Objective-C into an Any.
+///
+/// Since Objective-C APIs sometimes get their nullability annotations wrong,
+/// this includes a failsafe against nil `AnyObject`s, wrapping them up as
+/// a nil `AnyObject?`-inside-an-`Any`.
+///
+/// COMPILER_INTRINSIC
+public func _bridgeAnyObjectToAny(_ possiblyNullObject: AnyObject?) -> Any {
+  if let nonnullObject = possiblyNullObject {
+    return nonnullObject // AnyObject-in-Any
+  }
+  return possiblyNullObject // AnyObject?-in-Any
+}
+
 /// Convert `x` from its Objective-C representation to its Swift
 /// representation.
 ///
@@ -546,7 +560,7 @@
     _item14 = _item0
     _item15 = _item0
 
-    _sanityCheck(MemoryLayout._ofInstance(self).size >=
+    _sanityCheck(MemoryLayout.size(ofValue: self) >=
                    MemoryLayout<Optional<UnsafeRawPointer>>.size * count)
   }
 }
diff --git a/stdlib/public/core/Builtin.swift b/stdlib/public/core/Builtin.swift
index da8502c..96519ce 100644
--- a/stdlib/public/core/Builtin.swift
+++ b/stdlib/public/core/Builtin.swift
@@ -20,7 +20,7 @@
   Builtin.unreachable()
 }
 
-@available(*, unavailable, message: "use MemoryLayout<T>.size instead.")
+@available(*, unavailable, renamed: "MemoryLayout.size(ofValue:)")
 public func sizeofValue<T>(_:T) -> Int {
   Builtin.unreachable()
 }
@@ -30,7 +30,7 @@
   Builtin.unreachable()
 }
 
-@available(*, unavailable, message: "use MemoryLayout<T>.alignment instead.")
+@available(*, unavailable, renamed: "MemoryLayout.alignment(ofValue:)")
 public func alignofValue<T>(_:T) -> Int {
   Builtin.unreachable()
 }
@@ -40,7 +40,7 @@
   Builtin.unreachable()
 }
 
-@available(*, unavailable, message: "use MemoryLayout<T>.stride instead.")
+@available(*, unavailable, renamed: "MemoryLayout.stride(ofValue:)")
 public func strideofValue<T>(_:T) -> Int {
   Builtin.unreachable()
 }
diff --git a/stdlib/public/core/CMakeLists.txt b/stdlib/public/core/CMakeLists.txt
index 2917dea..f4fa91e 100644
--- a/stdlib/public/core/CMakeLists.txt
+++ b/stdlib/public/core/CMakeLists.txt
@@ -44,6 +44,7 @@
   CString.swift
   CTypes.swift
   DebuggerSupport.swift
+  DropWhile.swift.gyb
   EmptyCollection.swift
   Equatable.swift
   ErrorType.swift
@@ -88,6 +89,7 @@
   OutputStream.swift
   Pointer.swift
   Policy.swift
+  PrefixWhile.swift.gyb
   Print.swift
   RandomAccessCollection.swift
   Range.swift.gyb
@@ -174,7 +176,7 @@
       ${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY})
 endif()
 
-if(CMAKE_SYSTEM_NAME STREQUAL "CYGWIN")
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
   execute_process(COMMAND "cygpath" "-u" "$ENV{SYSTEMROOT}"
       OUTPUT_VARIABLE ENV_SYSTEMROOT)
 
diff --git a/stdlib/public/core/Character.swift b/stdlib/public/core/Character.swift
index 74fc63b..52d83eb 100644
--- a/stdlib/public/core/Character.swift
+++ b/stdlib/public/core/Character.swift
@@ -176,7 +176,7 @@
     let (count, initialUTF8) = s._core._encodeSomeUTF8(from: 0)
     // Notice that the result of sizeof() is a small non-zero number and can't
     // overflow when multiplied by 8.
-    let bits = MemoryLayout._ofInstance(initialUTF8).size &* 8 &- 1
+    let bits = MemoryLayout.size(ofValue: initialUTF8) &* 8 &- 1
     if _fastPath(
       count == s._core.count && (initialUTF8 & (1 << numericCast(bits))) != 0) {
       _representation = .small(Builtin.trunc_Int64_Int63(initialUTF8._value))
diff --git a/stdlib/public/core/Collection.swift b/stdlib/public/core/Collection.swift
index b2079e4..ebcec3f 100644
--- a/stdlib/public/core/Collection.swift
+++ b/stdlib/public/core/Collection.swift
@@ -528,7 +528,7 @@
 /// able to calculate its `count` property in O(1) time. Conversely, because a
 /// forward or bidirectional collection must traverse the entire collection to
 /// count the number of contained elements, accessing its `count` property is
-/// an O(N) operation.
+/// an O(*n*) operation.
 public protocol Collection : Indexable, Sequence {
   /// A type that can represent the number of steps between a pair of
   /// indices.
@@ -751,7 +751,7 @@
   /// or `Optional(nil)` if an element was determined to be missing;
   /// otherwise, `nil`.
   ///
-  /// - Complexity: O(N).
+  /// - Complexity: O(*n*)
   func _customIndexOfEquatableElement(_ element: Iterator.Element) -> Index??
 
   /// The first element of the collection.
@@ -1209,7 +1209,7 @@
   /// Customization point for `Collection.index(of:)`.
   ///
   /// Define this method if the collection can find an element in less than
-  /// O(N) by exploiting collection-specific knowledge.
+  /// O(*n*) by exploiting collection-specific knowledge.
   ///
   /// - Returns: `nil` if a linear search should be attempted instead,
   ///   `Optional(nil)` if the element was not found, or
@@ -1319,6 +1319,25 @@
       offsetBy: numericCast(amount), limitedBy: endIndex) ?? endIndex
     return self[startIndex..<end]
   }
+  
+  /// Returns a subsequence by skipping elements while `predicate` returns
+  /// `true` and returning the remaining elements.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the
+  ///   sequence as its argument and returns `true` if the element should
+  ///   be skipped or `false` if it should be included. Once the predicate
+  ///   returns `false` it will not be called again.
+  ///
+  /// - Complexity: O(*n*), where *n* is the length of the collection.
+  public func drop(
+    while predicate: (Iterator.Element) throws -> Bool
+  ) rethrows -> SubSequence {
+    var start = startIndex
+    while try start != endIndex && predicate(self[start]) {
+      formIndex(after: &start)
+    } 
+    return self[start..<endIndex]
+  }
 
   /// Returns a subsequence, up to the specified maximum length, containing
   /// the initial elements of the collection.
@@ -1344,6 +1363,25 @@
       offsetBy: numericCast(maxLength), limitedBy: endIndex) ?? endIndex
     return self[startIndex..<end]
   }
+  
+  /// Returns a subsequence containing the initial elements until `predicate`
+  /// returns `false` and skipping the remaining elements.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the
+  ///   sequence as its argument and returns `true` if the element should
+  ///   be included or `false` if it should be excluded. Once the predicate
+  ///   returns `false` it will not be called again.
+  ///
+  /// - Complexity: O(*n*), where *n* is the length of the collection.
+  public func prefix(
+    while predicate: (Iterator.Element) throws -> Bool
+  ) rethrows -> SubSequence {
+    var end = startIndex
+    while try end != endIndex && predicate(self[end]) {
+      formIndex(after: &end)
+    }
+    return self[startIndex..<end]
+  }
 
   /// Returns a subsequence, up to the given maximum length, containing the
   /// final elements of the collection.
diff --git a/stdlib/public/core/CollectionAlgorithms.swift.gyb b/stdlib/public/core/CollectionAlgorithms.swift.gyb
index 3045ff5..92b9598 100644
--- a/stdlib/public/core/CollectionAlgorithms.swift.gyb
+++ b/stdlib/public/core/CollectionAlgorithms.swift.gyb
@@ -597,6 +597,22 @@
   }
 }
 
+extension Sequence {
+  @available(*, unavailable, renamed: "sorted(by:)")
+  public func sort(
+    _ isOrderedBefore: (${IElement}, ${IElement}) -> Bool
+  ) -> [${IElement}] {
+    Builtin.unreachable()
+  }
+}
+
+extension Sequence where ${IElement} : Comparable {
+  @available(*, unavailable, renamed: "sorted()")
+  public func sort() -> [${IElement}] {
+    Builtin.unreachable()
+  }
+}
+
 extension MutableCollection
   where
   Self : RandomAccessCollection,
@@ -611,7 +627,7 @@
 extension MutableCollection where Self : RandomAccessCollection {
   @available(*, unavailable, renamed: "sort(by:)")
   public mutating func sortInPlace(
-    _ isOrderedBefore: (Iterator.Element, Iterator.Element) -> Bool
+    _ isOrderedBefore: (${IElement}, ${IElement}) -> Bool
   ) {
     Builtin.unreachable()
   }
diff --git a/stdlib/public/core/CompilerProtocols.swift b/stdlib/public/core/CompilerProtocols.swift
index e3f3102..3df6243 100644
--- a/stdlib/public/core/CompilerProtocols.swift
+++ b/stdlib/public/core/CompilerProtocols.swift
@@ -613,6 +613,7 @@
 ///           String(stringInterpolationSegment: " cookies: $"),
 ///           String(stringInterpolationSegment: price * number),
 ///           String(stringInterpolationSegment: "."))
+@available(*, deprecated, message: "it will be replaced or redesigned in Swift 4.0.  Instead of conforming to 'ExpressibleByStringInterpolation', consider adding an 'init(_:String)'")
 public protocol ExpressibleByStringInterpolation {
   /// Creates an instance by concatenating the given values.
   ///
@@ -736,7 +737,7 @@
 @available(*, deprecated, renamed: "ExpressibleByDictionaryLiteral")
 public typealias DictionaryLiteralConvertible
   = ExpressibleByDictionaryLiteral
-@available(*, deprecated, renamed: "ExpressibleByStringInterpolation")
+@available(*, deprecated, message: "it will be replaced or redesigned in Swift 4.0.  Instead of conforming to 'StringInterpolationConvertible', consider adding an 'init(_:String)'")
 public typealias StringInterpolationConvertible
   = ExpressibleByStringInterpolation
 @available(*, deprecated, renamed: "_ExpressibleByColorLiteral")
diff --git a/stdlib/public/core/ContiguousArrayBuffer.swift b/stdlib/public/core/ContiguousArrayBuffer.swift
index 85add43..120c8ea 100644
--- a/stdlib/public/core/ContiguousArrayBuffer.swift
+++ b/stdlib/public/core/ContiguousArrayBuffer.swift
@@ -469,7 +469,7 @@
   ///
   /// - Precondition: `U` is a class or `@objc` existential.
   ///
-  /// - Complexity: O(N).
+  /// - Complexity: O(*n*)
   func storesOnlyElementsOfType<U>(
     _: U.Type
   ) -> Bool {
diff --git a/stdlib/public/core/DebuggerSupport.swift b/stdlib/public/core/DebuggerSupport.swift
index e583296..c0fb62e 100644
--- a/stdlib/public/core/DebuggerSupport.swift
+++ b/stdlib/public/core/DebuggerSupport.swift
@@ -283,6 +283,10 @@
     }
   }
 
+  // LLDB uses this function in expressions, and if it is inlined the resulting
+  // LLVM IR is enormous.  As a result, to improve LLDB performance we have made
+  // this stdlib_binary_only, which prevents inlining.
+  @_semantics("stdlib_binary_only")
   public static func stringForPrintObject(_ value: Any) -> String {
     var maxItemCounter = Int.max
     var refs = Set<ObjectIdentifier>()
diff --git a/stdlib/public/core/DropWhile.swift.gyb b/stdlib/public/core/DropWhile.swift.gyb
new file mode 100644
index 0000000..00ae2c2
--- /dev/null
+++ b/stdlib/public/core/DropWhile.swift.gyb
@@ -0,0 +1,211 @@
+//===--- DropWhile.swift.gyb - Lazy views for drop(while:) ----------------===//
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+//===----------------------------------------------------------------------===//
+
+%{
+from gyb_stdlib_support import (
+    TRAVERSALS,
+    collectionForTraversal
+)
+}%
+
+//===--- Iterator & Sequence ----------------------------------------------===//
+
+/// An iterator over the elements traversed by a base iterator that follow the
+/// initial consecutive elements that satisfy a given predicate.
+///
+/// This is the associated iterator for the `LazyDropWhileSequence`,
+/// `LazyDropWhileCollection`, and `LazyDropWhileBidirectionalCollection`
+/// types.
+public struct LazyDropWhileIterator<Base : IteratorProtocol> :
+  IteratorProtocol, Sequence {
+
+  public mutating func next() -> Base.Element? {
+    // Once the predicate has failed for the first time, the base iterator
+    // can be used for the rest of the elements.
+    if _predicateHasFailed {
+      return _base.next()
+    }
+
+    // Retrieve and discard elements from the base iterator until one fails
+    // the predicate.
+    while let nextElement = _base.next() {
+      if !_predicate(nextElement) {
+        _predicateHasFailed = true
+        return nextElement
+      }
+    }
+    return nil
+  }
+
+  internal init(_base: Base, predicate: @escaping (Base.Element) -> Bool) {
+    self._base = _base
+    self._predicate = predicate
+  }
+
+  internal var _predicateHasFailed = false
+  internal var _base: Base
+  internal let _predicate: (Base.Element) -> Bool
+}
+
+/// A sequence whose elements consist of the elements that follow the initial
+/// consecutive elements of some base sequence that satisfy a given predicate.
+public struct LazyDropWhileSequence<Base : Sequence> : LazySequenceProtocol {
+
+  public typealias Elements = LazyDropWhileSequence
+
+  /// Returns an iterator over the elements of this sequence.
+  ///
+  /// - Complexity: O(1).
+  public func makeIterator() -> LazyDropWhileIterator<Base.Iterator> {
+    return LazyDropWhileIterator(
+      _base: _base.makeIterator(), predicate: _predicate)
+  }
+
+  /// Create an instance with elements `transform(x)` for each element
+  /// `x` of base.
+  internal init(_base: Base, predicate: @escaping (Base.Iterator.Element) -> Bool) {
+    self._base = _base
+    self._predicate = predicate
+  }
+
+  internal var _base: Base
+  internal let _predicate: (Base.Iterator.Element) -> Bool
+}
+
+extension LazySequenceProtocol {
+  /// Returns a lazy sequence that skips any initial elements that satisfy
+  /// `predicate`.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the sequence as
+  ///   its argument and returns `true` if the element should be skipped or
+  ///   `false` otherwise. Once `predicate` returns `false` it will not be
+  ///   called again.
+  public func drop(
+    while predicate: @escaping (Elements.Iterator.Element) -> Bool
+  ) -> LazyDropWhileSequence<Self.Elements> {
+    return LazyDropWhileSequence(_base: self.elements, predicate: predicate)
+  }
+}
+
+//===--- Collections ------------------------------------------------------===//
+
+/// A position in a `LazyDropWhileCollection` or
+/// `LazyDropWhileBidirectionalCollection` instance.
+public struct LazyDropWhileIndex<Base : Collection> : Comparable {
+  /// The position corresponding to `self` in the underlying collection.
+  public let base: Base.Index
+}
+
+public func == <Base : Collection>(
+  lhs: LazyDropWhileIndex<Base>,
+  rhs: LazyDropWhileIndex<Base>
+) -> Bool {
+  return lhs.base == rhs.base
+}
+
+public func < <Base : Collection>(
+  lhs: LazyDropWhileIndex<Base>,
+  rhs: LazyDropWhileIndex<Base>
+) -> Bool {
+  return lhs.base < rhs.base
+}
+
+% for Traversal in ['Forward', 'Bidirectional']:
+%   Collection = collectionForTraversal(Traversal)
+%   Self = "LazyDropWhile" + Collection
+
+/// A lazy `${Collection}` wrapper that includes the elements of an underlying
+/// collection after any initial consecutive elements that satisfy a
+/// predicate.
+///
+/// - Note: The performance of accessing `startIndex`, `first`, or any methods
+///   that depend on `startIndex` depends on how many elements satisfy the
+///   predicate at the start of the collection, and may not offer the usual
+///   performance given by the `Collection` protocol. Be aware, therefore,
+///   that general operations on `${Self}` instances may not have the
+///   documented complexity.
+public struct ${Self}<
+  Base : ${Collection}
+> : LazyCollectionProtocol, ${Collection} {
+
+  // FIXME(compiler limitation): should be inferrable.
+  public typealias Index = LazyDropWhileIndex<Base>
+
+  public var startIndex: Index {
+    var index = _base.startIndex
+    while index != _base.endIndex && _predicate(_base[index]) {
+      _base.formIndex(after: &index)
+    }
+    return LazyDropWhileIndex(base: index)
+  }
+
+  public var endIndex: Index {
+    return LazyDropWhileIndex(base: _base.endIndex)
+  }
+
+  public func index(after i: Index) -> Index {
+    _precondition(i.base < _base.endIndex, "can't advance past endIndex")
+    return LazyDropWhileIndex(base: _base.index(after: i.base))
+  }
+
+%   if Traversal == 'Bidirectional':
+
+  public func index(before i: Index) -> Index {
+    _precondition(i > startIndex, "can't move before startIndex")
+    return LazyDropWhileIndex(base: _base.index(before: i.base))
+  }
+
+%   end
+
+  public subscript(position: Index) -> Base.Iterator.Element {
+    return _base[position.base]
+  }
+
+  public func makeIterator() -> LazyDropWhileIterator<Base.Iterator> {
+    return LazyDropWhileIterator(
+      _base: _base.makeIterator(), predicate: _predicate)
+  }
+
+  internal init(_base: Base, predicate: @escaping (Base.Iterator.Element) -> Bool) {
+    self._base = _base
+    self._predicate = predicate
+  }
+
+  internal var _base: Base
+  internal let _predicate: (Base.Iterator.Element) -> Bool
+}
+
+extension LazyCollectionProtocol
+  where
+  Self : ${Collection},
+  Elements : ${Collection}
+{
+  /// Returns a lazy collection that skips any initial elements that satisfy
+  /// `predicate`.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the collection
+  ///   as its argument and returns `true` if the element should be skipped or
+  ///   `false` otherwise. Once `predicate` returns `false` it will not be
+  ///   called again.
+  public func drop(
+    while predicate: @escaping (Elements.Iterator.Element) -> Bool
+  ) -> LazyDropWhile${Collection}<Self.Elements> {
+    return LazyDropWhile${Collection}(
+      _base: self.elements, predicate: predicate)
+  }
+}
+
+% end
+
+// ${'Local Variables'}:
+// eval: (read-only-mode 1)
+// End:
diff --git a/stdlib/public/core/Equatable.swift b/stdlib/public/core/Equatable.swift
index 980cecb..f21acb6 100644
--- a/stdlib/public/core/Equatable.swift
+++ b/stdlib/public/core/Equatable.swift
@@ -191,7 +191,7 @@
 /// same value. For value equality, see the equal-to operator (`==`) and the
 /// `Equatable` protocol.
 ///
-/// The following example defines an `IntegerRef` type; an integer type with
+/// The following example defines an `IntegerRef` type, an integer type with
 /// reference semantics.
 ///
 ///     class IntegerRef: Equatable {
@@ -218,7 +218,7 @@
 ///     // Prints "true"
 ///
 /// The identical-to operator (`===`) returns `false` when comparing two
-/// references to different objects instances, even if the two instances have
+/// references to different object instances, even if the two instances have
 /// the same value.
 ///
 ///     let c = IntegerRef(10)
diff --git a/stdlib/public/core/ExistentialCollection.swift.gyb b/stdlib/public/core/ExistentialCollection.swift.gyb
index 892da31..9d7d637 100644
--- a/stdlib/public/core/ExistentialCollection.swift.gyb
+++ b/stdlib/public/core/ExistentialCollection.swift.gyb
@@ -200,6 +200,12 @@
 %   end
 
 %   override = 'override' if Kind != 'Sequence' else ''
+  internal ${override} func _drop(
+    while predicate: (Element) throws -> Bool
+  ) rethrows -> _Any${Kind}Box<Element> {
+    _abstract()
+  }
+  
   internal ${override} func _dropFirst(_ n: Int) -> _Any${Kind}Box<Element> {
     _abstract()
   }
@@ -211,6 +217,12 @@
   internal ${override} func _prefix(_ maxLength: Int) -> _Any${Kind}Box<Element> {
     _abstract()
   }
+  
+  internal ${override} func _prefix(
+    while predicate: (Element) throws -> Bool
+  ) rethrows -> _Any${Kind}Box<Element> {
+    _abstract()
+  }
 
   internal ${override} func _suffix(_ maxLength: Int) -> _Any${Kind}Box<Element> {
     _abstract()
@@ -379,12 +391,22 @@
     -> UnsafeMutablePointer<Element> {
     return _base._copyContents(initializing: ptr)
   }
+  internal override func _drop(
+    while predicate: (Element) throws -> Bool
+  ) rethrows -> _Any${Kind}Box<Element> {
+    return try _${Kind}Box<S.SubSequence>(_base: _base.drop(while: predicate))
+  }
   internal override func _dropFirst(_ n: Int) -> _Any${Kind}Box<Element> {
     return _${Kind}Box<S.SubSequence>(_base: _base.dropFirst(n))
   }
   internal override func _dropLast(_ n: Int) -> _Any${Kind}Box<Element> {
     return _${Kind}Box<S.SubSequence>(_base: _base.dropLast(n))
   }
+  internal override func _prefix(
+    while predicate: (Element) throws -> Bool
+  ) rethrows -> _Any${Kind}Box<Element> {
+    return try _${Kind}Box<S.SubSequence>(_base: _base.prefix(while: predicate))
+  }
   internal override func _prefix(_ maxLength: Int) -> _Any${Kind}Box<Element> {
     return _${Kind}Box<S.SubSequence>(_base: _base.prefix(maxLength))
   }
@@ -537,7 +559,7 @@
     return _makeUnderlyingIterator()
   }
 
-  internal var _makeUnderlyingIterator: @escaping () -> Iterator
+  internal var _makeUnderlyingIterator: () -> Iterator
 }
 
 /// A type-erased sequence.
@@ -606,6 +628,12 @@
     return try _box._forEach(body)
   }
 
+  public func drop(
+    while predicate: (Element) throws -> Bool
+  ) rethrows -> Any${Kind}<Element> {
+    return try Any${Kind}(_box: _box._drop(while: predicate))
+  }
+
   public func dropFirst(_ n: Int) -> Any${Kind}<Element> {
     return Any${Kind}(_box: _box._dropFirst(n))
   }
@@ -614,6 +642,12 @@
     return Any${Kind}(_box: _box._dropLast(n))
   }
 
+  public func prefix(
+    while predicate: (Element) throws -> Bool
+  ) rethrows -> Any${Kind}<Element> {
+    return try Any${Kind}(_box: _box._prefix(while: predicate))
+  }
+
   public func prefix(_ maxLength: Int) -> Any${Kind}<Element> {
     return Any${Kind}(_box: _box._prefix(maxLength))
   }
@@ -928,7 +962,7 @@
 
   /// The number of elements.
   ///
-  /// - Complexity: ${'O(1)' if Traversal == 'RandomAccess' else 'O(N)'}
+  /// - Complexity: ${'O(1)' if Traversal == 'RandomAccess' else 'O(*n*)'}
   public var count: IntMax {
     return _box._count
   }
diff --git a/stdlib/public/core/Filter.swift.gyb b/stdlib/public/core/Filter.swift.gyb
index e7edb1a..befbc38 100644
--- a/stdlib/public/core/Filter.swift.gyb
+++ b/stdlib/public/core/Filter.swift.gyb
@@ -201,7 +201,7 @@
   ///
   /// In an empty collection, `startIndex == endIndex`.
   ///
-  /// - Complexity: O(N), where N is the ratio between unfiltered and
+  /// - Complexity: O(*n*), where *n* is the ratio between unfiltered and
   ///   filtered collection counts.
   public var startIndex: Index {
     var index = _base.startIndex
diff --git a/stdlib/public/core/GroupInfo.json b/stdlib/public/core/GroupInfo.json
index 5b8c398..9cb01cb 100644
--- a/stdlib/public/core/GroupInfo.json
+++ b/stdlib/public/core/GroupInfo.json
@@ -63,6 +63,8 @@
         "Filter.swift",
         "Reverse.swift",
         "Slice.swift",
+        "DropWhile.swift",
+        "PrefixWhile.swift",
         "SequenceWrapper.swift",
         "LazyCollection.swift",
         "LazySequence.swift"],
diff --git a/stdlib/public/core/HashedCollections.swift.gyb b/stdlib/public/core/HashedCollections.swift.gyb
index b7ebc61..9107e37 100644
--- a/stdlib/public/core/HashedCollections.swift.gyb
+++ b/stdlib/public/core/HashedCollections.swift.gyb
@@ -421,7 +421,7 @@
 /// set's `Element` type is neither a class nor an `@objc` protocol, any
 /// required bridging of elements occurs at the first access of each element,
 /// so the first operation that uses the contents of the set (for example, a
-/// membership test) can take O(N).
+/// membership test) can take O(*n*).
 ///
 /// Bridging from `NSSet` to `Set` first calls the `copy(with:)` method
 /// (`- copyWithZone:` in Objective-C) on the set to get an immutable copy and
@@ -996,7 +996,7 @@
   ///
   /// In the following example, the `bothNeighborsAndEmployees` set is made up
   /// of the elements that are in *both* the `employees` and `neighbors` sets.
-  /// Elements that are only in one or the other are left out of the result of
+  /// Elements that are in only one or the other are left out of the result of
   /// the intersection.
   ///
   ///     let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
@@ -1278,15 +1278,6 @@
 
 //===--- Compiler conversion/casting entry points for Set<Element> --------===//
 
-func _impossible<T>(_:T.Type) -> T {
-  Builtin.unreachable()
-}
-
-func _unsafeUpcast<T, U>(_ x: T, to: U.Type) -> U {
-  _sanityCheck(x is U)
-  return x as? U ?? _impossible(U.self)
-}
-
 /// Perform a non-bridged upcast that always succeeds.
 ///
 /// - Precondition: `BaseValue` is a base class or base `@objc`
@@ -1295,7 +1286,7 @@
   -> Set<BaseValue> {
   var builder = _SetBuilder<BaseValue>(count: source.count)
   for x in source {
-    builder.add(member: _unsafeUpcast(x, to: BaseValue.self))
+    builder.add(member: x as! BaseValue)
   }
   return builder.take()
 }
@@ -1748,7 +1739,7 @@
   ///   the dictionary; otherwise, `nil`.
   @inline(__always)
   public func index(forKey key: Key) -> Index? {
-    // Complexity: amortized O(1) for native storage, O(N) when wrapping an
+    // Complexity: amortized O(1) for native storage, O(*n*) when wrapping an
     // NSDictionary.
     return _variantStorage.index(forKey: key)
   }
@@ -2220,8 +2211,7 @@
   var result = Dictionary<BaseKey, BaseValue>(minimumCapacity: source.count)
 
   for (k, v) in source {
-    result[_unsafeUpcast(k, to: BaseKey.self)]
-      = _unsafeUpcast(v, to: BaseValue.self)
+    result[k as! BaseKey] = v as! BaseValue
   }
   return result
 }
@@ -5227,7 +5217,7 @@
   ///
   /// In the following example, the `bothNeighborsAndEmployees` set is made up
   /// of the elements that are in *both* the `employees` and `neighbors` sets.
-  /// Elements that are only in one or the other are left out of the result of
+  /// Elements that are in only one or the other are left out of the result of
   /// the intersection.
   ///
   ///     let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
diff --git a/stdlib/public/core/InputStream.swift b/stdlib/public/core/InputStream.swift
index 6a839eb..51002a4 100644
--- a/stdlib/public/core/InputStream.swift
+++ b/stdlib/public/core/InputStream.swift
@@ -71,3 +71,8 @@
   _swift_stdlib_free(linePtr)
   return result
 }
+
+@available(*, unavailable, renamed: "readLine(strippingNewline:)")
+public func readLine(stripNewline: Bool = true) -> String? {
+  Builtin.unreachable()
+}
diff --git a/stdlib/public/core/LazyCollection.swift.gyb b/stdlib/public/core/LazyCollection.swift.gyb
index e0166ff..7c267d5 100644
--- a/stdlib/public/core/LazyCollection.swift.gyb
+++ b/stdlib/public/core/LazyCollection.swift.gyb
@@ -86,7 +86,7 @@
   /// Returns a value less than or equal to the number of elements in
   /// `self`, **nondestructively**.
   ///
-  /// - Complexity: O(N).
+  /// - Complexity: O(*n*)
   public var underestimatedCount: Int { return _base.underestimatedCount }
 
   public func _copyToContiguousArray()
@@ -158,7 +158,7 @@
   /// Returns the number of elements.
   ///
   /// - Complexity: O(1) if `Self` conforms to `RandomAccessCollection`;
-  ///   O(N) otherwise.
+  ///   O(*n*) otherwise.
   public var count: Base.IndexDistance {
     return _base.count
   }
@@ -169,7 +169,7 @@
   /// Returns `Optional(Optional(index))` if an element was found;
   /// `nil` otherwise.
   ///
-  /// - Complexity: O(N).
+  /// - Complexity: O(*n*)
   public func _customIndexOfEquatableElement(
     _ element: Base.Iterator.Element
   ) -> Index?? {
diff --git a/stdlib/public/core/LazySequence.swift b/stdlib/public/core/LazySequence.swift
index 8356ad6..a051972 100644
--- a/stdlib/public/core/LazySequence.swift
+++ b/stdlib/public/core/LazySequence.swift
@@ -44,7 +44,7 @@
 ///       ///
 ///       ///     (1..<6).scan(0, +) // [0, 1, 3, 6, 10, 15]
 ///       ///
-///       /// - Complexity: O(N)
+///       /// - Complexity: O(n)
 ///       func scan<ResultElement>(
 ///         _ initial: ResultElement,
 ///         _ nextPartialResult: (ResultElement, Iterator.Element) -> ResultElement
diff --git a/stdlib/public/core/LifetimeManager.swift b/stdlib/public/core/LifetimeManager.swift
index c2151fc..f3f6aa2 100644
--- a/stdlib/public/core/LifetimeManager.swift
+++ b/stdlib/public/core/LifetimeManager.swift
@@ -95,3 +95,50 @@
 {
   Builtin.unreachable()
 }
+
+@available(*, unavailable, message:"use nested withUnsafeMutablePointer(to:_:) instead")
+public func withUnsafeMutablePointers<A0, A1, Result>(
+  _ arg0: inout A0,
+  _ arg1: inout A1,
+  _ body: (
+    UnsafeMutablePointer<A0>, UnsafeMutablePointer<A1>) throws -> Result
+) rethrows -> Result {
+  Builtin.unreachable()
+}
+
+@available(*, unavailable, message:"use nested withUnsafeMutablePointer(to:_:) instead")
+public func withUnsafeMutablePointers<A0, A1, A2, Result>(
+  _ arg0: inout A0,
+  _ arg1: inout A1,
+  _ arg2: inout A2,
+  _ body: (
+    UnsafeMutablePointer<A0>,
+    UnsafeMutablePointer<A1>,
+    UnsafeMutablePointer<A2>
+  ) throws -> Result
+) rethrows -> Result {
+  Builtin.unreachable()
+}
+
+@available(*, unavailable, message:"use nested withUnsafePointer(to:_:) instead")
+public func withUnsafePointers<A0, A1, Result>(
+  _ arg0: inout A0,
+  _ arg1: inout A1,
+  _ body: (UnsafePointer<A0>, UnsafePointer<A1>) throws -> Result
+) rethrows -> Result {
+  Builtin.unreachable()
+}
+
+@available(*, unavailable, message:"use nested withUnsafePointer(to:_:) instead")
+public func withUnsafePointers<A0, A1, A2, Result>(
+  _ arg0: inout A0,
+  _ arg1: inout A1,
+  _ arg2: inout A2,
+  _ body: (
+    UnsafePointer<A0>,
+    UnsafePointer<A1>,
+    UnsafePointer<A2>
+  ) throws -> Result
+) rethrows -> Result {
+  Builtin.unreachable()
+}
diff --git a/stdlib/public/core/ManagedBuffer.swift b/stdlib/public/core/ManagedBuffer.swift
index 9dfd62d..309d23d 100644
--- a/stdlib/public/core/ManagedBuffer.swift
+++ b/stdlib/public/core/ManagedBuffer.swift
@@ -514,7 +514,31 @@
   return _isUnique(&object)
 }
 
+
+@available(*, unavailable, renamed: "ManagedBuffer")
+public typealias ManagedProtoBuffer<Header, Element> =
+  ManagedBuffer<Header, Element>
+
+extension ManagedBuffer {
+  @available(*, unavailable, renamed: "create(minimumCapacity:makingHeaderWith:)")
+  public final class func create(
+    _ minimumCapacity: Int,
+    initialValue: (ManagedBuffer<Header, Element>) -> Header
+  ) -> ManagedBuffer<Header, Element> {
+    Builtin.unreachable()
+  }
+}
+
 extension ManagedBufferPointer {
+  @available(*, unavailable, renamed: "init(bufferClass:minimumCapacity:makingHeaderWith:)")
+  public init(
+    bufferClass: AnyClass,
+    minimumCapacity: Int,
+    initialValue: (_ buffer: AnyObject, _ allocatedCount: (AnyObject) -> Int) -> Header
+  ) {
+    Builtin.unreachable()
+  }
+
   @available(*, unavailable, renamed: "capacity")
   public var allocatedElementCount: Int {
     Builtin.unreachable()
diff --git a/stdlib/public/core/Map.swift.gyb b/stdlib/public/core/Map.swift.gyb
index 5f10ad9..9821c91 100644
--- a/stdlib/public/core/Map.swift.gyb
+++ b/stdlib/public/core/Map.swift.gyb
@@ -60,7 +60,7 @@
   /// Returns a value less than or equal to the number of elements in
   /// `self`, **nondestructively**.
   ///
-  /// - Complexity: O(N).
+  /// - Complexity: O(*n*)
   public var underestimatedCount: Int {
     return _base.underestimatedCount
   }
@@ -150,7 +150,7 @@
   /// The number of elements in the collection.
   ///
   /// - Complexity: O(1) if `Index` conforms to `RandomAccessIndex`;
-  ///   O(N) otherwise.
+  ///   O(*n*) otherwise.
   public var count: Base.IndexDistance {
     return _base.count
   }
diff --git a/stdlib/public/core/MemoryLayout.swift b/stdlib/public/core/MemoryLayout.swift
index a588c99..fdf3384 100644
--- a/stdlib/public/core/MemoryLayout.swift
+++ b/stdlib/public/core/MemoryLayout.swift
@@ -12,30 +12,28 @@
 
 /// The memory layout of a type, describing its size, stride, and alignment.
 public enum MemoryLayout<T> {
-
-  /// The contiguous memory footprint of the type.
+  /// The contiguous memory footprint of `T`.
   ///
-  /// The `size` property for a type `T` does not include any
-  /// dynamically-allocated or "remote" storage. In particular,
-  /// `MemoryLayout<T>.size`, when `T` is a class type, is the same regardless
-  /// of how many stored properties `T` has.
+  /// Does not include any dynamically-allocated or "remote" storage. In
+  /// particular, `MemoryLayout<T>.size`, when `T` is a class type, is the same
+  /// regardless of how many stored properties `T` has.
   @_transparent
   public static var size: Int {
     return Int(Builtin.sizeof(T.self))
   }
 
-  /// The number of bytes from the start of one instance to the start of the
-  /// next, when stored in a contiguous array.
+  /// The number of bytes from the start of one instance of `T` to the start of
+  /// the next in an `Array<T>`.
   ///
   /// This is the same as the number of bytes moved when an `UnsafePointer<T>`
-  /// is incremented. The type may have a lower minimal alignment that trades
-  /// runtime performance for space efficiency. The result is always positive.
+  /// is incremented. `T` may have a lower minimal alignment that trades runtime
+  /// performance for space efficiency. The result is always positive.
   @_transparent
   public static var stride: Int {
     return Int(Builtin.strideof_nonzero(T.self))
   }
 
-  /// The default memory alignment of the type.
+  /// The default memory alignment of `T`.
   @_transparent
   public static var alignment: Int {
     return Int(Builtin.alignof(T.self))
@@ -43,9 +41,30 @@
 }
 
 extension MemoryLayout {
+  /// Returns the contiguous memory footprint of `T`.
+  ///
+  /// Does not include any dynamically-allocated or "remote" storage. In
+  /// particular, `MemoryLayout.size(ofValue: x)`, when `x` is a class instance,
+  /// is the same regardless of how many stored properties `T` has.
   @_transparent
-  public // @testable
-  static func _ofInstance(_: @autoclosure () -> T) -> MemoryLayout<T>.Type {
-    return MemoryLayout<T>.self
+  public static func size(ofValue _: T) -> Int {
+    return MemoryLayout.size
+  }
+
+  /// Returns the number of bytes from the start of one instance of `T` to the
+  /// start of the next in an `Array<T>`.
+  ///
+  /// This is the same as the number of bytes moved when an `UnsafePointer<T>`
+  /// is incremented. `T` may have a lower minimal alignment that trades runtime
+  /// performance for space efficiency. The result is always positive.
+  @_transparent
+  public static func stride(ofValue _: T) -> Int {
+    return MemoryLayout.stride
+  }
+
+  /// Returns the default memory alignment of `T`.
+  @_transparent
+  public static func alignment(ofValue _: T) -> Int {
+    return MemoryLayout.alignment
   }
 }
diff --git a/stdlib/public/core/Mirror.swift b/stdlib/public/core/Mirror.swift
index 9a9358c..af9a3a4 100644
--- a/stdlib/public/core/Mirror.swift
+++ b/stdlib/public/core/Mirror.swift
@@ -840,8 +840,9 @@
   /// string representation of `instance` in one of the following ways,
   /// depending on its protocol conformance:
   ///
-  /// - If `instance` conforms to the `TextOutputStreamable` protocol, the result is
-  ///   obtained by calling `instance.write(to: s)` on an empty string `s`.
+  /// - If `instance` conforms to the `TextOutputStreamable` protocol, the
+  ///   result is obtained by calling `instance.write(to: s)` on an empty
+  ///   string `s`.
   /// - If `instance` conforms to the `CustomStringConvertible` protocol, the
   ///   result is `instance.description`.
   /// - If `instance` conforms to the `CustomDebugStringConvertible` protocol,
@@ -890,8 +891,9 @@
   ///   the result is `subject.debugDescription`.
   /// - If `subject` conforms to the `CustomStringConvertible` protocol, the
   ///   result is `subject.description`.
-  /// - If `subject` conforms to the `TextOutputStreamable` protocol, the result is
-  ///   obtained by calling `subject.write(to: s)` on an empty string `s`.
+  /// - If `subject` conforms to the `TextOutputStreamable` protocol, the
+  ///   result is obtained by calling `subject.write(to: s)` on an empty
+  ///   string `s`.
   /// - An unspecified result is supplied automatically by the Swift standard
   ///   library.
   ///
@@ -944,7 +946,3 @@
 
 @available(*, unavailable, renamed: "MirrorPath")
 public typealias MirrorPathType = MirrorPath
-
-// Staging so we can move the official declarations into PlaygroundSupport
-public typealias _CustomPlaygroundQuickLookable = CustomPlaygroundQuickLookable
-public typealias _PlaygroundQuickLook = PlaygroundQuickLook
diff --git a/stdlib/public/core/MutableCollection.swift b/stdlib/public/core/MutableCollection.swift
index 7a1d745..698d5f0 100644
--- a/stdlib/public/core/MutableCollection.swift
+++ b/stdlib/public/core/MutableCollection.swift
@@ -303,7 +303,7 @@
   ///   collection match `belongsInSecondPartition`, the returned index is
   ///   equal to the collection's `endIndex`.
   ///
-  /// - Complexity: O(n)
+  /// - Complexity: O(*n*)
   mutating func partition(
     by belongsInSecondPartition: (Iterator.Element) throws -> Bool
   ) rethrows -> Index
diff --git a/stdlib/public/core/OptionSet.swift b/stdlib/public/core/OptionSet.swift
index b5c4aad..34337ad 100644
--- a/stdlib/public/core/OptionSet.swift
+++ b/stdlib/public/core/OptionSet.swift
@@ -55,10 +55,10 @@
 /// ========================
 ///
 /// When you need to create an instance of an option set, assign one of the
-/// type's static members to your variable or constant. Alternately, to create
-/// an option set instance with multiple members, assign an array literal with
-/// multiple static members of the option set. To create an empty instance,
-/// assign an empty array literal to your variable.
+/// type's static members to your variable or constant. Alternatively, to
+/// create an option set instance with multiple members, assign an array
+/// literal with multiple static members of the option set. To create an empty
+/// instance, assign an empty array literal to your variable.
 ///
 ///     let singleOption: ShippingOptions = .priority
 ///     let multipleOptions: ShippingOptions = [.nextDay, .secondDay, .priority]
@@ -217,7 +217,7 @@
   /// Adds the given element to the option set if it is not already a member.
   ///
   /// In the following example, the `.secondDay` shipping option is added to
-  /// the `freeOptions` option set if `purchasePrice` is greating than 50. For
+  /// the `freeOptions` option set if `purchasePrice` is greater than 50.0. For
   /// the `ShippingOptions` declaration, see the `OptionSet` protocol
   /// discussion.
   ///
@@ -249,7 +249,7 @@
     return result
   }
   
-  /// Removes the given element and all elements subsumed by the given element.
+  /// Removes the given element and all elements subsumed by it.
   ///
   /// In the following example, the `.priority` shipping option is removed from
   /// the `options` option set. Attempting to remove the same shipping option
@@ -277,8 +277,8 @@
   ///     // Prints "true"
   ///
   /// - Parameter member: The element of the set to remove.
-  /// - Returns: The intersection of `[member]` and the set if the intersection
-  ///   was nonempty; otherwise, `nil`.
+  /// - Returns: The intersection of `[member]` and the set, if the
+  ///   intersection was nonempty; otherwise, `nil`.
   @discardableResult
   public mutating func remove(_ member: Element) -> Element? {
     let r = isSuperset(of: member) ? Optional(member) : nil
diff --git a/stdlib/public/core/PrefixWhile.swift.gyb b/stdlib/public/core/PrefixWhile.swift.gyb
new file mode 100644
index 0000000..3aeb52b
--- /dev/null
+++ b/stdlib/public/core/PrefixWhile.swift.gyb
@@ -0,0 +1,268 @@
+//===--- PrefixWhile.swift.gyb - Lazy views for prefix(while:) ------------===//
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+//===----------------------------------------------------------------------===//
+
+%{
+from gyb_stdlib_support import (
+    TRAVERSALS,
+    collectionForTraversal
+)
+}%
+
+//===--- Iterator & Sequence ----------------------------------------------===//
+
+/// An iterator over the initial elements traversed by a base iterator that
+/// satisfy a given predicate.
+///
+/// This is the associated iterator for the `LazyPrefixWhileSequence`,
+/// `LazyPrefixWhileCollection`, and `LazyPrefixWhileBidirectionalCollection`
+/// types.
+public struct LazyPrefixWhileIterator<Base : IteratorProtocol> :
+  IteratorProtocol, Sequence {
+
+  public mutating func next() -> Base.Element? {
+    // Return elements from the base iterator until one fails the predicate.
+    if !_predicateHasFailed, let nextElement = _base.next() {
+      if _predicate(nextElement) {
+        return nextElement
+      } else {
+        _predicateHasFailed = true
+      }
+    }
+    return nil
+  }
+
+  internal init(_base: Base, predicate: @escaping (Base.Element) -> Bool) {
+    self._base = _base
+    self._predicate = predicate
+  }
+
+  internal var _predicateHasFailed = false
+  internal var _base: Base
+  internal let _predicate: (Base.Element) -> Bool
+}
+
+/// A sequence whose elements consist of the initial consecutive elements of
+/// some base sequence that satisfy a given predicate.
+public struct LazyPrefixWhileSequence<Base : Sequence> : LazySequenceProtocol {
+
+  public typealias Elements = LazyPrefixWhileSequence
+
+  public func makeIterator() -> LazyPrefixWhileIterator<Base.Iterator> {
+    return LazyPrefixWhileIterator(
+      _base: _base.makeIterator(), predicate: _predicate)
+  }
+
+  internal init(_base: Base, predicate: @escaping (Base.Iterator.Element) -> Bool) {
+    self._base = _base
+    self._predicate = predicate
+  }
+
+  internal var _base: Base
+  internal let _predicate: (Base.Iterator.Element) -> Bool
+}
+
+extension LazySequenceProtocol {
+  /// Returns a lazy sequence of the initial consecutive elements that satisfy
+  /// `predicate`.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the sequence as
+  ///   its argument and returns `true` if the element should be included or
+  ///   `false` otherwise. Once `predicate` returns `false` it will not be
+  ///   called again.
+  public func prefix(
+    while predicate: @escaping (Elements.Iterator.Element) -> Bool
+  ) -> LazyPrefixWhileSequence<Self.Elements> {
+    return LazyPrefixWhileSequence(_base: self.elements, predicate: predicate)
+  }
+}
+
+//===--- Collections ------------------------------------------------------===//
+
+/// A position in the base collection of a `LazyPrefixWhileCollection` or the
+/// end of that collection.
+public enum _LazyPrefixWhileIndexRepresentation<Base : Collection> {
+  case index(Base.Index)
+  case pastEnd
+}
+
+/// A position in a `LazyPrefixWhileCollection` or
+/// `LazyPrefixWhileBidirectionalCollection` instance.
+public struct LazyPrefixWhileIndex<Base : Collection> : Comparable {
+  /// The position corresponding to `self` in the underlying collection.
+  internal let _value: _LazyPrefixWhileIndexRepresentation<Base>
+
+  /// Creates a new index wrapper for `i`.
+  internal init(_ i: Base.Index) {
+    self._value = .index(i)
+  }
+
+  /// Creates a new index that can represent the `endIndex` of a
+  /// `LazyPrefixWhileCollection<Base>`. This is not the same as a wrapper
+  /// around `Base.endIndex`.
+  internal init(endOf: Base) {
+    self._value = .pastEnd
+  }
+}
+
+public func == <Base : Collection>(
+  lhs: LazyPrefixWhileIndex<Base>,
+  rhs: LazyPrefixWhileIndex<Base>
+) -> Bool {
+  switch (lhs._value, rhs._value) {
+  case let (.index(l), .index(r)):
+    return l == r
+  case (.pastEnd, .pastEnd):
+    return true
+  default:
+    return false
+  }
+}
+
+public func < <Base : Collection>(
+  lhs: LazyPrefixWhileIndex<Base>,
+  rhs: LazyPrefixWhileIndex<Base>
+) -> Bool {
+  switch (lhs._value, rhs._value) {
+  case let (.index(l), .index(r)):
+    return l < r
+  case (.index, .pastEnd):
+    return true
+  default:
+    return false
+  }
+}
+
+% for Traversal in ['Forward', 'Bidirectional']:
+%   Collection = collectionForTraversal(Traversal)
+%   Self = "LazyPrefixWhile" + Collection
+
+/// A lazy `${Collection}` wrapper that includes the initial consecutive
+/// elements of an underlying collection that satisfy a predicate.
+///
+/// - Note: The performance of accessing `endIndex`, `last`, any methods that
+///   depend on `endIndex`, or moving an index depends on how many elements
+///   satisfy the predicate at the start of the collection, and may not offer
+///   the usual performance given by the `Collection` protocol. Be aware,
+///   therefore, that general operations on `${Self}` instances may not have
+///   the documented complexity.
+public struct ${Self}<
+  Base : ${Collection}
+> : LazyCollectionProtocol, ${Collection} {
+
+  public typealias Index = LazyPrefixWhileIndex<Base>
+
+  public var startIndex: Index {
+    return LazyPrefixWhileIndex(_base.startIndex)
+  }
+
+  public var endIndex: Index {
+    // If the first element of `_base` satisfies the predicate, there is at
+    // least one element in the lazy collection: Use the explicit `.pastEnd` index.
+    if let first = _base.first, _predicate(first) {
+      return LazyPrefixWhileIndex(endOf: _base)
+    }
+
+    // `_base` is either empty or `_predicate(_base.first!) == false`. In either
+    // case, the lazy collection is empty, so `endIndex == startIndex`.
+    return startIndex
+  }
+
+  public func index(after i: Index) -> Index {
+    _precondition(i != endIndex, "can't advance past endIndex")
+    guard case .index(let i) = i._value else {
+      _preconditionFailure("invalid index passed to index(after:)")
+    }
+    let nextIndex = _base.index(after: i)
+    guard nextIndex != _base.endIndex && _predicate(_base[nextIndex]) else {
+      return LazyPrefixWhileIndex(endOf: _base)
+    }
+    return LazyPrefixWhileIndex(nextIndex)
+  }
+
+%   if Traversal == 'Bidirectional':
+
+  public func index(before i: Index) -> Index {
+    switch i._value {
+    case .index(let i):
+      _precondition(i != _base.startIndex, "can't move before startIndex")
+      return LazyPrefixWhileIndex(_base.index(before: i))
+    case .pastEnd:
+      // Look for the position of the last element in a non-empty
+      // prefix(while:) collection by searching forward for a predicate
+      // failure.
+
+      // Safe to assume that `_base.startIndex != _base.endIndex`; if they
+      // were equal, `_base.startIndex` would be used as the `endIndex` of
+      // this collection.
+      _sanityCheck(!_base.isEmpty)
+      var result = _base.startIndex
+      while true {
+        let next = _base.index(after: result)
+        if next == _base.endIndex || !_predicate(_base[next]) {
+          break
+        }
+        result = next
+      }
+      return LazyPrefixWhileIndex(result)
+    }
+  }
+
+%   end
+
+  public subscript(position: Index) -> Base.Iterator.Element {
+    switch position._value {
+    case .index(let i):
+      return _base[i]
+    case .pastEnd:
+      _preconditionFailure("Index out of range")
+    }
+  }
+
+  public func makeIterator() -> LazyPrefixWhileIterator<Base.Iterator> {
+    return LazyPrefixWhileIterator(
+      _base: _base.makeIterator(), predicate: _predicate)
+  }
+
+  internal init(_base: Base, predicate: @escaping (Base.Iterator.Element) -> Bool) {
+    self._base = _base
+    self._predicate = predicate
+  }
+
+  internal var _base: Base
+  internal let _predicate: (Base.Iterator.Element) -> Bool
+}
+
+extension LazyCollectionProtocol
+  where
+  Self : ${Collection},
+  Elements : ${Collection}
+{
+  /// Returns a lazy collection of the initial consecutive elements that
+  /// satisfy `predicate`.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the collection
+  ///   as its argument and returns `true` if the element should be included
+  ///   or `false` otherwise. Once `predicate` returns `false` it will not be
+  ///   called again.
+  public func prefix(
+    while predicate: @escaping (Elements.Iterator.Element) -> Bool
+  ) -> LazyPrefixWhile${Collection}<Self.Elements> {
+    return LazyPrefixWhile${Collection}(
+      _base: self.elements, predicate: predicate)
+  }
+}
+
+% end
+
+// ${'Local Variables'}:
+// eval: (read-only-mode 1)
+// End:
diff --git a/stdlib/public/core/Print.swift b/stdlib/public/core/Print.swift
index cc87537..51984b5 100644
--- a/stdlib/public/core/Print.swift
+++ b/stdlib/public/core/Print.swift
@@ -173,8 +173,9 @@
 ///     item.
 ///
 /// - SeeAlso: `print(_:separator:terminator:)`,
-///   `debugPrint(_:separator:terminator:to:)`, `TextOutputStream`,
-///   `TextOutputStreamable`, `CustomStringConvertible`, `CustomDebugStringConvertible`
+///   `debugPrint(_:separator:terminator:to:)`,
+///   `TextOutputStream`, `TextOutputStreamable`,
+///   `CustomStringConvertible`, `CustomDebugStringConvertible`
 @inline(__always)
 public func print<Target : TextOutputStream>(
   _ items: Any...,
@@ -225,7 +226,8 @@
 ///     item.
 ///
 /// - SeeAlso: `debugPrint(_:separator:terminator:)`,
-///   `print(_:separator:terminator:to:)`, `TextOutputStream`, `TextOutputStreamable`,
+///   `print(_:separator:terminator:to:)`,
+///   `TextOutputStream`, `TextOutputStreamable`,
 ///   `CustomStringConvertible`, `CustomDebugStringConvertible`
 @inline(__always)
 public func debugPrint<Target : TextOutputStream>(
@@ -281,6 +283,22 @@
 //===----------------------------------------------------------------------===//
 //===--- Migration Aids ---------------------------------------------------===//
 
+@available(*, unavailable, renamed: "print(_:separator:terminator:to:)")
+public func print<Target : TextOutputStream>(
+  _ items: Any...,
+  separator: String = "",
+  terminator: String = "",
+  toStream output: inout Target
+) {}
+
+@available(*, unavailable, renamed: "debugPrint(_:separator:terminator:to:)")
+public func debugPrint<Target : TextOutputStream>(
+  _ items: Any...,
+  separator: String = "",
+  terminator: String = "",
+  toStream output: inout Target
+) {}
+
 @available(*, unavailable, message: "Please use 'terminator: \"\"' instead of 'appendNewline: false': 'print((...), terminator: \"\")'")
 public func print<T>(_: T, appendNewline: Bool = true) {}
 @available(*, unavailable, message: "Please use 'terminator: \"\"' instead of 'appendNewline: false': 'debugPrint((...), terminator: \"\")'")
diff --git a/stdlib/public/core/RangeReplaceableCollection.swift.gyb b/stdlib/public/core/RangeReplaceableCollection.swift.gyb
index e747a5b..3c22a10 100644
--- a/stdlib/public/core/RangeReplaceableCollection.swift.gyb
+++ b/stdlib/public/core/RangeReplaceableCollection.swift.gyb
@@ -99,10 +99,9 @@
 
   /// Inserts a new element into the collection at the specified position.
   ///
-  /// The new element is inserted before the element currently at the
-  /// specified index. If you pass the collection's `endIndex` property as
-  /// the `index` parameter, the new element is appended to the
-  /// collection.
+  /// The new element is inserted before the element currently at the specified
+  /// index. If you pass the collection's `endIndex` property as the `index`
+  /// parameter, the new element is appended to the collection.
   ///
   ///     var numbers = [1, 2, 3, 4, 5]
   ///     numbers.insert(100, at: 3)
@@ -114,9 +113,10 @@
   /// Calling this method may invalidate any existing indices for use with this
   /// collection.
   ///
-  /// - Parameter newElement: The new element to insert into the collection.
-  /// - Parameter i: The position at which to insert the new element.
-  ///   `index` must be a valid index into the collection.
+  /// - Parameters:
+  ///   - newElement: The new element to insert into the collection.
+  ///   - i: The position at which to insert the new element. `index` must be a
+  ///     valid index into the collection.
   ///
   /// - Complexity: O(*n*), where *n* is the length of the collection.
   mutating func insert(_ newElement: _Element, at i: Index)
@@ -139,9 +139,10 @@
   /// Calling this method may invalidate any existing indices for use with this
   /// collection.
   ///
-  /// - Parameter newElements: The new elements to insert into the collection.
-  /// - Parameter i: The position at which to insert the new elements. `index`
-  ///   must be a valid index of the collection.
+  /// - Parameters:
+  ///   - newElements: The new elements to insert into the collection.
+  ///   - i: The position at which to insert the new elements. `index` must be
+  ///     a valid index of the collection.
   ///
   /// - Complexity: O(*m*), where *m* is the combined length of the collection
   ///   and `newElements`. If `i` is equal to the collection's `endIndex`
@@ -373,11 +374,11 @@
     where S.Iterator.Element == Iterator.Element
   */
 
-  /// Adds the elements of a sequence to the end of the collection.
+  /// Adds the elements of a sequence or collection to the end of this
+  /// collection.
   ///
-  /// Use this method to append the elements of a sequence or collection to the
-  /// end of this collection. The collection being appended to allocates any
-  /// additional necessary storage to hold the new elements.
+  /// The collection being appended to allocates any additional necessary
+  /// storage to hold the new elements.
   ///
   /// The following example appends the elements of a `Range<Int>` instance to
   /// an array of integers:
@@ -590,11 +591,11 @@
     insert(newElement, at: endIndex)
   }
 
-  /// Adds the elements of a sequence to the end of the collection.
+  /// Adds the elements of a sequence or collection to the end of this
+  /// collection.
   ///
-  /// Use this method to append the elements of a sequence or collection to the
-  /// end of this collection. The collection being appended to allocates any
-  /// additional necessary storage to hold the new elements.
+  /// The collection being appended to allocates any additional necessary
+  /// storage to hold the new elements.
   ///
   /// The following example appends the elements of a `Range<Int>` instance to
   /// an array of integers:
diff --git a/stdlib/public/core/Sequence.swift b/stdlib/public/core/Sequence.swift
index e6df4a0..44d0e37 100644
--- a/stdlib/public/core/Sequence.swift
+++ b/stdlib/public/core/Sequence.swift
@@ -210,9 +210,9 @@
 
 /// A type that provides sequential, iterated access to its elements.
 ///
-/// Sequences are lists of values that let you step over their values
-/// one at a time. The most common way to iterate over the elements of a
-/// sequence is to use a `for`-`in` loop:
+/// A sequence is a list of values that you can step through one at a time. The
+/// most common way to iterate over the elements of a sequence is to use a
+/// `for`-`in` loop:
 ///
 ///     let oneTwoThree = 1...3
 ///     for number in oneTwoThree {
@@ -253,38 +253,38 @@
 ///     }
 ///     // Prints "Whew, no mosquitos!"
 ///
-/// Repeated Access 
+/// Repeated Access
 /// ===============
 ///
 /// The `Sequence` protocol makes no requirement on conforming types regarding
-/// whether they will be destructively "consumed" by iteration. As a
+/// whether they will be destructively consumed by iteration. As a
 /// consequence, don't assume that multiple `for`-`in` loops on a sequence
-/// will either "resume" iteration or restart from the beginning:
+/// will either resume iteration or restart from the beginning:
 ///
 ///     for element in sequence {
 ///         if ... some condition { break }
 ///     }
-/// 
+///
 ///     for element in sequence {
 ///         // No defined behavior
 ///     }
 ///
-/// In this case, you cannot assume that a sequence will either be
-/// "consumable" and will resume iteration, or that a sequence is a
-/// collection and will restart iteration from the first element. A
-/// conforming sequence that is not a collection is allowed to produce an
-/// arbitrary sequence of elements in the second `for`-`in` loop.
+/// In this case, you cannot assume either that a sequence will be consumable
+/// and will resume iteration, or that a sequence is a collection and will
+/// restart iteration from the first element. A conforming sequence that is
+/// not a collection is allowed to produce an arbitrary sequence of elements
+/// in the second `for`-`in` loop.
 ///
-/// To establish that a type you've created supports nondestructive
-/// iteration, add conformance to the `Collection` protocol.
+/// To establish that a type you've created supports nondestructive iteration,
+/// add conformance to the `Collection` protocol.
 ///
-/// Conforming to the Sequence Protocol 
+/// Conforming to the Sequence Protocol
 /// ===================================
 ///
 /// Making your own custom types conform to `Sequence` enables many useful
 /// operations, like `for`-`in` looping and the `contains` method, without
-/// much effort. To add `Sequence` conformance to your own custom type, add
-/// a `makeIterator()` method that returns an iterator.
+/// much effort. To add `Sequence` conformance to your own custom type, add a
+/// `makeIterator()` method that returns an iterator.
 ///
 /// Alternatively, if your type can act as its own iterator, implementing the
 /// requirements of the `IteratorProtocol` protocol and declaring conformance
@@ -296,7 +296,7 @@
 ///
 ///     struct Countdown: Sequence, IteratorProtocol {
 ///         var count: Int
-/// 
+///
 ///         mutating func next() -> Int? {
 ///             if count == 0 {
 ///                 return nil
@@ -306,7 +306,7 @@
 ///             }
 ///         }
 ///     }
-/// 
+///
 ///     let threeToGo = Countdown(count: 3)
 ///     for i in threeToGo {
 ///         print(i)
@@ -315,7 +315,7 @@
 ///     // Prints "2"
 ///     // Prints "1"
 ///
-/// Expected Performance 
+/// Expected Performance
 /// ====================
 ///
 /// A sequence should provide its iterator in O(1). The `Sequence` protocol
@@ -471,6 +471,18 @@
   /// - Complexity: O(*n*), where *n* is the length of the sequence.
   func dropLast(_ n: Int) -> SubSequence
 
+  /// Returns a subsequence by skipping elements while `predicate` returns
+  /// `true` and returning the remaining elements.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the
+  ///   sequence as its argument and returns a Boolean value indicating
+  ///   whether the element is a match.
+  ///
+  /// - Complexity: O(*n*), where *n* is the length of the collection.
+  func drop(
+    while predicate: (Iterator.Element) throws -> Bool
+  ) rethrows -> SubSequence
+
   /// Returns a subsequence, up to the specified maximum length, containing
   /// the initial elements of the sequence.
   ///
@@ -488,6 +500,18 @@
   /// - Returns: A subsequence starting at the beginning of this sequence
   ///   with at most `maxLength` elements.
   func prefix(_ maxLength: Int) -> SubSequence
+  
+  /// Returns a subsequence containing the initial elements until `predicate`
+  /// returns `false` and skipping the remaining elements.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the
+  ///   sequence as its argument and returns a Boolean value indicating
+  ///   whether the element is a match.
+  ///
+  /// - Complexity: O(*n*), where *n* is the length of the collection.
+  func prefix(
+    while predicate: (Iterator.Element) throws -> Bool
+  ) rethrows -> SubSequence
 
   /// Returns a subsequence, up to the given maximum length, containing the
   /// final elements of the sequence.
@@ -697,6 +721,65 @@
         maxLength: Swift.min(maxLength, self._maxLength),
         taken: _taken))
   }
+  
+  internal func drop(
+    while predicate: (Base.Element) throws -> Bool
+  ) rethrows -> AnySequence<Base.Element> {
+    return try AnySequence(
+      _DropWhileSequence(
+        iterator: _iterator, nextElement: nil, predicate: predicate))
+  }
+}
+
+/// A sequence that lazily consumes and drops `n` elements from an underlying
+/// `Base` iterator before possibly returning the first available element.
+///
+/// The underlying iterator's sequence may be infinite.
+///
+/// This is a class - we require reference semantics to keep track
+/// of how many elements we've already dropped from the underlying sequence.
+internal class _DropWhileSequence<Base : IteratorProtocol>
+    : Sequence, IteratorProtocol {
+
+  internal var _iterator: Base
+  internal var _nextElement: Base.Element?
+
+  internal init(
+    iterator: Base,
+    nextElement: Base.Element?,
+    predicate: (Base.Element) throws -> Bool
+  ) rethrows {
+    self._iterator = iterator
+    self._nextElement = nextElement ?? _iterator.next()
+    
+    while try _nextElement.flatMap(predicate) == true {
+      _nextElement = _iterator.next()
+    }
+  }
+
+  internal func makeIterator() -> _DropWhileSequence<Base> {
+    return self
+  }
+
+  internal func next() -> Base.Element? {
+    guard _nextElement != nil else {
+      return _iterator.next()
+    }
+    
+    let next = _nextElement
+    _nextElement = nil
+    return next
+  }
+
+  internal func drop(
+    while predicate: (Base.Element) throws -> Bool
+  ) rethrows -> AnySequence<Base.Element> {
+    // If this is already a _DropWhileSequence, avoid multiple
+    // layers of wrapping and keep the same iterator.
+    return try AnySequence(
+      _DropWhileSequence(
+        iterator: _iterator, nextElement: _nextElement, predicate: predicate))
+  }
 }
 
 //===----------------------------------------------------------------------===//
@@ -915,7 +998,7 @@
   /// Returns a value less than or equal to the number of elements in
   /// the sequence, nondestructively.
   ///
-  /// - Complexity: O(N).
+  /// - Complexity: O(*n*)
   public var underestimatedCount: Int {
     return 0
   }
@@ -1128,6 +1211,23 @@
     }
     return AnySequence(result)
   }
+  
+  /// Returns a subsequence by skipping elements while `predicate` returns
+  /// `true` and returning the remaining elements.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the
+  ///   sequence as its argument and returns `true` if the element should
+  ///		be skipped or `false` if it should be included. Once the predicate
+  ///		returns `false` it will not be called again.
+  ///
+  /// - Complexity: O(*n*), where *n* is the length of the collection.
+  public func drop(
+    while predicate: (Iterator.Element) throws -> Bool
+  ) rethrows -> AnySequence<Iterator.Element> {
+    return try AnySequence(
+      _DropWhileSequence(
+        iterator: makeIterator(), nextElement: nil, predicate: predicate))
+  }
 
   /// Returns a subsequence, up to the specified maximum length, containing the
   /// initial elements of the sequence.
@@ -1155,6 +1255,29 @@
     return AnySequence(
       _PrefixSequence(_iterator: makeIterator(), maxLength: maxLength))
   }
+  
+  /// Returns a subsequence containing the initial elements until `predicate`
+  /// returns `false` and skipping the remaining elements.
+  ///
+  /// - Parameter predicate: A closure that takes an element of the
+  ///   sequence as its argument and returns `true` if the element should
+  ///   be included or `false` if it should be excluded. Once the predicate
+  ///   returns `false` it will not be called again.
+  ///
+  /// - Complexity: O(*n*), where *n* is the length of the collection.
+  public func prefix(
+    while predicate: (Iterator.Element) throws -> Bool
+  ) rethrows -> AnySequence<Iterator.Element> {
+    var result: [Iterator.Element] = []
+
+    for element in self {
+      guard try predicate(element) else {
+        break
+      }
+      result.append(element)
+    }
+    return AnySequence(result)
+  }
 }
 
 extension Sequence {
@@ -1262,7 +1385,7 @@
     Builtin.unreachable()
   }
 
-  @available(*, unavailable, message: "call 'split(maxSplits:omittingEmptySubsequences:isSeparator:)' and invert the 'allowEmptySlices' argument")
+  @available(*, unavailable, message: "call 'split(maxSplits:omittingEmptySubsequences:whereSeparator:)' and invert the 'allowEmptySlices' argument")
   public func split(_ maxSplit: Int, allowEmptySlices: Bool,
     isSeparator: (Iterator.Element) throws -> Bool
   ) rethrows -> [SubSequence] {
diff --git a/stdlib/public/core/SequenceAlgorithms.swift.gyb b/stdlib/public/core/SequenceAlgorithms.swift.gyb
index 2e8843b..7482f2c 100644
--- a/stdlib/public/core/SequenceAlgorithms.swift.gyb
+++ b/stdlib/public/core/SequenceAlgorithms.swift.gyb
@@ -70,7 +70,7 @@
   /// These counters can only be used as indices in instances of zero-based,
   /// integer-indexed collections, such as `Array` and `ContiguousArray`. For
   /// other collections the counters may be out of range or of the wrong type
-  /// to use as an index. To iterate over the elements of collection with its
+  /// to use as an index. To iterate over the elements of a collection with its
   /// indices, use the `zip(_:_:)` function.
   ///
   /// This example iterates over the indices and elements of a set, building a
@@ -312,7 +312,7 @@
 extension Sequence ${"" if preds else "where Iterator.Element : Equatable"} {
 
 %   if preds:
-  /// Returns a Boolean value indicating whether the sequence and a given
+  /// Returns a Boolean value indicating whether this sequence and another
   /// sequence contain equivalent elements, using the given predicate as the
   /// equivalence test.
   ///
@@ -328,13 +328,13 @@
   ///
   /// - SeeAlso: `elementsEqual(_:)`
 %   else:
-  /// Returns a Boolean value indicating whether the sequence and a given
+  /// Returns a Boolean value indicating whether this sequence and another
   /// sequence contain the same elements in the same order.
   ///
   /// At least one of the sequences must be finite.
   ///
   /// This example tests whether one countable range shares the same elements
-  /// as another countable range and as an array with the same elements.
+  /// as another countable range and an array.
   ///
   ///     let a = 1...3
   ///     let b = 1...10
@@ -393,7 +393,7 @@
 
 %   if preds:
   /// Returns a Boolean value indicating whether the sequence precedes another
-  /// sequence in a lexicographical ("dictionary") ordering, using the given
+  /// sequence in a lexicographical (dictionary) ordering, using the given
   /// predicate to compare elements.
   ///
 ${orderingExplanation}
@@ -412,7 +412,7 @@
   /// - SeeAlso: `lexicographicallyPrecedes(_:)`
 %   else:
   /// Returns a Boolean value indicating whether the sequence precedes another
-  /// sequence in a lexicographical ("dictionary") ordering, using the
+  /// sequence in a lexicographical (dictionary) ordering, using the
   /// less-than operator (`<`) to compare elements.
   ///
   /// This example uses the `lexicographicallyPrecedes` method to test which
@@ -432,7 +432,7 @@
   ///
   /// - Note: This method implements the mathematical notion of lexicographical
   ///   ordering, which has no connection to Unicode.  If you are sorting
-  ///   strings to present to the end user, you should use `String` APIs that
+  ///   strings to present to the end user, use `String` APIs that
   ///   perform localized comparison.
   /// - SeeAlso: `lexicographicallyPrecedes(_:by:)`
 %   end
@@ -611,7 +611,7 @@
   ///
   /// The sequence must be finite.
   ///
-  /// - Complexity: O(N), where N is the length of the sequence.
+  /// - Complexity: O(*n*), where *n* is the length of the sequence.
   ///
   /// - Returns: An array containing the elements of this sequence in
   ///   reverse order.
@@ -745,6 +745,17 @@
     Builtin.unreachable()
   }
 
+  @available(*, unavailable, renamed: "elementsEqual(_:by:)")
+  public func elementsEqual<OtherSequence>(
+    _ other: OtherSequence,
+    isEquivalent: (${GElement}, ${GElement}) throws -> Bool
+  ) rethrows -> Bool
+    where
+    OtherSequence: Sequence,
+    OtherSequence.${GElement} == ${GElement} {
+    Builtin.unreachable()
+  }
+
   @available(*, unavailable, renamed: "lexicographicallyPrecedes(_:by:)")
   public func lexicographicalCompare<
     OtherSequence
@@ -757,6 +768,21 @@
     OtherSequence.${GElement} == ${GElement} {
     Builtin.unreachable()
   }
+
+  @available(*, unavailable, renamed: "contains(where:)")
+  public func contains(
+    _ predicate: (${GElement}) throws -> Bool
+  ) rethrows -> Bool {
+    Builtin.unreachable()
+  }
+
+  @available(*, unavailable, renamed: "reduce(_:_:)")
+  public func reduce<Result>(
+    _ initial: Result,
+    combine: (_ partialResult: Result, ${GElement}) throws -> Result
+  ) rethrows -> Result {
+    Builtin.unreachable()
+  }
 }
 
 extension Sequence where Iterator.Element : Comparable {
diff --git a/stdlib/public/core/SetAlgebra.swift b/stdlib/public/core/SetAlgebra.swift
index 9de5a5a..4f29474 100644
--- a/stdlib/public/core/SetAlgebra.swift
+++ b/stdlib/public/core/SetAlgebra.swift
@@ -124,7 +124,7 @@
   ///
   /// In the following example, the `bothNeighborsAndEmployees` set is made up
   /// of the elements that are in *both* the `employees` and `neighbors` sets.
-  /// Elements that are only in one or the other are left out of the result of
+  /// Elements that are in only one or the other are left out of the result of
   /// the intersection.
   ///
   ///     let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
diff --git a/stdlib/public/core/StaticString.swift b/stdlib/public/core/StaticString.swift
index 626185f..e125132 100644
--- a/stdlib/public/core/StaticString.swift
+++ b/stdlib/public/core/StaticString.swift
@@ -132,7 +132,11 @@
       var buffer: UInt64 = 0
       var i = 0
       let sink: (UInt8) -> Void = {
+#if _endian(little)
         buffer = buffer | (UInt64($0) << (UInt64(i) * 8))
+#else
+        buffer = buffer | (UInt64($0) << (UInt64(7-i) * 8))
+#endif
         i += 1
       }
       UTF8.encode(unicodeScalar, into: sink)
diff --git a/stdlib/public/core/String.swift b/stdlib/public/core/String.swift
index 346e762..89e96e3 100644
--- a/stdlib/public/core/String.swift
+++ b/stdlib/public/core/String.swift
@@ -896,7 +896,7 @@
   ///
   /// - Returns: A lowercase copy of the string.
   ///
-  /// - Complexity: O(n)
+  /// - Complexity: O(*n*)
   public func lowercased() -> String {
     if self._core.isASCII {
       let count = self._core.count
@@ -946,7 +946,7 @@
   ///
   /// - Returns: An uppercase copy of the string.
   ///
-  /// - Complexity: O(n)
+  /// - Complexity: O(*n*)
   public func uppercased() -> String {
     if self._core.isASCII {
       let count = self._core.count
diff --git a/stdlib/public/core/StringCharacterView.swift b/stdlib/public/core/StringCharacterView.swift
index b51ee28..1ba40c5 100644
--- a/stdlib/public/core/StringCharacterView.swift
+++ b/stdlib/public/core/StringCharacterView.swift
@@ -236,6 +236,9 @@
     )
   }
 
+  // FIXME(ABI): don't make this function inlineable.  Grapheme cluster
+  // segmentation uses a completely different algorithm in Unicode 9.0.
+  //
   /// Returns the length of the first extended grapheme cluster in UTF-16
   /// code units.
   @inline(never)
@@ -275,7 +278,10 @@
     
     return start._position - startIndexUTF16
   }
-  
+
+  // FIXME(ABI): don't make this function inlineable.  Grapheme cluster
+  // segmentation uses a completely different algorithm in Unicode 9.0.
+  //
   /// Returns the length of the previous extended grapheme cluster in UTF-16
   /// code units.
   @inline(never)
diff --git a/stdlib/public/core/StringCore.swift b/stdlib/public/core/StringCore.swift
index d0fdbb5..613310c 100644
--- a/stdlib/public/core/StringCore.swift
+++ b/stdlib/public/core/StringCore.swift
@@ -299,8 +299,12 @@
     // Always dereference two bytes, but when elements are 8 bits we
     // multiply the high byte by 0.
     // FIXME(performance): use masking instead of multiplication.
+#if _endian(little)
     return UTF16.CodeUnit(p.pointee)
       + UTF16.CodeUnit((p + 1).pointee) * _highByteMultiplier
+#else
+    return _highByteMultiplier == 0 ? UTF16.CodeUnit(p.pointee) : UTF16.CodeUnit((p + 1).pointee) + UTF16.CodeUnit(p.pointee) * _highByteMultiplier
+#endif
   }
 
   /// Get the Nth UTF-16 Code Unit stored.
@@ -549,7 +553,7 @@
   /// Returns `true` iff the contents of this string can be
   /// represented as pure ASCII.
   ///
-  /// - Complexity: O(N) in the worst case.
+  /// - Complexity: O(*n*) in the worst case.
   func isRepresentableAsASCII() -> Bool {
     if _slowPath(!hasContiguousStorage) {
       return false
@@ -585,7 +589,7 @@
   /// Replace the elements within `bounds` with `newElements`.
   ///
   /// - Complexity: O(`bounds.count`) if `bounds.upperBound
-  ///   == self.endIndex` and `newElements.isEmpty`, O(N) otherwise.
+  ///   == self.endIndex` and `newElements.isEmpty`, O(*n*) otherwise.
   public mutating func replaceSubrange<C>(
     _ bounds: Range<Int>,
     with newElements: C
diff --git a/stdlib/public/core/StringUTF8.swift b/stdlib/public/core/StringUTF8.swift
index a0ab74d..e1cb9ca 100644
--- a/stdlib/public/core/StringUTF8.swift
+++ b/stdlib/public/core/StringUTF8.swift
@@ -469,7 +469,7 @@
     // Match up bytes in the buffer
     var buffer = (lhs._buffer, rhs._buffer)
     var isContinuation: Bool
-    repeat {
+    while true {
       let unit = (
         UTF8.CodeUnit(truncatingBitPattern: buffer.0),
         UTF8.CodeUnit(truncatingBitPattern: buffer.1))
@@ -490,7 +490,6 @@
         String.UTF8Index._nextBuffer(after: buffer.0),
         String.UTF8Index._nextBuffer(after: buffer.1))
     }
-    while true
   }
 
   public static func < (
diff --git a/stdlib/public/core/StringUnicodeScalarView.swift b/stdlib/public/core/StringUnicodeScalarView.swift
index cae6c5b..58fe63e 100644
--- a/stdlib/public/core/StringUnicodeScalarView.swift
+++ b/stdlib/public/core/StringUnicodeScalarView.swift
@@ -577,6 +577,8 @@
 }
 
 extension String.UnicodeScalarView {
+  // FIXME(ABI): don't make this function inlineable.  Grapheme cluster
+  // segmentation uses a completely different algorithm in Unicode 9.0.
   internal func _isOnGraphemeClusterBoundary(_ i: Index) -> Bool {
     if i == startIndex || i == endIndex {
       return true
diff --git a/stdlib/public/core/Unicode.swift b/stdlib/public/core/Unicode.swift
index 0589a26..750cc39 100644
--- a/stdlib/public/core/Unicode.swift
+++ b/stdlib/public/core/Unicode.swift
@@ -137,7 +137,8 @@
   /// Searches for the first occurrence of a `CodeUnit` that is equal to 0.
   ///
   /// Is an equivalent of `strlen` for C-strings.
-  /// - Complexity: O(n)
+  ///
+  /// - Complexity: O(*n*)
   static func _nullCodeUnitOffset(in input: UnsafePointer<CodeUnit>) -> Int
 }
 
@@ -839,7 +840,7 @@
     nextIndex = input.index(nextIndex, offsetBy: utf16Length)
   }
   // FIXME: Annoying check, courtesy of <rdar://problem/16740169>
-  if utf8Count < MemoryLayout._ofInstance(result).size {
+  if utf8Count < MemoryLayout.size(ofValue: result) {
     result |= ~0 << numericCast(utf8Count * 8)
   }
   return (nextIndex, result)
@@ -1139,6 +1140,16 @@
 @available(*, unavailable, renamed: "UnicodeCodec")
 public typealias UnicodeCodecType = UnicodeCodec
 
+extension UnicodeCodec {
+  @available(*, unavailable, renamed: "encode(_:into:)")
+  public static func encode(
+    _ input: UnicodeScalar,
+    output put: (CodeUnit) -> Void
+  ) {
+    Builtin.unreachable()
+  }
+}
+
 @available(*, unavailable, message: "use 'transcode(_:from:to:stoppingOnError:into:)'")
 public func transcode<Input, InputEncoding, OutputEncoding>(
   _ inputEncoding: InputEncoding.Type, _ outputEncoding: OutputEncoding.Type,
diff --git a/stdlib/public/core/UnicodeTrie.swift.gyb b/stdlib/public/core/UnicodeTrie.swift.gyb
index e38bb8c..74832d1 100644
--- a/stdlib/public/core/UnicodeTrie.swift.gyb
+++ b/stdlib/public/core/UnicodeTrie.swift.gyb
@@ -206,6 +206,9 @@
   }
 }
 
+// FIXME(ABI): don't mark this type versioned, or any of its APIs inlineable.
+// Grapheme cluster segmentation uses a completely different algorithm in
+// Unicode 9.0.
 internal struct _UnicodeExtendedGraphemeClusterSegmenter {
   let _noBoundaryRulesMatrix: UnsafePointer<UInt16>
 
diff --git a/stdlib/public/core/UnsafePointer.swift.gyb b/stdlib/public/core/UnsafePointer.swift.gyb
index 148d74a..995d17b 100644
--- a/stdlib/public/core/UnsafePointer.swift.gyb
+++ b/stdlib/public/core/UnsafePointer.swift.gyb
@@ -157,8 +157,9 @@
 
   /// Accesses the `Pointee` instance referenced by `self`.
   ///
-  /// - Precondition: the pointee has been initialized with an instance of
-  ///   type `Pointee`.
+  /// - Precondition: Either the pointee has been initialized with an
+  ///   instance of type `Pointee`, or `pointee` is being assigned to
+  ///   and `Pointee` is a trivial type.
   public var pointee: Pointee {
 %  if mutable:
     @_transparent unsafeAddress {
@@ -212,8 +213,11 @@
   ///
   /// - Precondition: `count >= 0`
   ///
-  /// - Precondition: The `Pointee`s at `self..<self + count` and
-  ///   `source..<source + count` are initialized.
+  /// - Precondition: The `Pointee`s at `source..<source + count` are
+  ///   initialized.
+  ///
+  /// - Precondition: Either the `Pointee`s at `self..<self + count`
+  ///   are initialized, or `Pointee` is a trivial type.
   public func assign(from source: UnsafePointer<Pointee>, count: Int) {
     _debugPrecondition(
       count >= 0, "${Self}.assign with negative count")
@@ -380,7 +384,9 @@
 
   /// Accesses the pointee at `self + i`.
   ///
-  /// - Precondition: the pointee at `self + i` is initialized.
+  /// - Precondition: Either the pointee at `self + i` is initialized, or the
+  ///   subscript is the left side of an assignment and `Pointee` is a trivial
+  ///   type.
   public subscript(i: Int) -> Pointee {
 %  if mutable:
     @_transparent
@@ -603,6 +609,11 @@
     Builtin.unreachable()
   }
 
+  @available(*, unavailable, renamed: "initialize(from:)")
+  public func initializeFrom<C : Collection>(_ source: C) {
+    Builtin.unreachable()
+  }
+
   @available(*, unavailable, renamed: "initialize(from:count:)")
   public func initializeFrom(_ source: UnsafePointer<Pointee>, count: Int) {
     Builtin.unreachable()
diff --git a/stdlib/public/core/UnsafeRawPointer.swift.gyb b/stdlib/public/core/UnsafeRawPointer.swift.gyb
index e086595..edeb2be 100644
--- a/stdlib/public/core/UnsafeRawPointer.swift.gyb
+++ b/stdlib/public/core/UnsafeRawPointer.swift.gyb
@@ -367,7 +367,7 @@
         & (UInt(MemoryLayout<T>.alignment) - 1)),
       "load from misaligned raw pointer")
 
-    return Builtin.load((self + offset)._rawValue)
+    return Builtin.loadRaw((self + offset)._rawValue)
   }
 
 %  if mutable:
diff --git a/stdlib/public/core/VarArgs.swift b/stdlib/public/core/VarArgs.swift
index 08cd194..e4f12d9 100644
--- a/stdlib/public/core/VarArgs.swift
+++ b/stdlib/public/core/VarArgs.swift
@@ -144,7 +144,7 @@
   /// the value returned by `_cVarArgEncoding`.
   public var _cVarArgAlignment: Int {
     // FIXME: alignof differs from the ABI alignment on some architectures
-    return MemoryLayout._ofInstance(self).alignment
+    return MemoryLayout.alignment(ofValue: self)
   }
 }
 
@@ -192,7 +192,7 @@
   /// the value returned by `_cVarArgEncoding`.
   public var _cVarArgAlignment: Int {
     // FIXME: alignof differs from the ABI alignment on some architectures
-    return MemoryLayout._ofInstance(self).alignment
+    return MemoryLayout.alignment(ofValue: self)
   }
 }
 
@@ -265,7 +265,7 @@
   /// the value returned by `_cVarArgEncoding`.
   public var _cVarArgAlignment: Int {
     // FIXME: alignof differs from the ABI alignment on some architectures
-    return MemoryLayout._ofInstance(Double(self)).alignment
+    return MemoryLayout.alignment(ofValue: Double(self))
   }
 }
 
@@ -280,7 +280,7 @@
   /// the value returned by `_cVarArgEncoding`.
   public var _cVarArgAlignment: Int {
     // FIXME: alignof differs from the ABI alignment on some architectures
-    return MemoryLayout._ofInstance(self).alignment
+    return MemoryLayout.alignment(ofValue: self)
   }
 }
 
diff --git a/stdlib/public/runtime/AnyHashableSupport.cpp b/stdlib/public/runtime/AnyHashableSupport.cpp
index 8eaea9c..3ee3e10 100644
--- a/stdlib/public/runtime/AnyHashableSupport.cpp
+++ b/stdlib/public/runtime/AnyHashableSupport.cpp
@@ -139,8 +139,8 @@
 #if SWIFT_OBJC_INTEROP
     id srcObject;
     memcpy(&srcObject, value, sizeof(id));
-    // Do we have a SwiftValue?
-    if (SwiftValue *srcSwiftValue = getAsSwiftValue(srcObject)) {
+    // Do we have a _SwiftValue?
+    if (_SwiftValue *srcSwiftValue = getAsSwiftValue(srcObject)) {
       // If so, extract the boxed value and try to cast it.
       const Metadata *unboxedType;
       const OpaqueValue *unboxedValue;
diff --git a/stdlib/public/runtime/CMakeLists.txt b/stdlib/public/runtime/CMakeLists.txt
index 044caea..575e6b8 100644
--- a/stdlib/public/runtime/CMakeLists.txt
+++ b/stdlib/public/runtime/CMakeLists.txt
@@ -39,6 +39,7 @@
     CygwinPort.cpp
     Demangle.cpp
     Enum.cpp
+    ErrorObjectConstants.cpp
     ErrorObjectNative.cpp
     Errors.cpp
     Heap.cpp
diff --git a/stdlib/public/runtime/Casting.cpp b/stdlib/public/runtime/Casting.cpp
index 5aa359f..ff69e19 100644
--- a/stdlib/public/runtime/Casting.cpp
+++ b/stdlib/public/runtime/Casting.cpp
@@ -316,9 +316,8 @@
 }
 
 SWIFT_CC(swift) SWIFT_RUNTIME_EXPORT
-extern "C"
 TwoWordPair<const char *, uintptr_t>::Return
-swift_getTypeName(const Metadata *type, bool qualified) {
+swift::swift_getTypeName(const Metadata *type, bool qualified) {
   using Pair = TwoWordPair<const char *, uintptr_t>;
   using Key = llvm::PointerIntPair<const Metadata *, 1, bool>;
 
@@ -1049,6 +1048,26 @@
     MetadataKind kind =
         srcDynamicType ? srcDynamicType->getKind() : MetadataKind::Class;
 
+    // A fallback to use if we don't have a more specialized approach
+    // for a non-class type.
+    auto fallbackForNonClass = [&] {
+#if SWIFT_OBJC_INTEROP
+      // If the destination type is a set of protocols that SwiftValue
+      // implements, we're fine.
+      if (findSwiftValueConformances(targetType->Protocols,
+                                     destExistential->getWitnessTables())) {
+        bool consumeValue = dynamicFlags & DynamicCastFlags::TakeOnSuccess;
+        destExistential->Value =
+          bridgeAnythingToSwiftValueObject(srcDynamicValue, srcDynamicType,
+                                           consumeValue);
+        maybeDeallocateSource(true);
+        return true;
+      }
+#endif
+
+      return _fail(src, srcType, targetType, flags);
+    };
+
     // If the source type is a value type, it cannot possibly conform
     // to a class-bounded protocol. 
     switch (kind) {
@@ -1068,14 +1087,15 @@
       }
 #endif
       // Otherwise, metatypes aren't class objects.
-      return _fail(src, srcType, targetType, flags);
+      return fallbackForNonClass();
     }
     
     case MetadataKind::Class:
     case MetadataKind::ObjCClassWrapper:
     case MetadataKind::ForeignClass:
     case MetadataKind::Existential:
-      // Handle these cases below.
+      // Handle the class cases below.  Note that opaque existentials
+      // shouldn't get here because we should have drilled into them above.
       break;
 
     case MetadataKind::Struct:
@@ -1105,7 +1125,7 @@
         return success;
       }
 #endif
-      break;
+      SWIFT_FALLTHROUGH;
 
     case MetadataKind::Function:
     case MetadataKind::HeapLocalVariable:
@@ -1113,8 +1133,7 @@
     case MetadataKind::ErrorObject:
     case MetadataKind::Opaque:
     case MetadataKind::Tuple:
-      // Will never succeed.
-      return _fail(src, srcType, targetType, flags);
+      return fallbackForNonClass();
     }
 
     // Check for protocol conformances and fill in the witness tables. If
@@ -2261,11 +2280,11 @@
 }
 
 /******************************************************************************/
-/***************************** Bridging SwiftValue ****************************/
+/**************************** Bridging _SwiftValue ****************************/
 /******************************************************************************/
 
 #if SWIFT_OBJC_INTEROP
-/// Try to unbox a SwiftValue box to perform a dynamic cast.
+/// Try to unbox a _SwiftValue box to perform a dynamic cast.
 static bool tryDynamicCastBoxedSwiftValue(OpaqueValue *dest,
                                           OpaqueValue *src,
                                           const Metadata *srcType,
@@ -2283,8 +2302,8 @@
   id srcObject;
   memcpy(&srcObject, src, sizeof(id));
   
-  // Do we have a SwiftValue?
-  SwiftValue *srcSwiftValue = getAsSwiftValue(srcObject);
+  // Do we have a _SwiftValue?
+  _SwiftValue *srcSwiftValue = getAsSwiftValue(srcObject);
   if (!srcSwiftValue)
     return false;
   
@@ -2483,7 +2502,7 @@
     return unwrapResult.success;
 
 #if SWIFT_OBJC_INTEROP
-  // A class or AnyObject reference may point at a boxed SwiftValue.
+  // A class or AnyObject reference may point at a boxed _SwiftValue.
   if (tryDynamicCastBoxedSwiftValue(dest, src, srcType,
                                     targetType, flags)) {
     return true;
@@ -2613,6 +2632,11 @@
     case MetadataKind::Class:
     case MetadataKind::ObjCClassWrapper:
     case MetadataKind::ForeignClass: {
+      // Casts to AnyHashable.
+      if (isAnyHashableType(targetType)) {
+        return _dynamicCastToAnyHashable(dest, src, srcType, targetType, flags);
+      }
+
 #if SWIFT_OBJC_INTEROP
       // If the target type is bridged to Objective-C, try to bridge.
       if (auto targetBridgeWitness = findBridgeWitness(targetType)) {
@@ -2629,10 +2653,6 @@
       }
 #endif
 
-      // Casts to AnyHashable.
-      if (isAnyHashableType(targetType)) {
-        return _dynamicCastToAnyHashable(dest, src, srcType, targetType, flags);
-      }
       break;
     }
 
@@ -2646,10 +2666,16 @@
       }
       break;
 
+    case MetadataKind::Optional:
+    case MetadataKind::Enum:
+      // Casts to AnyHashable.
+      if (isAnyHashableType(targetType)) {
+        return _dynamicCastToAnyHashable(dest, src, srcType, targetType, flags);
+      }
+      break;
+
     case MetadataKind::Existential:
     case MetadataKind::ExistentialMetatype:
-    case MetadataKind::Enum:
-    case MetadataKind::Optional:
     case MetadataKind::Function:
     case MetadataKind::HeapLocalVariable:
     case MetadataKind::HeapGenericLocalVariable:
diff --git a/stdlib/public/runtime/Enum.cpp b/stdlib/public/runtime/Enum.cpp
index dd14e45..92d9d14 100644
--- a/stdlib/public/runtime/Enum.cpp
+++ b/stdlib/public/runtime/Enum.cpp
@@ -348,17 +348,25 @@
 #if defined(__BIG_ENDIAN__)
   unsigned numPayloadValueBytes =
       std::min(layout.payloadSize, sizeof(payloadValue));
-  memcpy(bytes,
+  memcpy(bytes + sizeof(OpaqueValue *) - numPayloadValueBytes,
          reinterpret_cast<char *>(&payloadValue) + 4 - numPayloadValueBytes,
          numPayloadValueBytes);
+  if (layout.payloadSize > sizeof(payloadValue) &&
+      layout.payloadSize > sizeof(OpaqueValue *)) {
+    memset(bytes, 0,
+           sizeof(OpaqueValue *) - numPayloadValueBytes);
+    memset(bytes + sizeof(OpaqueValue *), 0,
+           layout.payloadSize - sizeof(OpaqueValue *));
+  }
 #else
   memcpy(bytes, &payloadValue,
          std::min(layout.payloadSize, sizeof(payloadValue)));
-#endif
+
   // If the payload is larger than the value, zero out the rest.
   if (layout.payloadSize > sizeof(payloadValue))
     memset(bytes + sizeof(payloadValue), 0,
            layout.payloadSize - sizeof(payloadValue));
+#endif
 }
 
 static unsigned loadMultiPayloadTag(const OpaqueValue *value,
@@ -384,7 +392,7 @@
   unsigned numPayloadValueBytes =
       std::min(layout.payloadSize, sizeof(payloadValue));
   memcpy(reinterpret_cast<char *>(&payloadValue) + 4 - numPayloadValueBytes,
-         bytes, numPayloadValueBytes);
+         bytes + sizeof(OpaqueValue *) - numPayloadValueBytes, numPayloadValueBytes);
 #else
   memcpy(&payloadValue, bytes,
          std::min(layout.payloadSize, sizeof(payloadValue)));
diff --git a/stdlib/public/runtime/ErrorObject.h b/stdlib/public/runtime/ErrorObject.h
index 0d01d9f..55b7979 100644
--- a/stdlib/public/runtime/ErrorObject.h
+++ b/stdlib/public/runtime/ErrorObject.h
@@ -78,6 +78,7 @@
   /// This member is only available for native Swift errors.
   const WitnessTable *errorConformance;
 
+#if SWIFT_OBJC_INTEROP
   /// The base type that introduces the `Hashable` conformance.
   /// This member is only available for native Swift errors.
   /// This member is lazily-initialized.
@@ -89,6 +90,7 @@
   /// This member is lazily-initialized.
   /// Instead of using it directly, call `getHashableConformance()`.
   mutable std::atomic<const hashable_support::HashableWitnessTable *> hashableConformance;
+#endif
 
   /// Get a pointer to the value contained inside the indirectly-referenced
   /// box reference.
@@ -143,6 +145,7 @@
   const WitnessTable *getErrorConformance() const { return errorConformance; }
 #endif
 
+#if SWIFT_OBJC_INTEROP
   /// Get the base type that conforms to `Hashable`.
   /// Returns NULL if the type does not conform.
   const Metadata *getHashableBaseType() const;
@@ -150,6 +153,7 @@
   /// Get the `Hashable` protocol witness table for the contained type.
   /// Returns NULL if the type does not conform.
   const hashable_support::HashableWitnessTable *getHashableConformance() const;
+#endif
 
   // Don't copy or move, please.
   SwiftError(const SwiftError &) = delete;
@@ -229,6 +233,14 @@
 
 #endif
 
+SWIFT_RUNTIME_EXPORT
+extern "C"
+const size_t _swift_lldb_offsetof_SwiftError_typeMetadata;
+
+SWIFT_RUNTIME_EXPORT
+extern "C"
+const size_t _swift_lldb_sizeof_SwiftError;
+
 } // namespace swift
 
 #endif
diff --git a/stdlib/public/runtime/ErrorObjectConstants.cpp b/stdlib/public/runtime/ErrorObjectConstants.cpp
new file mode 100644
index 0000000..4eaa3c9
--- /dev/null
+++ b/stdlib/public/runtime/ErrorObjectConstants.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+//===----------------------------------------------------------------------===//
+
+#include "ErrorObject.h"
+
+using namespace swift;
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Winvalid-offsetof"
+const size_t swift::_swift_lldb_offsetof_SwiftError_typeMetadata =
+    offsetof(SwiftError, type);
+#pragma clang diagnostic pop
+
+const size_t swift::_swift_lldb_sizeof_SwiftError = sizeof(SwiftError);
+
diff --git a/stdlib/public/runtime/Metadata.cpp b/stdlib/public/runtime/Metadata.cpp
index 5102367..6ee8b34 100644
--- a/stdlib/public/runtime/Metadata.cpp
+++ b/stdlib/public/runtime/Metadata.cpp
@@ -1764,6 +1764,9 @@
 
   // Okay, now do layout.
   for (unsigned i = 0; i != numFields; ++i) {
+    // Skip empty fields.
+    if (fieldOffsets[i] == 0 && fieldLayouts[i].Size == 0)
+      continue;
     auto offset = roundUpToAlignMask(size, fieldLayouts[i].AlignMask);
     fieldOffsets[i] = offset;
     size = offset + fieldLayouts[i].Size;
diff --git a/stdlib/public/runtime/Reflection.mm b/stdlib/public/runtime/Reflection.mm
index bcffa5a..8763cd9 100644
--- a/stdlib/public/runtime/Reflection.mm
+++ b/stdlib/public/runtime/Reflection.mm
@@ -398,6 +398,70 @@
   return fieldName;
 }
 
+
+static bool loadSpecialReferenceStorage(HeapObject *owner,
+                                        OpaqueValue *fieldData,
+                                        const FieldType fieldType,
+                                        Mirror *outMirror) {
+  // isWeak() implies a reference type via Sema.
+  if (!fieldType.isWeak())
+    return false;
+
+  auto type = fieldType.getType();
+  assert(type->getKind() == MetadataKind::Optional);
+
+  auto weakField = reinterpret_cast<WeakReference *>(fieldData);
+  auto strongValue = swift_unknownWeakLoadStrong(weakField);
+
+  // Now that we have a strong reference, we need to create a temporary buffer
+  // from which to copy the whole value, which might be a native class-bound
+  // existential, which means we also need to copy n witness tables, for
+  // however many protocols are in the protocol composition. For example, if we
+  // are copying a:
+  // weak var myWeakProperty : (Protocol1 & Protocol2)?
+  // then we need to copy three values:
+  // - the instance
+  // - the witness table for Protocol1
+  // - the witness table for Protocol2
+
+  auto weakContainer =
+    reinterpret_cast<WeakClassExistentialContainer *>(fieldData);
+
+  // Create a temporary existential where we can put the strong reference.
+  // The allocateBuffer value witness requires a ValueBuffer to own the
+  // allocated storage.
+  ValueBuffer temporaryBuffer;
+
+  auto temporaryValue =
+    reinterpret_cast<ClassExistentialContainer *>(
+      type->vw_allocateBuffer(&temporaryBuffer));
+
+  // Now copy the entire value out of the parent, which will include the
+  // witness tables.
+  temporaryValue->Value = strongValue;
+  auto valueWitnessesSize = type->getValueWitnesses()->getSize() -
+                            sizeof(WeakClassExistentialContainer);
+  memcpy(temporaryValue->getWitnessTables(), weakContainer->getWitnessTables(),
+         valueWitnessesSize);
+
+  // This MagicMirror constructor creates a box to hold the loaded refernce
+  // value, which becomes the new owner for the value.
+  new (outMirror) MagicMirror(reinterpret_cast<OpaqueValue *>(temporaryValue),
+                              type, /*take*/ true);
+
+  type->vw_deallocateBuffer(&temporaryBuffer);
+
+  // swift_StructMirror_subscript and swift_ClassMirror_subscript
+  // requires that the owner be consumed. Since we have the new heap box as the
+  // owner now, we need to release the old owner to maintain the contract.
+  if (owner->metadata->isAnyClass())
+    swift_unknownRelease(owner);
+  else
+    swift_release(owner);
+
+  return true;
+}
+
 // -- Struct destructuring.
   
 SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_INTERFACE
@@ -416,7 +480,7 @@
                                   Mirror *outMirror,
                                   intptr_t i,
                                   HeapObject *owner,
-                                  const OpaqueValue *value,
+                                  OpaqueValue *value,
                                   const Metadata *type) {
   auto Struct = static_cast<const StructMetadata *>(type);
   
@@ -427,13 +491,17 @@
   auto fieldType = Struct->getFieldTypes()[i];
   auto fieldOffset = Struct->getFieldOffsets()[i];
   
-  auto bytes = reinterpret_cast<const char*>(value);
-  auto fieldData = reinterpret_cast<const OpaqueValue *>(bytes + fieldOffset);
+  auto bytes = reinterpret_cast<char*>(value);
+  auto fieldData = reinterpret_cast<OpaqueValue *>(bytes + fieldOffset);
 
   new (outString) String(getFieldName(Struct->Description->Struct.FieldNames, i));
 
   // 'owner' is consumed by this call.
   assert(!fieldType.isIndirect() && "indirect struct fields not implemented");
+
+  if (loadSpecialReferenceStorage(owner, fieldData, fieldType, outMirror))
+    return;
+
   new (outMirror) Mirror(reflect(owner, fieldData, fieldType.getType()));
 }
 
@@ -614,7 +682,7 @@
                                  Mirror *outMirror,
                                  intptr_t i,
                                  HeapObject *owner,
-                                 const OpaqueValue *value,
+                                 OpaqueValue *value,
                                  const Metadata *type) {
   auto Clas = static_cast<const ClassMetadata*>(type);
 
@@ -655,10 +723,15 @@
 #endif
   }
   
-  auto bytes = *reinterpret_cast<const char * const*>(value);
-  auto fieldData = reinterpret_cast<const OpaqueValue *>(bytes + fieldOffset);
-  
-  new (outString) String(getFieldName(Clas->getDescription()->Class.FieldNames, i));
+  auto bytes = *reinterpret_cast<char * const *>(value);
+  auto fieldData = reinterpret_cast<OpaqueValue *>(bytes + fieldOffset);
+
+  new (outString) String(getFieldName(Clas->getDescription()->Class.FieldNames,
+                                      i));
+
+ if (loadSpecialReferenceStorage(owner, fieldData, fieldType, outMirror))
+   return;
+
   // 'owner' is consumed by this call.
   new (outMirror) Mirror(reflect(owner, fieldData, fieldType.getType()));
 }
diff --git a/stdlib/public/runtime/SwiftObject.h b/stdlib/public/runtime/SwiftObject.h
index bee584e..9b6b5ff 100644
--- a/stdlib/public/runtime/SwiftObject.h
+++ b/stdlib/public/runtime/SwiftObject.h
@@ -26,29 +26,15 @@
 #include <objc/NSObject.h>
 #endif
 
-namespace swift {
 
 #if SWIFT_OBJC_INTEROP
-struct SwiftObject_s {
-  void *isa __attribute__((__unavailable__));
-  uint32_t strongRefCount __attribute__((__unavailable__));
-  uint32_t weakRefCount __attribute__((__unavailable__));
-};
-
-static_assert(sizeof(SwiftObject_s) == sizeof(HeapObject),
-              "SwiftObject and HeapObject must have the same header");
-static_assert(std::is_trivially_constructible<SwiftObject_s>::value,
-              "SwiftObject must be trivially constructible");
-static_assert(std::is_trivially_destructible<SwiftObject_s>::value,
-              "SwiftObject must be trivially destructible");
-
-} // namespace swift
 
 #if __has_attribute(objc_root_class)
 __attribute__((__objc_root_class__))
 #endif
 SWIFT_RUNTIME_EXPORT @interface SwiftObject<NSObject> {
-  swift::SwiftObject_s header;
+  Class isa;
+  SWIFT_HEAPOBJECT_NON_OBJC_MEMBERS;
 }
 
 - (BOOL)isEqual:(id)object;
@@ -92,8 +78,8 @@
 // Convert a Swift String to an NSString.
 NSString *convertStringToNSString(String *swiftString);
 
-#endif
-  
 }
 
 #endif
+
+#endif
diff --git a/stdlib/public/runtime/SwiftValue.h b/stdlib/public/runtime/SwiftValue.h
index 7f35de9..f70fa72 100644
--- a/stdlib/public/runtime/SwiftValue.h
+++ b/stdlib/public/runtime/SwiftValue.h
@@ -23,33 +23,40 @@
 
 #if SWIFT_OBJC_INTEROP
 #include <objc/runtime.h>
+#include "swift/Runtime/Metadata.h"
 
-// SwiftValue is an Objective-C class, but we shouldn't interface with it
+// _SwiftValue is an Objective-C class, but we shouldn't interface with it
 // directly as such. Keep the type opaque.
 #if __OBJC__
-@class SwiftValue;
+@class _SwiftValue;
 #else
-typedef struct SwiftValue SwiftValue;
+typedef struct _SwiftValue _SwiftValue;
 #endif
 
 namespace swift {
 
-/// Bridge a Swift value to an Objective-C object by boxing it as a SwiftValue.
-SwiftValue *bridgeAnythingToSwiftValueObject(OpaqueValue *src,
-                                             const Metadata *srcType,
-                                             bool consume);
+/// Bridge a Swift value to an Objective-C object by boxing it as a _SwiftValue.
+_SwiftValue *bridgeAnythingToSwiftValueObject(OpaqueValue *src,
+                                              const Metadata *srcType,
+                                              bool consume);
 
 /// Get the type metadata for a value in a Swift box.
-const Metadata *getSwiftValueTypeMetadata(SwiftValue *v);
+const Metadata *getSwiftValueTypeMetadata(_SwiftValue *v);
 
 /// Get the value out of a Swift box along with its type metadata. The value
 /// inside the box is immutable and must not be modified or taken from the box.
 std::pair<const Metadata *, const OpaqueValue *>
-getValueFromSwiftValue(SwiftValue *v);
+getValueFromSwiftValue(_SwiftValue *v);
 
-/// Return the object reference as a SwiftValue* if it is a SwiftValue instance,
+/// Return the object reference as a _SwiftValue* if it is a _SwiftValue instance,
 /// or nil if it is not.
-SwiftValue *getAsSwiftValue(id object);
+_SwiftValue *getAsSwiftValue(id object);
+
+/// Find conformances for SwiftValue to the given list of protocols.
+///
+/// Returns true if SwiftValue does conform to all the protocols.
+bool findSwiftValueConformances(const ProtocolDescriptorList &protocols,
+                                const WitnessTable **tablesBuffer);
 
 } // namespace swift
 #endif
diff --git a/stdlib/public/runtime/SwiftValue.mm b/stdlib/public/runtime/SwiftValue.mm
index 0d953e1..d6c058e 100644
--- a/stdlib/public/runtime/SwiftValue.mm
+++ b/stdlib/public/runtime/SwiftValue.mm
@@ -38,23 +38,23 @@
 using namespace swift::hashable_support;
 
 // TODO: Making this a SwiftObject subclass would let us use Swift refcounting,
-// but we would need to be able to emit SwiftValue's Objective-C class object
+// but we would need to be able to emit _SwiftValue's Objective-C class object
 // with the Swift destructor pointer prefixed before it.
 //
-// The layout of `SwiftValue` is:
+// The layout of `_SwiftValue` is:
 // - object header,
 // - `SwiftValueHeader` instance,
 // - the payload, tail-allocated (the Swift value contained in this box).
-@interface SwiftValue : NSObject <NSCopying>
+@interface _SwiftValue : NSObject <NSCopying>
 
 - (id)copyWithZone:(NSZone *)zone;
 
 @end
 
-/// The fixed-size ivars of `SwiftValue`.  The actual boxed value is
+/// The fixed-size ivars of `_SwiftValue`.  The actual boxed value is
 /// tail-allocated.
 struct SwiftValueHeader {
-  /// The type of the value contained in the `SwiftValue` box.
+  /// The type of the value contained in the `_SwiftValue` box.
   const Metadata *type;
 
   /// The base type that introduces the `Hashable` conformance.
@@ -125,16 +125,16 @@
 /* TODO: If we're able to become a SwiftObject subclass in the future,
  * change to this:
 static constexpr const size_t SwiftValueHeaderOffset
-  = sizeof(SwiftObject_s);
+  = sizeof(HeapObject);
 static constexpr const size_t SwiftValueMinAlignMask
-  = alignof(SwiftObject_s) - 1;
+  = alignof(HeapObject) - 1;
  */
 
 static Class _getSwiftValueClass() {
-  auto theClass = [SwiftValue class];
-  // Fixed instance size of SwiftValue should be same as object header.
+  auto theClass = [_SwiftValue class];
+  // Fixed instance size of _SwiftValue should be same as object header.
   assert(class_getInstanceSize(theClass) == SwiftValueHeaderOffset
-         && "unexpected size of SwiftValue?!");
+         && "unexpected size of _SwiftValue?!");
   return theClass;
 }
 
@@ -147,13 +147,13 @@
          ~alignMask;
 }
 
-static SwiftValueHeader *getSwiftValueHeader(SwiftValue *v) {
+static SwiftValueHeader *getSwiftValueHeader(_SwiftValue *v) {
   auto instanceBytes = reinterpret_cast<char *>(v);
   return reinterpret_cast<SwiftValueHeader *>(instanceBytes +
                                               SwiftValueHeaderOffset);
 }
 
-static OpaqueValue *getSwiftValuePayload(SwiftValue *v, size_t alignMask) {
+static OpaqueValue *getSwiftValuePayload(_SwiftValue *v, size_t alignMask) {
   auto instanceBytes = reinterpret_cast<char *>(v);
   return reinterpret_cast<OpaqueValue *>(instanceBytes +
                                          getSwiftValuePayloadOffset(alignMask));
@@ -163,18 +163,18 @@
   return type->getValueWitnesses()->getAlignmentMask() | SwiftValueMinAlignMask;
 }
 
-const Metadata *swift::getSwiftValueTypeMetadata(SwiftValue *v) {
+const Metadata *swift::getSwiftValueTypeMetadata(_SwiftValue *v) {
   return getSwiftValueHeader(v)->type;
 }
 
 std::pair<const Metadata *, const OpaqueValue *>
-swift::getValueFromSwiftValue(SwiftValue *v) {
+swift::getValueFromSwiftValue(_SwiftValue *v) {
   auto instanceType = getSwiftValueTypeMetadata(v);
   size_t alignMask = getSwiftValuePayloadAlignMask(instanceType);
   return {instanceType, getSwiftValuePayload(v, alignMask)};
 }
 
-SwiftValue *swift::bridgeAnythingToSwiftValueObject(OpaqueValue *src,
+_SwiftValue *swift::bridgeAnythingToSwiftValueObject(OpaqueValue *src,
                                                     const Metadata *srcType,
                                                     bool consume) {
   size_t alignMask = getSwiftValuePayloadAlignMask(srcType);
@@ -183,7 +183,7 @@
       getSwiftValuePayloadOffset(alignMask) + srcType->getValueWitnesses()->size;
 
   void *instanceMemory = swift_slowAlloc(totalSize, alignMask);
-  SwiftValue *instance
+  _SwiftValue *instance
     = objc_constructInstance(getSwiftValueClass(), instanceMemory);
   /* TODO: If we're able to become a SwiftObject subclass in the future,
    * change to this:
@@ -204,18 +204,61 @@
   return instance;
 }
 
-SwiftValue *swift::getAsSwiftValue(id object) {
-  // SwiftValue should have no subclasses or proxies. We can do an exact
+_SwiftValue *swift::getAsSwiftValue(id object) {
+  // _SwiftValue should have no subclasses or proxies. We can do an exact
   // class check.
   if (object_getClass(object) == getSwiftValueClass())
     return object;
   return nil;
 }
 
-@implementation SwiftValue
+bool
+swift::findSwiftValueConformances(const ProtocolDescriptorList &protocols,
+                                  const WitnessTable **tablesBuffer) {
+  Class cls = nullptr;
+
+  // Note that currently we never modify tablesBuffer because
+  // _SwiftValue doesn't conform to any protocols that need witness tables.
+
+  for (size_t i = 0, e = protocols.NumProtocols; i != e; ++i) {
+    auto protocol = protocols[i];
+
+    // _SwiftValue does conform to AnyObject.
+    switch (protocol->Flags.getSpecialProtocol()) {
+    case SpecialProtocol::AnyObject:
+      continue;
+
+    case SpecialProtocol::Error:
+      return false;
+
+    case SpecialProtocol::None:
+      break;
+    }
+
+    // Otherwise, it only conforms to ObjC protocols.  We specifically
+    // don't want to say that _SwiftValue conforms to the Swift protocols
+    // that NSObject conforms to because that would create a situation
+    // where arguably an arbitrary type would conform to those protocols
+    // by way of coercion through _SwiftValue.  Eventually we want to
+    // change _SwiftValue to not be an NSObject subclass at all.
+
+    if (protocol->Flags.getDispatchStrategy() != ProtocolDispatchStrategy::ObjC)
+      return false;
+
+    if (!cls) cls = _getSwiftValueClass();
+
+    // Check whether the class conforms to the protocol.
+    if (![cls conformsToProtocol: (Protocol*) protocol])
+      return false;
+  }
+
+  return true;
+}
+
+@implementation _SwiftValue
 
 + (instancetype)allocWithZone:(NSZone *)zone {
-  swift::crash("SwiftValue cannot be instantiated");
+  swift::crash("_SwiftValue cannot be instantiated");
 }
 
 - (id)copyWithZone:(NSZone *)zone {
@@ -299,7 +342,7 @@
       selfHeader->type, hashableConformance);
 }
 
-static NSString *getValueDescription(SwiftValue *self) {
+static NSString *getValueDescription(_SwiftValue *self) {
   String tmp;
   const Metadata *type;
   const OpaqueValue *value;
@@ -326,12 +369,18 @@
 - (const Metadata *)_swiftTypeMetadata {
   return getSwiftValueTypeMetadata(self);
 }
+- (NSString *)_swiftTypeName {
+  TwoWordPair<const char *, uintptr_t> typeName
+    = swift_getTypeName(getSwiftValueTypeMetadata(self), true);
+  
+  return [NSString stringWithUTF8String: typeName.first];
+}
 - (const OpaqueValue *)_swiftValue {
   return getValueFromSwiftValue(self).second;
 }
 
 @end
 
-// TODO: We could pick specialized SwiftValue subclasses for trivial types
+// TODO: We could pick specialized _SwiftValue subclasses for trivial types
 // or for types with known size and alignment characteristics. Probably
 // not enough of a real perf bottleneck to be worth it...
diff --git a/stdlib/public/stubs/CommandLine.cpp b/stdlib/public/stubs/CommandLine.cpp
index 0f5b260..2132140 100644
--- a/stdlib/public/stubs/CommandLine.cpp
+++ b/stdlib/public/stubs/CommandLine.cpp
@@ -33,7 +33,7 @@
 static char **_swift_stdlib_ProcessOverrideUnsafeArgv = nullptr;
 static int _swift_stdlib_ProcessOverrideUnsafeArgc = 0;
 
-SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_INTERFACE
+SWIFT_RUNTIME_STDLIB_INTERFACE
 extern "C" void _swift_stdlib_overrideUnsafeArgvArgc(char **argv, int argc) {
   _swift_stdlib_ProcessOverrideUnsafeArgv = argv;
   _swift_stdlib_ProcessOverrideUnsafeArgc = argc;
@@ -45,7 +45,7 @@
 extern "C" char ***_NSGetArgv(void);
 extern "C" int *_NSGetArgc(void);
 
-SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_INTERFACE
+SWIFT_RUNTIME_STDLIB_INTERFACE
 extern "C" char ** _swift_stdlib_getUnsafeArgvArgc(int *outArgLen) {
   assert(outArgLen != nullptr);
 
@@ -58,7 +58,7 @@
   return *_NSGetArgv();
 }
 #elif defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD__)
-SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_INTERFACE
+SWIFT_RUNTIME_STDLIB_INTERFACE
 extern "C" char ** _swift_stdlib_getUnsafeArgvArgc(int *outArgLen) {
   assert(outArgLen != nullptr);
 
@@ -92,7 +92,7 @@
 #elif defined (_MSC_VER)
 #include <stdlib.h>
 
-SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_INTERFACE
+SWIFT_RUNTIME_STDLIB_INTERFACE
 extern "C" char ** _swift_stdlib_getUnsafeArgvArgc(int *outArgLen) {
   assert(outArgLen != nullptr);
 
@@ -105,7 +105,7 @@
   return __argv;
 }
 #else // __ANDROID__; Add your favorite arch's command line arg grabber here.
-SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_INTERFACE
+SWIFT_RUNTIME_STDLIB_INTERFACE
 extern "C" char ** _swift_stdlib_getUnsafeArgvArgc(int *outArgLen) {
   if (_swift_stdlib_ProcessOverrideUnsafeArgv) {
     *outArgLen = _swift_stdlib_ProcessOverrideUnsafeArgc;
diff --git a/stdlib/public/stubs/SwiftNativeNSXXXBase.mm.gyb b/stdlib/public/stubs/SwiftNativeNSXXXBase.mm.gyb
index 84f6c39..db1dcc9 100644
--- a/stdlib/public/stubs/SwiftNativeNSXXXBase.mm.gyb
+++ b/stdlib/public/stubs/SwiftNativeNSXXXBase.mm.gyb
@@ -48,10 +48,7 @@
 SWIFT_RUNTIME_STDLIB_INTERFACE
 @interface _SwiftNativeNS${Class}Base : NS${Class}
 {
-  // TODO: Workaround for rdar://problem/18950072
-  // SWIFT_HEAPOBJECT_NON_OBJC_MEMBERS;
-  uint32_t __magic_refCount;
-  uint32_t __magic_weakRefCount;
+  SWIFT_HEAPOBJECT_NON_OBJC_MEMBERS;
 }
 @end
 
diff --git a/test/1_stdlib/AnyHashableCasts.swift.gyb b/test/1_stdlib/AnyHashableCasts.swift.gyb
index 303c5ae..fa1bcd4 100644
--- a/test/1_stdlib/AnyHashableCasts.swift.gyb
+++ b/test/1_stdlib/AnyHashableCasts.swift.gyb
@@ -15,6 +15,37 @@
 protocol Unimplemented {}
 extension Int : Implemented {}
 
+struct HashableStruct : Hashable {
+  var value : Int
+  static func ==(lhs: HashableStruct, rhs: HashableStruct) -> Bool {
+    return lhs.value == rhs.value
+  }
+  var hashValue : Int { return value }
+}
+
+class HashableClass : Hashable {
+  var value : Int
+  init(value v: Int) { self.value = v }
+  static func ==(lhs: HashableClass, rhs: HashableClass) -> Bool {
+    return lhs.value == rhs.value
+  }
+  var hashValue : Int { return value }
+}
+
+enum HashableEnum : Hashable {
+  case value(Int)
+  static func ==(lhs: HashableEnum, rhs: HashableEnum) -> Bool {
+    switch (lhs, rhs) {
+    case (.value(let l), .value(let r)): return l == r
+    }
+  }
+  var hashValue : Int {
+    switch self {
+    case .value(let v): return v
+    }
+  }
+}
+
 func opaqueCast<T, U>(_ lhs: T, _ rhs: U.Type) -> U? {
   return lhs as? U
 }
@@ -39,7 +70,13 @@
   ("5", "AnyHashable", "Unimplemented", False),
   ("5", "Int", "AnyHashable", "5"),
   ("5", "Any", "AnyHashable", "5"),
-  ("AnyHashable(5)", "Any", "Int", "5")
+  ("AnyHashable(5)", "Any", "Int", "5"),
+  ("HashableStruct(value: 5)", "HashableStruct", "AnyHashable",
+   "AnyHashable(HashableStruct(value: 5))"),
+  ("HashableClass(value: 5)", "HashableClass", "AnyHashable",
+   "AnyHashable(HashableClass(value: 5))"),
+  ("HashableEnum.value(5)", "HashableEnum", "AnyHashable",
+   "AnyHashable(HashableEnum.value(5))"),
 ]
 }%
 
diff --git a/test/1_stdlib/ArrayBridge.swift.gyb b/test/1_stdlib/ArrayBridge.swift.gyb
index b6c75fa..4c5dab9 100644
--- a/test/1_stdlib/ArrayBridge.swift.gyb
+++ b/test/1_stdlib/ArrayBridge.swift.gyb
@@ -15,7 +15,7 @@
 //
 // RUN: %gyb %s -o %t/ArrayBridge.swift
 // RUN: %target-clang %S/Inputs/ArrayBridge/ArrayBridge.m -c -o %t/ArrayBridgeObjC.o -g
-// RUN:  %line-directive %t/ArrayBridge.swift -- %target-build-swift -Xfrontend -enable-experimental-collection-casts %t/ArrayBridge.swift -I %S/Inputs/ArrayBridge/ -Xlinker %t/ArrayBridgeObjC.o -o %t/ArrayBridge -- 
+// RUN:  %line-directive %t/ArrayBridge.swift -- %target-build-swift %t/ArrayBridge.swift -I %S/Inputs/ArrayBridge/ -Xlinker %t/ArrayBridgeObjC.o -o %t/ArrayBridge -- 
 
 // RUN: %target-run %t/ArrayBridge
 // REQUIRES: executable_test
@@ -237,7 +237,7 @@
   let nsArrayOfBaseConvertedToAnyArray = nsArrayOfBase
   % if Any == 'Any':
   // FIXME: nsArrayOfBase as [Any] doesn't
-  // typecheck. -enable-experimental-collection-casts doesn't change that.
+  // typecheck.
   as [AnyObject]
   % end
   as [${Any}]
@@ -314,7 +314,7 @@
     array: bridgeableValuesAsNSArray
     %if Any == 'Any':
     // FIXME: should just be "as [Any]" but the typechecker doesn't allow it
-    // yet. -enable-experimental-collection-casts doesn't change that.
+    // yet.
     as [AnyObject] as [Any] as [AnyObject]
     %else:
     as [${Any}]
@@ -378,7 +378,7 @@
   let wrappedCocoaBridgeableValues = cocoaBridgeableValues
   %if Any == 'Any':
   // FIXME: should just be "as [Any]" but typechecker doesn't allow it
-  // yet. -enable-experimental-collection-casts doesn't change that.
+  // yet.
   as [AnyObject]
   %end
   as [${Any}]
diff --git a/test/1_stdlib/BitwiseOperationsType.swift b/test/1_stdlib/BitwiseOperationsType.swift
index 5ed2e24..f70671a 100644
--- a/test/1_stdlib/BitwiseOperationsType.swift
+++ b/test/1_stdlib/BitwiseOperationsType.swift
@@ -1,5 +1,8 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift
 // REQUIRES: executable_test
+
+import StdlibUnittest
+
 struct MyInt32 : BitwiseOperations {
   var underlying: Int32
 
@@ -22,18 +25,19 @@
   return MyInt32(underlying: ~x.underlying)
 }
 
-// |=
-var a = MyInt32(underlying: 0x3)
-a |= MyInt32(underlying: 0x4)
-assert(a.underlying == 0x7)
+let BitwiseOperationsTests = TestSuite("BitwiseOperations")
 
-// &=
-a &= MyInt32(underlying: 0x5)
-assert(a.underlying == 0x5)
+BitwiseOperationsTests.test("smoke test") {
+  var a = MyInt32(underlying: 0x3)
+  a |= MyInt32(underlying: 0x4)
+  expectEqual(0x7, a.underlying)
 
-// ^= 
-a ^= MyInt32(underlying: 0x6)
-assert(a.underlying == 0x3)
+  a &= MyInt32(underlying: 0x5)
+  expectEqual(0x5, a.underlying)
 
-// CHECK: done
-print("done")
+  a ^= MyInt32(underlying: 0x6)
+  expectEqual(0x3, a.underlying)
+}
+
+runAllTests()
+
diff --git a/test/1_stdlib/BridgeNonVerbatim.swift b/test/1_stdlib/BridgeNonVerbatim.swift
index 67bb904..dc1e167 100644
--- a/test/1_stdlib/BridgeNonVerbatim.swift
+++ b/test/1_stdlib/BridgeNonVerbatim.swift
@@ -16,7 +16,7 @@
 //  outlive the array.  
 //
 //===----------------------------------------------------------------------===//
-// RUN: %target-run-stdlib-swift %s | FileCheck %s
+// RUN: %target-run-stdlib-swift %s | %FileCheck %s
 // REQUIRES: executable_test
 //
 // REQUIRES: objc_interop
diff --git a/test/1_stdlib/Bridgeable.swift b/test/1_stdlib/Bridgeable.swift
index 6b91296..420dfad 100644
--- a/test/1_stdlib/Bridgeable.swift
+++ b/test/1_stdlib/Bridgeable.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/1_stdlib/Character.swift b/test/1_stdlib/Character.swift
index c408c60..767de77 100644
--- a/test/1_stdlib/Character.swift
+++ b/test/1_stdlib/Character.swift
@@ -142,7 +142,7 @@
   expectTrue(size1 == 8 || size1 == 9)
 
   var a: Character = "a"
-  let size2 = MemoryLayout._ofInstance(a).size
+  let size2 = MemoryLayout.size(ofValue: a)
   expectTrue(size2 == 8 || size2 == 9)
 
   expectEqual(size1, size2)
diff --git a/test/1_stdlib/CollectionCasts.swift.gyb b/test/1_stdlib/CollectionCasts.swift.gyb
index 60bdee4..dab0932 100644
--- a/test/1_stdlib/CollectionCasts.swift.gyb
+++ b/test/1_stdlib/CollectionCasts.swift.gyb
@@ -12,7 +12,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %gyb %s -o %t/CollectionCasts.swift
-// RUN: %line-directive %t/CollectionCasts.swift -- %target-build-swift -Xfrontend -enable-experimental-collection-casts %t/CollectionCasts.swift -o %t/a.out
+// RUN: %line-directive %t/CollectionCasts.swift -- %target-build-swift %t/CollectionCasts.swift -o %t/a.out
 // RUN: %line-directive %t/CollectionCasts.swift -- %target-run %t/a.out 2>&1
 // REQUIRES: executable_test
 
diff --git a/test/1_stdlib/Dispatch.swift b/test/1_stdlib/Dispatch.swift
index 025420d..8b9b8e9 100644
--- a/test/1_stdlib/Dispatch.swift
+++ b/test/1_stdlib/Dispatch.swift
@@ -3,9 +3,6 @@
 
 // REQUIRES: objc_interop
 
-// rdar://27226313
-// REQUIRES: optimized_stdlib
-
 import Dispatch
 import Foundation
 import StdlibUnittest
diff --git a/test/1_stdlib/Float.swift b/test/1_stdlib/Float.swift
index 082dad0..07fe829 100644
--- a/test/1_stdlib/Float.swift
+++ b/test/1_stdlib/Float.swift
@@ -1,15 +1,19 @@
-// RUN: rm -rf %t &&mkdir %t
+// RUN: rm -rf %t && mkdir %t
 // RUN: cp %s %t/main.swift
 
 // RUN: echo "typealias TestFloat = Float" > %t/float_type.swift
 // RUN: %target-build-swift %t/main.swift %t/float_type.swift -o %t/float.out
-// RUN: %target-run %t/float.out | FileCheck %s
+// RUN: %target-run %t/float.out
 
 // RUN: echo "typealias TestFloat = Double" > %t/double_type.swift
 // RUN: %target-build-swift %t/main.swift %t/double_type.swift -o %t/double.out
-// RUN: %target-run %t/double.out | FileCheck %s
+// RUN: %target-run %t/double.out
 // REQUIRES: executable_test
 
+import StdlibUnittest
+
+var FloatTests = TestSuite("Float")
+
 //===---
 // Helpers
 //===---
@@ -36,7 +40,7 @@
   _precondition(!normal.isSignalingNaN)
 }
 
-func testNormal() {
+FloatTests.test("normal") {
   let positiveNormal: TestFloat = 42.0
   checkNormal(positiveNormal)
   _precondition(positiveNormal.sign == .plus)
@@ -53,11 +57,7 @@
   _precondition(negativeNormal != positiveNormal)
   _precondition(positiveNormal == -negativeNormal)
   _precondition(negativeNormal == -positiveNormal)
-
-  print("testNormal done")
 }
-testNormal()
-// CHECK: testNormal done
 
 //===---
 // Zeroes
@@ -73,7 +73,7 @@
   _precondition(!zero.isSignalingNaN)
 }
 
-func testZero() {
+FloatTests.test("zero") {
   let plusZero = noinlinePlusZero()
   checkZero(plusZero)
   _precondition(plusZero.sign == .plus)
@@ -90,11 +90,7 @@
   _precondition(minusZero == -0.0)
   _precondition(minusZero == plusZero)
   _precondition(minusZero == minusZero)
-
-  print("testZero done")
 }
-testZero()
-// CHECK: testZero done
 
 //===---
 // Subnormals
@@ -118,7 +114,8 @@
   return UInt64(a)
 }
 
-func testSubnormal() {
+#if !arch(arm)
+FloatTests.test("subnormal") {
   var iterations: Int
   switch asUInt64(TestFloat.RawSignificand.max) {
     case UInt64.max:
@@ -145,16 +142,8 @@
   _precondition(negativeSubnormal.sign == .minus)
   _precondition(negativeSubnormal.floatingPointClass == .negativeSubnormal)
   _precondition(negativeSubnormal != -0.0)
-
-  print("testSubnormal done")
 }
-
-#if arch(arm)
-  print("testSubnormal done")
-#else
-  testSubnormal()
 #endif
-// CHECK: testSubnormal done
 
 //===---
 // Infinities
@@ -170,7 +159,7 @@
   _precondition(!inf.isSignalingNaN)
 }
 
-func testInf() {
+FloatTests.test("infinity") {
   var stdlibPlusInf = TestFloat.infinity
   checkInf(stdlibPlusInf)
   _precondition(stdlibPlusInf.sign == .plus)
@@ -196,11 +185,7 @@
 
   _precondition(stdlibPlusInf != computedMinusInf)
   _precondition(stdlibMinusInf != computedPlusInf)
-
-  print("testInf done")
 }
-testInf()
-// CHECK: testInf done
 
 //===---
 // NaNs
@@ -231,7 +216,7 @@
 #endif
 }
 
-func testNaN() {
+FloatTests.test("nan") {
   var stdlibDefaultNaN = TestFloat.nan
   checkQNaN(stdlibDefaultNaN)
 
@@ -240,11 +225,7 @@
 
   var stdlibSNaN = TestFloat.signalingNaN
   checkSNaN(stdlibSNaN)
-  print("testNaN done")
 }
-testNaN()
-// CHECK: testNaN done
 
-print("all done.")
-// CHECK: all done.
+runAllTests()
 
diff --git a/test/1_stdlib/FloatingPointIR.swift b/test/1_stdlib/FloatingPointIR.swift
index 3c359b4..ff1a1d7 100644
--- a/test/1_stdlib/FloatingPointIR.swift
+++ b/test/1_stdlib/FloatingPointIR.swift
@@ -1,6 +1,6 @@
-// RUN: %target-build-swift -emit-ir %s | FileCheck -check-prefix=%target-cpu %s
-// RUN: %target-build-swift -O -emit-ir %s | FileCheck -check-prefix=%target-cpu %s
-// RUN: %target-build-swift -Ounchecked -emit-ir %s | FileCheck -check-prefix=%target-cpu %s
+// RUN: %target-build-swift -emit-ir %s | %FileCheck -check-prefix=%target-cpu %s
+// RUN: %target-build-swift -O -emit-ir %s | %FileCheck -check-prefix=%target-cpu %s
+// RUN: %target-build-swift -Ounchecked -emit-ir %s | %FileCheck -check-prefix=%target-cpu %s
 
 var globalFloat32 : Float32 = 0.0
 var globalFloat64 : Float64 = 0.0
diff --git a/test/1_stdlib/HeapBuffer.swift b/test/1_stdlib/HeapBuffer.swift
index 63b9939..9512fb5 100644
--- a/test/1_stdlib/HeapBuffer.swift
+++ b/test/1_stdlib/HeapBuffer.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/test/1_stdlib/ImplicitlyUnwrappedOptional.swift b/test/1_stdlib/ImplicitlyUnwrappedOptional.swift
index 761a7e5..b387f5f 100644
--- a/test/1_stdlib/ImplicitlyUnwrappedOptional.swift
+++ b/test/1_stdlib/ImplicitlyUnwrappedOptional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 var x : Int! = .none
diff --git a/test/1_stdlib/Inputs/SwiftNativeNSBase/SwiftNativeNSBase.m b/test/1_stdlib/Inputs/SwiftNativeNSBase/SwiftNativeNSBase.m
new file mode 100644
index 0000000..6ececf0
--- /dev/null
+++ b/test/1_stdlib/Inputs/SwiftNativeNSBase/SwiftNativeNSBase.m
@@ -0,0 +1,87 @@
+//===--- SwiftNativeNSBase.m - Test _SwiftNativeNS*Base classes -----------===//
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+//===----------------------------------------------------------------------===//
+
+// This file is compiled and run by SwiftNativeNSBase.swift.
+
+#include <Foundation/Foundation.h>
+#include <objc/runtime.h>
+
+static int Errors;
+
+#define expectTrue(expr)                                            \
+  do {                                                              \
+    if (!(expr)) {                                                  \
+      printf("%s:%d: not true:  %s\n", __FILE__, __LINE__, #expr);  \
+      Errors++;                                                     \
+    }                                                               \
+  } while (0)
+
+#define expectFalse(expr)                                           \
+  do {                                                              \
+    if (expr) {                                                     \
+      printf("%s:%d: not false: %s\n", __FILE__, __LINE__, #expr);  \
+      Errors++;                                                     \
+    }                                                               \
+  } while (0)
+
+#define fail(format, ...)                                           \
+  do {                                                              \
+    printf("%s:%d: " format, __FILE__, __LINE__, ##__VA_ARGS__);    \
+    Errors++;                                                       \
+  } while (0)
+
+
+void TestSwiftNativeNSBase(void) 
+{
+  printf("TestSwiftNativeNSBase\n");
+
+  unsigned int classCount;
+  Class *classes = objc_copyClassList(&classCount);
+
+  NSMutableSet *expectedClasses =
+    [NSMutableSet setWithObjects:
+      @"_SwiftNativeNSArrayBase",
+      @"_SwiftNativeNSDictionaryBase",
+      @"_SwiftNativeNSSetBase",
+      @"_SwiftNativeNSStringBase",
+      @"_SwiftNativeNSEnumeratorBase",
+      @"_SwiftNativeNSDataBase",
+      @"_SwiftNativeNSCharacterSetBase",
+      @"_SwiftNativeNSIndexSetBase",
+      nil];
+
+  for (unsigned int i = 0; i < classCount; i++) {
+    Class cls = classes[i];
+    NSString *name = @(class_getName(cls));
+    if (! ([name hasPrefix:@"_SwiftNativeNS"] && [name hasSuffix:@"Base"])) {
+      continue;
+    }
+    if (! [expectedClasses containsObject:name]) {
+      fail("did not expect class %s\n", name.UTF8String);
+      continue;
+    }
+
+    // cls is some _SwiftNativeNS*Base class
+    [expectedClasses removeObject:name];
+    printf("checking class %s\n", name.UTF8String);
+
+    // Check for unwanted C++ cdtors (rdar://18950072)
+    expectFalse([cls instancesRespondToSelector:sel_registerName(".cxx_construct")]);
+    expectFalse([cls instancesRespondToSelector:sel_registerName(".cxx_destruct")]);
+  }
+
+  expectTrue(expectedClasses.count == 0);
+
+  printf("TestSwiftNativeNSBase: %d error%s\n",
+         Errors, Errors == 1 ? "" : "s");
+  exit(Errors ? 1 : 0);
+}
diff --git a/test/1_stdlib/KVO.swift b/test/1_stdlib/KVO.swift
index 061ae98..6ce26ca 100644
--- a/test/1_stdlib/KVO.swift
+++ b/test/1_stdlib/KVO.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/1_stdlib/Leak.swift b/test/1_stdlib/Leak.swift
index 26d9afe..c083c5b 100644
--- a/test/1_stdlib/Leak.swift
+++ b/test/1_stdlib/Leak.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: leak-checker
 
 import StdlibUnittest
diff --git a/test/1_stdlib/Map.swift b/test/1_stdlib/Map.swift
index 080c7e9..b074102 100644
--- a/test/1_stdlib/Map.swift
+++ b/test/1_stdlib/Map.swift
@@ -9,7 +9,7 @@
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 //
 //===----------------------------------------------------------------------===//
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // Check that the generic parameters are called 'Base' and 'Element'.
diff --git a/test/1_stdlib/NSDictionary.swift b/test/1_stdlib/NSDictionary.swift
index bf32018..a9d29b8 100644
--- a/test/1_stdlib/NSDictionary.swift
+++ b/test/1_stdlib/NSDictionary.swift
@@ -17,5 +17,13 @@
   let y = NSMutableDictionary(dictionary: expected as NSDictionary)
   expectEqual(expected, y as NSDictionary as! Dictionary)
 }
+// rdar://problem/27875914
+tests.test("subscript with Any") {
+  let d = NSMutableDictionary()
+  d["k"] = "@this is how the world ends"
+  expectEqual((d["k"]! as AnyObject).characterAtIndex(0), 0x40)
+  d["k"] = nil
+  expectTrue(d["k"] == nil)
+}
 
 runAllTests()
diff --git a/test/1_stdlib/NSError.swift b/test/1_stdlib/NSError.swift
index 121ca94..9c37eee 100644
--- a/test/1_stdlib/NSError.swift
+++ b/test/1_stdlib/NSError.swift
@@ -4,7 +4,7 @@
 // REQUIRES: objc_interop
 
 // RUN: %target-build-swift %s 2> %t.warnings.txt
-// RUN: FileCheck -check-prefix=CHECK-WARNINGS %s < %t.warnings.txt
+// RUN: %FileCheck -check-prefix=CHECK-WARNINGS %s < %t.warnings.txt
 
 import StdlibUnittest
 
diff --git a/test/1_stdlib/NSObject.swift b/test/1_stdlib/NSObject.swift
index b487589..5156c2e 100644
--- a/test/1_stdlib/NSObject.swift
+++ b/test/1_stdlib/NSObject.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/1_stdlib/NSUndoManager.swift b/test/1_stdlib/NSUndoManager.swift
index c6d20f3..e7e011c 100644
--- a/test/1_stdlib/NSUndoManager.swift
+++ b/test/1_stdlib/NSUndoManager.swift
@@ -1,5 +1,5 @@
 // TODO: Relies on AnyObject lvalues <rdar://problem/17755906>
-// R/UN: %target-run-simple-swift | FileCheck %s
+// R/UN: %target-run-simple-swift | %FileCheck %s
 // RUN: not %target-build-swift -parse
 // REQUIRES: executable_test
 
diff --git a/test/1_stdlib/NewString.swift b/test/1_stdlib/NewString.swift
index 8eeb9f8..49d29be 100644
--- a/test/1_stdlib/NewString.swift
+++ b/test/1_stdlib/NewString.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-stdlib-swift | FileCheck %s
+// RUN: %target-run-stdlib-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/1_stdlib/NewStringAppending.swift b/test/1_stdlib/NewStringAppending.swift
index b4abfab..459da12 100644
--- a/test/1_stdlib/NewStringAppending.swift
+++ b/test/1_stdlib/NewStringAppending.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-stdlib-swift | FileCheck %s
+// RUN: %target-run-stdlib-swift | %FileCheck %s
 // REQUIRES: executable_test
 //
 // Parts of this test depend on memory allocator specifics.  The test
diff --git a/test/1_stdlib/Nil.swift b/test/1_stdlib/Nil.swift
index b34a981..84025f8 100644
--- a/test/1_stdlib/Nil.swift
+++ b/test/1_stdlib/Nil.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // FIXME: rdar://problem/19648117 Needs splitting objc parts out
diff --git a/test/1_stdlib/Reflection.swift b/test/1_stdlib/Reflection.swift
index 2c9ed2f..0cf3def 100644
--- a/test/1_stdlib/Reflection.swift
+++ b/test/1_stdlib/Reflection.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir %t
 // RUN: %target-build-swift -parse-stdlib %s -module-name Reflection -o %t/a.out
-// RUN: %S/timeout.sh 360 %target-run %t/a.out | FileCheck %s
+// RUN: %S/timeout.sh 360 %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 // FIXME: timeout wrapper is necessary because the ASan test runs for hours
 
diff --git a/test/1_stdlib/Reflection_jit.swift b/test/1_stdlib/Reflection_jit.swift
index 7dc4e0b..c36b6b6 100644
--- a/test/1_stdlib/Reflection_jit.swift
+++ b/test/1_stdlib/Reflection_jit.swift
@@ -1,4 +1,4 @@
 // Test Reflection.swift in JIT mode.
-// RUN: %target-jit-run -parse-stdlib %S/Reflection.swift -- %S/Inputs/shuffle.jpg | FileCheck %S/Reflection.swift
+// RUN: %target-jit-run -parse-stdlib %S/Reflection.swift -- %S/Inputs/shuffle.jpg | %FileCheck %S/Reflection.swift
 
 // REQUIRES: swift_interpreter
diff --git a/test/1_stdlib/Reflection_objc.swift b/test/1_stdlib/Reflection_objc.swift
index b367336..a50cdd3 100644
--- a/test/1_stdlib/Reflection_objc.swift
+++ b/test/1_stdlib/Reflection_objc.swift
@@ -2,7 +2,7 @@
 //
 // RUN: %target-clang %S/Inputs/Mirror/Mirror.mm -c -o %t/Mirror.mm.o -g
 // RUN: %target-build-swift -parse-stdlib %s -module-name Reflection -I %S/Inputs/Mirror/ -Xlinker %t/Mirror.mm.o -o %t/a.out
-// RUN: %S/timeout.sh 360 %target-run %t/a.out %S/Inputs/shuffle.jpg | FileCheck %s
+// RUN: %S/timeout.sh 360 %target-run %t/a.out %S/Inputs/shuffle.jpg | %FileCheck %s
 // REQUIRES: executable_test
 // FIXME: timeout wrapper is necessary because the ASan test runs for hours
 
diff --git a/test/1_stdlib/Renames.swift b/test/1_stdlib/Renames.swift
index d0aa6a7..9dc8657 100644
--- a/test/1_stdlib/Renames.swift
+++ b/test/1_stdlib/Renames.swift
@@ -91,6 +91,30 @@
   _ = c.indexOf { _ in true } // expected-error {{'indexOf' has been renamed to 'index(where:)'}} {{9-16=index}} {{none}}
 }
 
+func _CollectionAlgorithms<C : Sequence>(c: C) {
+  _ = c.sort { _, _ in true } // expected-error {{'sort' has been renamed to 'sorted(by:)'}} {{9-13=sorted}} {{none}}
+  _ = c.sort({ _, _ in true }) // expected-error {{'sort' has been renamed to 'sorted(by:)'}} {{9-13=sorted}} {{14-14=by: }} {{none}}
+}
+func _CollectionAlgorithms<C : Sequence>(c: C) where C.Iterator.Element : Comparable {
+  _ = c.sort() // expected-error {{'sort()' has been renamed to 'sorted()'}} {{9-13=sorted}} {{none}}
+}
+
+func _CollectionAlgorithms<C : MutableCollection>(c: C) {
+  _ = c.sort { _, _ in true } // expected-error {{'sort' has been renamed to 'sorted(by:)'}} {{9-13=sorted}} {{none}}
+  _ = c.sort({ _, _ in true }) // expected-error {{'sort' has been renamed to 'sorted(by:)'}} {{9-13=sorted}} {{14-14=by: }} {{none}}
+}
+func _CollectionAlgorithms<C : MutableCollection>(c: C) where C.Iterator.Element : Comparable {
+  _ = c.sort() // expected-error {{'sort()' has been renamed to 'sorted()'}} {{9-13=sorted}} {{none}}
+
+  var a: [Int] = [1,2,3]
+  var _: [Int] = a.sort() // expected-error {{'sort()' has been renamed to 'sorted()'}} {{20-24=sorted}} {{none}}
+  var _: [Int] = a.sort { _, _ in true }  // expected-error {{'sort' has been renamed to 'sorted(by:)'}} {{20-24=sorted}} {{none}}
+  var _: [Int] = a.sort({ _, _ in true })  // expected-error {{'sort' has been renamed to 'sorted(by:)'}} {{20-24=sorted}} {{25-25=by: }} {{none}}
+
+  _ = a.sort() // OK, in `Void`able context, `sort()` is a renamed `sortInPlace()`.
+  _ = a.sort { _, _ in true } // OK, `Void`able context, `sort(by:)` is a renamed `sortInPlace(_:)`.
+}
+
 func _CollectionOfOne<T>(i: IteratorOverOne<T>) {
   func fn(_: GeneratorOfOne<T>) {} // expected-error {{'GeneratorOfOne' has been renamed to 'IteratorOverOne'}} {{14-28=IteratorOverOne}} {{none}}
   _ = i.generate() // expected-error {{'generate()' has been renamed to 'makeIterator()'}} {{9-17=makeIterator}} {{none}}
@@ -240,6 +264,11 @@
   func fn3<T : RandomAccessIndexType>(_: T) {} // expected-error {{'RandomAccessIndexType' has been renamed to 'Strideable'}} {{16-37=Strideable}} {{none}}
 }
 
+func _InputStream() {
+  _ = readLine(stripNewline: true) // expected-error {{'readLine(stripNewline:)' has been renamed to 'readLine(strippingNewline:)'}} {{7-15=readLine}} {{16-28=strippingNewline}} {{none}}
+  _ = readLine() // ok
+}
+
 func _IntegerArithmetic() {
   func fn1<T : IntegerArithmeticType>(_: T) {} // expected-error {{'IntegerArithmeticType' has been renamed to 'IntegerArithmetic'}} {{16-37=IntegerArithmetic}} {{none}}
   func fn2<T : SignedNumberType>(_: T) {} // expected-error {{'SignedNumberType' has been renamed to 'SignedNumber'}} {{16-32=SignedNumber}} {{none}}
@@ -266,8 +295,24 @@
   _ = s.array // expected-error {{'array' is unavailable: Please use Array initializer instead.}} {{none}}
 }
 
-func _ManagedBuffer<V, E>(x: ManagedBufferPointer<V, E>) {
+func _LifetimeManager<T>(x: T) {
+  var x = x
+  _ = withUnsafeMutablePointer(&x) { _ in } // expected-error {{'withUnsafeMutablePointer' has been renamed to 'withUnsafeMutablePointer(to:_:)'}} {{7-31=withUnsafeMutablePointer}} {{32-32=to: }} {{none}}
+  _ = withUnsafeMutablePointers(&x, &x) { _, _ in } // expected-error {{'withUnsafeMutablePointers' is unavailable: use nested withUnsafeMutablePointer(to:_:) instead}} {{none}}
+  _ = withUnsafeMutablePointers(&x, &x, &x) { _, _, _ in } // expected-error {{'withUnsafeMutablePointers' is unavailable: use nested withUnsafeMutablePointer(to:_:) instead}} {{none}}
+  _ = withUnsafePointer(&x) { _ in } // expected-error {{'withUnsafePointer' has been renamed to 'withUnsafePointer(to:_:)'}} {7-24=withUnsafePointer}} {{25-25=to: }} {{none}}
+  _ = withUnsafePointers(&x, &x) { _, _ in } // expected-error {{'withUnsafePointers' is unavailable: use nested withUnsafePointer(to:_:) instead}} {{none}}
+  _ = withUnsafePointers(&x, &x, &x) { _, _, _ in } // expected-error {{'withUnsafePointers' is unavailable: use nested withUnsafePointer(to:_:) instead}} {{none}}
+}
+
+func _ManagedBuffer<H, E>(x: ManagedBufferPointer<H, E>, h: H, bc: AnyClass) {
   _ = x.allocatedElementCount // expected-error {{'allocatedElementCount' has been renamed to 'capacity'}} {{9-30=capacity}} {{none}}
+  _ = ManagedBuffer<H, E>.create(1) { _ in h } // expected-error {{'create(_:initialValue:)' has been renamed to 'create(minimumCapacity:makingHeaderWith:)'}} {{27-33=create}} {{34-34=minimumCapacity: }} {{none}}
+  _ = ManagedBuffer<H, E>.create(1, initialValue: { _ in h }) // expected-error {{'create(_:initialValue:)' has been renamed to 'create(minimumCapacity:makingHeaderWith:)'}} {{27-33=create}} {{34-34=minimumCapacity: }} {{37-49=makingHeaderWith}} {{none}}
+  _ = ManagedBufferPointer<H, E>(bufferClass: bc, minimumCapacity: 1, initialValue: { _, _ in h }) // expected-error {{'init(bufferClass:minimumCapacity:initialValue:)' has been renamed to 'init(bufferClass:minimumCapacity:makingHeaderWith:)'}} {{71-83=makingHeaderWith}} {{none}}
+  _ = ManagedBufferPointer<H, E>(bufferClass: bc, minimumCapacity: 1) { _, _ in h } // OK
+
+  func fn(_: ManagedProtoBuffer<H, E>) {} // expected-error {{'ManagedProtoBuffer' has been renamed to 'ManagedBuffer'}} {{14-32=ManagedBuffer}} {{none}}
 }
 
 func _Map() {
@@ -284,9 +329,9 @@
   _ = sizeof(T.self) // expected-error {{'sizeof' is unavailable: use MemoryLayout<T>.size instead.}} {{7-14=MemoryLayout<}} {{15-21=>.size}} {{none}}
   _ = alignof(T.self) // expected-error {{'alignof' is unavailable: use MemoryLayout<T>.alignment instead.}} {{7-15=MemoryLayout<}} {{16-22=>.alignment}} {{none}}
   _ = strideof(T.self) // expected-error {{'strideof' is unavailable: use MemoryLayout<T>.stride instead.}} {{7-16=MemoryLayout<}} {{17-23=>.stride}} {{none}}
-  _ = sizeofValue(t) // expected-error {{'sizeofValue' is unavailable: use MemoryLayout<T>.size instead.}} {{7-21=MemoryLayout<T>.size}} {{none}}
-  _ = alignofValue(t) // expected-error {{'alignofValue' is unavailable: use MemoryLayout<T>.alignment instead.}} {{7-22=MemoryLayout<T>.alignment}} {{none}}
-  _ = strideofValue(t) // expected-error {{'strideofValue' is unavailable: use MemoryLayout<T>.stride instead.}} {{7-23=MemoryLayout<T>.stride}} {{none}}
+  _ = sizeofValue(t) // expected-error {{'sizeofValue' has been replaced by 'MemoryLayout.size(ofValue:)'}} {{7-18=MemoryLayout.size}} {{19-19=ofValue: }} {{none}}
+  _ = alignofValue(t) // expected-error {{'alignofValue' has been replaced by 'MemoryLayout.alignment(ofValue:)'}} {{7-19=MemoryLayout.alignment}} {{20-20=ofValue: }} {{none}}
+  _ = strideofValue(t) // expected-error {{'strideofValue' has been replaced by 'MemoryLayout.stride(ofValue:)'}} {{7-20=MemoryLayout.stride}} {{21-21=ofValue: }} {{none}}
 }
 
 func _Mirror() {
@@ -319,6 +364,15 @@
   func fn<O : BitwiseOperationsType>(_: O) {} // expected-error {{'BitwiseOperationsType' has been renamed to 'BitwiseOperations'}} {{15-36=BitwiseOperations}} {{none}}
 }
 
+func _Print<T, O : TextOutputStream>(x: T, out: O) {
+  var out = out
+  print(x, toStream: &out) // expected-error {{'print(_:separator:terminator:toStream:)' has been renamed to 'print(_:separator:terminator:to:)'}} {{3-8=print}} {{12-20=to}} {{none}}
+  print(x, x, separator: "/", toStream: &out) // expected-error {{'print(_:separator:terminator:toStream:)' has been renamed to 'print(_:separator:terminator:to:)'}} {{3-8=print}} {{31-39=to}} {{none}}
+  print(terminator: "|", toStream: &out) // expected-error {{'print(_:separator:terminator:toStream:)' has been renamed to 'print(_:separator:terminator:to:)'}} {{3-8=print}} {{26-34=to}} {{none}}
+  print(x, separator: "*", terminator: "$", toStream: &out) // expected-error {{'print(_:separator:terminator:toStream:)' has been renamed to 'print(_:separator:terminator:to:)'}} {{3-8=print}} {{45-53=to}} {{none}}
+  debugPrint(x, toStream: &out) // expected-error {{'debugPrint(_:separator:terminator:toStream:)' has been renamed to 'debugPrint(_:separator:terminator:to:)'}} {{3-13=debugPrint}} {{17-25=to}} {{none}}
+}
+
 func _Print<T>(x: T) {
   print(x, appendNewline: true) // expected-error {{'print(_:appendNewline:)' is unavailable: Please use 'terminator: ""' instead of 'appendNewline: false': 'print((...), terminator: "")'}} {{none}}
   debugPrint(x, appendNewline: true) // expected-error {{'debugPrint(_:appendNewline:)' is unavailable: Please use 'terminator: ""' instead of 'appendNewline: false': 'debugPrint((...), terminator: "")'}} {{none}}
@@ -398,7 +452,7 @@
 func _Sequence<S : Sequence>(s: S) {
   _ = s.generate() // expected-error {{'generate()' has been renamed to 'makeIterator()'}} {{9-17=makeIterator}} {{none}}
   _ = s.underestimateCount() // expected-error {{'underestimateCount()' has been replaced by 'underestimatedCount'}} {{9-27=underestimatedCount}} {{27-29=}} {{none}}
-  _ = s.split(1, allowEmptySlices: true) { _ in true } // expected-error {{'split(_:allowEmptySlices:isSeparator:)' is unavailable: call 'split(maxSplits:omittingEmptySubsequences:isSeparator:)' and invert the 'allowEmptySlices' argument}} {{none}}
+  _ = s.split(1, allowEmptySlices: true) { _ in true } // expected-error {{'split(_:allowEmptySlices:isSeparator:)' is unavailable: call 'split(maxSplits:omittingEmptySubsequences:whereSeparator:)' and invert the 'allowEmptySlices' argument}} {{none}}
 }
 func _Sequence<S : Sequence>(s: S, e: S.Iterator.Element) where S.Iterator.Element : Equatable {
   _ = s.split(e, maxSplit: 1, allowEmptySlices: true) // expected-error {{'split(_:maxSplit:allowEmptySlices:)' is unavailable: call 'split(separator:maxSplits:omittingEmptySubsequences:)' and invert the 'allowEmptySlices' argument}} {{none}}
@@ -410,7 +464,13 @@
   _ = x.maxElement { _, _ in true } // expected-error {{'maxElement' has been renamed to 'max(by:)'}} {{9-19=max}} {{none}}
   _ = x.reverse() // expected-error {{'reverse()' has been renamed to 'reversed()'}} {{9-16=reversed}} {{none}}
   _ = x.startsWith([]) { _ in true } // expected-error {{'startsWith(_:isEquivalent:)' has been renamed to 'starts(with:by:)'}} {{9-19=starts}} {{20-20=with: }} {{none}}
+  _ = x.elementsEqual([], isEquivalent: { _, _ in true }) // expected-error {{'elementsEqual(_:isEquivalent:)' has been renamed to 'elementsEqual(_:by:)'}} {{9-22=elementsEqual}} {{27-39=by}} {{none}}
+  _ = x.elementsEqual([]) { _, _ in true } // OK
   _ = x.lexicographicalCompare([]) { _, _ in true } // expected-error {{'lexicographicalCompare(_:isOrderedBefore:)' has been renamed to 'lexicographicallyPrecedes(_:by:)'}} {{9-31=lexicographicallyPrecedes}}{{none}}
+  _ = x.contains({ _ in true }) // expected-error {{'contains' has been renamed to 'contains(where:)'}} {{9-17=contains}} {{18-18=where: }} {{none}}
+  _ = x.contains { _ in true } // OK
+  _ = x.reduce(1, combine: { _, _ in 1 }) // expected-error {{'reduce(_:combine:)' has been renamed to 'reduce(_:_:)'}} {{9-15=reduce}} {{19-28=}} {{none}}
+  _ = x.reduce(1) { _, _ in 1 } // OK
 }
 func _SequenceAlgorithms<S : Sequence>(x: S) where S.Iterator.Element : Comparable {
   _ = x.minElement() // expected-error {{'minElement()' has been renamed to 'min()'}} {{9-19=min}} {{none}}
@@ -485,9 +545,15 @@
   _ = String(repeating: u, count: 1) // expected-error {{'init(repeating:count:)' is unavailable: Replaced by init(repeating: String, count: Int)}} {{none}}
 }
 
-func _Unicode() {
+func _Unicode<C : UnicodeCodec>(s: UnicodeScalar, c: C.Type, out: (C.CodeUnit) -> Void) {
   func fn<T : UnicodeCodecType>(_: T) {} // expected-error {{'UnicodeCodecType' has been renamed to 'UnicodeCodec'}} {{15-31=UnicodeCodec}} {{none}}
+  c.encode(s, output: out) // expected-error {{encode(_:output:)' has been renamed to 'encode(_:into:)}} {{5-11=encode}} {{15-21=into}} {{none}}
+  c.encode(s) { _ in } // OK
+  UTF8.encode(s, output: { _ in }) // expected-error {{'encode(_:output:)' has been renamed to 'encode(_:into:)'}} {{8-14=encode}} {{18-24=into}} {{none}}
+  UTF16.encode(s, output: { _ in }) // expected-error {{'encode(_:output:)' has been renamed to 'encode(_:into:)'}} {{9-15=encode}} {{19-25=into}} {{none}}
+  UTF32.encode(s, output: { _ in }) // expected-error {{'encode(_:output:)' has been renamed to 'encode(_:into:)'}} {{9-15=encode}} {{19-25=into}} {{none}}
 }
+
 func _Unicode<I : IteratorProtocol, E : UnicodeCodec>(i: I, e: E.Type) where I.Element == E.CodeUnit {
   _ = transcode(e, e, i, { _ in }, stopOnError: true) // expected-error {{'transcode(_:_:_:_:stopOnError:)' is unavailable: use 'transcode(_:from:to:stoppingOnError:into:)'}} {{none}}
   _ = UTF16.measure(e, input: i, repairIllFormedSequences: true) // expected-error {{'measure(_:input:repairIllFormedSequences:)' is unavailable: use 'transcodedLength(of:decodedAs:repairingIllFormedSequences:)'}} {{none}}
@@ -540,6 +606,10 @@
   ptr2.deallocate(capacity: 1)
 }
 
+func _UnsafePointer<T, C : Collection>(x: UnsafeMutablePointer<T>, c: C) where C.Iterator.Element == T {
+  x.initializeFrom(c) // expected-error {{'initializeFrom' has been renamed to 'initialize(from:)'}}
+}
+
 func _VarArgs() {
   func fn1(_: CVarArgType) {} // expected-error {{'CVarArgType' has been renamed to 'CVarArg'}} {{15-26=CVarArg}}{{none}}
   func fn2(_: VaListBuilder) {} // expected-error {{'VaListBuilder' is unavailable}} {{none}}
diff --git a/test/1_stdlib/Runtime.swift.gyb b/test/1_stdlib/Runtime.swift.gyb
index bb6ad4d..8dfbb89 100644
--- a/test/1_stdlib/Runtime.swift.gyb
+++ b/test/1_stdlib/Runtime.swift.gyb
@@ -9,6 +9,11 @@
 import StdlibUnittest
 import SwiftShims
 
+#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
+import Darwin
+#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android)
+import Glibc
+#endif
 
 @_silgen_name("swift_demangle")
 public
@@ -496,6 +501,35 @@
   print(malkovich)
 }
 
+Runtime.test("SwiftError layout constants for LLDB") {
+#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
+  let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2)
+#elseif os(Linux)
+  let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: 0)
+#else
+  _UnimplementedError()
+#endif
+
+  let offsetof_SwiftError_typeMetadata =
+    dlsym(RTLD_DEFAULT, "_swift_lldb_offsetof_SwiftError_typeMetadata")!
+  let sizeof_SwiftError =
+    dlsym(RTLD_DEFAULT, "_swift_lldb_sizeof_SwiftError")!
+#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
+#if arch(i386) || arch(arm)
+  expectEqual(20, offsetof_SwiftError_typeMetadata.load(as: UInt.self))
+  expectEqual(36, sizeof_SwiftError.load(as: UInt.self))
+#else
+  expectEqual(40, offsetof_SwiftError_typeMetadata.load(as: UInt.self))
+  expectEqual(72, sizeof_SwiftError.load(as: UInt.self))
+#endif
+#elseif os(Linux)
+  expectEqual(16, offsetof_SwiftError_typeMetadata.load(as: UInt.self))
+  expectEqual(32, sizeof_SwiftError.load(as: UInt.self))
+#else
+  _UnimplementedError()
+#endif
+}
+
 var Reflection = TestSuite("Reflection")
 
 func wrap1   (_ x: Any) -> Any { return x }
diff --git a/test/1_stdlib/SegmentAlignment.c b/test/1_stdlib/SegmentAlignment.c
index 7e728b6..645f2e5 100644
--- a/test/1_stdlib/SegmentAlignment.c
+++ b/test/1_stdlib/SegmentAlignment.c
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t  &&  mkdir -p %t
 // RUN: xcrun -sdk %target-sdk-name %clang -c -arch %target-cpu %s -o %t/SegmentAlignment.o
 // RUN: %target-build-swift %S/Inputs/SegmentAlignment.swift -Xlinker %t/SegmentAlignment.o -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: CPU=armv7
 
diff --git a/test/1_stdlib/StringAPI.swift b/test/1_stdlib/StringAPI.swift
index 1d3250d..7e74f9f 100644
--- a/test/1_stdlib/StringAPI.swift
+++ b/test/1_stdlib/StringAPI.swift
@@ -24,7 +24,7 @@
   init(
     _ expectedUnicodeCollation: ExpectedComparisonResult,
     _ lhs: String, _ rhs: String,
-    xfail: TestRunPredicate = .custom({false}, reason: ""),
+    xfail: TestRunPredicate = .never,
     file: String = #file, line: UInt = #line
   ) {
     self.expectedUnicodeCollation = expectedUnicodeCollation
@@ -33,25 +33,28 @@
     self.loc = SourceLoc(file, line, comment: "test data")
     self.xfail = xfail
   }
+
+  func replacingPredicate(_ xfail: TestRunPredicate) -> ComparisonTest {
+    return ComparisonTest(expectedUnicodeCollation, lhs, rhs,
+      xfail: xfail, file: loc.file, line: loc.line)
+  }
 }
 
-let comparisonTests = [
+// List test cases for comparisons and prefix/suffix. Ideally none fail.
+
+let tests = [
   ComparisonTest(.eq, "", ""),
   ComparisonTest(.lt, "", "a"),
 
   // ASCII cases
   ComparisonTest(.lt, "t", "tt"),
-  ComparisonTest(.gt, "t", "Tt",
-    xfail: .nativeRuntime(
-      "Compares in reverse with ICU, https://bugs.swift.org/browse/SR-530")),
-  ComparisonTest(.gt, "\u{0}", "",
-    xfail: .nativeRuntime(
-      "Null-related issue: https://bugs.swift.org/browse/SR-630")),
+  ComparisonTest(.gt, "t", "Tt"),
+  ComparisonTest(.gt, "\u{0}", ""),
   ComparisonTest(.eq, "\u{0}", "\u{0}"),
-  // Currently fails:
-  // ComparisonTest(.lt, "\r\n", "t"),
-  // ComparisonTest(.gt, "\r\n", "\n"),
-  // ComparisonTest(.lt, "\u{0}", "\u{0}\u{0}"),
+
+  ComparisonTest(.lt, "\r\n", "t"),
+  ComparisonTest(.gt, "\r\n", "\n"),
+  ComparisonTest(.lt, "\u{0}", "\u{0}\u{0}"),
 
   // Whitespace
   // U+000A LINE FEED (LF)
@@ -89,9 +92,7 @@
   ComparisonTest(.eq, "\u{212b}", "A\u{30a}"),
   ComparisonTest(.eq, "\u{212b}", "\u{c5}"),
   ComparisonTest(.eq, "A\u{30a}", "\u{c5}"),
-  ComparisonTest(.lt, "A\u{30a}", "a",
-    xfail: .nativeRuntime(
-      "Compares in reverse with ICU, https://bugs.swift.org/browse/SR-530")),
+  ComparisonTest(.lt, "A\u{30a}", "a"),
   ComparisonTest(.lt, "A", "A\u{30a}"),
 
   // U+2126 OHM SIGN
@@ -114,6 +115,10 @@
   ComparisonTest(.eq, "\u{fb01}", "\u{fb01}"),
   ComparisonTest(.lt, "fi", "\u{fb01}"),
 
+  // U+1F1E7 REGIONAL INDICATOR SYMBOL LETTER B
+  // \u{1F1E7}\u{1F1E7} Flag of Barbados
+  ComparisonTest(.lt, "\u{1F1E7}", "\u{1F1E7}\u{1F1E7}"),
+
   // Test that Unicode collation is performed in deterministic mode.
   //
   // U+0301 COMBINING ACUTE ACCENT
@@ -128,10 +133,8 @@
   // U+0301 and U+0954 don't decompose in the canonical decomposition mapping.
   // U+0341 has a canonical decomposition mapping of U+0301.
   ComparisonTest(.eq, "\u{0301}", "\u{0341}"),
-  ComparisonTest(.lt, "\u{0301}", "\u{0954}",
-    xfail: .nativeRuntime("Compares as equal with ICU")),
-  ComparisonTest(.lt, "\u{0341}", "\u{0954}",
-    xfail: .nativeRuntime("Compares as equal with ICU")),
+  ComparisonTest(.lt, "\u{0301}", "\u{0954}"),
+  ComparisonTest(.lt, "\u{0341}", "\u{0954}"),
 ]
 
 func checkStringComparison(
@@ -169,6 +172,28 @@
 #endif
 }
 
+// Mark the test cases that are expected to fail in checkStringComparison
+
+let comparisonTests = tests.map {
+  (test: ComparisonTest) -> ComparisonTest in
+  switch (test.expectedUnicodeCollation, test.lhs, test.rhs) {
+  case (.gt, "t", "Tt"), (.lt, "A\u{30a}", "a"):
+    return test.replacingPredicate(.nativeRuntime(
+      "Comparison reversed between ICU and CFString, https://bugs.swift.org/browse/SR-530"))
+
+  case (.gt, "\u{0}", ""), (.lt, "\u{0}", "\u{0}\u{0}"):
+    return test.replacingPredicate(.nativeRuntime(
+      "Null-related issue: https://bugs.swift.org/browse/SR-630"))
+
+  case (.lt, "\u{0301}", "\u{0954}"), (.lt, "\u{0341}", "\u{0954}"):
+    return test.replacingPredicate(.nativeRuntime(
+      "Compares as equal with ICU"))
+
+  default:
+    return test
+  }
+}
+
 for test in comparisonTests {
   StringTests.test("String.{Equatable,Hashable,Comparable}: line \(test.loc.line)")
   .xfail(test.xfail)
@@ -248,11 +273,7 @@
     .starts(with: rhsNFDGraphemeClusters.lazy.reversed(), by: (==))
 
   expectEqual(expectHasPrefix, lhs.hasPrefix(rhs), stackTrace: stackTrace)
-  expectEqual(
-    expectHasPrefix, (lhs + "abc").hasPrefix(rhs), stackTrace: stackTrace)
   expectEqual(expectHasSuffix, lhs.hasSuffix(rhs), stackTrace: stackTrace)
-  expectEqual(
-    expectHasSuffix, ("abc" + lhs).hasSuffix(rhs), stackTrace: stackTrace)
 #endif
 }
 
@@ -261,33 +282,48 @@
   checkLosslessStringConvertible(comparisonTests.map { $0.rhs })
 }
 
-StringTests.test("hasPrefix,hasSuffix")
-  .skip(.nativeRuntime(
-    "String.has{Prefix,Suffix} defined when _runtime(_ObjC)"))
-  .code {
-  for test in comparisonTests {
-    checkHasPrefixHasSuffix(test.lhs, test.rhs, test.loc.withCurrentLoc())
-    checkHasPrefixHasSuffix(test.rhs, test.lhs, test.loc.withCurrentLoc())
+// Mark the test cases that are expected to fail in checkHasPrefixHasSuffix
+
+let substringTests = tests.map {
+  (test: ComparisonTest) -> ComparisonTest in
+  switch (test.expectedUnicodeCollation, test.lhs, test.rhs) {
+  case (.eq, "\u{0}", "\u{0}"):
+    return test.replacingPredicate(.objCRuntime(
+      "https://bugs.swift.org/browse/SR-332"))
+
+  case (.gt, "\r\n", "\n"):
+    return test.replacingPredicate(.objCRuntime(
+      "blocked on rdar://problem/19036555"))
+
+  case (.eq, "\u{0301}", "\u{0341}"):
+    return test.replacingPredicate(.objCRuntime(
+      "https://bugs.swift.org/browse/SR-243"))
+
+  case (.lt, "\u{1F1E7}", "\u{1F1E7}\u{1F1E7}"):
+    return test.replacingPredicate(.objCRuntime(
+      "https://bugs.swift.org/browse/SR-367"))
+
+  default:
+    return test
   }
 }
 
-StringTests.test("Failures{hasPrefix,hasSuffix}-CF")
-  .skip(.nativeRuntime(
-    "String.has{Prefix,Suffix} defined when _runtime(_ObjC)"))
-  .code {
-  let test = ComparisonTest(.lt, "\u{0}", "\u{0}\u{0}")
-  checkHasPrefixHasSuffix(test.lhs, test.rhs, test.loc.withCurrentLoc())
-}
+for test in substringTests {
+  StringTests.test("hasPrefix,hasSuffix: line \(test.loc.line)")
+    .skip(.nativeRuntime(
+        "String.has{Prefix,Suffix} defined when _runtime(_ObjC)"))
+    .xfail(test.xfail)
+    .code {
+    checkHasPrefixHasSuffix(test.lhs, test.rhs, test.loc.withCurrentLoc())
+    checkHasPrefixHasSuffix(test.rhs, test.lhs, test.loc.withCurrentLoc())
 
-StringTests.test("Failures{hasPrefix,hasSuffix}")
-  .xfail(.custom({ true }, reason: "blocked on rdar://problem/19036555"))
-  .skip(.nativeRuntime(
-    "String.has{Prefix,Suffix} defined when _runtime(_ObjC)"))
-  .code {
-  let tests =
-    [ComparisonTest(.lt, "\r\n", "t"), ComparisonTest(.gt, "\r\n", "\n")]
-  tests.forEach {
-    checkHasPrefixHasSuffix($0.lhs, $0.rhs, $0.loc.withCurrentLoc())
+    let fragment = "abc"
+    let combiner = "\u{0301}" // combining acute accent
+
+    checkHasPrefixHasSuffix(test.lhs + fragment, test.rhs, test.loc.withCurrentLoc())
+    checkHasPrefixHasSuffix(fragment + test.lhs, test.rhs, test.loc.withCurrentLoc())
+    checkHasPrefixHasSuffix(test.lhs + combiner, test.rhs, test.loc.withCurrentLoc())
+    checkHasPrefixHasSuffix(combiner + test.lhs, test.rhs, test.loc.withCurrentLoc())
   }
 }
 
@@ -308,8 +344,7 @@
 
 StringTests.test("CompareStringsWithUnpairedSurrogates")
   .xfail(
-    .custom({ true },
-    reason: "<rdar://problem/18029104> Strings referring to underlying " +
+    .always("<rdar://problem/18029104> Strings referring to underlying " +
       "storage with unpaired surrogates compare unequal"))
   .code {
   let donor = "abcdef"
diff --git a/test/1_stdlib/StringDiagnostics_without_Foundation.swift b/test/1_stdlib/StringDiagnostics_without_Foundation.swift
index 2f5cd93..4109070 100644
--- a/test/1_stdlib/StringDiagnostics_without_Foundation.swift
+++ b/test/1_stdlib/StringDiagnostics_without_Foundation.swift
@@ -27,5 +27,5 @@
 struct NotLosslessStringConvertible {}
 
 func testStringInitT() {
-  _ = String(NotLosslessStringConvertible()) // expected-error{{'init' has been renamed to 'init(describing:)}}
+  _ = String(NotLosslessStringConvertible()) // expected-error{{'init' has been renamed to 'init(describing:)}}{{14-14=describing: }}
 }
diff --git a/test/1_stdlib/StringReallocation.swift b/test/1_stdlib/StringReallocation.swift
index 98a208d..e774fbb 100644
--- a/test/1_stdlib/StringReallocation.swift
+++ b/test/1_stdlib/StringReallocation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // CHECK-NOT: Reallocations exceeded 30
diff --git a/test/1_stdlib/TestCharacterSet.swift b/test/1_stdlib/TestCharacterSet.swift
index ee8825d..316e148 100644
--- a/test/1_stdlib/TestCharacterSet.swift
+++ b/test/1_stdlib/TestCharacterSet.swift
@@ -180,6 +180,28 @@
         expectNotEqual(anyHashables[0], anyHashables[1])
         expectEqual(anyHashables[1], anyHashables[2])
     }
+
+    func test_superSet() {
+        let a = CharacterSet.letters.isSuperset(of: CharacterSet(charactersIn: "ab"))
+        expectTrue(a)
+    }
+
+    func test_union() {
+        let union = CharacterSet(charactersIn: "ab").union(CharacterSet(charactersIn: "cd"))
+        let expected = CharacterSet(charactersIn: "abcd")
+        expectEqual(expected, union)
+    }
+
+    func test_hasMember() {
+        let contains = CharacterSet.letters.hasMember(inPlane: 1)
+        expectTrue(contains)
+    }
+
+    func test_bitmap() {
+        let bitmap = CharacterSet(charactersIn: "ab").bitmapRepresentation
+        expectEqual(0x6, bitmap[12])
+        expectEqual(8192, bitmap.count)
+    }
 }
 
 
@@ -195,6 +217,10 @@
 CharacterSetTests.test("test_classForCoder") { TestCharacterSet().test_classForCoder() }
 CharacterSetTests.test("test_AnyHashableContainingCharacterSet") { TestCharacterSet().test_AnyHashableContainingCharacterSet() }
 CharacterSetTests.test("test_AnyHashableCreatedFromNSCharacterSet") { TestCharacterSet().test_AnyHashableCreatedFromNSCharacterSet() }
+CharacterSetTests.test("test_superSet") { TestCharacterSet().test_superSet() }
+CharacterSetTests.test("test_union") { TestCharacterSet().test_union() }
+CharacterSetTests.test("test_hasMember") { TestCharacterSet().test_hasMember() }
+CharacterSetTests.test("test_bitmap") { TestCharacterSet().test_bitmap() }
 runAllTests()
 #endif
 
diff --git a/test/1_stdlib/UIViewControllerAdditions.swift b/test/1_stdlib/UIViewControllerAdditions.swift
index f9ffdd2..df57fb2 100644
--- a/test/1_stdlib/UIViewControllerAdditions.swift
+++ b/test/1_stdlib/UIViewControllerAdditions.swift
@@ -1,6 +1,6 @@
 // RxUN: %target-build-swift -g %s -o %t/ViewControllerAdditions.out
-// RxUN: %target-run %t/ViewControllerAdditions.out %S/Inputs/UIViewControllerAdditions | FileCheck %s
-// RUN: %target-run-simple-swift %S/Inputs/UIViewControllerAdditions | FileCheck %s
+// RxUN: %target-run %t/ViewControllerAdditions.out %S/Inputs/UIViewControllerAdditions | %FileCheck %s
+// RUN: %target-run-simple-swift %S/Inputs/UIViewControllerAdditions | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: OS=ios
diff --git a/test/1_stdlib/UnsafePointer.swift.gyb b/test/1_stdlib/UnsafePointer.swift.gyb
index 5df91a9..5986932 100644
--- a/test/1_stdlib/UnsafePointer.swift.gyb
+++ b/test/1_stdlib/UnsafePointer.swift.gyb
@@ -293,14 +293,14 @@
 }
 
 func checkPtr(
-  _ f: ((UnsafeMutablePointer<Missile>) -> (UnsafeMutablePointer<Missile>, _ count: Int) -> Void), 
+  _ f: @escaping ((UnsafeMutablePointer<Missile>) -> (UnsafeMutablePointer<Missile>, _ count: Int) -> Void),
   _ m: Bool
 ) -> (Check) -> Void {
   return { checkPointerCorrectness($0, m, f) }
 }
 
 func checkPtr(
-  _ f: ((UnsafeMutablePointer<Missile>) -> (UnsafePointer<Missile>, _ count: Int) -> Void), 
+  _ f: @escaping ((UnsafeMutablePointer<Missile>) -> (UnsafePointer<Missile>, _ count: Int) -> Void),
   _ m: Bool
 ) -> (Check) -> Void {
   return {
diff --git a/test/1_stdlib/UnsafePointerDiagnostics.swift b/test/1_stdlib/UnsafePointerDiagnostics.swift
index ef5e5a8..ced6d5d 100644
--- a/test/1_stdlib/UnsafePointerDiagnostics.swift
+++ b/test/1_stdlib/UnsafePointerDiagnostics.swift
@@ -12,6 +12,15 @@
   umps: UnsafeMutablePointer<String>,
   ups: UnsafePointer<String>) {
 
+  let omrp: UnsafeMutableRawPointer? = mrp
+  let orp: UnsafeRawPointer? = rp
+  let oumpv: UnsafeMutablePointer<Void> = umpv  // expected-warning {{UnsafeMutablePointer<Void> has been replaced by UnsafeMutableRawPointer}}
+  let oupv: UnsafePointer<Void>? = upv  // expected-warning {{UnsafePointer<Void> has been replaced by UnsafeRawPointer}}
+  let oumpi: UnsafeMutablePointer<Int>? = umpi
+  let oupi: UnsafePointer<Int>? = upi
+  let oumps: UnsafeMutablePointer<String>? = umps
+  let oups: UnsafePointer<String>? = ups
+
   _ = UnsafeMutableRawPointer(mrp)
   _ = UnsafeMutableRawPointer(rp)   // expected-error {{'init' has been renamed to 'init(mutating:)'}}
   _ = UnsafeMutableRawPointer(umpv)
@@ -20,6 +29,14 @@
   _ = UnsafeMutableRawPointer(upi)  // expected-error {{'init' has been renamed to 'init(mutating:)'}}
   _ = UnsafeMutableRawPointer(umps)
   _ = UnsafeMutableRawPointer(ups)  // expected-error {{'init' has been renamed to 'init(mutating:)'}}
+  _ = UnsafeMutableRawPointer(omrp)
+  _ = UnsafeMutableRawPointer(orp)   // expected-error {{'init' has been renamed to 'init(mutating:)'}}
+  _ = UnsafeMutableRawPointer(oumpv)
+  _ = UnsafeMutableRawPointer(oupv)  // expected-error {{'init' has been renamed to 'init(mutating:)'}}
+  _ = UnsafeMutableRawPointer(oumpi)
+  _ = UnsafeMutableRawPointer(oupi)  // expected-error {{'init' has been renamed to 'init(mutating:)'}}
+  _ = UnsafeMutableRawPointer(oumps)
+  _ = UnsafeMutableRawPointer(oups)  // expected-error {{'init' has been renamed to 'init(mutating:)'}}
 
   // These all correctly pass with no error.
   _ = UnsafeRawPointer(mrp)
@@ -30,8 +47,15 @@
   _ = UnsafeRawPointer(upi)
   _ = UnsafeRawPointer(umps)
   _ = UnsafeRawPointer(ups)
+  _ = UnsafeRawPointer(omrp)
+  _ = UnsafeRawPointer(orp)
+  _ = UnsafeRawPointer(oumpv)
+  _ = UnsafeRawPointer(oupv)
+  _ = UnsafeRawPointer(oumpi)
+  _ = UnsafeRawPointer(oupi)
+  _ = UnsafeRawPointer(oumps)
+  _ = UnsafeRawPointer(oups)
 
-  // UnsafeMutablePointer<Void> to UnsafeMutableRawPointer(umpv)
   _ = UnsafeMutablePointer<Void>(rp) // expected-warning 3 {{UnsafeMutablePointer<Void> has been replaced by UnsafeMutableRawPointer}} expected-error {{cannot invoke initializer for type 'UnsafeMutablePointer<Void>' with an argument list of type '(UnsafeRawPointer)'}} expected-note {{overloads for 'UnsafeMutablePointer<Void>' exist with these partially matching parameter lists: (RawPointer), (OpaquePointer), (OpaquePointer?), (UnsafeMutablePointer<Pointee>), (UnsafeMutablePointer<Pointee>?)}} expected-note{{Pointer conversion restricted: use '.assumingMemoryBound(to:)' or '.bindMemory(to:capacity:)' to view memory as a type}}
   _ = UnsafeMutablePointer<Void>(mrp) // expected-error {{cannot invoke initializer for type 'UnsafeMutablePointer<Void>' with an argument list of type '(UnsafeMutableRawPointer)'}} expected-note {{}} expected-warning 3 {{UnsafeMutablePointer<Void> has been replaced by UnsafeMutableRawPointer}} expected-note{{overloads for 'UnsafeMutablePointer<Void>' exist with these partially matching parameter lists: (RawPointer), (OpaquePointer), (OpaquePointer?), (UnsafeMutablePointer<Pointee>), (UnsafeMutablePointer<Pointee>?)}}
   _ = UnsafeMutablePointer<Void>(umpv) // expected-warning {{UnsafeMutablePointer<Void> has been replaced by UnsafeMutableRawPointer}}
@@ -41,7 +65,6 @@
   _ = UnsafeMutablePointer<Void>(umps) // expected-warning {{UnsafeMutablePointer<Void> has been replaced by UnsafeMutableRawPointer}}
   _ = UnsafeMutablePointer<Void>(ups)  // expected-error {{'init' has been renamed to 'init(mutating:)'}} expected-warning {{UnsafeMutablePointer<Void> has been replaced by UnsafeMutableRawPointer}}
 
-  // UnsafePointer<Void> to UnsafeRawPointer(umpv)
   _ = UnsafePointer<Void>(rp)  // expected-error {{cannot invoke initializer for type 'UnsafePointer<Void>' with an argument list of type '(UnsafeRawPointer)'}} expected-note {{}} expected-warning 3 {{UnsafePointer<Void> has been replaced by UnsafeRawPointer}} expected-note{{overloads for 'UnsafePointer<Void>' exist with these partially matching parameter lists: (RawPointer), (OpaquePointer), (OpaquePointer?), (UnsafePointer<Pointee>), (UnsafePointer<Pointee>?), (UnsafeMutablePointer<Pointee>), (UnsafeMutablePointer<Pointee>?)}}
   _ = UnsafePointer<Void>(mrp) // expected-error {{cannot invoke initializer for type 'UnsafePointer<Void>' with an argument list of type '(UnsafeMutableRawPointer)'}} expected-note {{}} expected-warning 3 {{UnsafePointer<Void> has been replaced by UnsafeRawPointer}} expected-note{{overloads for 'UnsafePointer<Void>' exist with these partially matching parameter lists: (RawPointer), (OpaquePointer), (OpaquePointer?), (UnsafePointer<Pointee>), (UnsafePointer<Pointee>?), (UnsafeMutablePointer<Pointee>), (UnsafeMutablePointer<Pointee>?)}}
   _ = UnsafePointer<Void>(umpv) // expected-warning {{UnsafePointer<Void> has been replaced by UnsafeRawPointer}}
@@ -59,6 +82,14 @@
   _ = UnsafeMutablePointer<Int>(upi)  // expected-error {{'init' has been renamed to 'init(mutating:)'}}
   _ = UnsafeMutablePointer<Int>(umps) // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
   _ = UnsafeMutablePointer<Int>(ups)  // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
+  _ = UnsafeMutablePointer<Int>(orp) // expected-error {{cannot invoke initializer for type 'UnsafeMutablePointer<Int>' with an argument list of type '(UnsafeRawPointer?)'}} expected-note {{Pointer conversion restricted: use '.assumingMemoryBound(to:)' or '.bindMemory(to:capacity:)' to view memory as a type.}} expected-note {{}}
+  _ = UnsafeMutablePointer<Int>(omrp) // expected-error {{cannot invoke initializer for type 'UnsafeMutablePointer<Int>' with an argument list of type '(UnsafeMutableRawPointer?)'}} expected-note {{Pointer conversion restricted: use '.assumingMemoryBound(to:)' or '.bindMemory(to:capacity:)' to view memory as a type.}} expected-note {{}}
+  _ = UnsafeMutablePointer<Int>(oumpv) // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
+  _ = UnsafeMutablePointer<Int>(oupv)  // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
+  _ = UnsafeMutablePointer<Int>(oumpi)
+  _ = UnsafeMutablePointer<Int>(oupi)  // expected-error {{'init' has been renamed to 'init(mutating:)'}}
+  _ = UnsafeMutablePointer<Int>(oumps) // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
+  _ = UnsafeMutablePointer<Int>(oups)  // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
 
   _ = UnsafePointer<Int>(rp)  // expected-error {{cannot invoke initializer for type 'UnsafePointer<Int>' with an argument list of type '(UnsafeRawPointer)'}} expected-note {{Pointer conversion restricted: use '.assumingMemoryBound(to:)' or '.bindMemory(to:capacity:)' to view memory as a type.}} expected-note {{}}
   _ = UnsafePointer<Int>(mrp) // expected-error {{cannot invoke initializer for type 'UnsafePointer<Int>' with an argument list of type '(UnsafeMutableRawPointer)'}} expected-note {{Pointer conversion restricted: use '.assumingMemoryBound(to:)' or '.bindMemory(to:capacity:)' to view memory as a type.}} expected-note {{}}
@@ -68,4 +99,12 @@
   _ = UnsafePointer<Int>(upi)
   _ = UnsafePointer<Int>(umps) // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
   _ = UnsafePointer<Int>(ups)  // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
+  _ = UnsafePointer<Int>(orp)  // expected-error {{cannot invoke initializer for type 'UnsafePointer<Int>' with an argument list of type '(UnsafeRawPointer?)'}} expected-note {{Pointer conversion restricted: use '.assumingMemoryBound(to:)' or '.bindMemory(to:capacity:)' to view memory as a type.}} expected-note {{}}
+  _ = UnsafePointer<Int>(omrp) // expected-error {{cannot invoke initializer for type 'UnsafePointer<Int>' with an argument list of type '(UnsafeMutableRawPointer?)'}} expected-note {{Pointer conversion restricted: use '.assumingMemoryBound(to:)' or '.bindMemory(to:capacity:)' to view memory as a type.}} expected-note {{}}
+  _ = UnsafePointer<Int>(oumpv) // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
+  _ = UnsafePointer<Int>(oupv)  // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
+  _ = UnsafePointer<Int>(oumpi)
+  _ = UnsafePointer<Int>(oupi)
+  _ = UnsafePointer<Int>(oumps) // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
+  _ = UnsafePointer<Int>(oups)  // expected-error {{'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.}}
 }
diff --git a/test/1_stdlib/UnsafeRawPointer.swift b/test/1_stdlib/UnsafeRawPointer.swift
index 3b0cd6d..c5ad8d7 100644
--- a/test/1_stdlib/UnsafeRawPointer.swift
+++ b/test/1_stdlib/UnsafeRawPointer.swift
@@ -180,7 +180,7 @@
 }
 
 func checkPtr(
-  _ f: ((UnsafeMutableRawPointer)
+  _ f: @escaping ((UnsafeMutableRawPointer)
     -> (_ as: Int.Type, _ from: UnsafeMutablePointer<Int>, _ count: Int)
     -> UnsafeMutablePointer<Int>)
 ) -> (Check) -> Void {
@@ -188,7 +188,7 @@
 }
 
 func checkPtr(
-  _ f: ((UnsafeMutableRawPointer)
+  _ f: @escaping ((UnsafeMutableRawPointer)
     -> (_ as: Int.Type, _ from: UnsafePointer<Int>, _ count: Int)
     -> UnsafeMutablePointer<Int>)
 ) -> (Check) -> Void {
diff --git a/test/1_stdlib/VarArgs.swift b/test/1_stdlib/VarArgs.swift
index c46aec9..ee2801b 100644
--- a/test/1_stdlib/VarArgs.swift
+++ b/test/1_stdlib/VarArgs.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-stdlib-swift -parse-stdlib %s | FileCheck %s
+// RUN: %target-run-stdlib-swift -parse-stdlib %s | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/test/1_stdlib/WeakMirror.swift b/test/1_stdlib/WeakMirror.swift
new file mode 100644
index 0000000..8402de3
--- /dev/null
+++ b/test/1_stdlib/WeakMirror.swift
@@ -0,0 +1,273 @@
+//===--- Mirror.swift -----------------------------------------------------===//
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+//===----------------------------------------------------------------------===//
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+//
+// RUN: if [ %target-runtime == "objc" ]; \
+// RUN: then \
+// RUN:   %target-clang %S/Inputs/Mirror/Mirror.mm -c -o %t/Mirror.mm.o -g && \
+// RUN:   %target-build-swift -Xfrontend -disable-access-control %s -I %S/Inputs/Mirror/ -Xlinker %t/Mirror.mm.o -o %t/Mirror; \
+// RUN: else \
+// RUN:   %target-build-swift %s -Xfrontend -disable-access-control -o %t/Mirror; \
+// RUN: fi
+// RUN: %target-run %t/Mirror
+// REQUIRES: executable_test
+
+import StdlibUnittest
+
+var mirrors = TestSuite("Mirrors")
+
+class NativeSwiftClass : NativeClassBoundExistential {
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+protocol NativeClassBoundExistential : class {
+  var x: Int { get }
+}
+class NativeSwiftClassHasWeak {
+  weak var weakProperty: AnyObject?
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+class NativeSwiftClassHasNativeClassBoundExistential {
+  weak var weakProperty: NativeClassBoundExistential?
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+struct StructHasNativeWeakReference {
+  weak var weakProperty: AnyObject?
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+mirrors.test("class/NativeSwiftClassHasNativeWeakReference") {
+  let parent = NativeSwiftClassHasWeak(x: 1010)
+  let child = NativeSwiftClass(x: 2020)
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! NativeSwiftClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+mirrors.test("class/NativeSwiftClassHasNativeClassBoundExistential") {
+  let parent = NativeSwiftClassHasNativeClassBoundExistential(x: 1010)
+  let child = NativeSwiftClass(x: 2020) as NativeClassBoundExistential
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! NativeSwiftClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+mirrors.test("struct/StructHasNativeWeakReference") {
+  var parent = StructHasNativeWeakReference(x: 1010)
+  let child = NativeSwiftClass(x: 2020)
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! NativeSwiftClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+#if _runtime(_ObjC)
+
+import Foundation
+
+@objc protocol ObjCClassExistential : class {
+  weak var weakProperty: AnyObject? { get set }
+  var x: Int { get }
+}
+
+class ObjCClass : ObjCClassExistential {
+  weak var weakProperty: AnyObject?
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+class NativeSwiftClassHasObjCClassBoundExistential {
+  weak var weakProperty: ObjCClassExistential?
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+class ObjCClassHasWeak : NSObject {
+  weak var weakProperty: AnyObject?
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+class ObjCClassHasNativeClassBoundExistential : NSObject {
+  weak var weakProperty: NativeClassBoundExistential?
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+class ObjCClassHasObjCClassBoundExistential : NSObject {
+  weak var weakProperty: ObjCClassExistential?
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+struct StructHasObjCWeakReference {
+  weak var weakProperty: ObjCClass? = nil
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+struct StructHasObjCClassBoundExistential {
+  weak var weakProperty: ObjCClassExistential? = nil
+  let x: Int
+  init(x: Int) {
+    self.x = x
+  }
+}
+
+mirrors.test("class/NativeSwiftClassHasObjCWeakReference") {
+  let parent = NativeSwiftClassHasWeak(x: 1010)
+  let child = ObjCClass(x: 2020)
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! ObjCClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+mirrors.test("class/NativeSwiftClassHasObjCClassBoundExistential") {
+  let parent = NativeSwiftClassHasObjCClassBoundExistential(x: 1010)
+  let child = ObjCClass(x: 2020) as ObjCClassExistential
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! ObjCClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+mirrors.test("class/ObjCClassHasNativeWeak") {
+  let parent = ObjCClassHasWeak(x: 1010)
+  let child = NativeSwiftClass(x: 2020)
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! NativeSwiftClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+mirrors.test("class/ObjcCClassHasObjCWeakReference") {
+  let parent = ObjCClassHasWeak(x: 1010)
+  let child = ObjCClass(x: 2020)
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! ObjCClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+mirrors.test("class/ObjCClassHasNativeClassBoundExistential") {
+  let parent = ObjCClassHasNativeClassBoundExistential(x: 1010)
+  let child = NativeSwiftClass(x: 2020) as NativeClassBoundExistential
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! NativeSwiftClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+mirrors.test("class/ObjCClassHasObjCClassBoundExistential") {
+  let parent = ObjCClassHasObjCClassBoundExistential(x: 1010)
+  let child = ObjCClass(x: 2020) as ObjCClassExistential
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! ObjCClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+mirrors.test("struct/StructHasObjCWeakReference") {
+  var parent = StructHasObjCWeakReference(x: 1010)
+  let child = ObjCClass(x: 2020)
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! ObjCClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+mirrors.test("struct/StructHasObjCClassBoundExistential") {
+  var parent = StructHasObjCClassBoundExistential(x: 1010)
+  let child = ObjCClass(x: 2020) as ObjCClassExistential
+  parent.weakProperty = child
+  let mirror = Mirror(reflecting: parent)
+  let children = Array(mirror.children)
+  let extractedChild = children[0].1 as! ObjCClass
+  expectNotEqual(parent.x, extractedChild.x)
+  expectEqual(ObjectIdentifier(child), ObjectIdentifier(extractedChild))
+  expectEqual(child.x, extractedChild.x)
+  print(extractedChild)
+}
+
+#endif
+
+runAllTests()
diff --git a/test/1_stdlib/Zip.swift b/test/1_stdlib/Zip.swift
deleted file mode 100644
index f76807c..0000000
--- a/test/1_stdlib/Zip.swift
+++ /dev/null
@@ -1,30 +0,0 @@
-// RUN: %target-run-simple-swift | FileCheck %s
-// REQUIRES: executable_test
-
-// FIXME(prext): remove this file when protocol extensions land.
-
-var n = [2, 3, 5, 7, 11]
-var s = ["two", "three", "five", "seven", "eleven", "thirteen"]
-
-var i = 0
-var prefix = ""
-for p in zip(n, s) {
-    print("\(prefix)\(p.0) => \(p.1)", terminator: "")
-    i += 1
-    prefix = ", "
-}
-print(" (\(i) items)")
-// CHECK: 2 => two, 3 => three, 5 => five, 7 => seven, 11 => eleven (5 items)
-
-i = 0
-prefix = ""
-for p in zip(s, n) {
-    print("\(prefix)\(p.0) => \(p.1)", terminator: "")
-    i += 1
-    prefix = ", "
-}
-print(" (\(i) items)")
-// CHECK: two => 2, three => 3, five => 5, seven => 7, eleven => 11 (5 items)
-
-print("done.")
-
diff --git a/test/1_stdlib/integer_conversions.swift b/test/1_stdlib/integer_conversions.swift
index 76144e7..6bfeb91 100644
--- a/test/1_stdlib/integer_conversions.swift
+++ b/test/1_stdlib/integer_conversions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 var a : Int
diff --git a/test/1_stdlib/sort_integers.swift b/test/1_stdlib/sort_integers.swift
index 29328fb..0717679 100644
--- a/test/1_stdlib/sort_integers.swift
+++ b/test/1_stdlib/sort_integers.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // Generate all possible permutes.
diff --git a/test/AutolinkExtract/empty.swift b/test/AutolinkExtract/empty.swift
index 2e32546..b9ae006 100644
--- a/test/AutolinkExtract/empty.swift
+++ b/test/AutolinkExtract/empty.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swiftc_driver -c %s -o %t
-// RUN: %target-swift-autolink-extract %t -o - | FileCheck --check-prefix CHECK-%target-object-format %s
+// RUN: %target-swift-autolink-extract %t -o - | %FileCheck --check-prefix CHECK-%target-object-format %s
 
 // REQUIRES: autolink-extract
 
diff --git a/test/AutolinkExtract/empty_archive.swift b/test/AutolinkExtract/empty_archive.swift
index 030ef63..ee66d67 100644
--- a/test/AutolinkExtract/empty_archive.swift
+++ b/test/AutolinkExtract/empty_archive.swift
@@ -1,7 +1,7 @@
 // RUN: %target-swiftc_driver -c %s -o %t
 // RUN: rm -f %t.a
 // RUN: llvm-ar cr %t.a %t
-// RUN: %target-swift-autolink-extract %t.a -o - | FileCheck --check-prefix CHECK-%target-object-format %s
+// RUN: %target-swift-autolink-extract %t.a -o - | %FileCheck --check-prefix CHECK-%target-object-format %s
 
 // REQUIRES: autolink-extract
 
diff --git a/test/AutolinkExtract/error_no_inputs.swift b/test/AutolinkExtract/error_no_inputs.swift
index 77ed359..d86b243 100644
--- a/test/AutolinkExtract/error_no_inputs.swift
+++ b/test/AutolinkExtract/error_no_inputs.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swiftc_driver -c %s -o %t
-// RUN: not %target-swift-autolink-extract 2>&1 | FileCheck %s
+// RUN: not %target-swift-autolink-extract 2>&1 | %FileCheck %s
 
 // REQUIRES: autolink-extract
 
diff --git a/test/AutolinkExtract/import.swift b/test/AutolinkExtract/import.swift
index c87a7bc..5f55961 100644
--- a/test/AutolinkExtract/import.swift
+++ b/test/AutolinkExtract/import.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir -p %t
 // RUN: %target-swiftc_driver -emit-library -emit-module -emit-module-path %t/empty.swiftmodule -module-name empty -module-link-name empty %S/empty.swift
 // RUN: %target-swiftc_driver -c %s -I %t -o %t/import_experimental.o
-// RUN: %target-swift-autolink-extract %t/import_experimental.o -o - | FileCheck --check-prefix CHECK-%target-object-format %s
+// RUN: %target-swift-autolink-extract %t/import_experimental.o -o - | %FileCheck --check-prefix CHECK-%target-object-format %s
 
 // REQUIRES: autolink-extract
 
diff --git a/test/AutolinkExtract/import_archive.swift b/test/AutolinkExtract/import_archive.swift
index d3fa6a6..d4bb89e 100644
--- a/test/AutolinkExtract/import_archive.swift
+++ b/test/AutolinkExtract/import_archive.swift
@@ -3,7 +3,7 @@
 // RUN: %target-swiftc_driver -emit-library -emit-module -emit-module-path %t/empty.swiftmodule -module-name empty -module-link-name empty %S/empty.swift
 // RUN: %target-swiftc_driver -c %s -I %t -o %t/import_experimental.o
 // RUN: llvm-ar cr %t/import_experimental.a %t/import_experimental.o
-// RUN: %target-swift-autolink-extract %t/import_experimental.a -o - | FileCheck --check-prefix CHECK-%target-object-format %s
+// RUN: %target-swift-autolink-extract %t/import_experimental.a -o - | %FileCheck --check-prefix CHECK-%target-object-format %s
 
 // REQUIRES: autolink-extract
 
diff --git a/test/AutolinkExtract/linker-order.ll b/test/AutolinkExtract/linker-order.ll
index 7da7d60..735add6 100644
--- a/test/AutolinkExtract/linker-order.ll
+++ b/test/AutolinkExtract/linker-order.ll
@@ -1,6 +1,6 @@
-; RUN: llc -mtriple armv7--linux-gnueabihf -filetype obj -o - %s | %target-swift-autolink-extract -o - - | FileCheck %s
-; RUN: llc -mtriple x86_64--windows-gnu -filetype obj -o - %s | %target-swift-autolink-extract -o - - | FileCheck %s
-; RUN: llc -mtriple x86_64--windows-cygnus -filetype obj -o - %s | %target-swift-autolink-extract -o - - | FileCheck %s
+; RUN: llc -mtriple armv7--linux-gnueabihf -filetype obj -o - %s | %target-swift-autolink-extract -o - - | %FileCheck %s
+; RUN: llc -mtriple x86_64--windows-gnu -filetype obj -o - %s | %target-swift-autolink-extract -o - - | %FileCheck %s
+; RUN: llc -mtriple x86_64--windows-cygnus -filetype obj -o - %s | %target-swift-autolink-extract -o - - | %FileCheck %s
 ; REQUIRES: autolink-extract
 
 ; Ensure that the options in the object file preserve ordering.  The linker
diff --git a/test/ClangModules/CoreGraphics_test.swift b/test/ClangModules/CoreGraphics_test.swift
index f90ef43..ae95ee3 100644
--- a/test/ClangModules/CoreGraphics_test.swift
+++ b/test/ClangModules/CoreGraphics_test.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -target x86_64-apple-macosx10.11 -emit-ir -O %s | FileCheck %s
+// RUN: %target-swift-frontend -target x86_64-apple-macosx10.11 -emit-ir -O %s | %FileCheck %s
 
 // Test some imported CG APIs
 import CoreGraphics
@@ -87,6 +87,15 @@
 // CHECK:   ret void
 }
 
+// Test factory-ness of inferred imports
+extension CGMutablePath {
+  // CHECK-LABEL: define %{{.*}}CGMutablePath* {{.*}}CGMutablePath{{.*}}(i1{{.*}})
+  public convenience init(p: Bool) {
+    self.init()
+    // CHECK: tail call %struct.CGPath* @CGPathCreateMutable()
+  }
+}
+
 // CHECK-LABEL: define void {{.*}}testRenames{{.*}} {
 public func testRenames(transform: CGAffineTransform, context: CGContext,
                         point: CGPoint, size: CGSize, rect: CGRect,
diff --git a/test/ClangModules/Inputs/custom-modules/Newtype.h b/test/ClangModules/Inputs/custom-modules/Newtype.h
new file mode 100644
index 0000000..12d9a7f
--- /dev/null
+++ b/test/ClangModules/Inputs/custom-modules/Newtype.h
@@ -0,0 +1,4 @@
+@import Foundation;
+
+typedef NSString *__nonnull SNTErrorDomain __attribute((swift_newtype(struct)));
+typedef NSInteger MyInt __attribute((swift_newtype(struct)));
diff --git a/test/ClangModules/Inputs/custom-modules/module.map b/test/ClangModules/Inputs/custom-modules/module.map
index 23a7d22..97987c1 100644
--- a/test/ClangModules/Inputs/custom-modules/module.map
+++ b/test/ClangModules/Inputs/custom-modules/module.map
@@ -69,6 +69,10 @@
   header "this-header-does-not-exist.h"
 }
 
+module Newtype {
+  header "Newtype.h"
+}
+
 module ObjCIRExtras {
   header "ObjCIRExtras.h"
   export *
diff --git a/test/ClangModules/MixedSource/Xcc_include.swift b/test/ClangModules/MixedSource/Xcc_include.swift
index ebfb4a4..312e2e5 100644
--- a/test/ClangModules/MixedSource/Xcc_include.swift
+++ b/test/ClangModules/MixedSource/Xcc_include.swift
@@ -1,10 +1,10 @@
-// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xcc -include -Xcc %S/Inputs/Xcc_include.h -parse %s 2>&1 | FileCheck -check-prefix=CHECK-INCLUDE-ONLY %s
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xcc -include -Xcc %S/Inputs/Xcc_include.h -parse %s 2>&1 | %FileCheck -check-prefix=CHECK-INCLUDE-ONLY %s
 
-// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xcc -include -Xcc %S/Inputs/Xcc_include.h -import-objc-header %S/../../Inputs/empty.swift -parse %s 2>&1 | FileCheck -check-prefix=CHECK-INCLUDE-PLUS-BRIDGING %s
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xcc -include -Xcc %S/Inputs/Xcc_include.h -import-objc-header %S/../../Inputs/empty.swift -parse %s 2>&1 | %FileCheck -check-prefix=CHECK-INCLUDE-PLUS-BRIDGING %s
 
-// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xcc -include -Xcc %S/Inputs/Xcc_include.h -F %S/Inputs/mixed-target/ -module-name Mixed -import-underlying-module -parse %s -disable-objc-attr-requires-foundation-module 2>&1 | FileCheck -check-prefix=CHECK-INCLUDE-FRAMEWORK %s
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xcc -include -Xcc %S/Inputs/Xcc_include.h -F %S/Inputs/mixed-target/ -module-name Mixed -import-underlying-module -parse %s -disable-objc-attr-requires-foundation-module 2>&1 | %FileCheck -check-prefix=CHECK-INCLUDE-FRAMEWORK %s
 
-// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xcc -include -Xcc %S/Inputs/this_header_does_not_exist.h -parse %s 2>&1 | FileCheck -check-prefix=CHECK-INCLUDE-MISSING %s
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xcc -include -Xcc %S/Inputs/this_header_does_not_exist.h -parse %s 2>&1 | %FileCheck -check-prefix=CHECK-INCLUDE-MISSING %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/MixedSource/broken-bridging-header.swift b/test/ClangModules/MixedSource/broken-bridging-header.swift
index 2ca2521..14211d7 100644
--- a/test/ClangModules/MixedSource/broken-bridging-header.swift
+++ b/test/ClangModules/MixedSource/broken-bridging-header.swift
@@ -1,21 +1,21 @@
 // RUN: rm -rf %t && mkdir -p %t
-// RUN: not %target-swift-frontend -parse %S/../../Inputs/empty.swift -import-objc-header %t/fake.h 2>&1 | FileCheck -check-prefix=MISSING-HEADER %s
+// RUN: not %target-swift-frontend -parse %S/../../Inputs/empty.swift -import-objc-header %t/fake.h 2>&1 | %FileCheck -check-prefix=MISSING-HEADER %s
 
 // RUN: cp %S/Inputs/error-on-define.h %t
-// RUN: not %target-swift-frontend -parse %S/../../Inputs/empty.swift -import-objc-header %t/error-on-define.h 2>&1 | FileCheck -check-prefix=MISSING-OTHER-HEADER %s
+// RUN: not %target-swift-frontend -parse %S/../../Inputs/empty.swift -import-objc-header %t/error-on-define.h 2>&1 | %FileCheck -check-prefix=MISSING-OTHER-HEADER %s
 
 // RUN: cp %S/Inputs/error-on-define-impl.h %t
-// RUN: not %target-swift-frontend -parse %S/../../Inputs/empty.swift -import-objc-header %t/error-on-define.h -Xcc -DERROR 2>&1 | FileCheck -check-prefix=HEADER-ERROR %s
+// RUN: not %target-swift-frontend -parse %S/../../Inputs/empty.swift -import-objc-header %t/error-on-define.h -Xcc -DERROR 2>&1 | %FileCheck -check-prefix=HEADER-ERROR %s
 
 
 // RUN: %target-swift-frontend -emit-module -o %t -module-name HasBridgingHeader %S/../../Inputs/empty.swift -import-objc-header %t/error-on-define.h
 
 // RUN: %target-swift-frontend -parse %s -I %t -Xcc -DERROR -verify -show-diagnostics-after-fatal
-// RUN: not %target-swift-frontend -parse %s -I %t -Xcc -DERROR 2>&1 | FileCheck -check-prefix=HEADER-ERROR %s
+// RUN: not %target-swift-frontend -parse %s -I %t -Xcc -DERROR 2>&1 | %FileCheck -check-prefix=HEADER-ERROR %s
 
 // RUN: rm %t/error-on-define-impl.h
 // RUN: %target-swift-frontend -parse %s -I %t -verify -show-diagnostics-after-fatal
-// RUN: not %target-swift-frontend -parse %s -I %t 2>&1 | FileCheck -check-prefix=MISSING-OTHER-HEADER %s
+// RUN: not %target-swift-frontend -parse %s -I %t 2>&1 | %FileCheck -check-prefix=MISSING-OTHER-HEADER %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/MixedSource/broken-modules.swift b/test/ClangModules/MixedSource/broken-modules.swift
index 49a86ab..635d719 100644
--- a/test/ClangModules/MixedSource/broken-modules.swift
+++ b/test/ClangModules/MixedSource/broken-modules.swift
@@ -1,11 +1,11 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: not %target-swift-frontend -parse %s -I %S/Inputs/broken-modules/ -enable-source-import -show-diagnostics-after-fatal 2> %t/err.txt
-// RUN: FileCheck -check-prefix CHECK -check-prefix CLANG-CHECK %s < %t/err.txt
+// RUN: %FileCheck -check-prefix CHECK -check-prefix CLANG-CHECK %s < %t/err.txt
 
 // RUN: not %target-swift-frontend -parse %s -import-objc-header %S/Inputs/broken-modules/BrokenClangModule.h -enable-source-import 2> %t/err.bridging-header.txt 
-// RUN: FileCheck -check-prefix CHECK-BRIDGING-HEADER -check-prefix CLANG-CHECK %s < %t/err.bridging-header.txt
+// RUN: %FileCheck -check-prefix CHECK-BRIDGING-HEADER -check-prefix CLANG-CHECK %s < %t/err.bridging-header.txt
 
-// RUN: not %target-swift-frontend -parse %s -import-objc-header %S/../../Inputs/empty.swift 2>&1 | FileCheck -check-prefix=EMPTY-HEADER %s
+// RUN: not %target-swift-frontend -parse %s -import-objc-header %S/../../Inputs/empty.swift 2>&1 | %FileCheck -check-prefix=EMPTY-HEADER %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/MixedSource/import-mixed-with-header-twice.swift b/test/ClangModules/MixedSource/import-mixed-with-header-twice.swift
index 15bd64a..84728be 100644
--- a/test/ClangModules/MixedSource/import-mixed-with-header-twice.swift
+++ b/test/ClangModules/MixedSource/import-mixed-with-header-twice.swift
@@ -6,7 +6,7 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/../Inputs/custom-modules -I %t -parse %s -verify
 
 // RUN: rm %t/mixed-target/header.h
-// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %t -I %S/../Inputs/custom-modules -parse %s 2>&1 | FileCheck %s -check-prefix=USE-SERIALIZED-HEADER
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %t -I %S/../Inputs/custom-modules -parse %s 2>&1 | %FileCheck %s -check-prefix=USE-SERIALIZED-HEADER
 
 // XFAIL: linux
 
diff --git a/test/ClangModules/MixedSource/mixed-target-using-module.swift b/test/ClangModules/MixedSource/mixed-target-using-module.swift
index f6fbd4f..fdea038 100644
--- a/test/ClangModules/MixedSource/mixed-target-using-module.swift
+++ b/test/ClangModules/MixedSource/mixed-target-using-module.swift
@@ -1,6 +1,6 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -F %S/Inputs/mixed-target/ -module-name Mixed -import-underlying-module -parse %s -verify -disable-objc-attr-requires-foundation-module
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -F %S/Inputs/mixed-target/ -module-name Mixed -import-underlying-module -emit-ir %S/../../Inputs/empty.swift - | FileCheck -check-prefix=CHECK-AUTOLINK %s
-// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -F %S/Inputs/mixed-target/ -module-name WrongName -import-underlying-module -parse %s  -disable-objc-attr-requires-foundation-module 2>&1 | FileCheck -check-prefix=CHECK-WRONG-NAME %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -F %S/Inputs/mixed-target/ -module-name Mixed -import-underlying-module -emit-ir %S/../../Inputs/empty.swift - | %FileCheck -check-prefix=CHECK-AUTOLINK %s
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -F %S/Inputs/mixed-target/ -module-name WrongName -import-underlying-module -parse %s  -disable-objc-attr-requires-foundation-module 2>&1 | %FileCheck -check-prefix=CHECK-WRONG-NAME %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/SceneKit_test.swift b/test/ClangModules/SceneKit_test.swift
index db5a823..64cf343 100644
--- a/test/ClangModules/SceneKit_test.swift
+++ b/test/ClangModules/SceneKit_test.swift
@@ -154,10 +154,10 @@
                     lookAtConstraint: SCNLookAtConstraint, mat4: SCNMatrix4,
                     particleSystem: SCNParticleSystem, event: SCNParticleEvent,
                     stage: SCNParticleModifierStage, animation: CAAnimation,
-                    bindingBlock: SCNBindingBlock, material: SCNMaterial,
-                    bufferBindingBlock: SCNBufferBindingBlock, vec4: SCNVector4,
-                    eventBlock: SCNParticleEventBlock, morpher: SCNMorpher,
-                    modifierBlock: SCNParticleModifierBlock, scene: SCNScene,
+                    bindingBlock: @escaping SCNBindingBlock, material: SCNMaterial,
+                    bufferBindingBlock: @escaping SCNBufferBindingBlock, vec4: SCNVector4,
+                    eventBlock: @escaping SCNParticleEventBlock, morpher: SCNMorpher,
+                    modifierBlock: @escaping SCNParticleModifierBlock, scene: SCNScene,
                     physicsBehavior: SCNPhysicsBehavior, geometry: SCNGeometry,
                     physicsBody: SCNPhysicsBody, sceneSource: SCNSceneSource,
                     physicsWorld: SCNPhysicsWorld, point: CGPoint,
diff --git a/test/ClangModules/attr-swift_name.swift b/test/ClangModules/attr-swift_name.swift
index 0b02bff..38b4d09 100644
--- a/test/ClangModules/attr-swift_name.swift
+++ b/test/ClangModules/attr-swift_name.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules -Xcc -w -parse %s 2>&1 | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules -Xcc -w -parse %s 2>&1 | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/attr-swift_private.swift b/test/ClangModules/attr-swift_private.swift
index d4c42ec..440efc5 100644
--- a/test/ClangModules/attr-swift_private.swift
+++ b/test/ClangModules/attr-swift_private.swift
@@ -2,10 +2,10 @@
 // RUN: %build-clang-importer-objc-overlays
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -I %S/Inputs/custom-modules -parse %s -verify
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -I %S/Inputs/custom-modules -emit-ir %s -D IRGEN | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -I %S/Inputs/custom-modules -emit-ir %s -D IRGEN | %FileCheck %s
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk-nosource -I %t) -I %S/Inputs/custom-modules -print-module -source-filename="%s" -module-to-print SwiftPrivateAttr > %t.txt
-// RUN: FileCheck -check-prefix=GENERATED-NEGATIVE %s < %t.txt
+// RUN: %FileCheck -check-prefix=GENERATED-NEGATIVE %s < %t.txt
 // RUN: diff -U3 %S/Inputs/SwiftPrivateAttr.txt %t.txt
 
 // Look for identifiers with "Priv" in them that haven't been prefixed.
diff --git a/test/ClangModules/autolinking.swift b/test/ClangModules/autolinking.swift
index ba9e8a5..de87350 100644
--- a/test/ClangModules/autolinking.swift
+++ b/test/ClangModules/autolinking.swift
@@ -1,15 +1,15 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %target-swift-frontend %s -sdk %S/Inputs -I %S/Inputs/custom-modules -emit-ir -o %t/without-adapter.ll
-// RUN: FileCheck %s < %t/without-adapter.ll
+// RUN: %FileCheck %s < %t/without-adapter.ll
 
 // RUN: %target-swift-frontend -emit-module %S/Inputs/adapter.swift -sdk %S/Inputs -module-link-name SwiftAdapter -module-name ClangModuleWithAdapter -I %S/Inputs/custom-modules -o %t
 // RUN: %target-swift-frontend %s -sdk %S/Inputs -I %S/Inputs/custom-modules -I %t -emit-ir -o %t/with-adapter.ll
-// RUN: FileCheck %s < %t/with-adapter.ll
-// RUN: FileCheck --check-prefix=CHECK-WITH-SWIFT %s < %t/with-adapter.ll
+// RUN: %FileCheck %s < %t/with-adapter.ll
+// RUN: %FileCheck --check-prefix=CHECK-WITH-SWIFT %s < %t/with-adapter.ll
 
 // RUN: %target-swift-frontend %s -sdk %S/Inputs -I %S/Inputs/custom-modules -emit-ir -disable-autolink-framework LinkFramework -o %t/with-disabled.ll
-// RUN: FileCheck --check-prefix=CHECK-WITH-DISABLED %s < %t/with-disabled.ll
+// RUN: %FileCheck --check-prefix=CHECK-WITH-DISABLED %s < %t/with-disabled.ll
 
 // Linux uses a different autolinking mechanism, based on
 // swift-autolink-extract. This file tests the Darwin mechanism.
diff --git a/test/ClangModules/availability_implicit_macosx.swift b/test/ClangModules/availability_implicit_macosx.swift
index 8c421cb..813d549 100644
--- a/test/ClangModules/availability_implicit_macosx.swift
+++ b/test/ClangModules/availability_implicit_macosx.swift
@@ -1,5 +1,5 @@
 // RUN: %swift -parse -verify -target x86_64-apple-macosx10.51 %clang-importer-sdk -I %S/Inputs/custom-modules %s %S/Inputs/availability_implicit_macosx_other.swift
-// RUN: not %swift -parse -target x86_64-apple-macosx10.51 %clang-importer-sdk -I %S/Inputs/custom-modules %s %S/Inputs/availability_implicit_macosx_other.swift 2>&1 | FileCheck %s '--implicit-check-not=<unknown>:0'
+// RUN: not %swift -parse -target x86_64-apple-macosx10.51 %clang-importer-sdk -I %S/Inputs/custom-modules %s %S/Inputs/availability_implicit_macosx_other.swift 2>&1 | %FileCheck %s '--implicit-check-not=<unknown>:0'
 
 // REQUIRES: OS=macosx
 
diff --git a/test/ClangModules/broken-modules.swift b/test/ClangModules/broken-modules.swift
index b6248cf..bd3fdd6 100644
--- a/test/ClangModules/broken-modules.swift
+++ b/test/ClangModules/broken-modules.swift
@@ -1,13 +1,13 @@
 // RUN: rm -rf %t && mkdir -p %t
 
 // RUN: not %target-swift-frontend -parse %s -I %S/Inputs/custom-modules/ -show-diagnostics-after-fatal -D MISSING_FROM_MODULE 2> %t/err.txt
-// RUN: FileCheck -check-prefix CHECK-MODULE-MAP %s < %t/err.txt
+// RUN: %FileCheck -check-prefix CHECK-MODULE-MAP %s < %t/err.txt
 
 // RUN: not %target-swift-frontend -parse %s -I %S/Inputs/custom-modules/ -show-diagnostics-after-fatal 2> %t/err.txt
-// RUN: FileCheck -check-prefix CHECK -check-prefix CHECK-DIRECT %s < %t/err.txt
+// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK-DIRECT %s < %t/err.txt
 
 // RUN: not %target-swift-frontend -parse %s -I %S/Inputs/custom-modules/ -show-diagnostics-after-fatal -D INDIRECT 2> %t/err.txt
-// RUN: FileCheck -check-prefix CHECK -check-prefix CHECK-INDIRECT %s < %t/err.txt
+// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK-INDIRECT %s < %t/err.txt
 
 // FIXME: not every test here depends on Objective-C syntax, this test can be
 // split.
diff --git a/test/ClangModules/cfuncs_ir.swift b/test/ClangModules/cfuncs_ir.swift
index a3ab129..160daf3 100644
--- a/test/ClangModules/cfuncs_ir.swift
+++ b/test/ClangModules/cfuncs_ir.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir -o - | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir -o - | %FileCheck %s
 
 // REQUIRES: OS=macosx
 
diff --git a/test/ClangModules/cfuncs_parse.swift b/test/ClangModules/cfuncs_parse.swift
index 9ada150..1075c19 100644
--- a/test/ClangModules/cfuncs_parse.swift
+++ b/test/ClangModules/cfuncs_parse.swift
@@ -1,7 +1,5 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify -I %S/Inputs %s
 
-// XFAIL: linux
-
 import cfuncs
 
 func test_cfunc1(_ i: Int) {
diff --git a/test/ClangModules/clang_builtin.swift b/test/ClangModules/clang_builtin.swift
index 710f5f3..166639f 100644
--- a/test/ClangModules/clang_builtin.swift
+++ b/test/ClangModules/clang_builtin.swift
@@ -2,7 +2,7 @@
 //
 // RUN: rm -rf %t/clang-module-cache
 // RUN: %target-swift-frontend -parse -verify -module-cache-path %t/clang-module-cache %s
-// RUN: ls -lR %t/clang-module-cache | FileCheck %s
+// RUN: ls -lR %t/clang-module-cache | %FileCheck %s
 
 // CHECK: _Builtin_intrinsics{{.*}}.pcm
 
diff --git a/test/ClangModules/const_and_pure.swift b/test/ClangModules/const_and_pure.swift
index 4f90641..1574c68 100644
--- a/test/ClangModules/const_and_pure.swift
+++ b/test/ClangModules/const_and_pure.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil %s -import-objc-header %S/Inputs/const_and_pure.h | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil %s -import-objc-header %S/Inputs/const_and_pure.h | %FileCheck %s
 
 func testit() {
 	const_function()
diff --git a/test/ClangModules/cstring_parse.swift b/test/ClangModules/cstring_parse.swift
index 0281454..5c6bdf0 100644
--- a/test/ClangModules/cstring_parse.swift
+++ b/test/ClangModules/cstring_parse.swift
@@ -3,9 +3,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify -module-cache-path %t/clang-module-cache -I %S/Inputs %s
-// RUN: ls -lR %t/clang-module-cache | FileCheck %s
-
-// XFAIL: linux
+// RUN: ls -lR %t/clang-module-cache | %FileCheck %s
 
 // CHECK: cfuncs{{.*}}.pcm
 
diff --git a/test/ClangModules/ctypes_ir.swift b/test/ClangModules/ctypes_ir.swift
index c8af8bd..a1328d7 100644
--- a/test/ClangModules/ctypes_ir.swift
+++ b/test/ClangModules/ctypes_ir.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -o - -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -o - -primary-file %s | %FileCheck %s
 
 // REQUIRES: OS=macosx
 
diff --git a/test/ClangModules/cvars_ir.swift b/test/ClangModules/cvars_ir.swift
index 10a52c4..79e0872 100644
--- a/test/ClangModules/cvars_ir.swift
+++ b/test/ClangModules/cvars_ir.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir -o - | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir -o - | %FileCheck %s
 
 // REQUIRES: OS=macosx
 
diff --git a/test/ClangModules/diags_from_module.swift b/test/ClangModules/diags_from_module.swift
index 493175f..2b404fd 100644
--- a/test/ClangModules/diags_from_module.swift
+++ b/test/ClangModules/diags_from_module.swift
@@ -1,5 +1,5 @@
 // RUN: not %target-swift-frontend -parse %s -F %S/Inputs/frameworks -Xcc -D -Xcc FOO 2> %t.err.txt
-// RUN: FileCheck -input-file=%t.err.txt %s
+// RUN: %FileCheck -input-file=%t.err.txt %s
 
 // XFAIL: linux
 
@@ -10,7 +10,7 @@
 // CHECK: diags_from_module.swift:[[@LINE-4]]:8: error: could not build Objective-C module 'Module'
 
 // RUN: %target-swift-frontend -parse %s -F %S/Inputs/frameworks 2> %tw.err.txt
-// RUN: FileCheck -input-file=%tw.err.txt %s -check-prefix=CHECK-WARN
+// RUN: %FileCheck -input-file=%tw.err.txt %s -check-prefix=CHECK-WARN
 
 // CHECK-WARN: Sub2.h:7:2: warning: here is some warning about something
 // FIXME: show the clang warning: <module-includes>:1:1: warning: umbrella header for module 'Module' does not include header 'NotInModule.h' [-Wincomplete-umbrella]
diff --git a/test/ClangModules/enum-error-execute.swift b/test/ClangModules/enum-error-execute.swift
index 29a726d..13f628a 100644
--- a/test/ClangModules/enum-error-execute.swift
+++ b/test/ClangModules/enum-error-execute.swift
@@ -1,7 +1,7 @@
 // RUN: mkdir -p %t
 // RUN: %target-clang %S/Inputs/enum-error.m -c -o %t/enum-error.o
 // RUN: %target-build-swift -import-objc-header %S/Inputs/enum-error.h -Xlinker %t/enum-error.o %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 
 // REQUIRES: executable_test
 // REQUIRES: OS=macosx
diff --git a/test/ClangModules/enum-error.swift b/test/ClangModules/enum-error.swift
index 362fecb..5e77a24 100644
--- a/test/ClangModules/enum-error.swift
+++ b/test/ClangModules/enum-error.swift
@@ -1,18 +1,18 @@
 // REQUIRES: OS=macosx
 
-// RUN: %target-swift-frontend -DVALUE -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | FileCheck %s -check-prefix=VALUE
-// RUN: %target-swift-frontend -DEMPTYCATCH -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | FileCheck %s -check-prefix=EMPTYCATCH
-// RUN: %target-swift-frontend -DASQEXPR -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | FileCheck %s -check-prefix=ASQEXPR
-// RUN: %target-swift-frontend -DASBANGEXPR -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | FileCheck %s -check-prefix=ASBANGEXPR
-// RUN: %target-swift-frontend -DCATCHIS -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | FileCheck %s -check-prefix=CATCHIS
-// RUN: %target-swift-frontend -DCATCHAS -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | FileCheck %s -check-prefix=CATCHAS
-// RUN: %target-swift-frontend -DGENERICONLY -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | FileCheck %s -check-prefix=GENERICONLY
+// RUN: %target-swift-frontend -DVALUE -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=VALUE
+// RUN: %target-swift-frontend -DEMPTYCATCH -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=EMPTYCATCH
+// RUN: %target-swift-frontend -DASQEXPR -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=ASQEXPR
+// RUN: %target-swift-frontend -DASBANGEXPR -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=ASBANGEXPR
+// RUN: %target-swift-frontend -DCATCHIS -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=CATCHIS
+// RUN: %target-swift-frontend -DCATCHAS -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=CATCHAS
+// RUN: %target-swift-frontend -DGENERICONLY -emit-sil %s -import-objc-header %S/Inputs/enum-error.h | %FileCheck %s -check-prefix=GENERICONLY
 
 // RUN: %target-swift-frontend -emit-sil %s -import-objc-header %S/Inputs/enum-error.h -verify
 
 // RUN: echo '#include "enum-error.h"' > %t.m
 // RUN: %target-swift-ide-test -source-filename %s -print-header -header-to-print %S/Inputs/enum-error.h -import-objc-header %S/Inputs/enum-error.h -print-regular-comments --cc-args %target-cc-options -fsyntax-only %t.m -I %S/Inputs > %t.txt
-// RUN: FileCheck -check-prefix=HEADER %s < %t.txt
+// RUN: %FileCheck -check-prefix=HEADER %s < %t.txt
 
 import Foundation
 
diff --git a/test/ClangModules/enum-with-target.swift b/test/ClangModules/enum-with-target.swift
index 15ce96c..f83d86b 100644
--- a/test/ClangModules/enum-with-target.swift
+++ b/test/ClangModules/enum-with-target.swift
@@ -14,7 +14,7 @@
 // rdar://problem/21081557
 func pokeRawValue(_ random: SomeRandomEnum) {
   switch (random) {
-  case SomeRandomEnum.RawValue // expected-error{{expression pattern of type 'RawValue.Type' (aka 'Int.Type') cannot match values of type 'SomeRandomEnum'}}
+  case SomeRandomEnum.RawValue // expected-error{{expression pattern of type 'SomeRandomEnum.RawValue.Type' (aka 'Int.Type') cannot match values of type 'SomeRandomEnum'}}
     // expected-error@-1{{expected ':' after 'case'}}
   }
 }
diff --git a/test/ClangModules/invalid_bridging_header.swift b/test/ClangModules/invalid_bridging_header.swift
index 6ede330..7ae08ed 100644
--- a/test/ClangModules/invalid_bridging_header.swift
+++ b/test/ClangModules/invalid_bridging_header.swift
@@ -1,5 +1,5 @@
 // RUN: not %target-swift-frontend-parse -import-objc-header %S/Inputs/invalid_bridging_header.h %s > %t.out 2>&1 
-// RUN: FileCheck %s < %t.out
+// RUN: %FileCheck %s < %t.out
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/non-modular-include.swift b/test/ClangModules/non-modular-include.swift
index ac9a692..ee443c3 100644
--- a/test/ClangModules/non-modular-include.swift
+++ b/test/ClangModules/non-modular-include.swift
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t && mkdir -p %t
-// RUN: not %target-swift-frontend -parse %s -I %S/Inputs/non-modular -F %S/Inputs/non-modular 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -parse %s -I %S/Inputs/non-modular -F %S/Inputs/non-modular 2>&1 | %FileCheck %s
 
 // CHECK: {{.+}}/non-modular/Foo.framework/Headers/Foo.h:1:9: error: include of non-modular header inside framework module 'Foo'
 // CHECK: error: could not build Objective-C module 'Foo'
diff --git a/test/ClangModules/nullability_silgen.swift b/test/ClangModules/nullability_silgen.swift
index cb84318..1fe29af 100644
--- a/test/ClangModules/nullability_silgen.swift
+++ b/test/ClangModules/nullability_silgen.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-clang-importer-objc-overlays
 
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-silgen -I %S/Inputs/custom-modules %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-silgen -I %S/Inputs/custom-modules %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/objc_bridging_generics.swift b/test/ClangModules/objc_bridging_generics.swift
index e4b5acd..de9d7c8 100644
--- a/test/ClangModules/objc_bridging_generics.swift
+++ b/test/ClangModules/objc_bridging_generics.swift
@@ -133,9 +133,8 @@
   func usesGenericParamG(_ x: T) {
     _ = T.self // expected-note{{used here}}
   }
-  // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
-  func usesGenericParamH(_ x: T) {
-    _ = x as Any // expected-note{{used here}}
+  func doesntUseGenericParamH(_ x: T) {
+    _ = x as Any
   }
   // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
   func usesGenericParamI(_ y: T.Type) {
@@ -181,14 +180,13 @@
     _ = #selector(y.create)
   }
 
-  // TODO: 'Any' bridging should not require reifying generic params.
-  func doesntUseGenericParam2(_ x: T, _ y: T.Type) { // expected-error{{cannot access the class's generic parameters}}
+  func doesntUseGenericParam2(_ x: T, _ y: T.Type) {
     let a = x.another()
     _ = a.another()
     _ = x.another().another()
 
     _ = type(of: x).create().another()
-    _ = type(of: x).init(noise: x).another() // expected-note{{here}}
+    _ = type(of: x).init(noise: x).another()
     _ = y.create().another()
     _ = y.init(noise: x).another()
     _ = y.init(noise: x.another()).another()
@@ -212,6 +210,44 @@
     y.apexPredator = x
   }
 
+  func doesntUseGenericParam5(y: T) {
+    var x = y
+    x = y
+    _ = x
+  }
+  func doesntUseGenericParam6(y: T?) {
+    var x = y
+    x = y
+    _ = x
+  }
+
+  // Doesn't use 'T', since dynamic casting to an ObjC generic class doesn't
+  // check its generic parameters
+  func doesntUseGenericParam7() {
+    _ = (self as AnyObject) as! GenericClass<T>
+    _ = (self as AnyObject) as? GenericClass<T>
+    _ = (self as AnyObject) as! AnimalContainer<T>
+    _ = (self as AnyObject) as? AnimalContainer<T>
+    _ = (self as AnyObject) is AnimalContainer<T>
+    _ = (self as AnyObject) is AnimalContainer<T>
+  }
+
+  // Dynamic casting to the generic parameter would require its generic params,
+  // though
+  // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
+  func usesGenericParamZ1() {
+    _ = (self as AnyObject) as! T //expected-note{{here}}
+  }
+  // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
+  func usesGenericParamZ2() {
+    _ = (self as AnyObject) as? T //expected-note{{here}}
+  }
+  // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
+  func usesGenericParamZ3() {
+    _ = (self as AnyObject) is T //expected-note{{here}}
+  }
+
+
   // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
   func usesGenericParamA(_ x: T) {
     _ = T(noise: x) // expected-note{{used here}}
@@ -229,6 +265,14 @@
     T.apexPredator = x // expected-note{{used here}}
   }
 
+  // rdar://problem/27796375 -- allocating init entry points for ObjC
+  // initializers are generated as true Swift generics, so reify type
+  // parameters.
+  // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
+  func usesGenericParamE(_ x: T) {
+    _ = GenericClass(thing: x) // expected-note{{used here}}
+  }
+
   func checkThatMethodsAreObjC() {
     _ = #selector(AnimalContainer.doesntUseGenericParam1)
     _ = #selector(AnimalContainer.doesntUseGenericParam2)
@@ -246,16 +290,28 @@
 }
 
 extension PettableContainer {
-  // TODO: Any erasure shouldn't use generic parameter metadata.
-  func doesntUseGenericParam(_ x: T, _ y: T.Type) { // expected-error{{cannot access the class's generic parameters}}
-    _ = type(of: x).init(fur: x).other() // expected-note{{here}}
+  func doesntUseGenericParam(_ x: T, _ y: T.Type) {
+    // TODO: rdar://problem/27796375--allocating entry points are emitted as
+    // true generics.
+    // _ = type(of: x).init(fur: x).other()
     _ = type(of: x).adopt().other()
-    _ = y.init(fur: x).other()
+    // _ = y.init(fur: x).other()
     _ = y.adopt().other()
     x.pet()
     x.pet(with: x)
   }
 
+  // TODO: rdar://problem/27796375--allocating entry points are emitted as
+  // true generics.
+  // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
+  func usesGenericParamZ1(_ x: T, _ y: T.Type) {
+    _ = type(of: x).init(fur: x).other() // expected-note{{used here}}
+  }
+  // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
+  func usesGenericParamZ2(_ x: T, _ y: T.Type) {
+    _ = y.init(fur: x).other() // expected-note{{used here}}
+  }
+
   // expected-error@+1{{extension of a generic Objective-C class cannot access the class's generic parameters}}
   func usesGenericParamA(_ x: T) {
     _ = T(fur: x) // expected-note{{used here}}
diff --git a/test/ClangModules/objc_id_as_any.swift b/test/ClangModules/objc_id_as_any.swift
index 997468c..e08a6b1 100644
--- a/test/ClangModules/objc_id_as_any.swift
+++ b/test/ClangModules/objc_id_as_any.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify -enable-id-as-any %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify %s
 // REQUIRES: objc_interop
 
 import Foundation
diff --git a/test/ClangModules/objc_init_redundant.swift b/test/ClangModules/objc_init_redundant.swift
index 00a2ba7..0be9993 100644
--- a/test/ClangModules/objc_init_redundant.swift
+++ b/test/ClangModules/objc_init_redundant.swift
@@ -1,6 +1,6 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk -I %S/Inputs/custom-modules) -emit-sil %s -verify
 // RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk -I %S/Inputs/custom-modules) -emit-sil %s > %t.log 2>&1
-// RUN: FileCheck %s < %t.log
+// RUN: %FileCheck %s < %t.log
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/objc_ir.swift b/test/ClangModules/objc_ir.swift
index 7979919..dcc3536 100644
--- a/test/ClangModules/objc_ir.swift
+++ b/test/ClangModules/objc_ir.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-clang-importer-objc-overlays
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -I %S/Inputs/custom-modules -emit-ir -o - -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -I %S/Inputs/custom-modules -emit-ir -o - -primary-file %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 // REQUIRES: OS=macosx
diff --git a/test/ClangModules/objc_parse.swift b/test/ClangModules/objc_parse.swift
index 31efa1c..3dacc98 100644
--- a/test/ClangModules/objc_parse.swift
+++ b/test/ClangModules/objc_parse.swift
@@ -5,6 +5,7 @@
 import AppKit
 import AVFoundation
 
+import Newtype
 import objc_ext
 import TestProtocols
 
@@ -599,3 +600,10 @@
   let _: String = num.uintValue // expected-error {{cannot convert value of type 'UInt' to specified type 'String'}}
 }
 
+class NewtypeUser {
+  @objc func stringNewtype(a: SNTErrorDomain) {}
+  @objc func stringNewtypeOptional(a: SNTErrorDomain?) {}
+  @objc func intNewtype(a: MyInt) {}
+  @objc func intNewtypeOptional(a: MyInt?) {} // expected-error {{method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C}}
+}
+
diff --git a/test/ClangModules/optional.swift b/test/ClangModules/optional.swift
index 80f3de4..4fd67af 100644
--- a/test/ClangModules/optional.swift
+++ b/test/ClangModules/optional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules -emit-silgen -o - %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules -emit-silgen -o - %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/requires.swift b/test/ClangModules/requires.swift
index 084ade0..8e8d532 100644
--- a/test/ClangModules/requires.swift
+++ b/test/ClangModules/requires.swift
@@ -1,4 +1,4 @@
-// RUN: not %target-swift-frontend -parse %s -I %S/Inputs/custom-modules 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -parse %s -I %S/Inputs/custom-modules 2>&1 | %FileCheck %s
 
 import Requires.Swift // OK
 import Requires.NotSwift
diff --git a/test/ClangModules/sdk-bridging-header.swift b/test/ClangModules/sdk-bridging-header.swift
index d3838d0..72cec54 100644
--- a/test/ClangModules/sdk-bridging-header.swift
+++ b/test/ClangModules/sdk-bridging-header.swift
@@ -1,11 +1,11 @@
 // RUN: %target-swift-frontend -parse -verify %s -import-objc-header %S/Inputs/sdk-bridging-header.h
-// RUN: not %target-swift-frontend -parse %s -import-objc-header %S/Inputs/bad-bridging-header.h 2>&1 | FileCheck -check-prefix=CHECK-FATAL %s
+// RUN: not %target-swift-frontend -parse %s -import-objc-header %S/Inputs/bad-bridging-header.h 2>&1 | %FileCheck -check-prefix=CHECK-FATAL %s
 
 // RUN: %target-swift-frontend -parse -verify %s -Xcc -include -Xcc %S/Inputs/sdk-bridging-header.h -import-objc-header %S/../Inputs/empty.swift
 
-// RUN: not %target-swift-frontend -parse %s -Xcc -include -Xcc %S/Inputs/bad-bridging-header.h 2>&1 | FileCheck -check-prefix=CHECK-INCLUDE %s
-// RUN: not %target-swift-frontend -parse %s -Xcc -include -Xcc %S/Inputs/bad-bridging-header.h -import-objc-header %S/../Inputs/empty.swift 2>&1 | FileCheck -check-prefix=CHECK-INCLUDE %s
-// RUN: not %target-swift-frontend -parse %s -Xcc -include -Xcc %S/Inputs/bad-bridging-header.h -import-objc-header %S/Inputs/sdk-bridging-header.h 2>&1 | FileCheck -check-prefix=CHECK-INCLUDE %s
+// RUN: not %target-swift-frontend -parse %s -Xcc -include -Xcc %S/Inputs/bad-bridging-header.h 2>&1 | %FileCheck -check-prefix=CHECK-INCLUDE %s
+// RUN: not %target-swift-frontend -parse %s -Xcc -include -Xcc %S/Inputs/bad-bridging-header.h -import-objc-header %S/../Inputs/empty.swift 2>&1 | %FileCheck -check-prefix=CHECK-INCLUDE %s
+// RUN: not %target-swift-frontend -parse %s -Xcc -include -Xcc %S/Inputs/bad-bridging-header.h -import-objc-header %S/Inputs/sdk-bridging-header.h 2>&1 | %FileCheck -check-prefix=CHECK-INCLUDE %s
 
 // CHECK-FATAL: failed to import bridging header
 
diff --git a/test/ClangModules/sdk.swift b/test/ClangModules/sdk.swift
index d86315b..7e3654f 100644
--- a/test/ClangModules/sdk.swift
+++ b/test/ClangModules/sdk.swift
@@ -12,7 +12,7 @@
 
 // Some traditional Objective-C types should fail with fixits.
 
-func unavailable_id(_ a: id) {} // expected-error {{use of undeclared type 'id'}}
+func unavailable_id(_ a: id) {} // expected-error {{'id' is unavailable in Swift: 'id' is not available in Swift; use 'Any'}}
 func unavailable_Class(_ a: Class) {} // expected-error {{use of undeclared type 'Class'; did you mean to use 'AnyClass'?}} {{29-34=AnyClass}}
 func unavailable_BOOL(_ a: BOOL) {} // expected-error {{use of undeclared type 'BOOL'; did you mean to use 'ObjCBool'?}} {{28-32=ObjCBool}}
 func unavailable_SEL(_ a: SEL) {} // expected-error {{use of undeclared type 'SEL'; did you mean to use 'Selector'?}} {{27-30=Selector}}
diff --git a/test/ClangModules/serialization-sil.swift b/test/ClangModules/serialization-sil.swift
index 527e41b..7cf5997 100644
--- a/test/ClangModules/serialization-sil.swift
+++ b/test/ClangModules/serialization-sil.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-swift-frontend -emit-module-path %t/Test.swiftmodule -emit-sil -o /dev/null -module-name Test %s -sdk "" -import-objc-header %S/Inputs/serialization-sil.h
-// RUN: %target-sil-extract %t/Test.swiftmodule -func=_TF4Test16testPartialApplyFPSo4Test_T_ -o - | FileCheck %s
+// RUN: %target-sil-extract %t/Test.swiftmodule -func=_TF4Test16testPartialApplyFPSo4Test_T_ -o - | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/ClangModules/static_inline.swift b/test/ClangModules/static_inline.swift
index 118c5de..c1c86f6 100644
--- a/test/ClangModules/static_inline.swift
+++ b/test/ClangModules/static_inline.swift
@@ -3,8 +3,8 @@
 // Check if SIL printing+parsing of a clang imported function works.
 
 // RUN: %target-swift-frontend -parse-as-library -module-name=test -emit-sil %s -import-objc-header %S/Inputs/static_inline.h -o %t/test.sil
-// RUN: FileCheck < %t/test.sil %s
-// RUN: %target-swift-frontend -parse-as-library -module-name=test -O -emit-ir %t/test.sil -import-objc-header %S/Inputs/static_inline.h | FileCheck --check-prefix=CHECK-IR %s
+// RUN: %FileCheck < %t/test.sil %s
+// RUN: %target-swift-frontend -parse-as-library -module-name=test -O -emit-ir %t/test.sil -import-objc-header %S/Inputs/static_inline.h | %FileCheck --check-prefix=CHECK-IR %s
 
 // CHECK: sil shared [clang c_inline_func] @c_inline_func : $@convention(c) (Int32) -> Int32
 
diff --git a/test/ClangModules/submodules.swift b/test/ClangModules/submodules.swift
index 1e09077..4450637 100644
--- a/test/ClangModules/submodules.swift
+++ b/test/ClangModules/submodules.swift
@@ -6,7 +6,7 @@
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module-path %t/submodules.swiftmodule %s -DNO_ERRORS
 // RUN: echo 'import submodules; let s = "\(x), \(y)"' | %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse - -I %t
-// RUN: echo 'import submodules; let s = "\(x), \(y)"' | not %target-swift-frontend -parse - -I %t 2>&1 | FileCheck -check-prefix=MISSING %s
+// RUN: echo 'import submodules; let s = "\(x), \(y)"' | not %target-swift-frontend -parse - -I %t 2>&1 | %FileCheck -check-prefix=MISSING %s
 
 #if IMPORT_TOP_LEVEL
 import ctypes
diff --git a/test/ClangModules/submodules_indirect.swift b/test/ClangModules/submodules_indirect.swift
index 9c2183c..ff8a336 100644
--- a/test/ClangModules/submodules_indirect.swift
+++ b/test/ClangModules/submodules_indirect.swift
@@ -3,7 +3,7 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify -I %S/Inputs/custom-modules/ %s
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -o %t -emit-module -I %S/Inputs/custom-modules/ %s -module-name submodules
 // RUN: echo 'import submodules; let s = "\(x), \(y)"' | %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse - -I %t -I %S/Inputs/custom-modules/
-// RUN: echo 'import submodules; let s = "\(x), \(y)"' | not %target-swift-frontend -parse - -I %t -I %S/Inputs/custom-modules/ 2>&1 | FileCheck -check-prefix=MISSING %s
+// RUN: echo 'import submodules; let s = "\(x), \(y)"' | not %target-swift-frontend -parse - -I %t -I %S/Inputs/custom-modules/ 2>&1 | %FileCheck -check-prefix=MISSING %s
 
 // XFAIL: linux
 
diff --git a/test/ClangModules/submodules_scoped.swift b/test/ClangModules/submodules_scoped.swift
index 84eb1e7..98aba30 100644
--- a/test/ClangModules/submodules_scoped.swift
+++ b/test/ClangModules/submodules_scoped.swift
@@ -3,7 +3,7 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify %s -DCHECK_SCOPING
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s -module-name submodules
 // RUN: echo 'import submodules; let s = "\(x), \(y)"' | %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse - -I %t
-// RUN: echo 'import submodules; let s = "\(x), \(y)"' | not %target-swift-frontend -parse - -I %t 2>&1 | FileCheck -check-prefix=MISSING %s
+// RUN: echo 'import submodules; let s = "\(x), \(y)"' | not %target-swift-frontend -parse - -I %t 2>&1 | %FileCheck -check-prefix=MISSING %s
 
 import typealias ctypes.bits.DWORD
 // MISSING: missing required modules:
diff --git a/test/ClangModules/working-directory.swift b/test/ClangModules/working-directory.swift
index 1ba6f0a..14d0b43 100644
--- a/test/ClangModules/working-directory.swift
+++ b/test/ClangModules/working-directory.swift
@@ -1,4 +1,4 @@
-// RUN: cd %S/Inputs/ && %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -Xcc -I -Xcc custom-modules %s -dump-clang-diagnostics 2>&1 | FileCheck %s
+// RUN: cd %S/Inputs/ && %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -Xcc -I -Xcc custom-modules %s -dump-clang-diagnostics 2>&1 | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/Constraints/anyhashable-collection-cast.swift b/test/Constraints/anyhashable-collection-cast.swift
new file mode 100644
index 0000000..223934c
--- /dev/null
+++ b/test/Constraints/anyhashable-collection-cast.swift
@@ -0,0 +1,23 @@
+// RUN: %target-swift-frontend -parse -verify %s
+
+func dict() -> [AnyHashable: Any] {
+   return ["x": "y"]
+}
+func set() -> Set<AnyHashable> {
+   return ["x"]
+}
+
+func test() {
+   if let d = dict() as? [String: String] {
+    print(d)
+   }
+   if let s = set() as? Set<String> {
+    print(s)
+   }
+}
+
+func testLValueCoerce() {
+	var lvalue = "lvalue"
+	var map: [AnyHashable : Any] = [lvalue: lvalue]
+	lvalue = map[lvalue] as! String
+}
diff --git a/test/Constraints/array_literal.swift b/test/Constraints/array_literal.swift
index b88f23e..36ca35a 100644
--- a/test/Constraints/array_literal.swift
+++ b/test/Constraints/array_literal.swift
@@ -143,3 +143,18 @@
   let a4 = [B(), C()]
   let _: Int = a4 // expected-error{{value of type '[A]'}}
 }
+
+/// Check handling of 'nil'.
+func joinWithNil(s: String) {
+  let a1 = [s, nil]
+  let _: Int = a1 // expected-error{{value of type '[String?]'}}
+
+  let a2 = [nil, s]
+  let _: Int = a2 // expected-error{{value of type '[String?]'}}
+
+  let a3 = ["hello", nil]
+  let _: Int = a3 // expected-error{{value of type '[String?]'}}
+
+  let a4 = [nil, "hello"]
+  let _: Int = a4 // expected-error{{value of type '[String?]'}}
+}
diff --git a/test/Constraints/bridging.swift b/test/Constraints/bridging.swift
index 617c0b7..acfe82d 100644
--- a/test/Constraints/bridging.swift
+++ b/test/Constraints/bridging.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse -verify %s -enable-id-as-any
+// RUN: %target-swift-frontend -parse -verify %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/Constraints/bridging_nonobjc.swift b/test/Constraints/bridging_nonobjc.swift
index 068cbea..f0816b7 100644
--- a/test/Constraints/bridging_nonobjc.swift
+++ b/test/Constraints/bridging_nonobjc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse -verify %s -enable-id-as-any -disable-objc-interop
+// RUN: %target-swift-frontend -parse -verify %s -disable-objc-interop
 
 
 var x: Any = 1
diff --git a/test/Constraints/closures.swift b/test/Constraints/closures.swift
index a5f9b2c..0fdd98f 100644
--- a/test/Constraints/closures.swift
+++ b/test/Constraints/closures.swift
@@ -8,7 +8,7 @@
 _ = myMap(intArray, { x -> String in String(x) } )
 
 // Closures with too few parameters.
-func foo(_ x: (Int, Int) -> Int) {}
+func foo(_ x: ((Int, Int)) -> Int) {}
 foo({$0}) // expected-error{{cannot convert value of type '(Int, Int)' to closure result type 'Int'}}
 
 struct X {}
@@ -130,7 +130,7 @@
 // expected-error @+1 {{contextual closure type '(Int) -> Int' expects 1 argument, but 3 were used in closure body}}
 var _: (Int) -> Int = {a,b,c in 0}
 
-var _: (Int, Int) -> Int = {a in 0}
+var _: ((Int, Int)) -> Int = {a in 0}
 
 // expected-error @+1 {{contextual closure type '(Int, Int, Int) -> Int' expects 3 arguments, but 2 were used in closure body}}
 var _: (Int, Int, Int) -> Int = {a, b in a+b}
@@ -175,7 +175,7 @@
 }
 
 // SR-832 - both these should be ok
-func someFunc(_ foo: (@escaping (String) -> String)?, 
+func someFunc(_ foo: ((String) -> String)?,
               bar: @escaping (String) -> String) {
     let _: (String) -> String = foo != nil ? foo! : bar
     let _: (String) -> String = foo ?? bar
@@ -202,7 +202,7 @@
 func testAcceptNothingToInt(ac1: @autoclosure () -> Int) {
   // expected-note@-1{{parameter 'ac1' is implicitly non-escaping because it was declared @autoclosure}}
   acceptNothingToInt({ac1($0)})
-  // expected-error@-1{{cannot convert value of type '(_) -> Int' to expected argument type '() -> Int'}}
+  // expected-error@-1{{contextual closure type '() -> Int' expects 0 arguments, but 1 was used in closure body}}
   // FIXME: expected-error@-2{{closure use of non-escaping parameter 'ac1' may allow it to escape}}
 }
 
@@ -323,4 +323,4 @@
   
 }
 
-
+let f: (Int, Int) -> Void = { x in }  // expected-error {{contextual closure type specifies '(Int, Int)', but 1 was used in closure body, try adding extra parentheses around the single tuple argument}}
diff --git a/test/Constraints/diag_ambiguities_module.swift b/test/Constraints/diag_ambiguities_module.swift
index 1006d7e..6d862bb 100644
--- a/test/Constraints/diag_ambiguities_module.swift
+++ b/test/Constraints/diag_ambiguities_module.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/has_ambiguities.swift
-// RUN: not %target-swift-frontend -parse %s -I %t 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -parse %s -I %t 2>&1 | %FileCheck %s
 
 import has_ambiguities
 
diff --git a/test/Constraints/diagnostics.swift b/test/Constraints/diagnostics.swift
index beaa533..4439075 100644
--- a/test/Constraints/diagnostics.swift
+++ b/test/Constraints/diagnostics.swift
@@ -21,7 +21,7 @@
 
 func f1(_: @escaping (Int, Float) -> Int) { }
 
-func f2(_: (_: @escaping (Int) -> Int)) -> Int {}
+func f2(_: (_: (Int) -> Int)) -> Int {}
 
 func f3(_: @escaping (_: @escaping (Int) -> Float) -> Int) {}
 
@@ -163,7 +163,7 @@
 // <rdar://problem/21080030> Bad diagnostic for invalid method call in boolean expression: (_, ExpressibleByIntegerLiteral)' is not convertible to 'ExpressibleByIntegerLiteral
 func rdar21080030() {
   var s = "Hello"
-  if s.characters.count() == 0 {} // expected-error{{cannot call value of non-function type 'IndexDistance'}}{{24-26=}}
+  if s.characters.count() == 0 {} // expected-error{{cannot call value of non-function type 'String.CharacterView.IndexDistance'}}{{24-26=}}
 }
 
 // <rdar://problem/21248136> QoI: problem with return type inference mis-diagnosed as invalid arguments
@@ -769,3 +769,14 @@
 let sr1752: SR1752? = nil
 
 true ? nil : sr1752?.foo() // don't generate a warning about unused result since foo returns Void
+
+// <rdar://problem/27891805> QoI: FailureDiagnosis doesn't look through 'try'
+struct rdar27891805 {
+  init(contentsOf: String, encoding: String) throws {}
+  init(contentsOf: String, usedEncoding: inout String) throws {}
+  init<T>(_ t: T) {}
+}
+
+try rdar27891805(contentsOfURL: nil, usedEncoding: nil)
+// expected-error@-1 {{argument labels '(contentsOfURL:, usedEncoding:)' do not match any available overloads}}
+// expected-note@-2 {{overloads for 'rdar27891805' exist with these partially matching parameter lists: (contentsOf: String, encoding: String), (contentsOf: String, usedEncoding: inout String)}}
diff --git a/test/Constraints/optional.swift b/test/Constraints/optional.swift
index d69c38e..1098be5 100644
--- a/test/Constraints/optional.swift
+++ b/test/Constraints/optional.swift
@@ -119,3 +119,14 @@
   let optNoop: (()?) -> ()? = { return $0 }
   voidOptional(optNoop)
 }
+
+func testTernaryWithNil(b: Bool, s: String, i: Int) {
+  let t1 = b ? s : nil
+  let _: Double = t1 // expected-error{{value of type 'String?'}}
+  let t2 = b ? nil : i
+  let _: Double = t2 // expected-error{{value of type 'Int?'}}
+  let t3 = b ? "hello" : nil
+  let _: Double = t3 // expected-error{{value of type 'String?'}}
+  let t4 = b ? nil : 1
+  let _: Double = t4 // expected-error{{value of type 'Int?'}}
+}
diff --git a/test/Constraints/override.swift b/test/Constraints/override.swift
index 9fd58b1..7ac4022 100644
--- a/test/Constraints/override.swift
+++ b/test/Constraints/override.swift
@@ -12,3 +12,21 @@
   _ = concrete.foo()
   _ = generic.foo()
 }
+
+class Base1 {
+	func foo1(a : Int, b : @escaping ()->()) {} // expected-note{{potential overridden instance method 'foo1(a:b:)' here}}
+	func foo2(a : @escaping (Int)->(Int), b : @escaping ()->()) {} // expected-note{{potential overridden instance method 'foo2(a:b:)' here}}
+}
+
+class Sub1 : Base1 {
+	override func foo1(a : Int, b : ()->()) {} // expected-error {{method does not override any method from its superclass}} expected-note {{type does not match superclass instance method with type '(Int, @escaping () -> ()) -> ()'}} {{34-34=@escaping }}
+	override func foo2(a : (Int)->(Int), b : ()->()) {} // expected-error {{method does not override any method from its superclass}} expected-note{{type does not match superclass instance method with type '(@escaping (Int) -> (Int), @escaping () -> ()) -> ()'}} {{25-25=@escaping }} {{43-43=@escaping }}
+}
+
+class Base2 {
+  func foo<T>(a : @escaping (T) ->()) {} // expected-note{{potential overridden instance method 'foo(a:)' here}}
+}
+
+class Sub2 : Base2 {
+  override func foo<T>(a : (T) ->()) {} // expected-error {{method does not override any method from its superclass}} expected-note{{type does not match superclass instance method with type '<T> (a: (T) -> ()) -> ()'}}{{28-28=@escaping }}
+}
diff --git a/test/Constraints/same_types.swift b/test/Constraints/same_types.swift
index 8ea59db..cdc6413 100644
--- a/test/Constraints/same_types.swift
+++ b/test/Constraints/same_types.swift
@@ -91,7 +91,7 @@
 func fail4<T: Barrable>(_ t: T) -> (Y, Z)
   where
   T.Bar == Y,
-  T.Bar.Foo == Z { // expected-error{{generic parameter 'Foo' cannot be equal to both 'Foo' (aka 'X') and 'Z'}}
+  T.Bar.Foo == Z { // expected-error{{generic parameter 'Foo' cannot be equal to both 'Y.Foo' (aka 'X') and 'Z'}}
   return (t.bar, t.bar.foo) // expected-error{{cannot convert return expression of type 'X' to return type 'Z'}}
 }
 
@@ -99,7 +99,7 @@
 func fail5<T: Barrable>(_ t: T) -> (Y, Z)
   where
   T.Bar.Foo == Z,
-  T.Bar == Y { // expected-error 2{{generic parameter 'Foo' cannot be equal to both 'Z' and 'Foo'}}
+  T.Bar == Y { // expected-error 2{{generic parameter 'Foo' cannot be equal to both 'Z' and 'Y.Foo'}}
   return (t.bar, t.bar.foo) // expected-error{{cannot convert return expression of type 'X' to return type 'Z'}}
 }
 
diff --git a/test/DebugInfo/ASTSection.swift b/test/DebugInfo/ASTSection.swift
index 4d48134..6dcf030 100644
--- a/test/DebugInfo/ASTSection.swift
+++ b/test/DebugInfo/ASTSection.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 
 // RUN: %target-build-swift -emit-executable %s -g -o %t/ASTSection -emit-module
-// RUN: %lldb-moduleimport-test %t/ASTSection | FileCheck %s
+// RUN: %lldb-moduleimport-test %t/ASTSection | %FileCheck %s
 
 // REQUIRES: executable_test
 
diff --git a/test/DebugInfo/ASTSection_ObjC.swift b/test/DebugInfo/ASTSection_ObjC.swift
index d4e9a95..241d31d 100644
--- a/test/DebugInfo/ASTSection_ObjC.swift
+++ b/test/DebugInfo/ASTSection_ObjC.swift
@@ -2,13 +2,13 @@
 
 // RUN: cp %S/Inputs/serialized-objc-header.h %t
 // RUN: %target-build-swift -emit-executable %S/ASTSection.swift -g -o %t/ASTSection-with-ObjC -import-objc-header %t/serialized-objc-header.h -DOBJC -module-name ASTSection -emit-module
-// RUN: %lldb-moduleimport-test %t/ASTSection-with-ObjC | FileCheck %s
+// RUN: %lldb-moduleimport-test %t/ASTSection-with-ObjC | %FileCheck %s
 
 // RUN: rm %t/serialized-objc-header.h
-// RUN: %lldb-moduleimport-test %t/ASTSection-with-ObjC | FileCheck %s
+// RUN: %lldb-moduleimport-test %t/ASTSection-with-ObjC | %FileCheck %s
 
 // RUN: %target-build-swift -emit-executable %S/ASTSection.swift -gline-tables-only -o %t/ASTSection -emit-module
-// RUN: %lldb-moduleimport-test %t/ASTSection | FileCheck %s --allow-empty --check-prefix=LINETABLE-CHECK
+// RUN: %lldb-moduleimport-test %t/ASTSection | %FileCheck %s --allow-empty --check-prefix=LINETABLE-CHECK
 
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
diff --git a/test/DebugInfo/ASTSection_linker.swift b/test/DebugInfo/ASTSection_linker.swift
index 3f33269..6b022b0 100644
--- a/test/DebugInfo/ASTSection_linker.swift
+++ b/test/DebugInfo/ASTSection_linker.swift
@@ -8,11 +8,11 @@
 
 // Test the inline section mechanism.
 // RUN: %target-ld %t/ASTSection.o -sectcreate __SWIFT __ast %t/ASTSection.swiftmodule -o %t/ASTSection.dylib -dylib -lSystem -lobjc
-// RUN: %lldb-moduleimport-test %t/ASTSection.dylib | FileCheck %s
+// RUN: %lldb-moduleimport-test %t/ASTSection.dylib | %FileCheck %s
 
 // Test the symbol table entry.
 // RUN: %target-ld %t/ASTSection.o -add_ast_path %t/ASTSection.swiftmodule -o %t/ASTSection.dylib -dylib -lSystem -lobjc
-// RUN: %lldb-moduleimport-test %t/ASTSection.dylib | FileCheck %s
+// RUN: %lldb-moduleimport-test %t/ASTSection.dylib | %FileCheck %s
 
 // REQUIRES: OS=macosx
 
diff --git a/test/DebugInfo/Constructors.swift b/test/DebugInfo/Constructors.swift
index 63369eb..ce5813e 100644
--- a/test/DebugInfo/Constructors.swift
+++ b/test/DebugInfo/Constructors.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 struct Foo {
   // Allocating constructor - should have no line table info.
   // CHECK: !DISubprogram(name: "init", linkageName: "_TFV12Constructors3FooCfT1xVs5Int64_S0_",
diff --git a/test/DebugInfo/Destructors.swift b/test/DebugInfo/Destructors.swift
index 277aae6..9810954 100644
--- a/test/DebugInfo/Destructors.swift
+++ b/test/DebugInfo/Destructors.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 public class Foo {
   // CHECK: !DISubprogram(name: "deinit", linkageName: "_TFC11Destructors3FooD"
diff --git a/test/DebugInfo/DoubleCapture.swift b/test/DebugInfo/DoubleCapture.swift
index 5f34ae4..6321f21 100644
--- a/test/DebugInfo/DoubleCapture.swift
+++ b/test/DebugInfo/DoubleCapture.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 class C {
   func foo() {
     func bar() {
diff --git a/test/DebugInfo/DynamicSelf.swift b/test/DebugInfo/DynamicSelf.swift
index 2e2b7ca..d2b4109 100644
--- a/test/DebugInfo/DynamicSelf.swift
+++ b/test/DebugInfo/DynamicSelf.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 class C {
   let n : Int64
diff --git a/test/DebugInfo/EagerTypeMetadata.swift b/test/DebugInfo/EagerTypeMetadata.swift
index 4400ed2..a53cedc 100644
--- a/test/DebugInfo/EagerTypeMetadata.swift
+++ b/test/DebugInfo/EagerTypeMetadata.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -Onone -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -Onone -emit-ir -g -o - | %FileCheck %s
 
 public class C<T>
 {
diff --git a/test/DebugInfo/Errors.swift b/test/DebugInfo/Errors.swift
index 426a87f..9427ee7 100644
--- a/test/DebugInfo/Errors.swift
+++ b/test/DebugInfo/Errors.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 class Obj {}
 
 enum MyError : Error {
diff --git a/test/DebugInfo/GlobalMetatype.swift b/test/DebugInfo/GlobalMetatype.swift
index 8356be7..e0a562e 100644
--- a/test/DebugInfo/GlobalMetatype.swift
+++ b/test/DebugInfo/GlobalMetatype.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 class Foo {}
 let x = "Hello World!"
diff --git a/test/DebugInfo/GuardVar.swift b/test/DebugInfo/GuardVar.swift
index 6758d0f..9bc0540 100644
--- a/test/DebugInfo/GuardVar.swift
+++ b/test/DebugInfo/GuardVar.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 func markUsed<T>(_ t: T) {}
 
 public func f(_ i : Int?)
diff --git a/test/DebugInfo/ImportClangSubmodule.swift b/test/DebugInfo/ImportClangSubmodule.swift
index 87c4483..ff4d274 100644
--- a/test/DebugInfo/ImportClangSubmodule.swift
+++ b/test/DebugInfo/ImportClangSubmodule.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // REQUIRES: OS=macosx
 
-// RUN: %target-swift-frontend -emit-ir %s -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s -g -o - | %FileCheck %s
 
 // CHECK: !DIImportedEntity(
 // CHECK: tag: DW_TAG_imported_module{{.*}}entity: ![[C:.*]], line: [[@LINE+1]])
diff --git a/test/DebugInfo/Imports.swift b/test/DebugInfo/Imports.swift
index 0868829..cd36f01 100644
--- a/test/DebugInfo/Imports.swift
+++ b/test/DebugInfo/Imports.swift
@@ -1,9 +1,9 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-swift-frontend -emit-module-path %t/basic.swiftmodule %S/basic.swift
 
-// RUN: %target-swift-frontend -emit-ir -module-name Foo %s -I %t -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -module-name Foo %s -I %t -g -o - | %FileCheck %s
 // RUN: %target-swift-frontend -c -module-name Foo %s -I %t -g -o %t.o
-// RUN: llvm-dwarfdump %t.o | FileCheck --check-prefix=DWARF %s
+// RUN: llvm-dwarfdump %t.o | %FileCheck --check-prefix=DWARF %s
 
 // CHECK-DAG: ![[FOOMODULE:[0-9]+]] = !DIModule({{.*}}, name: "Foo", includePath: "{{.*}}test{{.*}}DebugInfo{{.*}}"
 // CHECK-DAG: !DIImportedEntity(tag: DW_TAG_imported_module, scope: ![[THISFILE:[0-9]+]], entity: ![[FOOMODULE]]
diff --git a/test/DebugInfo/InlineBridgingHeader.swift b/test/DebugInfo/InlineBridgingHeader.swift
index 6697e08..90cad41 100644
--- a/test/DebugInfo/InlineBridgingHeader.swift
+++ b/test/DebugInfo/InlineBridgingHeader.swift
@@ -1,6 +1,6 @@
 // RUN: %target-swift-frontend \
 // RUN:   -import-objc-header %S/Inputs/InlineBridgingHeader.h \
-// RUN:   -emit-ir -g %s -o - | FileCheck %s
+// RUN:   -emit-ir -g %s -o - | %FileCheck %s
 // REQUIRES: objc_interop
 
 // The Swift CU must come first.
diff --git a/test/DebugInfo/LinetableArtificialFn.swift b/test/DebugInfo/LinetableArtificialFn.swift
index 592e780..820d15b 100644
--- a/test/DebugInfo/LinetableArtificialFn.swift
+++ b/test/DebugInfo/LinetableArtificialFn.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - -disable-sil-linking | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - -disable-sil-linking | %FileCheck %s
 
 // Verify that a helper function that is generated on-the-fly does
 // not mess up the linetable of the calling function.
diff --git a/test/DebugInfo/NestedTypes.swift b/test/DebugInfo/NestedTypes.swift
index f52d4d8..e5834ec 100644
--- a/test/DebugInfo/NestedTypes.swift
+++ b/test/DebugInfo/NestedTypes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -gdwarf-types -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -gdwarf-types -o - | %FileCheck %s
 
 // Verify that the size of a class that has not been created before
 // its outer type is emitted is emitted correctly.
diff --git a/test/DebugInfo/PrivateDiscriminator.swift b/test/DebugInfo/PrivateDiscriminator.swift
index 803d3a4..1db03e1 100644
--- a/test/DebugInfo/PrivateDiscriminator.swift
+++ b/test/DebugInfo/PrivateDiscriminator.swift
@@ -1,9 +1,9 @@
 // Private discriminators should only be emitted for multi-file projects.
 
-// RUN: %target-swift-frontend -emit-ir %s -g -o - | FileCheck --check-prefix=SINGLE %s
+// RUN: %target-swift-frontend -emit-ir %s -g -o - | %FileCheck --check-prefix=SINGLE %s
 // SINGLE-NOT: !DICompileUnit({{.*}}-private-discriminator
 
-// RUN: %target-swift-frontend %S/../Inputs/empty.swift -primary-file %s -emit-ir -g | FileCheck %s
+// RUN: %target-swift-frontend %S/../Inputs/empty.swift -primary-file %s -emit-ir -g | %FileCheck %s
 // CHECK: !DICompileUnit({{.*}}flags: {{[^,]*}}-private-discriminator [[DISCRIMINATOR:_[A-Z0-9]+]]
 
 func markUsed<T>(_ t: T) {}
diff --git a/test/DebugInfo/ProtocolContainer.swift b/test/DebugInfo/ProtocolContainer.swift
index 0c0ca44..7ccd786 100644
--- a/test/DebugInfo/ProtocolContainer.swift
+++ b/test/DebugInfo/ProtocolContainer.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/WeakCapture.swift b/test/DebugInfo/WeakCapture.swift
index d0e91ff..4cf3643 100644
--- a/test/DebugInfo/WeakCapture.swift
+++ b/test/DebugInfo/WeakCapture.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 class A {
     init(handler: (() -> ())) { }
 }
diff --git a/test/DebugInfo/accessors.swift b/test/DebugInfo/accessors.swift
index 840cbd8..6a040cd 100644
--- a/test/DebugInfo/accessors.swift
+++ b/test/DebugInfo/accessors.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 // Verify that we generate appropriate names for accessors.
 // CHECK: !DISubprogram(name: "x.get"
diff --git a/test/DebugInfo/alloca-init.swift b/test/DebugInfo/alloca-init.swift
index 5a8cbbb..9c9edee 100644
--- a/test/DebugInfo/alloca-init.swift
+++ b/test/DebugInfo/alloca-init.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/allocstack.swift b/test/DebugInfo/allocstack.swift
index 4534f3c..98808cc 100644
--- a/test/DebugInfo/allocstack.swift
+++ b/test/DebugInfo/allocstack.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
-// RUN: %target-swift-frontend %s -emit-sil -g -o - | FileCheck -check-prefix=CHECK-SIL %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
+// RUN: %target-swift-frontend %s -emit-sil -g -o - | %FileCheck -check-prefix=CHECK-SIL %s
 import StdlibUnittest
 
 // Test that debug info for local variables is preserved by the
diff --git a/test/DebugInfo/anonymous.swift b/test/DebugInfo/anonymous.swift
index 7e94b1a..c1734d9 100644
--- a/test/DebugInfo/anonymous.swift
+++ b/test/DebugInfo/anonymous.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 // CHECK: !DILocalVariable(name: "_0", arg: 1
 // CHECK: !DILocalVariable(name: "_1", arg: 2
diff --git a/test/DebugInfo/any.swift b/test/DebugInfo/any.swift
index 25343be..e16ff8e 100644
--- a/test/DebugInfo/any.swift
+++ b/test/DebugInfo/any.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/apple-types-accel.swift b/test/DebugInfo/apple-types-accel.swift
index 536e02c..dc2b4ee 100644
--- a/test/DebugInfo/apple-types-accel.swift
+++ b/test/DebugInfo/apple-types-accel.swift
@@ -1,7 +1,7 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 // RUN: %target-swift-frontend %s -c -g -o %t.o
-// RUN: dwarfdump --verify --apple-types %t.o | FileCheck --check-prefix=CHECK-ACCEL %s
-// RUN: dwarfdump --debug-info %t.o | FileCheck --check-prefix=CHECK-DWARF %s
+// RUN: dwarfdump --verify --apple-types %t.o | %FileCheck --check-prefix=CHECK-ACCEL %s
+// RUN: dwarfdump --debug-info %t.o | %FileCheck --check-prefix=CHECK-DWARF %s
 
 // REQUIRES: OS=macosx
 
diff --git a/test/DebugInfo/archetype.swift b/test/DebugInfo/archetype.swift
index d880552..1155001 100644
--- a/test/DebugInfo/archetype.swift
+++ b/test/DebugInfo/archetype.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 protocol IntegerArithmetic {
   static func uncheckedSubtract(_ lhs: Self, rhs: Self) -> (Self, Bool)
diff --git a/test/DebugInfo/archetypes2.swift b/test/DebugInfo/archetypes2.swift
index ebccba0..c6f25d8 100644
--- a/test/DebugInfo/archetypes2.swift
+++ b/test/DebugInfo/archetypes2.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -verify -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -verify -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/arg-debug_value.swift b/test/DebugInfo/arg-debug_value.swift
index 475bbae..2e156c4 100644
--- a/test/DebugInfo/arg-debug_value.swift
+++ b/test/DebugInfo/arg-debug_value.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 // Verify that arguments described by debug_value intrinsics are only
 // emitted once.
diff --git a/test/DebugInfo/argument.swift b/test/DebugInfo/argument.swift
index cba77e4..3a1559d 100644
--- a/test/DebugInfo/argument.swift
+++ b/test/DebugInfo/argument.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/attributes.swift b/test/DebugInfo/attributes.swift
index 7955597..16a61a5 100644
--- a/test/DebugInfo/attributes.swift
+++ b/test/DebugInfo/attributes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module %s -emit-ir -g -o - | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/DebugInfo/atype.swift b/test/DebugInfo/atype.swift
index a141fef..8566191 100644
--- a/test/DebugInfo/atype.swift
+++ b/test/DebugInfo/atype.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/autoclosure.swift b/test/DebugInfo/autoclosure.swift
index 6358bdf..6d757f2 100644
--- a/test/DebugInfo/autoclosure.swift
+++ b/test/DebugInfo/autoclosure.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 // CHECK: define{{.*}}@_TF11autoclosure7call_meFVs5Int64T_
 // CHECK-NOT: ret void
diff --git a/test/DebugInfo/basic.swift b/test/DebugInfo/basic.swift
index af27e93..9028fea 100644
--- a/test/DebugInfo/basic.swift
+++ b/test/DebugInfo/basic.swift
@@ -2,29 +2,29 @@
 // --------------------------------------------------------------------
 // Verify that we don't emit any debug info by default.
 // RUN: %target-swift-frontend %s -emit-ir -o - \
-// RUN:   | FileCheck %s --check-prefix NDEBUG
+// RUN:   | %FileCheck %s --check-prefix NDEBUG
 // NDEBUG-NOT: !dbg
 // NDEBUG-NOT: DW_TAG
 // --------------------------------------------------------------------
 // Verify that we don't emit any debug info with -gnone.
 // RUN: %target-swift-frontend %s -emit-ir -gnone -o - \
-// RUN:   | FileCheck %s --check-prefix NDEBUG
+// RUN:   | %FileCheck %s --check-prefix NDEBUG
 // --------------------------------------------------------------------
 // Verify that we don't emit any type info with -gline-tables-only.
 // RUN: %target-swift-frontend %s -emit-ir -gline-tables-only -o - \
-// RUN:   | FileCheck %s --check-prefix CHECK-LINETABLES
+// RUN:   | %FileCheck %s --check-prefix CHECK-LINETABLES
 // CHECK: !dbg
 // CHECK-LINETABLES-NOT: DW_TAG_{{.*}}variable
 // CHECK-LINETABLES-NOT: DW_TAG_structure_type
 // CHECK-LINETABLES-NOT: DW_TAG_basic_type
 // --------------------------------------------------------------------
 // Now check that we do generate line+scope info with -g.
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 // RUN: %target-swift-frontend %s -emit-ir -g -o - -disable-sil-linking \
-// RUN:   | FileCheck %s --check-prefix=CHECK-NOSIL
+// RUN:   | %FileCheck %s --check-prefix=CHECK-NOSIL
 // --------------------------------------------------------------------
 // Currently -gdwarf-types should give the same results as -g.
-// RUN: %target-swift-frontend %s -emit-ir -gdwarf-types -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -gdwarf-types -o - | %FileCheck %s
 // --------------------------------------------------------------------
 //
 // CHECK: foo
diff --git a/test/DebugInfo/bbentry-location.swift b/test/DebugInfo/bbentry-location.swift
index 47fd6dd..1b52e10 100644
--- a/test/DebugInfo/bbentry-location.swift
+++ b/test/DebugInfo/bbentry-location.swift
@@ -1,6 +1,6 @@
 // REQUIRES: OS=ios
 // REQUIRES: objc_interop
-// RUN: %target-swift-frontend -emit-ir -g %s -o - | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -g %s -o - | %FileCheck %s
 
 import UIKit
 @available(iOS, introduced: 8.0)
diff --git a/test/DebugInfo/bool.swift b/test/DebugInfo/bool.swift
index 95e6ae2..a1c5546 100644
--- a/test/DebugInfo/bool.swift
+++ b/test/DebugInfo/bool.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -gdwarf-types -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -gdwarf-types -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/bound-namealiastype.swift b/test/DebugInfo/bound-namealiastype.swift
index cae0f7c..cc2112f 100644
--- a/test/DebugInfo/bound-namealiastype.swift
+++ b/test/DebugInfo/bound-namealiastype.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir -g %s -o - | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -g %s -o - | %FileCheck %s
 
 public protocol OS_dispatch_queue {
 }
diff --git a/test/DebugInfo/byref-capture.swift b/test/DebugInfo/byref-capture.swift
index 0500765..438d2d7 100644
--- a/test/DebugInfo/byref-capture.swift
+++ b/test/DebugInfo/byref-capture.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func makeIncrementor(_ inc : Int64) -> () -> Int64
 {
diff --git a/test/DebugInfo/callexpr.swift b/test/DebugInfo/callexpr.swift
index 3d08ed4..4b738f2 100644
--- a/test/DebugInfo/callexpr.swift
+++ b/test/DebugInfo/callexpr.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -g -emit-ir -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -g -emit-ir -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/capturelist.swift b/test/DebugInfo/capturelist.swift
index cac7e8b..6c02abd 100644
--- a/test/DebugInfo/capturelist.swift
+++ b/test/DebugInfo/capturelist.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 class C {
   func withClosure(_ : () -> ()) -> () {}
 
diff --git a/test/DebugInfo/closure-arg-linetable.swift b/test/DebugInfo/closure-arg-linetable.swift
index ebcca4b..3ad6faa 100644
--- a/test/DebugInfo/closure-arg-linetable.swift
+++ b/test/DebugInfo/closure-arg-linetable.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 public class C {
 
diff --git a/test/DebugInfo/closure-args.swift b/test/DebugInfo/closure-args.swift
index ca30f00..1c306cc 100644
--- a/test/DebugInfo/closure-args.swift
+++ b/test/DebugInfo/closure-args.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 import Swift
 
diff --git a/test/DebugInfo/closure-args2.swift b/test/DebugInfo/closure-args2.swift
index 353d815..5014cf5 100644
--- a/test/DebugInfo/closure-args2.swift
+++ b/test/DebugInfo/closure-args2.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func main () -> Void
 {
diff --git a/test/DebugInfo/closure-multivalue.swift b/test/DebugInfo/closure-multivalue.swift
index 0381bf8..5c7fe7f 100644
--- a/test/DebugInfo/closure-multivalue.swift
+++ b/test/DebugInfo/closure-multivalue.swift
@@ -1,5 +1,5 @@
 // rdar://problem/23727705:
-// RUN-DISABLED: %target-swift-frontend -O %s -disable-llvm-optzns -emit-ir -g -o - | FileCheck %s
+// RUN-DISABLED: %target-swift-frontend -O %s -disable-llvm-optzns -emit-ir -g -o - | %FileCheck %s
 import StdlibUnittest
 
 // CHECK: define {{.*}}i1 {{.*}}4main4sort
@@ -31,7 +31,7 @@
 demo()
 
 // At -O0, we should have a single aggregate argument.
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s --check-prefix=CHECK-O0
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s --check-prefix=CHECK-O0
 // Verify that a reabstraction thunk does not have a line number.
 // CHECK-O0-NOT: DW_OP_bit_piece
 // CHECK-O0-NOT: DW_OP_bit_piece
diff --git a/test/DebugInfo/closure.swift b/test/DebugInfo/closure.swift
index d876e65..300d097 100644
--- a/test/DebugInfo/closure.swift
+++ b/test/DebugInfo/closure.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/debug_value_addr.swift b/test/DebugInfo/debug_value_addr.swift
index e50b33c..56d22b5 100644
--- a/test/DebugInfo/debug_value_addr.swift
+++ b/test/DebugInfo/debug_value_addr.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
-// RUN: %target-swift-frontend %s -emit-sil -g -o - | FileCheck -check-prefix=CHECK-SIL %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
+// RUN: %target-swift-frontend %s -emit-sil -g -o - | %FileCheck -check-prefix=CHECK-SIL %s
 
 // Verify that -Onone shadow copies are emitted for debug_value_addr
 // instructions.
diff --git a/test/DebugInfo/dynamic_layout.swift b/test/DebugInfo/dynamic_layout.swift
index 73448ea..104c84a 100644
--- a/test/DebugInfo/dynamic_layout.swift
+++ b/test/DebugInfo/dynamic_layout.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/enum.swift b/test/DebugInfo/enum.swift
index 65e1101..98c2578 100644
--- a/test/DebugInfo/enum.swift
+++ b/test/DebugInfo/enum.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -gdwarf-types -o - | FileCheck %s --check-prefix=DWARF
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -gdwarf-types -o - | %FileCheck %s --check-prefix=DWARF
 
 // CHECK: ![[EMPTY:.*]] = !{}
 
diff --git a/test/DebugInfo/external-global.swift b/test/DebugInfo/external-global.swift
index d7f1c40..0a73297 100644
--- a/test/DebugInfo/external-global.swift
+++ b/test/DebugInfo/external-global.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-swift-frontend -emit-module-path %t/Globals.swiftmodule %S/Globals.swift
-// RUN: %target-swift-frontend -I %t %s -g -emit-ir -o - | FileCheck %s
+// RUN: %target-swift-frontend -I %t %s -g -emit-ir -o - | %FileCheck %s
 import Globals
 // No debug info should be emitted for an externally defined global variable.
 // CHECK-NOT: !DIGlobalVariable({{.*}}global
diff --git a/test/DebugInfo/fnptr.swift b/test/DebugInfo/fnptr.swift
index bb412db..62e8d5e 100644
--- a/test/DebugInfo/fnptr.swift
+++ b/test/DebugInfo/fnptr.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend %s -emit-ir -gdwarf-types -o - | FileCheck %s
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s --check-prefix=AST
+// RUN: %target-swift-frontend %s -emit-ir -gdwarf-types -o - | %FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s --check-prefix=AST
 
 // CHECK-DAG: ![[SINODE:.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Int64",{{.*}} identifier: [[SI:.*]])
 // CHECK-DAG: ![[SFNODE:.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Float",{{.*}} identifier: [[SF:.*]])
diff --git a/test/DebugInfo/for.swift b/test/DebugInfo/for.swift
index 9c141cf..a0ea094 100644
--- a/test/DebugInfo/for.swift
+++ b/test/DebugInfo/for.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -g -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -g -emit-ir %s | %FileCheck %s
 
 // Verify that variables bound in the for statements are in distinct scopes.
 
diff --git a/test/DebugInfo/foreach.swift b/test/DebugInfo/foreach.swift
index b322a84..248e95a 100644
--- a/test/DebugInfo/foreach.swift
+++ b/test/DebugInfo/foreach.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -g -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -g -emit-ir %s | %FileCheck %s
 
 // Verify that variables bound in the foreach statements are in distinct scopes.
 let values = [1, 2, 3]
diff --git a/test/DebugInfo/generic_arg.swift b/test/DebugInfo/generic_arg.swift
index bcd29c4..9d260f2 100644
--- a/test/DebugInfo/generic_arg.swift
+++ b/test/DebugInfo/generic_arg.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 import StdlibUnittest
 func foo<T>(_ x: T) -> () {
   // CHECK: define {{.*}} @_TF11generic_arg3foourFxT_
diff --git a/test/DebugInfo/generic_arg2.swift b/test/DebugInfo/generic_arg2.swift
index e429e91..a7750af 100644
--- a/test/DebugInfo/generic_arg2.swift
+++ b/test/DebugInfo/generic_arg2.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 // CHECK: define hidden void @_TFC12generic_arg25Class3foo{{.*}}, %swift.type* %U
 // CHECK: [[Y:%.*]] = getelementptr inbounds %C12generic_arg25Class, %C12generic_arg25Class* %2, i32 0, i32 0, i32 0
diff --git a/test/DebugInfo/generic_arg3.swift b/test/DebugInfo/generic_arg3.swift
index ed333fa..8ff043f 100644
--- a/test/DebugInfo/generic_arg3.swift
+++ b/test/DebugInfo/generic_arg3.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func apply<Type>(_ T : Type, fn: (Type) -> Type) -> Type { return fn(T) }
 
diff --git a/test/DebugInfo/generic_arg4.swift b/test/DebugInfo/generic_arg4.swift
index 156f8fa..72783de 100644
--- a/test/DebugInfo/generic_arg4.swift
+++ b/test/DebugInfo/generic_arg4.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 // REQUIRES: objc_interop
 public struct Q<T> {
   let x: T
diff --git a/test/DebugInfo/generic_arg5.swift b/test/DebugInfo/generic_arg5.swift
index b47fa1e..ebed49e 100644
--- a/test/DebugInfo/generic_arg5.swift
+++ b/test/DebugInfo/generic_arg5.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 public struct S<Type>
 {
   let value : Type
diff --git a/test/DebugInfo/generic_args.swift b/test/DebugInfo/generic_args.swift
index 7c01a12..ce2331c 100644
--- a/test/DebugInfo/generic_args.swift
+++ b/test/DebugInfo/generic_args.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -verify -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -verify -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/generic_enum.swift b/test/DebugInfo/generic_enum.swift
index 6fca022..3485c99 100644
--- a/test/DebugInfo/generic_enum.swift
+++ b/test/DebugInfo/generic_enum.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/generic_enum_closure.swift b/test/DebugInfo/generic_enum_closure.swift
index 4e7d0df..9945a64 100644
--- a/test/DebugInfo/generic_enum_closure.swift
+++ b/test/DebugInfo/generic_enum_closure.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 struct __CurrentErrno {}
 struct CErrorOr<T>
diff --git a/test/DebugInfo/gsil.swift b/test/DebugInfo/gsil.swift
index 9866e0f..a760bce 100644
--- a/test/DebugInfo/gsil.swift
+++ b/test/DebugInfo/gsil.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend %s -O -gsil -emit-ir -o %t/out.ir
-// RUN: FileCheck %s < %t/out.ir
-// RUN: FileCheck %s --check-prefix=CHECK_OUT_SIL < %t/out.ir.gsil_0.sil
+// RUN: %FileCheck %s < %t/out.ir
+// RUN: %FileCheck %s --check-prefix=CHECK_OUT_SIL < %t/out.ir.gsil_0.sil
 
 // CHECK: [[F:![0-9]+]] = !DIFile(filename: "out.ir.gsil_0.sil", directory: "{{.+}}")
 // CHECK: !DISubprogram(linkageName: "_TF3out6testitFT_T_", scope: !{{[0-9]+}}, file: [[F]], line: {{[1-9][0-9]+}},
diff --git a/test/DebugInfo/guard-let.swift b/test/DebugInfo/guard-let.swift
index 8d5fd03..da54e8e 100644
--- a/test/DebugInfo/guard-let.swift
+++ b/test/DebugInfo/guard-let.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s --check-prefix=CHECK2
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s --check-prefix=CHECK2
 func use<T>(_ t: T) {}
 
 public func f(_ i : Int?)
diff --git a/test/DebugInfo/if-branchlocations.swift b/test/DebugInfo/if-branchlocations.swift
index f5cd0fa..d7b5be2 100644
--- a/test/DebugInfo/if-branchlocations.swift
+++ b/test/DebugInfo/if-branchlocations.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-sil -emit-verbose-sil -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck %s
 
 class NSURL {}
 
diff --git a/test/DebugInfo/if-var.swift b/test/DebugInfo/if-var.swift
index 33fdd91..137392f 100644
--- a/test/DebugInfo/if-var.swift
+++ b/test/DebugInfo/if-var.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 func markUsed<T>(_ t: T) {}
 
 public func f(_ s : String?)
diff --git a/test/DebugInfo/if.swift b/test/DebugInfo/if.swift
index b531ac8..2b478da 100644
--- a/test/DebugInfo/if.swift
+++ b/test/DebugInfo/if.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -g -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -g -emit-ir %s | %FileCheck %s
 
 func yieldValue() -> Int64? { return 23 }
 
diff --git a/test/DebugInfo/implicitdecl.swift b/test/DebugInfo/implicitdecl.swift
index b42cf62..e805fbc 100644
--- a/test/DebugInfo/implicitdecl.swift
+++ b/test/DebugInfo/implicitdecl.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir -g %s -o - | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -g %s -o - | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/DebugInfo/implicitreturn.swift b/test/DebugInfo/implicitreturn.swift
index 0c75f15..3501f90 100644
--- a/test/DebugInfo/implicitreturn.swift
+++ b/test/DebugInfo/implicitreturn.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -S -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -S -g -o - | %FileCheck %s
 
 func app() {
 // Make sure we don't jump back to before the prologue.
diff --git a/test/DebugInfo/initializer.swift b/test/DebugInfo/initializer.swift
index e9e3dc0..fda6d35 100644
--- a/test/DebugInfo/initializer.swift
+++ b/test/DebugInfo/initializer.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -import-objc-header %S/Inputs/serialized-objc-header.h -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -import-objc-header %S/Inputs/serialized-objc-header.h -emit-ir -g -o - | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/DebugInfo/inlinedAt.swift b/test/DebugInfo/inlinedAt.swift
index f933160..44c0f83 100644
--- a/test/DebugInfo/inlinedAt.swift
+++ b/test/DebugInfo/inlinedAt.swift
@@ -1,6 +1,6 @@
 // RUN: %target-swift-frontend %s -O -I %t -emit-sil -emit-verbose-sil -o - \
-// RUN:    | FileCheck %s --check-prefix=CHECK-SIL
-// RUN: %target-swift-frontend %s -O -I %t -emit-ir -g -o - | FileCheck %s
+// RUN:    | %FileCheck %s --check-prefix=CHECK-SIL
+// RUN: %target-swift-frontend %s -O -I %t -emit-ir -g -o - | %FileCheck %s
 
 public var glob : Int = 0
 @inline(never) public func hold(_ n : Int) { glob = n }
diff --git a/test/DebugInfo/inlinescopes.swift b/test/DebugInfo/inlinescopes.swift
index e67f81e..9a05d5e 100644
--- a/test/DebugInfo/inlinescopes.swift
+++ b/test/DebugInfo/inlinescopes.swift
@@ -3,8 +3,8 @@
 // RUN: echo "public var x = Int64()" \
 // RUN:   | %target-swift-frontend -module-name FooBar -emit-module -o %t -
 // RUN: %target-swift-frontend %s -O -I %t -emit-ir -g -o %t.ll
-// RUN: FileCheck %s < %t.ll
-// RUN: FileCheck %s -check-prefix=TRANSPARENT-CHECK < %t.ll
+// RUN: %FileCheck %s < %t.ll
+// RUN: %FileCheck %s -check-prefix=TRANSPARENT-CHECK < %t.ll
 
 // CHECK: define{{( protected)?( signext)?}} i32 @main
 // CHECK: call {{.*}}noinline{{.*}}, !dbg ![[CALL:.*]]
diff --git a/test/DebugInfo/inout.swift b/test/DebugInfo/inout.swift
index 544aef0..3b66e7c 100644
--- a/test/DebugInfo/inout.swift
+++ b/test/DebugInfo/inout.swift
@@ -1,7 +1,7 @@
 // RUN: %target-swift-frontend %s -emit-ir -g -module-name inout -o %t.ll
-// RUN: cat %t.ll | FileCheck %s
-// RUN: cat %t.ll | FileCheck %s --check-prefix=PROMO-CHECK
-// RUN: cat %t.ll | FileCheck %s --check-prefix=FOO-CHECK
+// RUN: cat %t.ll | %FileCheck %s
+// RUN: cat %t.ll | %FileCheck %s --check-prefix=PROMO-CHECK
+// RUN: cat %t.ll | %FileCheck %s --check-prefix=FOO-CHECK
 
 // LValues are direct values, too. They are reference types, though.
 
diff --git a/test/DebugInfo/inout2.swift b/test/DebugInfo/inout2.swift
index 82e7cca..7e776e3 100644
--- a/test/DebugInfo/inout2.swift
+++ b/test/DebugInfo/inout2.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 // LValues are direct values, too. They are reference types, though.
 
diff --git a/test/DebugInfo/iteration.swift b/test/DebugInfo/iteration.swift
index f40f220..a884ea0 100644
--- a/test/DebugInfo/iteration.swift
+++ b/test/DebugInfo/iteration.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-frontend %s -emit-ir -g -o %t.ll
-// RUN: FileCheck %s < %t.ll
+// RUN: %FileCheck %s < %t.ll
 
 func markUsed<T>(_ t: T) {}
 
@@ -29,7 +29,7 @@
 count()
 
 // End-to-end test:
-// RUN: llc %t.ll -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s --check-prefix DWARF-CHECK
+// RUN: llc %t.ll -filetype=obj -o - | llvm-dwarfdump - | %FileCheck %s --check-prefix DWARF-CHECK
 // DWARF-CHECK:  DW_TAG_variable
 // DWARF-CHECK:  DW_AT_name {{.*}} "letter"
 //
diff --git a/test/DebugInfo/iuo_arg.swift b/test/DebugInfo/iuo_arg.swift
index a9c25d1..7088d1a 100644
--- a/test/DebugInfo/iuo_arg.swift
+++ b/test/DebugInfo/iuo_arg.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 class CGImageRef {}
 class UIImage {
diff --git a/test/DebugInfo/let.swift b/test/DebugInfo/let.swift
index 604ed55..55a9b66 100644
--- a/test/DebugInfo/let.swift
+++ b/test/DebugInfo/let.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 class DeepThought {
   func query() -> Int64 { return 42 }
diff --git a/test/DebugInfo/letclause.swift b/test/DebugInfo/letclause.swift
index 1d48191..2dd62f1 100644
--- a/test/DebugInfo/letclause.swift
+++ b/test/DebugInfo/letclause.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 // Test debug info for storageless variables.
 struct Symbol {}
diff --git a/test/DebugInfo/letstring.swift b/test/DebugInfo/letstring.swift
index 68868fe..9cb8b29 100644
--- a/test/DebugInfo/letstring.swift
+++ b/test/DebugInfo/letstring.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-frontend %s -emit-ir -g -o %t.ll
-// RUN: FileCheck %s < %t.ll
+// RUN: %FileCheck %s < %t.ll
 
 class UIWindow {}
 class AppDelegate {
@@ -25,7 +25,7 @@
 
 // End-to-end test:
 // RUN: llc %t.ll -filetype=obj -o %t.o
-// RUN: llvm-dwarfdump %t.o | FileCheck %s --check-prefix DWARF-CHECK
+// RUN: llvm-dwarfdump %t.o | %FileCheck %s --check-prefix DWARF-CHECK
 // DWARF-CHECK: DW_AT_name {{.*}} "f"
 //
 // DWARF-CHECK: DW_TAG_formal_parameter
diff --git a/test/DebugInfo/line-directive.swift b/test/DebugInfo/line-directive.swift
index 7785cee..f3b4866 100644
--- a/test/DebugInfo/line-directive.swift
+++ b/test/DebugInfo/line-directive.swift
@@ -12,7 +12,7 @@
   markUsed("jump directly to def")
 }
 
-// RUN: %target-swift-frontend -primary-file %s -S -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -S -g -o - | %FileCheck %s
 // CHECK: .file	[[MAIN:.*]] "{{.*}}line-directive.swift"
 // CHECK: .loc	[[MAIN]] 1
 // CHECK: .file	[[ABC:.*]] "abc.swift"
diff --git a/test/DebugInfo/linetable-cleanups.swift b/test/DebugInfo/linetable-cleanups.swift
index 843b39d..aaa569b 100644
--- a/test/DebugInfo/linetable-cleanups.swift
+++ b/test/DebugInfo/linetable-cleanups.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/linetable-do.swift b/test/DebugInfo/linetable-do.swift
index 49c5d26..3274353 100644
--- a/test/DebugInfo/linetable-do.swift
+++ b/test/DebugInfo/linetable-do.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-ir -g -o - | FileCheck %s
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-sil -emit-verbose-sil -g -o - | FileCheck -check-prefix=CHECK-SIL %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-ir -g -o - | %FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck -check-prefix=CHECK-SIL %s
 import StdlibUnittest
 
 class Obj {}
diff --git a/test/DebugInfo/linetable.swift b/test/DebugInfo/linetable.swift
index 6ca493f..c8ebbc3 100644
--- a/test/DebugInfo/linetable.swift
+++ b/test/DebugInfo/linetable.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
-// RUN: %target-swift-frontend %s -S -g -o - | FileCheck %s --check-prefix ASM-CHECK
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
+// RUN: %target-swift-frontend %s -S -g -o - | %FileCheck %s --check-prefix ASM-CHECK
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/DebugInfo/liverange-extension-vector.swift b/test/DebugInfo/liverange-extension-vector.swift
new file mode 100644
index 0000000..d4d3567
--- /dev/null
+++ b/test/DebugInfo/liverange-extension-vector.swift
@@ -0,0 +1,15 @@
+// RUN: %target-swift-frontend %s -g -emit-ir -o - | %FileCheck %s
+// REQUIRES: objc_interop, CPU=x86_64
+import simd
+
+func use<T>(_ x: T) {}
+
+func getInt32() -> Int32 { return -1 }
+
+public func rangeExtension(x: Int32, y: Int32) {
+  let p = int2(x, y)
+  // CHECK: define {{.*}}rangeExtension
+  // CHECK: llvm.dbg.value(metadata <2 x i32> %[[P:.*]], i64 0, metadata
+  use(p)
+  // CHECK: asm sideeffect "", "r"{{.*}}[[P]]
+}
diff --git a/test/DebugInfo/liverange-extension.swift b/test/DebugInfo/liverange-extension.swift
index ba2bad5..bc4864b 100644
--- a/test/DebugInfo/liverange-extension.swift
+++ b/test/DebugInfo/liverange-extension.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -g -emit-ir -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -g -emit-ir -o - | %FileCheck %s
 
 func use<T>(_ x: T) {}
 
diff --git a/test/DebugInfo/local-vars.swift.gyb b/test/DebugInfo/local-vars.swift.gyb
index d22becd..c4e7404 100644
--- a/test/DebugInfo/local-vars.swift.gyb
+++ b/test/DebugInfo/local-vars.swift.gyb
@@ -3,12 +3,12 @@
 // all. There are other tests testing liveness and representation.
 
 // RUN: %gyb %s -o %t.swift
-// RUN: %target-swift-frontend %t.swift -g -emit-ir -o - | FileCheck %t.swift
+// RUN: %target-swift-frontend %t.swift -g -emit-ir -o - | %FileCheck %t.swift
 // RUN: %target-swift-frontend %t.swift -g -c -o %t.o
 // RUN: llvm-dwarfdump --debug-dump=info %t.o \
-// RUN:   | FileCheck %t.swift --check-prefix=DWARF
+// RUN:   | %FileCheck %t.swift --check-prefix=DWARF
 // RUN: %target-swift-frontend %t.swift -O -g -emit-ir -o - \
-// RUN:   | FileCheck %t.swift --check-prefix=OPTZNS
+// RUN:   | %FileCheck %t.swift --check-prefix=OPTZNS
 
 // OPTZNS-NOT: alloca{{.*}}.addr
 
diff --git a/test/DebugInfo/mangling-stdlib.swift b/test/DebugInfo/mangling-stdlib.swift
index c9df647..2f8f14f 100644
--- a/test/DebugInfo/mangling-stdlib.swift
+++ b/test/DebugInfo/mangling-stdlib.swift
@@ -1,3 +1,3 @@
-// RUN: %target-swift-frontend -parse-stdlib %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib %s -emit-ir -g -o - | %FileCheck %s
 // CHECK:  !DIDerivedType(tag: DW_TAG_typedef, name: "_TtBb",
 var bo : Builtin.BridgeObject
diff --git a/test/DebugInfo/mangling.swift b/test/DebugInfo/mangling.swift
index fc5c810..0f8c3fe 100644
--- a/test/DebugInfo/mangling.swift
+++ b/test/DebugInfo/mangling.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 // Type:
 // Swift.Dictionary<Swift.Int64, Swift.String>
diff --git a/test/DebugInfo/multi-file.swift b/test/DebugInfo/multi-file.swift
index 7206721..a45d078 100644
--- a/test/DebugInfo/multi-file.swift
+++ b/test/DebugInfo/multi-file.swift
@@ -1,7 +1,7 @@
-// RUN: %target-swift-frontend -primary-file %s %S/../Inputs/empty.swift -emit-ir -g -module-name multi | FileCheck %s
-// RUN: %target-swift-frontend %S/../Inputs/empty.swift -primary-file %s -emit-ir -g -module-name multi | FileCheck %s
-// RUN: %target-swift-frontend -primary-file %S/../Inputs/empty.swift %s -emit-ir -g -module-name multi | FileCheck %s --check-prefix=CHECK-OTHER
-// RUN: %target-swift-frontend %s -primary-file %S/../Inputs/empty.swift -emit-ir -g -module-name multi | FileCheck %s --check-prefix=CHECK-OTHER
+// RUN: %target-swift-frontend -primary-file %s %S/../Inputs/empty.swift -emit-ir -g -module-name multi | %FileCheck %s
+// RUN: %target-swift-frontend %S/../Inputs/empty.swift -primary-file %s -emit-ir -g -module-name multi | %FileCheck %s
+// RUN: %target-swift-frontend -primary-file %S/../Inputs/empty.swift %s -emit-ir -g -module-name multi | %FileCheck %s --check-prefix=CHECK-OTHER
+// RUN: %target-swift-frontend %s -primary-file %S/../Inputs/empty.swift -emit-ir -g -module-name multi | %FileCheck %s --check-prefix=CHECK-OTHER
 // CHECK: !DICompileUnit(language: DW_LANG_Swift, file: ![[FILE:[0-9]+]]
 // CHECK: ![[FILE]] = !DIFile(filename: "{{.*}}multi-file.swift"
 // CHECK-OTHER: !DICompileUnit(language: DW_LANG_Swift, file: ![[FILE:[0-9]+]]
diff --git a/test/DebugInfo/nested_functions.swift b/test/DebugInfo/nested_functions.swift
index 8e72819..bc2ede8 100644
--- a/test/DebugInfo/nested_functions.swift
+++ b/test/DebugInfo/nested_functions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 // CHECK: ![[OUTER:.*]] = distinct !DISubprogram(name: "outer",
 // CHECK-SAME:                                   line: [[@LINE+1]]
diff --git a/test/DebugInfo/nostorage.swift b/test/DebugInfo/nostorage.swift
index 8fd15eb..e7760bb 100644
--- a/test/DebugInfo/nostorage.swift
+++ b/test/DebugInfo/nostorage.swift
@@ -1,7 +1,7 @@
 // RUN: %target-swift-frontend %s -emit-ir -g -o %t
-// RUN: cat %t | FileCheck %s --check-prefix=CHECK1
-// RUN: cat %t | FileCheck %s --check-prefix=CHECK2
-// RUN: cat %t | FileCheck %s --check-prefix=CHECK3
+// RUN: cat %t | %FileCheck %s --check-prefix=CHECK1
+// RUN: cat %t | %FileCheck %s --check-prefix=CHECK2
+// RUN: cat %t | %FileCheck %s --check-prefix=CHECK3
 
 func used<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/parent-scope.swift b/test/DebugInfo/parent-scope.swift
index d95b2d6..9717de0 100644
--- a/test/DebugInfo/parent-scope.swift
+++ b/test/DebugInfo/parent-scope.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -g -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -g -emit-ir %s | %FileCheck %s
 
 public protocol P {
   associatedtype AT;
diff --git a/test/DebugInfo/patternmatching.swift b/test/DebugInfo/patternmatching.swift
index e77b31b..2d45ed0 100644
--- a/test/DebugInfo/patternmatching.swift
+++ b/test/DebugInfo/patternmatching.swift
@@ -1,7 +1,7 @@
 // RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o %t.ll
-// RUN: FileCheck %s < %t.ll
-// RUN: FileCheck --check-prefix=CHECK-SCOPES %s < %t.ll
-// RUN: %target-swift-frontend -emit-sil -emit-verbose-sil -primary-file %s -o - | FileCheck %s --check-prefix=SIL-CHECK
+// RUN: %FileCheck %s < %t.ll
+// RUN: %FileCheck --check-prefix=CHECK-SCOPES %s < %t.ll
+// RUN: %target-swift-frontend -emit-sil -emit-verbose-sil -primary-file %s -o - | %FileCheck %s --check-prefix=SIL-CHECK
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/pcomp.swift b/test/DebugInfo/pcomp.swift
index db0c276..69c1493 100644
--- a/test/DebugInfo/pcomp.swift
+++ b/test/DebugInfo/pcomp.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/prologue.swift b/test/DebugInfo/prologue.swift
index 491df54..fce6cb9 100644
--- a/test/DebugInfo/prologue.swift
+++ b/test/DebugInfo/prologue.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -S -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -S -g -o - | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/DebugInfo/protocol-sugar.swift b/test/DebugInfo/protocol-sugar.swift
index 99fa9ed..367eba3 100644
--- a/test/DebugInfo/protocol-sugar.swift
+++ b/test/DebugInfo/protocol-sugar.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 protocol A {}
 protocol B {}
 typealias C = B & A
diff --git a/test/DebugInfo/protocol.swift b/test/DebugInfo/protocol.swift
index cbf586d..9748673 100644
--- a/test/DebugInfo/protocol.swift
+++ b/test/DebugInfo/protocol.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 protocol PointUtils {
   func distanceFromOrigin() -> Float
diff --git a/test/DebugInfo/protocolarg.swift b/test/DebugInfo/protocolarg.swift
index 27bdbe3..6e1df0c 100644
--- a/test/DebugInfo/protocolarg.swift
+++ b/test/DebugInfo/protocolarg.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 func use<T>(_ t: inout T) {}
diff --git a/test/DebugInfo/return.swift b/test/DebugInfo/return.swift
index 6667bfa..77db805 100644
--- a/test/DebugInfo/return.swift
+++ b/test/DebugInfo/return.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -g -emit-ir -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -g -emit-ir -o - | %FileCheck %s
 
 class X {
   init (i : Int64) { x = i }
diff --git a/test/DebugInfo/returnlocation.swift b/test/DebugInfo/returnlocation.swift
index e0b23d7..3f07a51 100644
--- a/test/DebugInfo/returnlocation.swift
+++ b/test/DebugInfo/returnlocation.swift
@@ -8,7 +8,7 @@
 // of simple/complex/empty return expressions,
 // cleanups/no cleanups, single / multiple return locations.
 
-// RUN: FileCheck %s --check-prefix=CHECK_NONE < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_NONE < %t.ll
 // CHECK_NONE: define{{( protected)?}} void {{.*}}none
 public func none(_ a: inout Int64) {
   // CHECK_NONE: call void @llvm.dbg{{.*}}, !dbg
@@ -19,7 +19,7 @@
   // CHECK_NONE: ![[NONE_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_EMPTY < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_EMPTY < %t.ll
 // CHECK_EMPTY: define {{.*}}empty
 public func empty(_ a: inout Int64) {
   if a > 24 {
@@ -36,7 +36,7 @@
   // CHECK-DAG_EMPTY: ![[EMPTY_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_EMPTY_NONE < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_EMPTY_NONE < %t.ll
 // CHECK_EMPTY_NONE: define {{.*}}empty_none
 public func empty_none(_ a: inout Int64) {
   if a > 24 {
@@ -48,7 +48,7 @@
   // CHECK_EMPTY_NONE: ![[EMPTY_NONE_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_SIMPLE_RET < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_SIMPLE_RET < %t.ll
 // CHECK_SIMPLE_RET: define {{.*}}simple
 public func simple(_ a: Int64) -> Int64 {
   if a > 24 {
@@ -59,7 +59,7 @@
   // CHECK_SIMPLE_RET: ![[SIMPLE_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_COMPLEX_RET < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_COMPLEX_RET < %t.ll
 // CHECK_COMPLEX_RET: define {{.*}}complex
 public func complex(_ a: Int64) -> Int64 {
   if a > 24 {
@@ -70,7 +70,7 @@
   // CHECK_COMPLEX_RET: ![[COMPLEX_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_COMPLEX_SIMPLE < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_COMPLEX_SIMPLE < %t.ll
 // CHECK_COMPLEX_SIMPLE: define {{.*}}complex_simple
 public func complex_simple(_ a: Int64) -> Int64 {
   if a > 24 {
@@ -81,7 +81,7 @@
   // CHECK_COMPLEX_SIMPLE: ![[COMPLEX_SIMPLE_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_SIMPLE_COMPLEX < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_SIMPLE_COMPLEX < %t.ll
 // CHECK_SIMPLE_COMPLEX: define {{.*}}simple_complex
 public func simple_complex(_ a: Int64) -> Int64 {
   if a > 24 {
@@ -96,7 +96,7 @@
 // ---------------------------------------------------------------------
 
 
-// RUN: FileCheck %s --check-prefix=CHECK_CLEANUP_NONE < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_CLEANUP_NONE < %t.ll
 // CHECK_CLEANUP_NONE: define {{.*}}cleanup_none
 public func cleanup_none(_ a: inout NSString) {
   a = "empty"
@@ -104,7 +104,7 @@
   // CHECK_CLEANUP_NONE: ![[CLEANUP_NONE_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_CLEANUP_EMPTY < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_CLEANUP_EMPTY < %t.ll
 // CHECK_CLEANUP_EMPTY: define {{.*}}cleanup_empty
 public func cleanup_empty(_ a: inout NSString) {
   if a.length > 24 {
@@ -117,7 +117,7 @@
   // CHECK_CLEANUP_EMPTY: ![[CLEANUP_EMPTY_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_CLEANUP_EMPTY_NONE < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_CLEANUP_EMPTY_NONE < %t.ll
 // CHECK_CLEANUP_EMPTY_NONE: define {{.*}}cleanup_empty_none
 public func cleanup_empty_none(_ a: inout NSString) {
   if a.length > 24 {
@@ -129,7 +129,7 @@
   // CHECK_CLEANUP_EMPTY_NONE: ![[CLEANUP_EMPTY_NONE_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_CLEANUP_SIMPLE_RET < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_CLEANUP_SIMPLE_RET < %t.ll
 // CHECK_CLEANUP_SIMPLE_RET: define {{.*}}cleanup_simple
 public func cleanup_simple(_ a: NSString) -> Int64 {
   if a.length > 24 {
@@ -141,7 +141,7 @@
   // CHECK_CLEANUP_SIMPLE_RET: ![[CLEANUP_SIMPLE_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_CLEANUP_COMPLEX < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_CLEANUP_COMPLEX < %t.ll
 // CHECK_CLEANUP_COMPLEX: define {{.*}}cleanup_complex
 public func cleanup_complex(_ a: NSString) -> Int64 {
   if a.length > 24 {
@@ -153,7 +153,7 @@
   // CHECK_CLEANUP_COMPLEX: ![[CLEANUP_COMPLEX_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_CLEANUP_COMPLEX_SIMPLE < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_CLEANUP_COMPLEX_SIMPLE < %t.ll
 // CHECK_CLEANUP_COMPLEX_SIMPLE: define {{.*}}cleanup_complex_simple
 public func cleanup_complex_simple(_ a: NSString) -> Int64 {
   if a.length > 24 {
@@ -165,7 +165,7 @@
   // CHECK_CLEANUP_COMPLEX_SIMPLE: ![[CLEANUP_COMPLEX_SIMPLE_RET]] = !DILocation(line: [[@LINE+1]], column: 1,
 }
 
-// RUN: FileCheck %s --check-prefix=CHECK_CLEANUP_SIMPLE_COMPLEX < %t.ll
+// RUN: %FileCheck %s --check-prefix=CHECK_CLEANUP_SIMPLE_COMPLEX < %t.ll
 // CHECK_CLEANUP_SIMPLE_COMPLEX: define {{.*}}cleanup_simple_complex
 public func cleanup_simple_complex(_ a: NSString) -> Int64 {
   if a.length > 24 {
diff --git a/test/DebugInfo/scopes.swift b/test/DebugInfo/scopes.swift
index a703b29..0b7c1a8 100644
--- a/test/DebugInfo/scopes.swift
+++ b/test/DebugInfo/scopes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -g -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -g -emit-ir %s | %FileCheck %s
 
 class UIViewController {
 }
diff --git a/test/DebugInfo/sdk.swift b/test/DebugInfo/sdk.swift
index 06cd83e..f7a0b07 100644
--- a/test/DebugInfo/sdk.swift
+++ b/test/DebugInfo/sdk.swift
@@ -1,6 +1,6 @@
 // Check that the sdk and resource dirs end up in the debug info.
-// RUN: %target-swiftc_driver %s -emit-ir -g -o - | FileCheck %s
-// RUN: %target-swiftc_driver %s -emit-ir -sdk "/Weird Location/SDK" -g -o - | FileCheck --check-prefix CHECK-EXPLICIT %s
+// RUN: %target-swiftc_driver %s -emit-ir -g -o - | %FileCheck %s
+// RUN: %target-swiftc_driver %s -emit-ir -sdk "/Weird Location/SDK" -g -o - | %FileCheck --check-prefix CHECK-EXPLICIT %s
 // CHECK:          !DICompileUnit({{.*}}producer: "{{(Apple )?Swift version [^"]+}}"
 // CHECK-SAME:                    flags: "
 // CHECK-NOT:                     "
diff --git a/test/DebugInfo/self-nostorage.swift b/test/DebugInfo/self-nostorage.swift
index f8dec43..4ae7069 100644
--- a/test/DebugInfo/self-nostorage.swift
+++ b/test/DebugInfo/self-nostorage.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 public struct S {
   func f() {
diff --git a/test/DebugInfo/self.swift b/test/DebugInfo/self.swift
index 76fcd0f..3c53575 100644
--- a/test/DebugInfo/self.swift
+++ b/test/DebugInfo/self.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 public struct stuffStruct {
     var a: Int64 = 6
diff --git a/test/DebugInfo/shadow_copies.swift b/test/DebugInfo/shadow_copies.swift
index e152aa0..49417a4 100644
--- a/test/DebugInfo/shadow_copies.swift
+++ b/test/DebugInfo/shadow_copies.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -Onone -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -Onone -emit-ir -g -o - | %FileCheck %s
 
 class ClassA
 {
diff --git a/test/DebugInfo/shadowcopy-linetable.swift b/test/DebugInfo/shadowcopy-linetable.swift
index 92f3a36..3fd1444 100644
--- a/test/DebugInfo/shadowcopy-linetable.swift
+++ b/test/DebugInfo/shadowcopy-linetable.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/simple.sil b/test/DebugInfo/simple.sil
index c5fdc17..b5cb8f9 100644
--- a/test/DebugInfo/simple.sil
+++ b/test/DebugInfo/simple.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -g -emit-ir -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -g -emit-ir -o - | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/DebugInfo/specialization.swift b/test/DebugInfo/specialization.swift
index d42d528..0920cd0 100644
--- a/test/DebugInfo/specialization.swift
+++ b/test/DebugInfo/specialization.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O %s -disable-llvm-optzns -emit-sil -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -O %s -disable-llvm-optzns -emit-sil -g -o - | %FileCheck %s
 
 // CHECK: sil shared [noinline] @_TTSg5V14specialization7AddableS0_S_5ProtoS____TF14specialization3sumuRxS_5ProtorFTxx_x
 // CHECK-SAME: $@convention(thin) (Addable, Addable) -> Addable {
diff --git a/test/DebugInfo/structs.swift b/test/DebugInfo/structs.swift
index 4eb1f58..1da16ff 100644
--- a/test/DebugInfo/structs.swift
+++ b/test/DebugInfo/structs.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 // Capture the pointer size from type Int
 // CHECK: %Si = type <{ i[[PTRSIZE:[0-9]+]] }>
diff --git a/test/DebugInfo/test-foundation.swift b/test/DebugInfo/test-foundation.swift
index dff20bc..c09ce36 100644
--- a/test/DebugInfo/test-foundation.swift
+++ b/test/DebugInfo/test-foundation.swift
@@ -1,8 +1,8 @@
 // RUN: %target-swift-frontend -emit-ir -g %s -o %t.ll
-// RUN: FileCheck %s --check-prefix IMPORT-CHECK < %t.ll
-// RUN: FileCheck %s --check-prefix LOC-CHECK < %t.ll
+// RUN: %FileCheck %s --check-prefix IMPORT-CHECK < %t.ll
+// RUN: %FileCheck %s --check-prefix LOC-CHECK < %t.ll
 // RUN: llc %t.ll -filetype=obj -o %t.o
-// RUN: llvm-dwarfdump %t.o | FileCheck %s --check-prefix DWARF-CHECK
+// RUN: llvm-dwarfdump %t.o | %FileCheck %s --check-prefix DWARF-CHECK
 // RUN: dwarfdump --verify %t.o
 
 // REQUIRES: OS=macosx
diff --git a/test/DebugInfo/test_ints.swift b/test/DebugInfo/test_ints.swift
index be20359..81444ff 100644
--- a/test/DebugInfo/test_ints.swift
+++ b/test/DebugInfo/test_ints.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 // These two should not have the same type.
 // CHECK: !DIGlobalVariable(name: "a",{{.*}} line: [[@LINE+2]]
diff --git a/test/DebugInfo/thunks.swift b/test/DebugInfo/thunks.swift
index 8211868..b1b6558 100644
--- a/test/DebugInfo/thunks.swift
+++ b/test/DebugInfo/thunks.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -emit-ir -g %s -o - | FileCheck %s
-// RUN: %target-swift-frontend -emit-sil -emit-verbose-sil -g %s -o - | FileCheck %s --check-prefix=SIL-CHECK
+// RUN: %target-swift-frontend -emit-ir -g %s -o - | %FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -emit-verbose-sil -g %s -o - | %FileCheck %s --check-prefix=SIL-CHECK
 // REQUIRES: objc_interop
 import Foundation
 
diff --git a/test/DebugInfo/top_level_code.swift b/test/DebugInfo/top_level_code.swift
index 86dae8d..8b6d702 100644
--- a/test/DebugInfo/top_level_code.swift
+++ b/test/DebugInfo/top_level_code.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -S -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -S -g -o - | %FileCheck %s
 
 // XFAIL: linux
 
diff --git a/test/DebugInfo/top_level_var.swift b/test/DebugInfo/top_level_var.swift
index 0ac5ec1..c9af74f 100644
--- a/test/DebugInfo/top_level_var.swift
+++ b/test/DebugInfo/top_level_var.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 var a = 1
diff --git a/test/DebugInfo/trap.swift b/test/DebugInfo/trap.swift
index a754569..bd8ef64 100644
--- a/test/DebugInfo/trap.swift
+++ b/test/DebugInfo/trap.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -parse-stdlib -primary-file %s -emit-ir -g -o - | FileCheck %s
-// RUN: %target-swift-frontend -O -parse-stdlib -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -primary-file %s -emit-ir -g -o - | %FileCheck %s
+// RUN: %target-swift-frontend -O -parse-stdlib -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 import Swift
 // CHECK: define{{.*}}1f
diff --git a/test/DebugInfo/tuple.swift b/test/DebugInfo/tuple.swift
index 095054c..3c591ec 100644
--- a/test/DebugInfo/tuple.swift
+++ b/test/DebugInfo/tuple.swift
@@ -1,6 +1,6 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 // RUN: %target-swift-frontend -primary-file %s -emit-ir -gdwarf-types -o - \
-// RUN:   | FileCheck %s --check-prefix=DWARF
+// RUN:   | %FileCheck %s --check-prefix=DWARF
 
 // Don't emit a line number for tuple types. They are unnamed
 // and have no declaration, so the line number is nonsensical.
diff --git a/test/DebugInfo/typealias.swift b/test/DebugInfo/typealias.swift
index 7ab2b6f..2031f1c 100644
--- a/test/DebugInfo/typealias.swift
+++ b/test/DebugInfo/typealias.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/DebugInfo/typearg.swift b/test/DebugInfo/typearg.swift
index f1d195b..5b1acfc 100644
--- a/test/DebugInfo/typearg.swift
+++ b/test/DebugInfo/typearg.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
 
 protocol AProtocol {
   func f() -> String
@@ -35,7 +35,7 @@
 
 // Verify that the backend doesn't elide the debug intrinsics.
 // RUN: %target-swift-frontend %s -c -g -o %t.o
-// RUN: llvm-dwarfdump %t.o | FileCheck %s --check-prefix=CHECK-LLVM
+// RUN: llvm-dwarfdump %t.o | %FileCheck %s --check-prefix=CHECK-LLVM
 // CHECK-LLVM-DAG:  .debug_str[{{.*}}] = "x"
 // CHECK-LLVM-DAG:  .debug_str[{{.*}}] = "$swift.type.T"
 // CHECK- FIXME -LLVM-DAG:  .debug_str[{{.*}}] = "$swift.type.Bar"
diff --git a/test/DebugInfo/unowned-capture.swift b/test/DebugInfo/unowned-capture.swift
index 9a3474d..1b3160d 100644
--- a/test/DebugInfo/unowned-capture.swift
+++ b/test/DebugInfo/unowned-capture.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
 
 class Foo
 {
diff --git a/test/DebugInfo/value-update.sil b/test/DebugInfo/value-update.sil
index be66b14..adbf812 100644
--- a/test/DebugInfo/value-update.sil
+++ b/test/DebugInfo/value-update.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -module-name test -g -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -module-name test -g -o - | %FileCheck %s
 // REQUIRES: CPU=x86_64
 sil_stage canonical
 
diff --git a/test/DebugInfo/value-witness-table.swift b/test/DebugInfo/value-witness-table.swift
index bb14dda4..ce04cd2 100644
--- a/test/DebugInfo/value-witness-table.swift
+++ b/test/DebugInfo/value-witness-table.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -g -emit-ir %s | FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK
+// RUN: %target-swift-frontend -g -emit-ir %s | %FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK
 
 // Test that we don't generate debug info for hidden global variables.
 
diff --git a/test/DebugInfo/variables-interpreter.swift b/test/DebugInfo/variables-interpreter.swift
index 04498fc..8ecf355 100644
--- a/test/DebugInfo/variables-interpreter.swift
+++ b/test/DebugInfo/variables-interpreter.swift
@@ -1,4 +1,4 @@
 // Run test variables.swift, verifying that the combination of -interpret and -g works.
-// RUN: %target-jit-run -g %S/variables.swift | FileCheck %s
+// RUN: %target-jit-run -g %S/variables.swift | %FileCheck %s
 // CHECK: 8, 16, 32
 // REQUIRES: swift_interpreter
diff --git a/test/DebugInfo/variables-repl.swift b/test/DebugInfo/variables-repl.swift
index 3b26c16..0348a26 100644
--- a/test/DebugInfo/variables-repl.swift
+++ b/test/DebugInfo/variables-repl.swift
@@ -1,4 +1,4 @@
 // Run test variables.swift, verifying that the combination of repl and -g works
-// RUN: %swift -g -repl < %S/variables.swift | FileCheck %s
+// RUN: %swift -g -repl < %S/variables.swift | %FileCheck %s
 // CHECK: 8, 16, 32
 // REQUIRES: swift_repl
diff --git a/test/DebugInfo/variables.swift b/test/DebugInfo/variables.swift
index 00e6f47..ee5e375 100644
--- a/test/DebugInfo/variables.swift
+++ b/test/DebugInfo/variables.swift
@@ -1,7 +1,7 @@
-// RUN: %target-swift-frontend %s -g -emit-ir -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -g -emit-ir -o - | %FileCheck %s
 
 // Ensure that the debug info we're emitting passes the back end verifier.
-// RUN: %target-swift-frontend %s -g -S -o - | FileCheck %s --check-prefix ASM-%target-object-format
+// RUN: %target-swift-frontend %s -g -S -o - | %FileCheck %s --check-prefix ASM-%target-object-format
 // ASM-macho: .section __DWARF,__debug_info
 // ASM-elf: .section .debug_info,"",{{[@%]}}progbits
 
diff --git a/test/DebugInfo/while.swift b/test/DebugInfo/while.swift
index cdc4e59..343b7f2 100644
--- a/test/DebugInfo/while.swift
+++ b/test/DebugInfo/while.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -g -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -g -emit-ir %s | %FileCheck %s
 
 func yieldValues() -> Int64? { return .none }
 
diff --git a/test/Demangle/demangle.swift b/test/Demangle/demangle.swift
index a64d29d..f7ed70d 100644
--- a/test/Demangle/demangle.swift
+++ b/test/Demangle/demangle.swift
@@ -9,6 +9,6 @@
 RUN: swift-demangle < %t.input > %t.output
 RUN: diff %t.check %t.output
 
-; RUN: swift-demangle __TtSi | FileCheck %s -check-prefix=DOUBLE
+; RUN: swift-demangle __TtSi | %FileCheck %s -check-prefix=DOUBLE
 ; DOUBLE: _TtSi ---> Swift.Int
 
diff --git a/test/Demangle/lookup.swift b/test/Demangle/lookup.swift
index 28a213c..643c990 100644
--- a/test/Demangle/lookup.swift
+++ b/test/Demangle/lookup.swift
@@ -6,7 +6,7 @@
 // RUN: %target-swift-ide-test -source-filename=%s -print-ast-typechecked -find-mangled=_TtV14swift_ide_test14InternalStruct
 // RUN: not %target-swift-ide-test -source-filename=%s -print-ast-typechecked -find-mangled=_TtV14swift_ide_testP13PrivateStruct
 // RUN: not %target-swift-ide-test -source-filename=%s -print-ast-typechecked -find-mangled=_TtV14swift_ide_testP1_13PrivateStruct
-// RUN: %target-swift-ide-test -source-filename=%s -print-ast-typechecked -find-mangled=_TtV14swift_ide_testP33_5CB4BCC03C4B9CB2AEEDDFF10FE7BD1E13PrivateStruct | FileCheck -check-prefix=THIS-FILE %s
+// RUN: %target-swift-ide-test -source-filename=%s -print-ast-typechecked -find-mangled=_TtV14swift_ide_testP33_5CB4BCC03C4B9CB2AEEDDFF10FE7BD1E13PrivateStruct | %FileCheck -check-prefix=THIS-FILE %s
 
 // RUN: %target-swift-ide-test -source-filename=%s -print-ast-typechecked -find-mangled=_TtCC14swift_ide_test5Outer5Inner
 // RUN: not %target-swift-ide-test -source-filename=%s -print-ast-typechecked -find-mangled=_TtCC14swift_ide_test5Outer6Absent
@@ -23,8 +23,8 @@
 
 // RUN: %target-swift-ide-test -source-filename=%t/test.swift -print-ast-typechecked -I %t -find-mangled=_TtV6Lookup12PublicStruct
 // RUN: %target-swift-ide-test -source-filename=%t/test.swift -print-ast-typechecked -I %t -find-mangled=_TtV6Lookup14InternalStruct
-// RUN: %target-swift-ide-test -source-filename=%t/test.swift -print-ast-typechecked -I %t -find-mangled=_TtV6LookupP33_FB24ABFEF851D18A6D2510DCD3FD6D6013PrivateStruct | FileCheck -check-prefix=THIS-FILE %s
-// RUN: %target-swift-ide-test -source-filename=%t/test.swift -print-ast-typechecked -I %t -find-mangled=_TtV6LookupP33_F999E3591DC4FCB0EC84CD4166BF8EDB13PrivateStruct | FileCheck -check-prefix=OTHER-FILE %s
+// RUN: %target-swift-ide-test -source-filename=%t/test.swift -print-ast-typechecked -I %t -find-mangled=_TtV6LookupP33_FB24ABFEF851D18A6D2510DCD3FD6D6013PrivateStruct | %FileCheck -check-prefix=THIS-FILE %s
+// RUN: %target-swift-ide-test -source-filename=%t/test.swift -print-ast-typechecked -I %t -find-mangled=_TtV6LookupP33_F999E3591DC4FCB0EC84CD4166BF8EDB13PrivateStruct | %FileCheck -check-prefix=OTHER-FILE %s
 
 public struct PublicStruct {}
 internal struct InternalStruct {}
diff --git a/test/Driver/Dependencies/bindings-build-record-options.swift b/test/Driver/Dependencies/bindings-build-record-options.swift
index cffc3f1..550a454 100644
--- a/test/Driver/Dependencies/bindings-build-record-options.swift
+++ b/test/Driver/Dependencies/bindings-build-record-options.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/bindings-build-record/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=MUST-EXEC-INITIAL
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=MUST-EXEC-INITIAL
 
 // MUST-EXEC-INITIAL-NOT: warning
 // MUST-EXEC-INITIAL: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: run-without-cascading
@@ -14,38 +14,38 @@
 // MUST-EXEC-ALL: inputs: ["./yet-another.swift"], output: {{[{].*[}]$}}
 
 // RUN: cd %t && %swiftc_driver -c -module-name main -driver-use-frontend-path %S/Inputs/update-dependencies.py ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
 
 // NO-EXEC: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: check-dependencies
 // NO-EXEC: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: check-dependencies
 // NO-EXEC: inputs: ["./yet-another.swift"], output: {{[{].*[}]}}, condition: check-dependencies
 
 
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings -serialize-diagnostics ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings -serialize-diagnostics ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
 
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -O -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=MUST-EXEC-ALL
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -O -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=MUST-EXEC-ALL
 // RUN: cd %t && %swiftc_driver -c -module-name main -driver-use-frontend-path %S/Inputs/update-dependencies.py ./main.swift ./other.swift ./yet-another.swift -incremental -O -output-file-map %t/output.json
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -O -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -O -serialize-diagnostics -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -O -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -O -serialize-diagnostics -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
 
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -Onone -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=MUST-EXEC-ALL
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -Onone -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=MUST-EXEC-ALL
 // RUN: cd %t && %swiftc_driver -c -module-name main -driver-use-frontend-path %S/Inputs/update-dependencies.py ./main.swift ./other.swift ./yet-another.swift -incremental -Onone -output-file-map %t/output.json
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -Onone -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -Onone -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
 
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=MUST-EXEC-ALL
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=MUST-EXEC-ALL
 // RUN: cd %t && %swiftc_driver -c -module-name main -driver-use-frontend-path %S/Inputs/update-dependencies.py ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
 
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=MUST-EXEC-ALL
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=MUST-EXEC-ALL
 // RUN: cd %t && %swiftc_driver -c -module-name main -driver-use-frontend-path %S/Inputs/update-dependencies.py ./main.swift ./other.swift ./yet-another.swift -incremental -I. -output-file-map %t/output.json
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
 
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -I/ -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=MUST-EXEC-ALL
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -I/ -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=MUST-EXEC-ALL
 // RUN: cd %t && %swiftc_driver -c -module-name main -driver-use-frontend-path %S/Inputs/update-dependencies.py ./main.swift ./other.swift ./yet-another.swift -incremental -I. -I/ -output-file-map %t/output.json
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -I/ -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -I/ -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
 
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -DDEBUG -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=MUST-EXEC-ALL
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -DDEBUG -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=MUST-EXEC-ALL
 // RUN: cd %t && %swiftc_driver -c -module-name main -driver-use-frontend-path %S/Inputs/update-dependencies.py ./main.swift ./other.swift ./yet-another.swift -incremental -I. -DDEBUG -output-file-map %t/output.json
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -DDEBUG -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
-// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -DDEBUG -I. -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -I. -DDEBUG -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -c -module-name main -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -DDEBUG -I. -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
diff --git a/test/Driver/Dependencies/bindings-build-record.swift b/test/Driver/Dependencies/bindings-build-record.swift
index c9fa63a..85d2751 100644
--- a/test/Driver/Dependencies/bindings-build-record.swift
+++ b/test/Driver/Dependencies/bindings-build-record.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/bindings-build-record/ %t
 // RUN: %S/Inputs/touch.py 443865900 %t/*
 
-// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=MUST-EXEC
+// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=MUST-EXEC
 
 // MUST-EXEC-NOT: warning
 // MUST-EXEC: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: run-without-cascading
@@ -9,7 +9,7 @@
 // MUST-EXEC: inputs: ["./yet-another.swift"], output: {{[{].*[}]}}, condition: run-without-cascading
 
 // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": [443865900, 0], "./yet-another.swift": [443865900, 0]}, build_time: [443865901, 0]}' > %t/main~buildrecord.swiftdeps
-// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=NO-EXEC
+// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=NO-EXEC
 
 // NO-EXEC: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: check-dependencies
 // NO-EXEC: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: check-dependencies
@@ -17,33 +17,33 @@
 
 
 // RUN: echo '{version: "'$(%swiftc_driver_plain -version | head -n1)'", inputs: {"./main.swift": [443865900, 0], "./other.swift": !private [443865900, 0], "./yet-another.swift": !dirty [443865900, 0]}, build_time: [443865901, 0]}' > %t/main~buildrecord.swiftdeps
-// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=BUILD-RECORD
+// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD
 
 // BUILD-RECORD: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: check-dependencies{{$}}
 // BUILD-RECORD: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: run-without-cascading{{$}}
 // BUILD-RECORD: inputs: ["./yet-another.swift"], output: {{[{].*[}]$}}
 
 // RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift ./added.swift -incremental -output-file-map %t/output.json 2>&1 > %t/added.txt
-// RUN: FileCheck %s -check-prefix=BUILD-RECORD < %t/added.txt
-// RUN: FileCheck %s -check-prefix=FILE-ADDED < %t/added.txt
+// RUN: %FileCheck %s -check-prefix=BUILD-RECORD < %t/added.txt
+// RUN: %FileCheck %s -check-prefix=FILE-ADDED < %t/added.txt
 
 // FILE-ADDED: inputs: ["./added.swift"], output: {{[{].*[}]}}, condition: newly-added{{$}}
 
 // RUN: %S/Inputs/touch.py 443865960 %t/main.swift
-// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=BUILD-RECORD-PLUS-CHANGE
+// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=BUILD-RECORD-PLUS-CHANGE
 // BUILD-RECORD-PLUS-CHANGE: inputs: ["./main.swift"], output: {{[{].*[}]}}, condition: run-without-cascading
 // BUILD-RECORD-PLUS-CHANGE: inputs: ["./other.swift"], output: {{[{].*[}]}}, condition: run-without-cascading{{$}}
 // BUILD-RECORD-PLUS-CHANGE: inputs: ["./yet-another.swift"], output: {{[{].*[}]$}}
 
 // RUN: %S/Inputs/touch.py 443865900 %t/*
-// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=FILE-REMOVED
+// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=FILE-REMOVED
 // FILE-REMOVED: inputs: ["./main.swift"], output: {{[{].*[}]$}}
 // FILE-REMOVED: inputs: ["./other.swift"], output: {{[{].*[}]$}}
 // FILE-REMOVED-NOT: yet-another.swift
 
 
 // RUN: echo '{version: "bogus", inputs: {"./main.swift": [443865900, 0], "./other.swift": !private [443865900, 0], "./yet-another.swift": !dirty [443865900, 0]}}' > %t/main~buildrecord.swiftdeps
-// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | FileCheck %s -check-prefix=INVALID-RECORD
+// RUN: cd %t && %swiftc_driver -driver-print-bindings ./main.swift ./other.swift ./yet-another.swift -incremental -output-file-map %t/output.json 2>&1 | %FileCheck %s -check-prefix=INVALID-RECORD
 
 // INVALID-RECORD-NOT: warning
 // INVALID-RECORD: inputs: ["./main.swift"], output: {{[{].*[}]$}}
diff --git a/test/Driver/Dependencies/build-record-invalid.swift b/test/Driver/Dependencies/build-record-invalid.swift
index e7f9543..16ffbf8 100644
--- a/test/Driver/Dependencies/build-record-invalid.swift
+++ b/test/Driver/Dependencies/build-record-invalid.swift
@@ -1,11 +1,11 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/bindings-build-record/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s -check-prefix=CHECK-ALL-BUILT
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s -check-prefix=CHECK-ALL-BUILT
 
 // CHECK-ALL-BUILT: Handled main.swift
 // CHECK-ALL-BUILT: Handled other.swift
 
 // RUN: echo '{version: "bogus", inputs: {"./main.swift": [443865900, 0], "./other.swift": !private [443865900, 0], "./yet-another.swift": !dirty [443865900, 0]}}' > %t/main~buildrecord.swiftdeps
 // RUN: echo 'provides-nominal: garbage' > %t/main.swiftdeps
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s -check-prefix=CHECK-ALL-BUILT
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s -check-prefix=CHECK-ALL-BUILT
diff --git a/test/Driver/Dependencies/chained-additional-kinds.swift b/test/Driver/Dependencies/chained-additional-kinds.swift
index f383668..5aad8ab 100644
--- a/test/Driver/Dependencies/chained-additional-kinds.swift
+++ b/test/Driver/Dependencies/chained-additional-kinds.swift
@@ -3,25 +3,25 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/chained-additional-kinds/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
 // CHECK-FIRST: Handled other.swift
 // CHECK-FIRST: Handled yet-another.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD: Handled other.swift
 // CHECK-THIRD-DAG: Handled main.swift
 // CHECK-THIRD-DAG: Handled yet-another.swift
 
 // RUN: touch -t 201401240007 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // RUN: touch -t 201401240008 %t/other.swift
diff --git a/test/Driver/Dependencies/chained-after.swift b/test/Driver/Dependencies/chained-after.swift
index f4e8e8b..901fb3c 100644
--- a/test/Driver/Dependencies/chained-after.swift
+++ b/test/Driver/Dependencies/chained-after.swift
@@ -9,13 +9,13 @@
 
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/chained-after/*.swiftdeps %t
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD: Handled other.swift
 // CHECK-THIRD: Handled main.swift
diff --git a/test/Driver/Dependencies/chained-private-after-multiple-nominal-members.swift b/test/Driver/Dependencies/chained-private-after-multiple-nominal-members.swift
index 77a68b5..5bc9173 100644
--- a/test/Driver/Dependencies/chained-private-after-multiple-nominal-members.swift
+++ b/test/Driver/Dependencies/chained-private-after-multiple-nominal-members.swift
@@ -9,13 +9,13 @@
 
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/chained-private-after-multiple-nominal-members/*.swiftdeps %t
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND: Handled main.swift
diff --git a/test/Driver/Dependencies/chained-private-after-multiple.swift b/test/Driver/Dependencies/chained-private-after-multiple.swift
index cde7c6b..a203d7d 100644
--- a/test/Driver/Dependencies/chained-private-after-multiple.swift
+++ b/test/Driver/Dependencies/chained-private-after-multiple.swift
@@ -9,13 +9,13 @@
 
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/chained-private-after-multiple/*.swiftdeps %t
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND: Handled main.swift
diff --git a/test/Driver/Dependencies/chained-private-after.swift b/test/Driver/Dependencies/chained-private-after.swift
index df1d2d0..555bd64 100644
--- a/test/Driver/Dependencies/chained-private-after.swift
+++ b/test/Driver/Dependencies/chained-private-after.swift
@@ -9,13 +9,13 @@
 
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/chained-private-after/*.swiftdeps %t
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND: Handled main.swift
diff --git a/test/Driver/Dependencies/chained-private.swift b/test/Driver/Dependencies/chained-private.swift
index 4cfd619..9be747b 100644
--- a/test/Driver/Dependencies/chained-private.swift
+++ b/test/Driver/Dependencies/chained-private.swift
@@ -3,19 +3,19 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/chained-private/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
 // CHECK-FIRST: Handled other.swift
 // CHECK-FIRST: Handled yet-another.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD-NOT: Handled yet-another.swift
 // CHECK-THIRD: Handled other.swift
diff --git a/test/Driver/Dependencies/chained.swift b/test/Driver/Dependencies/chained.swift
index c28ec03..f1bcf78 100644
--- a/test/Driver/Dependencies/chained.swift
+++ b/test/Driver/Dependencies/chained.swift
@@ -3,29 +3,29 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/chained/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
 // CHECK-FIRST: Handled other.swift
 // CHECK-FIRST: Handled yet-another.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD: Handled other.swift
 // CHECK-THIRD-DAG: Handled main.swift
 // CHECK-THIRD-DAG: Handled yet-another.swift
 
 // RUN: touch -t 201401240007 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift ./yet-another.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // RUN: touch -t 201401240008 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./yet-another.swift ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // RUN: touch -t 201401240009 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./yet-another.swift ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./yet-another.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
diff --git a/test/Driver/Dependencies/crash-added.swift b/test/Driver/Dependencies/crash-added.swift
index 1f4f978..badb46a 100644
--- a/test/Driver/Dependencies/crash-added.swift
+++ b/test/Driver/Dependencies/crash-added.swift
@@ -3,14 +3,14 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/crash-simple/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-INITIAL %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s
 
 // CHECK-INITIAL-NOT: warning
 // CHECK-INITIAL: Handled main.swift
 // CHECK-INITIAL: Handled other.swift
 
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./crash.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-ADDED %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./crash.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-ADDED-NOT: Handled
 // CHECK-ADDED: Handled crash.swift
@@ -24,7 +24,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/crash-simple/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-INITIAL %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s
 
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-ADDED %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./crash.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps
diff --git a/test/Driver/Dependencies/crash-new.swift b/test/Driver/Dependencies/crash-new.swift
index 4bb967c..c68c185 100644
--- a/test/Driver/Dependencies/crash-new.swift
+++ b/test/Driver/Dependencies/crash-new.swift
@@ -3,20 +3,20 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/crash-simple/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s
 // CHECK-NOT: warning
 // CHECK: Handled main.swift
 // CHECK: Handled crash.swift
 // CHECK-NOT: Handled other.swift
 
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-BAD-ONLY %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s
 
 // CHECK-BAD-ONLY-NOT: warning
 // CHECK-BAD-ONLY-NOT: Handled
 // CHECK-BAD-ONLY: Handled crash.swift
 // CHECK-BAD-ONLY-NOT: Handled
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-OKAY %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s
 // CHECK-OKAY: Handled main.swift
 // CHECK-OKAY: Handled crash.swift
 // CHECK-OKAY: Handled other.swift
@@ -24,10 +24,10 @@
 
 // RUN: touch -t 201401240006 %t/crash.swift
 // RUN: rm %t/crash.swiftdeps
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s
 
 // RUN: touch -t 201401240005 %t/*
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-OKAY-2 %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s
 
 // CHECK-OKAY-2: Handled crash.swift
 // CHECK-OKAY-2: Handled other.swift
@@ -35,10 +35,10 @@
 
 // RUN: touch -t 201401240006 %t/main.swift
 // RUN: rm %t/main.swiftdeps
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s
 
 // RUN: touch -t 201401240005 %t/*
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-OKAY %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s
 // RUN: touch -t 201401240006 %t/other.swift
 // RUN: rm %t/other.swiftdeps
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s
diff --git a/test/Driver/Dependencies/crash-simple.swift b/test/Driver/Dependencies/crash-simple.swift
index ce0eb9e..394aaa8 100644
--- a/test/Driver/Dependencies/crash-simple.swift
+++ b/test/Driver/Dependencies/crash-simple.swift
@@ -3,7 +3,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/crash-simple/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
@@ -11,8 +11,8 @@
 // CHECK-FIRST: Handled other.swift
 
 // RUN: touch -t 201401240006 %t/crash.swift
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./crash.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-SECOND: Handled crash.swift
 // CHECK-SECOND-NOT: Handled main.swift
diff --git a/test/Driver/Dependencies/embed-bitcode-parallel.swift b/test/Driver/Dependencies/embed-bitcode-parallel.swift
index 97afcea..3005bd4 100644
--- a/test/Driver/Dependencies/embed-bitcode-parallel.swift
+++ b/test/Driver/Dependencies/embed-bitcode-parallel.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/fake-build-for-bitcode.py -output-file-map %t/output.json -incremental ./main.swift ./other.swift -embed-bitcode -module-name main -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/fake-build-for-bitcode.py -output-file-map %t/output.json -incremental ./main.swift ./other.swift -embed-bitcode -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: {{^{$}}
@@ -54,7 +54,7 @@
 
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/fake-build-for-bitcode.py -output-file-map %t/output.json -incremental ./main.swift ./other.swift -embed-bitcode -module-name main -j2 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/fake-build-for-bitcode.py -output-file-map %t/output.json -incremental ./main.swift ./other.swift -embed-bitcode -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: "kind": "began"
 // CHECK-SECOND: "name": "compile"
diff --git a/test/Driver/Dependencies/fail-added.swift b/test/Driver/Dependencies/fail-added.swift
index a333078..e316a83 100644
--- a/test/Driver/Dependencies/fail-added.swift
+++ b/test/Driver/Dependencies/fail-added.swift
@@ -3,14 +3,14 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/fail-simple/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-INITIAL %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s
 
 // CHECK-INITIAL-NOT: warning
 // CHECK-INITIAL: Handled main.swift
 // CHECK-INITIAL: Handled other.swift
 
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-ADDED %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-ADDED-NOT: Handled
 // CHECK-ADDED: Handled bad.swift
@@ -24,7 +24,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/fail-simple/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-INITIAL %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s
 
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-ADDED %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./bad.swift ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-ADDED %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-ADDED %s < %t/main~buildrecord.swiftdeps
diff --git a/test/Driver/Dependencies/fail-chained.swift b/test/Driver/Dependencies/fail-chained.swift
index f28cbd7..3bb7023 100644
--- a/test/Driver/Dependencies/fail-chained.swift
+++ b/test/Driver/Dependencies/fail-chained.swift
@@ -3,8 +3,8 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/fail-chained/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled a.swift
@@ -26,9 +26,9 @@
 
 // RUN: touch -t 201401240006 %t/a.swift
 // RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/a.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-A %s < %t/a.txt
-// RUN: FileCheck -check-prefix=NEGATIVE-A %s < %t/a.txt
-// RUN: FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps
+// RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE-A %s < %t/a.txt
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-A: Handled a.swift
 // CHECK-A: Handled bad.swift
@@ -47,9 +47,9 @@
 // CHECK-RECORD-A-DAG: "./bad.swift": !dirty [
 
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/a2.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-A2 %s < %t/a2.txt
-// RUN: FileCheck -check-prefix=NEGATIVE-A2 %s < %t/a2.txt
-// RUN: FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps
+// RUN: %FileCheck -check-prefix=CHECK-A2 %s < %t/a2.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE-A2 %s < %t/a2.txt
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-A2-DAG: Handled c.swift
 // CHECK-A2-DAG: Handled d.swift
@@ -63,13 +63,13 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/fail-chained/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // RUN: touch -t 201401240006 %t/b.swift
 // RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-B %s < %t/b.txt
-// RUN: FileCheck -check-prefix=NEGATIVE-B %s < %t/b.txt
-// RUN: FileCheck -check-prefix=CHECK-RECORD-B %s < %t/main~buildrecord.swiftdeps
+// RUN: %FileCheck -check-prefix=CHECK-B %s < %t/b.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE-B %s < %t/b.txt
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-B %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-B: Handled b.swift
 // CHECK-B: Handled bad.swift
@@ -88,9 +88,9 @@
 // CHECK-RECORD-B-DAG: "./bad.swift": !private [
 
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/b2.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-B2 %s < %t/b2.txt
-// RUN: FileCheck -check-prefix=NEGATIVE-B2 %s < %t/b2.txt
-// RUN: FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps
+// RUN: %FileCheck -check-prefix=CHECK-B2 %s < %t/b2.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE-B2 %s < %t/b2.txt
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-B2-DAG: Handled bad.swift
 // NEGATIVE-B2-NOT: Handled a.swift
@@ -104,13 +104,13 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/fail-chained/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // RUN: touch -t 201401240006 %t/bad.swift
 // RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/bad.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-BAD %s < %t/bad.txt
-// RUN: FileCheck -check-prefix=NEGATIVE-BAD %s < %t/bad.txt
-// RUN: FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps
+// RUN: %FileCheck -check-prefix=CHECK-BAD %s < %t/bad.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE-BAD %s < %t/bad.txt
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-A %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-BAD: Handled bad.swift
 // NEGATIVE-BAD-NOT: Handled a.swift
@@ -121,6 +121,6 @@
 // NEGATIVE-BAD-NOT: Handled f.swift
 
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./bad.swift -module-name main -j1 -v > %t/bad2.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-A2 %s < %t/bad2.txt
-// RUN: FileCheck -check-prefix=NEGATIVE-A2 %s < %t/bad2.txt
-// RUN: FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps
+// RUN: %FileCheck -check-prefix=CHECK-A2 %s < %t/bad2.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE-A2 %s < %t/bad2.txt
+// RUN: %FileCheck -check-prefix=CHECK-RECORD-CLEAN %s < %t/main~buildrecord.swiftdeps
diff --git a/test/Driver/Dependencies/fail-interface-hash.swift b/test/Driver/Dependencies/fail-interface-hash.swift
index 392cc24..618f7b4 100644
--- a/test/Driver/Dependencies/fail-interface-hash.swift
+++ b/test/Driver/Dependencies/fail-interface-hash.swift
@@ -3,7 +3,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/fail-interface-hash/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
@@ -15,8 +15,8 @@
 // RUN: cp -r %S/Inputs/fail-interface-hash/*.swiftdeps %t
 
 // RUN: touch -t 201401240006 %t/bad.swift %t/main.swift
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-SECOND: Handled main.swift
 // CHECK-SECOND-NOT: Handled depends
diff --git a/test/Driver/Dependencies/fail-new.swift b/test/Driver/Dependencies/fail-new.swift
index 226098c..36b0395 100644
--- a/test/Driver/Dependencies/fail-new.swift
+++ b/test/Driver/Dependencies/fail-new.swift
@@ -3,20 +3,20 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/fail-simple/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s
 // CHECK-NOT: warning
 // CHECK: Handled main.swift
 // CHECK: Handled bad.swift
 // CHECK-NOT: Handled other.swift
 
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-BAD-ONLY %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BAD-ONLY %s
 
 // CHECK-BAD-ONLY-NOT: warning
 // CHECK-BAD-ONLY-NOT: Handled
 // CHECK-BAD-ONLY: Handled bad.swift
 // CHECK-BAD-ONLY-NOT: Handled
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-OKAY %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s
 // CHECK-OKAY: Handled main.swift
 // CHECK-OKAY: Handled bad.swift
 // CHECK-OKAY: Handled other.swift
@@ -24,10 +24,10 @@
 
 // RUN: touch -t 201401240006 %t/bad.swift
 // RUN: rm %t/bad.swiftdeps
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s
 
 // RUN: touch -t 201401240005 %t/*
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-OKAY-2 %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY-2 %s
 
 // CHECK-OKAY-2: Handled bad.swift
 // CHECK-OKAY-2: Handled other.swift
@@ -35,10 +35,10 @@
 
 // RUN: touch -t 201401240006 %t/main.swift
 // RUN: rm %t/main.swiftdeps
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s
 
 // RUN: touch -t 201401240005 %t/*
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-OKAY %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-OKAY %s
 // RUN: touch -t 201401240006 %t/other.swift
 // RUN: rm %t/other.swiftdeps
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s
diff --git a/test/Driver/Dependencies/fail-simple.swift b/test/Driver/Dependencies/fail-simple.swift
index 9247137..d228b65 100644
--- a/test/Driver/Dependencies/fail-simple.swift
+++ b/test/Driver/Dependencies/fail-simple.swift
@@ -3,7 +3,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/fail-simple/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
@@ -11,8 +11,8 @@
 // CHECK-FIRST: Handled other.swift
 
 // RUN: touch -t 201401240006 %t/bad.swift
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-SECOND: Handled bad.swift
 // CHECK-SECOND-NOT: Handled main.swift
diff --git a/test/Driver/Dependencies/fail-with-bad-deps.swift b/test/Driver/Dependencies/fail-with-bad-deps.swift
index f7e535d..ee1e2da 100644
--- a/test/Driver/Dependencies/fail-with-bad-deps.swift
+++ b/test/Driver/Dependencies/fail-with-bad-deps.swift
@@ -3,7 +3,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/fail-with-bad-deps/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
@@ -14,14 +14,14 @@
 // Reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/fail-with-bad-deps/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-NONE %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NONE %s
 // CHECK-NONE-NOT: Handled
 
 // Reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/fail-with-bad-deps/*.swiftdeps %t
 
 // RUN: touch -t 201401240006 %t/bad.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-BUILD-ALL %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-BUILD-ALL %s
 
 // CHECK-BUILD-ALL-NOT: warning
 // CHECK-BUILD-ALL: Handled bad.swift
@@ -33,8 +33,8 @@
 // RUN: cp -r %S/Inputs/fail-with-bad-deps/*.swiftdeps %t
 
 // RUN: touch -t 201401240007 %t/bad.swift %t/main.swift
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-WITH-FAIL %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./depends-on-main.swift ./depends-on-bad.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-WITH-FAIL %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-WITH-FAIL: Handled main.swift
 // CHECK-WITH-FAIL-NOT: Handled depends
diff --git a/test/Driver/Dependencies/file-added.swift b/test/Driver/Dependencies/file-added.swift
index 8d70722..726ca88 100644
--- a/test/Driver/Dependencies/file-added.swift
+++ b/test/Driver/Dependencies/file-added.swift
@@ -3,16 +3,16 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled other.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD-NOT: Handled other.swift
 // CHECK-THIRD: Handled main.swift
diff --git a/test/Driver/Dependencies/independent-half-dirty.swift b/test/Driver/Dependencies/independent-half-dirty.swift
index 0268f15..964995d 100644
--- a/test/Driver/Dependencies/independent-half-dirty.swift
+++ b/test/Driver/Dependencies/independent-half-dirty.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/independent/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
@@ -9,14 +9,14 @@
 
 // RUN: touch -t 201401240005 %t/other.o
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled main.swift
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND-NOT: Handled main.swift
 
 // RUN: rm %t/other.swiftdeps
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD: Handled main.swift
 // CHECK-THIRD: Handled other.swift
diff --git a/test/Driver/Dependencies/independent-parseable.swift b/test/Driver/Dependencies/independent-parseable.swift
index 259b9f8..1b86b80 100644
--- a/test/Driver/Dependencies/independent-parseable.swift
+++ b/test/Driver/Dependencies/independent-parseable.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/independent/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: {{^{$}}
@@ -16,7 +16,7 @@
 // CHECK-FIRST: "output": "Handled main.swift\n"
 // CHECK-FIRST: {{^}$}}
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: {{^{$}}
 // CHECK-SECOND: "kind": "skipped"
@@ -25,13 +25,13 @@
 // CHECK-SECOND: {{^}$}}
 
 // RUN: touch -t 201401240006 %t/*
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 
 // RUN: rm -rf %t && cp -r %S/Inputs/independent/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-FIRST-MULTI %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s
 
 // CHECK-FIRST-MULTI: {{^{$}}
 // CHECK-FIRST-MULTI: "kind": "began"
@@ -57,7 +57,7 @@
 // CHECK-FIRST-MULTI: "output": "Handled other.swift\n"
 // CHECK-FIRST-MULTI: {{^}$}}
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-SECOND-MULTI %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND-MULTI %s
 
 // CHECK-SECOND-MULTI: {{^{$}}
 // CHECK-SECOND-MULTI: "kind": "skipped"
@@ -72,5 +72,5 @@
 // CHECK-SECOND-MULTI: {{^}$}}
 
 // RUN: touch -t 201401240006 %t/*
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-FIRST-MULTI %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s
 
diff --git a/test/Driver/Dependencies/independent.swift b/test/Driver/Dependencies/independent.swift
index da558ed..6f8cc8d 100644
--- a/test/Driver/Dependencies/independent.swift
+++ b/test/Driver/Dependencies/independent.swift
@@ -3,41 +3,41 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/independent/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 // RUN: ls %t/main~buildrecord.swiftdeps
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/*
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // RUN: touch -t 201401240007 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 
 // RUN: rm -rf %t && cp -r %S/Inputs/independent/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST-MULTI %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s
 
 // CHECK-FIRST-MULTI: Handled main.swift
 // CHECK-FIRST-MULTI: Handled other.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // RUN: touch -t 201401240006 %t/*
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST-MULTI %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST-MULTI %s
 
 
 // RUN: rm -rf %t && cp -r %S/Inputs/independent/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SINGLE %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SINGLE %s
 // CHECK-SINGLE: Handled main.swift
 
 // RUN: ls %t/main~buildrecord.swiftdeps
diff --git a/test/Driver/Dependencies/malformed-but-valid-yaml.swift b/test/Driver/Dependencies/malformed-but-valid-yaml.swift
index 2f13c8b5..f00b5a7 100644
--- a/test/Driver/Dependencies/malformed-but-valid-yaml.swift
+++ b/test/Driver/Dependencies/malformed-but-valid-yaml.swift
@@ -7,19 +7,19 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/malformed-after/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND: Handled main.swift
 
 // RUN: touch -t 201401240007 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD: Handled main.swift
 // CHECK-THIRD: Handled other.swift
@@ -33,13 +33,13 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/malformed-after/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // RUN: touch -t 201401240006 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // RUN: touch -t 201401240007 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // CHECK-FOURTH-NOT: Handled other.swift
 // CHECK-FOURTH: Handled main.swift
diff --git a/test/Driver/Dependencies/malformed.swift b/test/Driver/Dependencies/malformed.swift
index 2e5a87a..0edcabb 100644
--- a/test/Driver/Dependencies/malformed.swift
+++ b/test/Driver/Dependencies/malformed.swift
@@ -7,19 +7,19 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/malformed-after/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND: Handled main.swift
 
 // RUN: touch -t 201401240007 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD: Handled main.swift
 // CHECK-THIRD: Handled other.swift
@@ -33,13 +33,13 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/malformed-after/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // RUN: touch -t 201401240006 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // RUN: touch -t 201401240007 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // CHECK-FOURTH-NOT: Handled other.swift
 // CHECK-FOURTH: Handled main.swift
diff --git a/test/Driver/Dependencies/mutual-interface-hash.swift b/test/Driver/Dependencies/mutual-interface-hash.swift
index 0bf90ca..13ec646 100644
--- a/test/Driver/Dependencies/mutual-interface-hash.swift
+++ b/test/Driver/Dependencies/mutual-interface-hash.swift
@@ -9,12 +9,12 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/mutual-interface-hash/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-CLEAN %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s
 
 // CHECK-CLEAN-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/does-change.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-CHANGE %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CHANGE %s
 
 // CHECK-CHANGE: Handled does-change.swift
 // CHECK-CHANGE: Handled does-not-change.swift
@@ -23,7 +23,7 @@
 // RUN: cp -r %S/Inputs/mutual-interface-hash/*.swiftdeps %t
 
 // RUN: touch -t 201401240006 %t/does-not-change.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-NO-CHANGE %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-NO-CHANGE %s
 
 // CHECK-NO-CHANGE-NOT: Handled
 // CHECK-NO-CHANGE: Handled does-not-change.swift
@@ -34,7 +34,7 @@
 
 // Make sure the files really were dependent on one another.
 // RUN: touch -t 201401240007 %t/does-not-change.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s
 
 // CHECK-REBUILD-DEPENDENTS: Handled does-not-change.swift
 // CHECK-REBUILD-DEPENDENTS: Handled does-change.swift
@@ -44,4 +44,4 @@
 // considered cascading.
 // RUN: cp -r %S/Inputs/mutual-interface-hash/*.swiftdeps %t
 // RUN: sed -E -e 's/"[^"]*does-not-change.swift":/& !dirty/' -i.prev %t/main~buildrecord.swiftdeps
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./does-change.swift ./does-not-change.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REBUILD-DEPENDENTS %s
diff --git a/test/Driver/Dependencies/mutual.swift b/test/Driver/Dependencies/mutual.swift
index e6c42d8..7db852b 100644
--- a/test/Driver/Dependencies/mutual.swift
+++ b/test/Driver/Dependencies/mutual.swift
@@ -3,21 +3,21 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/mutual/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
 // CHECK-FIRST: Handled other.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD: Handled other.swift
 // CHECK-THIRD: Handled main.swift
 
 // RUN: touch -t 201401240006 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
diff --git a/test/Driver/Dependencies/nominal-members.swift b/test/Driver/Dependencies/nominal-members.swift
index 21f41f0..85cc635 100644
--- a/test/Driver/Dependencies/nominal-members.swift
+++ b/test/Driver/Dependencies/nominal-members.swift
@@ -3,7 +3,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/nominal-members/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-INITIAL %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s
 
 // CHECK-INITIAL-NOT: warning
 // CHECK-INITIAL: Handled a.swift
@@ -11,25 +11,25 @@
 // CHECK-INITIAL: Handled depends-on-a-foo.swift
 // CHECK-INITIAL: Handled depends-on-a-ext.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift  -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-CLEAN %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift  -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s
 
 // CHECK-CLEAN-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/a.swift
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift  -module-name main -j1 -v > %t/touched-a.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-TOUCHED-A %s < %t/touched-a.txt
-// RUN: FileCheck -check-prefix=NEGATIVE-TOUCHED-A %s < %t/touched-a.txt
+// RUN: %FileCheck -check-prefix=CHECK-TOUCHED-A %s < %t/touched-a.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE-TOUCHED-A %s < %t/touched-a.txt
 
 // CHECK-TOUCHED-A: Handled a.swift
 // CHECK-TOUCHED-A-DAG: Handled depends-on-a-foo.swift
 // CHECK-TOUCHED-A-DAG: Handled depends-on-a-ext.swift
 // NEGATIVE-TOUCHED-A-NOT: Handled a-ext.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift  -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-CLEAN %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift  -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-CLEAN %s
 
 
 // RUN: touch -t 201401240007 %t/a-ext.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift  -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-TOUCHED-EXT %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./a-ext.swift ./depends-on-a-foo.swift ./depends-on-a-ext.swift  -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-TOUCHED-EXT %s
 
 // CHECK-TOUCHED-EXT-NOT: Handled
 // CHECK-TOUCHED-EXT: Handled a-ext.swift
diff --git a/test/Driver/Dependencies/one-way-depends-after.swift b/test/Driver/Dependencies/one-way-depends-after.swift
index 469cbff..d6f3bca 100644
--- a/test/Driver/Dependencies/one-way-depends-after.swift
+++ b/test/Driver/Dependencies/one-way-depends-after.swift
@@ -10,20 +10,20 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/one-way-depends-after/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled main.swift
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND-NOT: Handled main.swift
 
 // RUN: touch -t 201401240007 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way-depends-after/ %t
@@ -35,20 +35,20 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/one-way-depends-after/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // RUN: touch -t 201401240006 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD-NOT: Handled other.swift
 // CHECK-THIRD: Handled main.swift
 // CHECK-THIRD-NOT: Handled other.swift
 
 // RUN: touch -t 201401240007 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // RUN: touch -t 201401240008 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // CHECK-FOURTH: Handled other.swift
 // CHECK-FOURTH: Handled main.swift
diff --git a/test/Driver/Dependencies/one-way-depends-before.swift b/test/Driver/Dependencies/one-way-depends-before.swift
index 034b01c..f6d0751 100644
--- a/test/Driver/Dependencies/one-way-depends-before.swift
+++ b/test/Driver/Dependencies/one-way-depends-before.swift
@@ -10,19 +10,19 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/one-way-depends-before/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND: Handled main.swift
 
 // RUN: touch -t 201401240007 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD-NOT: Handled main.swift
 // CHECK-THIRD: Handled other.swift
@@ -38,17 +38,17 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/one-way-depends-before/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // RUN: touch -t 201401240006 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // CHECK-FOURTH-NOT: Handled other.swift
 // CHECK-FOURTH: Handled main.swift
 // CHECK-FOURTH-NOT: Handled other.swift
 
 // RUN: touch -t 201401240007 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // RUN: touch -t 201401240008 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
diff --git a/test/Driver/Dependencies/one-way-external-delete.swift b/test/Driver/Dependencies/one-way-external-delete.swift
index 5663e86..82bc5cc 100644
--- a/test/Driver/Dependencies/one-way-external-delete.swift
+++ b/test/Driver/Dependencies/one-way-external-delete.swift
@@ -1,13 +1,13 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way-external/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
 // CHECK-FIRST: Handled other.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled
 
@@ -16,7 +16,7 @@
 // RUN: touch -t 201401240006 %t/*.o
 // RUN: touch -t 201401240004 %t/*-external
 // RUN: rm %t/other1-external
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD-DAG: Handled other.swift
 // CHECK-THIRD-DAG: Handled main.swift
@@ -25,14 +25,14 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way-external/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 
 // RUN: touch -t 201401240005 %t/*
 // RUN: touch -t 201401240006 %t/*.o
 // RUN: touch -t 201401240004 %t/*-external
 // RUN: rm %t/main1-external
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // CHECK-FOURTH-NOT: Handled other.swift
 // CHECK-FOURTH: Handled main.swift
diff --git a/test/Driver/Dependencies/one-way-external.swift b/test/Driver/Dependencies/one-way-external.swift
index 11c5407..fdea22c 100644
--- a/test/Driver/Dependencies/one-way-external.swift
+++ b/test/Driver/Dependencies/one-way-external.swift
@@ -7,13 +7,13 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way-external/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
 // CHECK-FIRST: Handled other.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled
 
@@ -22,7 +22,7 @@
 // RUN: touch -t 201401240006 %t/*.o
 // RUN: touch -t 201401240004 %t/*-external
 // RUN: touch -t 203704010005 %t/other1-external
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD-DAG: Handled other.swift
 // CHECK-THIRD-DAG: Handled main.swift
@@ -31,14 +31,14 @@
 // RUN: touch -t 201401240006 %t/*.o
 // RUN: touch -t 201401240004 %t/*-external
 // RUN: touch -t 203704010005 %t/other2-external
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 
 // RUN: touch -t 201401240005 %t/*
 // RUN: touch -t 201401240006 %t/*.o
 // RUN: touch -t 201401240004 %t/*-external
 // RUN: touch -t 203704010005 %t/main1-external
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // CHECK-FOURTH-NOT: Handled other.swift
 // CHECK-FOURTH: Handled main.swift
@@ -48,4 +48,4 @@
 // RUN: touch -t 201401240006 %t/*.o
 // RUN: touch -t 201401240004 %t/*-external
 // RUN: touch -t 203704010005 %t/main2-external
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
diff --git a/test/Driver/Dependencies/one-way-merge-module.swift b/test/Driver/Dependencies/one-way-merge-module.swift
index f434e51..90543bf 100644
--- a/test/Driver/Dependencies/one-way-merge-module.swift
+++ b/test/Driver/Dependencies/one-way-merge-module.swift
@@ -3,14 +3,14 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
 // CHECK-FIRST: Handled other.swift
 // CHECK-FIRST: Produced master.swiftmodule
 
-// RUN: cd %t && %swiftc_driver -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: warning
 // CHECK-SECOND-NOT: Handled
diff --git a/test/Driver/Dependencies/one-way-parallel.swift b/test/Driver/Dependencies/one-way-parallel.swift
index b2ad7e7..a617d13 100644
--- a/test/Driver/Dependencies/one-way-parallel.swift
+++ b/test/Driver/Dependencies/one-way-parallel.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: {{^{$}}
@@ -29,7 +29,7 @@
 // CHECK-FIRST: {{^}$}}
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j2 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j2 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: {{^{$}}
 // CHECK-SECOND: "kind": "began"
diff --git a/test/Driver/Dependencies/one-way-parseable.swift b/test/Driver/Dependencies/one-way-parseable.swift
index a99b838..bd2946f 100644
--- a/test/Driver/Dependencies/one-way-parseable.swift
+++ b/test/Driver/Dependencies/one-way-parseable.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: {{^{$}}
@@ -28,7 +28,7 @@
 // CHECK-FIRST: "output": "Handled other.swift\n"
 // CHECK-FIRST: {{^}$}}
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: {{^{$}}
 // CHECK-SECOND: "kind": "skipped"
@@ -43,7 +43,7 @@
 // CHECK-SECOND: {{^}$}}
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD: {{^{$}}
 // CHECK-THIRD: "kind": "began"
@@ -70,7 +70,7 @@
 // CHECK-THIRD: {{^}$}}
 
 // RUN: touch -t 201401240006 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -parseable-output 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // CHECK-FOURTH: {{^{$}}
 // CHECK-FOURTH: "kind": "began"
diff --git a/test/Driver/Dependencies/one-way-provides-after.swift b/test/Driver/Dependencies/one-way-provides-after.swift
index ce8e8b8..561cf08 100644
--- a/test/Driver/Dependencies/one-way-provides-after.swift
+++ b/test/Driver/Dependencies/one-way-provides-after.swift
@@ -10,19 +10,19 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/one-way-provides-after/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND: Handled main.swift
 
 // RUN: touch -t 201401240007 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way-provides-after/ %t
 // RUN: touch -t 201401240005 %t/*.swift
@@ -33,13 +33,13 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/one-way-provides-after/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // RUN: touch -t 201401240007 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // RUN: touch -t 201401240008 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD-NOT: Handled other.swift
 // CHECK-THIRD: Handled main.swift
diff --git a/test/Driver/Dependencies/one-way-provides-before.swift b/test/Driver/Dependencies/one-way-provides-before.swift
index b050485..a1b98d0 100644
--- a/test/Driver/Dependencies/one-way-provides-before.swift
+++ b/test/Driver/Dependencies/one-way-provides-before.swift
@@ -10,19 +10,19 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/one-way-provides-before/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND: Handled other.swift
 // CHECK-SECOND: Handled main.swift
 
 // RUN: touch -t 201401240007 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD-NOT: Handled main.swift
 // CHECK-THIRD: Handled other.swift
@@ -37,13 +37,13 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/one-way-provides-before/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // RUN: touch -t 201401240006 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // RUN: touch -t 201401240007 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // CHECK-FOURTH-NOT: Handled other.swift
 // CHECK-FOURTH: Handled main.swift
diff --git a/test/Driver/Dependencies/one-way-while-editing.swift b/test/Driver/Dependencies/one-way-while-editing.swift
index b6aad82..2e6295e 100644
--- a/test/Driver/Dependencies/one-way-while-editing.swift
+++ b/test/Driver/Dependencies/one-way-while-editing.swift
@@ -3,7 +3,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/modify-non-primary-files.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/modify-non-primary-files.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck %s
 
 // CHECK: Handled main.swift
 // CHECK: Handled other.swift
@@ -11,14 +11,14 @@
 // CHECK: error: input file 'other.swift' was modified during the build
 // CHECK-NOT: error
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-RECOVER %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-RECOVER %s
 
 // CHECK-RECOVER: Handled main.swift
 // CHECK-RECOVER: Handled other.swift
 
 
 // RUN: touch -t 201401240005 %t/*
-// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/modify-non-primary-files.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-REVERSED %s
+// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/modify-non-primary-files.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED %s
 
 // CHECK-REVERSED: Handled other.swift
 // CHECK-REVERSED: Handled main.swift
@@ -26,7 +26,7 @@
 // CHECK-REVERSED: error: input file 'main.swift' was modified during the build
 // CHECK-REVERSED-NOT: error
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-REVERSED-RECOVER %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REVERSED-RECOVER %s
 
 // CHECK-REVERSED-RECOVER-NOT: Handled other.swift
 // CHECK-REVERSED-RECOVER: Handled main.swift
diff --git a/test/Driver/Dependencies/one-way.swift b/test/Driver/Dependencies/one-way.swift
index d71be29..ccacabb 100644
--- a/test/Driver/Dependencies/one-way.swift
+++ b/test/Driver/Dependencies/one-way.swift
@@ -3,34 +3,34 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Handled main.swift
 // CHECK-FIRST: Handled other.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
 
 // CHECK-SECOND-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // CHECK-THIRD: Handled other.swift
 // CHECK-THIRD: Handled main.swift
 
 // RUN: touch -t 201401240006 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // CHECK-FOURTH-NOT: Handled other.swift
 // CHECK-FOURTH: Handled main.swift
 // CHECK-FOURTH-NOT: Handled other.swift
 
 // RUN: rm %t/main.o
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 // RUN: rm %t/other.o
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIFTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIFTH %s
 
 // CHECK-FIFTH-NOT: Handled main.swift
 // CHECK-FIFTH: Handled other.swift
@@ -39,33 +39,33 @@
 
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
 
 // Try modifying the inputs /backwards/ in time rather than forwards.
 // RUN: touch -t 201401240004 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-THIRD %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-THIRD %s
 
 // RUN: touch -t 201401240004 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FOURTH %s
 
 
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-REV-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s
 
 // CHECK-REV-FIRST: Handled other.swift
 // CHECK-REV-FIRST: Handled main.swift
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-REV-SECOND %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-SECOND %s
 
 // CHECK-REV-SECOND-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/other.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-REV-FIRST %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FIRST %s
 
 // RUN: touch -t 201401240006 %t/main.swift
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-REV-FOURTH %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./other.swift ./main.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-REV-FOURTH %s
 
 // CHECK-REV-FOURTH-NOT: Handled other.swift
 // CHECK-REV-FOURTH: Handled main.swift
diff --git a/test/Driver/Dependencies/private-after.swift b/test/Driver/Dependencies/private-after.swift
index f31d464..0c2fbdc 100644
--- a/test/Driver/Dependencies/private-after.swift
+++ b/test/Driver/Dependencies/private-after.swift
@@ -10,15 +10,15 @@
 // ...then reset the .swiftdeps files.
 // RUN: cp -r %S/Inputs/private-after/*.swiftdeps %t
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-INITIAL %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s
 
 // CHECK-INITIAL-NOT: warning
 // CHECK-INITIAL-NOT: Handled
 
 // RUN: touch -t 201401240006 %t/a.swift
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/a.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-A %s < %t/a.txt
-// RUN: FileCheck -check-prefix=CHECK-A-NEG %s < %t/a.txt
+// RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt
+// RUN: %FileCheck -check-prefix=CHECK-A-NEG %s < %t/a.txt
 
 // CHECK-A: Handled a.swift
 // CHECK-A-DAG: Handled b.swift
@@ -40,8 +40,8 @@
 
 // RUN: touch -t 201401240006 %t/f.swift
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift ./f.swift ./g.swift -module-name main -j1 -v > %t/f.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-F %s < %t/f.txt
-// RUN: FileCheck -check-prefix=CHECK-F-NEG %s < %t/f.txt
+// RUN: %FileCheck -check-prefix=CHECK-F %s < %t/f.txt
+// RUN: %FileCheck -check-prefix=CHECK-F-NEG %s < %t/f.txt
 
 // CHECK-F: Handled f.swift
 // CHECK-F: Handled g.swift
diff --git a/test/Driver/Dependencies/private.swift b/test/Driver/Dependencies/private.swift
index 6add23c..90656c6 100644
--- a/test/Driver/Dependencies/private.swift
+++ b/test/Driver/Dependencies/private.swift
@@ -3,7 +3,7 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/private/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-INITIAL %s
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-INITIAL %s
 
 // CHECK-INITIAL-NOT: warning
 // CHECK-INITIAL: Handled a.swift
@@ -14,8 +14,8 @@
 
 // RUN: touch -t 201401240006 %t/a.swift
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/a.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-A %s < %t/a.txt
-// RUN: FileCheck -check-prefix=CHECK-A-NEG %s < %t/a.txt
+// RUN: %FileCheck -check-prefix=CHECK-A %s < %t/a.txt
+// RUN: %FileCheck -check-prefix=CHECK-A-NEG %s < %t/a.txt
 
 // CHECK-A: Handled a.swift
 // CHECK-A-DAG: Handled b.swift
@@ -25,8 +25,8 @@
 
 // RUN: touch -t 201401240006 %t/b.swift
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/b.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-B %s < %t/b.txt
-// RUN: FileCheck -check-prefix=CHECK-B-NEG %s < %t/b.txt
+// RUN: %FileCheck -check-prefix=CHECK-B %s < %t/b.txt
+// RUN: %FileCheck -check-prefix=CHECK-B-NEG %s < %t/b.txt
 
 // CHECK-B-NEG-NOT: Handled a.swift
 // CHECK-B: Handled b.swift
@@ -36,8 +36,8 @@
 
 // RUN: touch -t 201401240006 %t/c.swift
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/c.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-C %s < %t/c.txt
-// RUN: FileCheck -check-prefix=CHECK-C-NEG %s < %t/c.txt
+// RUN: %FileCheck -check-prefix=CHECK-C %s < %t/c.txt
+// RUN: %FileCheck -check-prefix=CHECK-C-NEG %s < %t/c.txt
 
 // CHECK-C-NEG-NOT: Handled a.swift
 // CHECK-C-NEG-NOT: Handled b.swift
@@ -47,8 +47,8 @@
 
 // RUN: touch -t 201401240006 %t/d.swift
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/d.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-D %s < %t/d.txt
-// RUN: FileCheck -check-prefix=CHECK-D-NEG %s < %t/d.txt
+// RUN: %FileCheck -check-prefix=CHECK-D %s < %t/d.txt
+// RUN: %FileCheck -check-prefix=CHECK-D-NEG %s < %t/d.txt
 
 // CHECK-D-NEG-NOT: Handled a.swift
 // CHECK-D-NEG-NOT: Handled b.swift
@@ -58,8 +58,8 @@
 
 // RUN: touch -t 201401240006 %t/e.swift
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/e.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-E %s < %t/e.txt
-// RUN: FileCheck -check-prefix=CHECK-E-NEG %s < %t/e.txt
+// RUN: %FileCheck -check-prefix=CHECK-E %s < %t/e.txt
+// RUN: %FileCheck -check-prefix=CHECK-E-NEG %s < %t/e.txt
 
 // CHECK-E-NEG-NOT: Handled a.swift
 // CHECK-E-NEG-NOT: Handled b.swift
@@ -69,8 +69,8 @@
 
 // RUN: touch -t 201401240007 %t/a.swift %t/e.swift
 // RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./a.swift ./b.swift ./c.swift ./d.swift ./e.swift -module-name main -j1 -v > %t/ae.txt 2>&1
-// RUN: FileCheck -check-prefix=CHECK-AE %s < %t/ae.txt
-// RUN: FileCheck -check-prefix=CHECK-AE-NEG %s < %t/ae.txt
+// RUN: %FileCheck -check-prefix=CHECK-AE %s < %t/ae.txt
+// RUN: %FileCheck -check-prefix=CHECK-AE-NEG %s < %t/ae.txt
 
 // CHECK-AE: Handled a.swift
 // CHECK-AE: Handled e.swift
diff --git a/test/Driver/Dependencies/whole-module-build-record.swift b/test/Driver/Dependencies/whole-module-build-record.swift
index d7c516c..57866c1 100644
--- a/test/Driver/Dependencies/whole-module-build-record.swift
+++ b/test/Driver/Dependencies/whole-module-build-record.swift
@@ -3,8 +3,8 @@
 // RUN: rm -rf %t && cp -r %S/Inputs/one-way/ %t
 // RUN: touch -t 201401240005 %t/*
 
-// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/fake-build-whole-module.py -output-file-map %t/output.json -whole-module-optimization ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-FIRST %s
-// RUN: FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
+// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/fake-build-whole-module.py -output-file-map %t/output.json -whole-module-optimization ./main.swift ./other.swift -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
+// RUN: %FileCheck -check-prefix=CHECK-RECORD %s < %t/main~buildrecord.swiftdeps
 
 // CHECK-FIRST-NOT: warning
 // CHECK-FIRST: Produced main.o
diff --git a/test/Driver/Inputs/error.swift b/test/Driver/Inputs/error.swift
new file mode 100644
index 0000000..9bb04c6
--- /dev/null
+++ b/test/Driver/Inputs/error.swift
@@ -0,0 +1,6 @@
+struct Foo {
+  let bar: Int
+  init() {
+    self.bar = self.bar
+  }
+}
diff --git a/test/Driver/actions.swift b/test/Driver/actions.swift
index aec3593..10ed593 100644
--- a/test/Driver/actions.swift
+++ b/test/Driver/actions.swift
@@ -3,66 +3,66 @@
 
 // XFAIL: freebsd, linux
 
-// RUN: %swiftc_driver -driver-print-actions %s 2>&1 | FileCheck %s -check-prefix=BASIC
+// RUN: %swiftc_driver -driver-print-actions %s 2>&1 | %FileCheck %s -check-prefix=BASIC
 // BASIC: 0: input, "{{.*}}actions.swift", swift
 // BASIC: 1: compile, {0}, object
 // BASIC: 2: link, {1}, image
 
-// RUN: %swiftc_driver -driver-print-actions -c %s 2>&1 | FileCheck %s -check-prefix=BASICC
+// RUN: %swiftc_driver -driver-print-actions -c %s 2>&1 | %FileCheck %s -check-prefix=BASICC
 // BASICC: 0: input, "{{.*}}actions.swift", swift
 // BASICC: 1: compile, {0}, object
 
-// RUN: %swiftc_driver -driver-print-actions -emit-sil %s 2>&1 | FileCheck %s -check-prefix=BASICSIL
+// RUN: %swiftc_driver -driver-print-actions -emit-sil %s 2>&1 | %FileCheck %s -check-prefix=BASICSIL
 // BASICSIL: 0: input, "{{.*}}actions.swift", swift
 // BASICSIL: 1: compile, {0}, sil
 
-// RUN: %swiftc_driver -driver-print-actions -emit-silgen %s 2>&1 | FileCheck %s -check-prefix=BASICSILGEN
+// RUN: %swiftc_driver -driver-print-actions -emit-silgen %s 2>&1 | %FileCheck %s -check-prefix=BASICSILGEN
 // BASICSILGEN: 0: input, "{{.*}}actions.swift", swift
 // BASICSILGEN: 1: compile, {0}, raw-sil
 
-// RUN: %swiftc_driver -driver-print-actions -S %s 2>&1 | FileCheck %s -check-prefix=BASICASM
+// RUN: %swiftc_driver -driver-print-actions -S %s 2>&1 | %FileCheck %s -check-prefix=BASICASM
 // BASICASM: 0: input, "{{.*}}actions.swift", swift
 // BASICASM: 1: compile, {0}, assembly
 
-// RUN: %swiftc_driver -driver-print-actions -emit-module %s 2>&1 | FileCheck %s -check-prefix=BASICMODULE
+// RUN: %swiftc_driver -driver-print-actions -emit-module %s 2>&1 | %FileCheck %s -check-prefix=BASICMODULE
 // BASICMODULE: 0: input, "{{.*}}actions.swift", swift
 // BASICMODULE: 1: compile, {0}, swiftmodule
 // BASICMODULE: 2: merge-module, {1}, swiftmodule
 
-// RUN: %swiftc_driver -driver-print-actions -emit-executable -emit-module %s 2>&1 | FileCheck %s -check-prefix=EXEC-AND-MODULE
+// RUN: %swiftc_driver -driver-print-actions -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=EXEC-AND-MODULE
 // EXEC-AND-MODULE: 0: input, "{{.*}}actions.swift", swift
 // EXEC-AND-MODULE: 1: compile, {0}, object
 // EXEC-AND-MODULE: 2: merge-module, {1}, swiftmodule
 // EXEC-AND-MODULE: 3: link, {1}, image
 
-// RUN: %swiftc_driver -driver-print-actions -g %s 2>&1 | FileCheck %s -check-prefix=DEBUG
-// RUN: %swiftc_driver -driver-print-actions -gnone -g %s 2>&1 | FileCheck %s -check-prefix=DEBUG
+// RUN: %swiftc_driver -driver-print-actions -g %s 2>&1 | %FileCheck %s -check-prefix=DEBUG
+// RUN: %swiftc_driver -driver-print-actions -gnone -g %s 2>&1 | %FileCheck %s -check-prefix=DEBUG
 // DEBUG: 0: input, "{{.*}}actions.swift", swift
 // DEBUG: 1: compile, {0}, object
 // DEBUG: 2: merge-module, {1}, swiftmodule
 // DEBUG: 3: link, {1, 2}, image
 // DEBUG: 4: generate-dSYM, {3}, dSYM
 
-// RUN: %swiftc_driver -driver-print-actions -gnone %s 2>&1 | FileCheck %s -check-prefix=BASIC
-// RUN: %swiftc_driver -driver-print-actions -g -gnone %s 2>&1 | FileCheck %s -check-prefix=BASIC
+// RUN: %swiftc_driver -driver-print-actions -gnone %s 2>&1 | %FileCheck %s -check-prefix=BASIC
+// RUN: %swiftc_driver -driver-print-actions -g -gnone %s 2>&1 | %FileCheck %s -check-prefix=BASIC
 
-// RUN: %swiftc_driver -driver-print-actions -g -c %s 2>&1 | FileCheck %s -check-prefix=DEBUG-OBJECT
+// RUN: %swiftc_driver -driver-print-actions -g -c %s 2>&1 | %FileCheck %s -check-prefix=DEBUG-OBJECT
 // DEBUG-OBJECT: 0: input, "{{.*}}actions.swift", swift
 // DEBUG-OBJECT: 1: compile, {0}, object
 // DEBUG-OBJECT-NOT: merge-module
 
-// RUN: %swiftc_driver -driver-print-actions -g -emit-executable -emit-module %s 2>&1 | FileCheck %s -check-prefix=DEBUG-MODULE
-// RUN: %swiftc_driver -driver-print-actions -gnone -g -emit-executable -emit-module %s 2>&1 | FileCheck %s -check-prefix=DEBUG-MODULE
+// RUN: %swiftc_driver -driver-print-actions -g -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=DEBUG-MODULE
+// RUN: %swiftc_driver -driver-print-actions -gnone -g -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=DEBUG-MODULE
 // DEBUG-MODULE: 0: input, "{{.*}}actions.swift", swift
 // DEBUG-MODULE: 1: compile, {0}, object
 // DEBUG-MODULE: 2: merge-module, {1}, swiftmodule
 // DEBUG-MODULE: 3: link, {1, 2}, image
 // DEBUG-MODULE: 4: generate-dSYM, {3}, dSYM
 
-// RUN: %swiftc_driver -driver-print-actions -gnone -emit-executable -emit-module %s 2>&1 | FileCheck %s -check-prefix=EXEC-AND-MODULE
-// RUN: %swiftc_driver -driver-print-actions -g -gnone -emit-executable -emit-module %s 2>&1 | FileCheck %s -check-prefix=EXEC-AND-MODULE
+// RUN: %swiftc_driver -driver-print-actions -gnone -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=EXEC-AND-MODULE
+// RUN: %swiftc_driver -driver-print-actions -g -gnone -emit-executable -emit-module %s 2>&1 | %FileCheck %s -check-prefix=EXEC-AND-MODULE
 
-// RUN: %swiftc_driver -driver-print-actions %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions 2>&1 | FileCheck %s -check-prefix=MULTI
+// RUN: %swiftc_driver -driver-print-actions %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions 2>&1 | %FileCheck %s -check-prefix=MULTI
 // MULTI: 0: input, "{{.*}}Inputs/main.swift", swift
 // MULTI: 1: compile, {0}, object
 // MULTI: 2: input, "{{.*}}Inputs/empty.swift", swift
@@ -71,7 +71,7 @@
 // MULTI: 5: compile, {4}, object
 // MULTI: 6: link, {1, 3, 5}, image
 
-// RUN: %swiftc_driver -driver-print-actions -g %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions 2>&1 | FileCheck %s -check-prefix=DEBUG-MULTI
+// RUN: %swiftc_driver -driver-print-actions -g %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions 2>&1 | %FileCheck %s -check-prefix=DEBUG-MULTI
 // DEBUG-MULTI: 0: input, "{{.*}}Inputs/main.swift", swift
 // DEBUG-MULTI: 1: compile, {0}, object
 // DEBUG-MULTI: 2: input, "{{.*}}Inputs/empty.swift", swift
@@ -84,14 +84,14 @@
 
 
 // RUN: touch %t/a.o %t/b.o
-// RUN: %swiftc_driver -driver-print-actions %t/a.o %t/b.o -o main 2>&1 | FileCheck %s -check-prefix=LINK-ONLY
-// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o -o main 2>&1 | FileCheck %s -check-prefix=LINK-ONLY
+// RUN: %swiftc_driver -driver-print-actions %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY
+// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY
 // LINK-ONLY: 0: input, "{{.*}}/a.o", object
 // LINK-ONLY: 1: input, "{{.*}}/b.o", object
 // LINK-ONLY: 2: link, {0, 1}, image
 
 // RUN: touch %t/a.swiftmodule %t/b.swiftmodule
-// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | FileCheck %s -check-prefix=DEBUG-LINK-ONLY
+// RUN: %swiftc_driver -driver-print-actions -g %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=DEBUG-LINK-ONLY
 // DEBUG-LINK-ONLY: 0: input, "{{.*}}/a.o", object
 // DEBUG-LINK-ONLY: 1: input, "{{.*}}/b.o", object
 // DEBUG-LINK-ONLY: 2: input, "{{.*}}/a.swiftmodule", swiftmodule
@@ -101,19 +101,19 @@
 // DEBUG-LINK-ONLY: 6: generate-dSYM, {5}, dSYM
 
 // RUN: touch %t/a.o %t/b.o
-// RUN: %swiftc_driver -driver-print-actions %t/a.o %s -o main 2>&1 | FileCheck %s -check-prefix=COMPILE-PLUS-OBJECT
+// RUN: %swiftc_driver -driver-print-actions %t/a.o %s -o main 2>&1 | %FileCheck %s -check-prefix=COMPILE-PLUS-OBJECT
 // COMPILE-PLUS-OBJECT: 0: input, "{{.*}}/a.o", object
 // COMPILE-PLUS-OBJECT: 1: input, "{{.*}}actions.swift", swift
 // COMPILE-PLUS-OBJECT: 2: compile, {1}, object
 // COMPILE-PLUS-OBJECT: 3: link, {0, 2}, image
 
 
-// RUN: %swiftc_driver -driver-print-actions %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions -force-single-frontend-invocation 2>&1 | FileCheck %s -check-prefix=WHOLE-MODULE
+// RUN: %swiftc_driver -driver-print-actions %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions -force-single-frontend-invocation 2>&1 | %FileCheck %s -check-prefix=WHOLE-MODULE
 // WHOLE-MODULE: 0: input, "{{.*}}Inputs/main.swift", swift
 // WHOLE-MODULE: 1: input, "{{.*}}Inputs/empty.swift", swift
 // WHOLE-MODULE: 2: input, "{{.*}}actions.swift", swift
 // WHOLE-MODULE: 3: compile, {0, 1, 2}, object
 // WHOLE-MODULE: 4: link, {3}, image
 
-// RUN: %swiftc_driver -driver-print-actions -g %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions -force-single-frontend-invocation 2>&1 | FileCheck %s -check-prefix=WHOLE-MODULE -check-prefix=WHOLE-MODULE-DEBUG
+// RUN: %swiftc_driver -driver-print-actions -g %S/Inputs/main.swift %S/../Inputs/empty.swift %s -module-name actions -force-single-frontend-invocation 2>&1 | %FileCheck %s -check-prefix=WHOLE-MODULE -check-prefix=WHOLE-MODULE-DEBUG
 // WHOLE-MODULE-DEBUG: 5: generate-dSYM, {4}, dSYM
diff --git a/test/Driver/advanced_output_file_map.swift b/test/Driver/advanced_output_file_map.swift
index d561b26..54564f7 100644
--- a/test/Driver/advanced_output_file_map.swift
+++ b/test/Driver/advanced_output_file_map.swift
@@ -1,7 +1,7 @@
 // RUN: echo "{\"%s\": {\"object\": \"/build/obj/advanced_output_file_map.o\", \"swiftmodule\": \"/build/swiftmodule/advanced_output_file_map.swiftmodule\", \"swiftdoc\": "/build/swiftmodule/advanced_output_file_map_x.swiftdoc", \"diagnostics\": \"/build/dia/advanced_output_file_map.dia\", \"dependencies\": \"/build/d/advanced_output_file_map.d\"}, \"%S/Inputs/main.swift\": {\"object\": \"/build/obj/main.o\", \"swiftmodule\": \"/build/swiftmodule/main.swiftmodule\", \"swiftdoc\": "/build/swiftmodule/main_x.swiftdoc", \"diagnostics\": \"/build/dia/main.dia\", \"dependencies\": \"/build/d/main.d\"}, \"%S/Inputs/lib.swift\": {\"object\": \"/build/obj/lib.o\", \"swiftmodule\": \"/build/swiftmodule/lib.swiftmodule\", \"swiftdoc\": \"/build/swiftmodule/lib_x.swiftdoc\", \"diagnostics\": \"/build/dia/lib.dia\", \"dependencies\": \"/build/d/lib.d\"}}" > %t.json
 
-// RUN: %swiftc_driver -driver-print-output-file-map -target x86_64-apple-macosx10.9 -emit-executable -emit-module -serialize-diagnostics %s %S/Inputs/main.swift %S/Inputs/lib.swift -g -o /build/advanced_output_file_map.out -emit-module-path /build/OutputFileMap.swiftmodule -module-name OutputFileMap -output-file-map %t.json 2>&1 | FileCheck %s -check-prefix=DUMPOFM
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -emit-executable -emit-module -serialize-diagnostics -emit-dependencies %s %S/Inputs/main.swift %S/Inputs/lib.swift -g -o /build/advanced_output_file_map.out -emit-module-path /build/OutputFileMap.swiftmodule -module-name OutputFileMap -output-file-map %t.json 2>&1 | FileCheck %s -check-prefix=BINDINGS
+// RUN: %swiftc_driver -driver-print-output-file-map -target x86_64-apple-macosx10.9 -emit-executable -emit-module -serialize-diagnostics %s %S/Inputs/main.swift %S/Inputs/lib.swift -g -o /build/advanced_output_file_map.out -emit-module-path /build/OutputFileMap.swiftmodule -module-name OutputFileMap -output-file-map %t.json 2>&1 | %FileCheck %s -check-prefix=DUMPOFM
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -emit-executable -emit-module -serialize-diagnostics -emit-dependencies %s %S/Inputs/main.swift %S/Inputs/lib.swift -g -o /build/advanced_output_file_map.out -emit-module-path /build/OutputFileMap.swiftmodule -module-name OutputFileMap -output-file-map %t.json 2>&1 | %FileCheck %s -check-prefix=BINDINGS
 
 // DUMPOFM: {{.*}}/Inputs/lib.swift -> object: "/build/obj/lib.o"
 // DUMPOFM-NEXT: {{.*}}/Inputs/lib.swift -> dependencies: "/build/d/lib.d"
diff --git a/test/Driver/assert.swift b/test/Driver/assert.swift
index 95f78d5..7047522 100644
--- a/test/Driver/assert.swift
+++ b/test/Driver/assert.swift
@@ -1,5 +1,5 @@
-// RUN: not %swiftc_driver -emit-executable -o %t.exe %s -Xfrontend -debug-assert-immediately 2>&1 | FileCheck %s
-// RUN: not %swiftc_driver -emit-executable -o %t.exe %s -Xfrontend -debug-assert-after-parse 2>&1 | FileCheck %s
+// RUN: not %swiftc_driver -emit-executable -o %t.exe %s -Xfrontend -debug-assert-immediately 2>&1 | %FileCheck %s
+// RUN: not %swiftc_driver -emit-executable -o %t.exe %s -Xfrontend -debug-assert-after-parse 2>&1 | %FileCheck %s
 
 // REQUIRES: asserts
 
diff --git a/test/Driver/autolink_extract.swift b/test/Driver/autolink_extract.swift
index 5c212a0..0947102 100644
--- a/test/Driver/autolink_extract.swift
+++ b/test/Driver/autolink_extract.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swiftc_driver -### %s | FileCheck %s
+// RUN: %target-swiftc_driver -### %s | %FileCheck %s
 
 // REQUIRES: autolink-extract
 
diff --git a/test/Driver/basic_output_file_map.swift b/test/Driver/basic_output_file_map.swift
index a7bbbde..c4f830c 100644
--- a/test/Driver/basic_output_file_map.swift
+++ b/test/Driver/basic_output_file_map.swift
@@ -1,7 +1,7 @@
 // RUN: echo "{\"%s\": {\"object\": \"/build/basic_output_file_map.o\"}, \"%S/Inputs/main.swift\": {\"object\": \"/build/main.o\"}, \"%S/Inputs/lib.swift\": {\"object\": \"/build/lib.o\"}}" > %t.json
 
-// RUN: %swiftc_driver -driver-print-output-file-map -target x86_64-apple-macosx10.9 -emit-executable %s %S/Inputs/main.swift %S/Inputs/lib.swift -o /build/basic_output_file_map.out -module-name OutputFileMap -output-file-map %t.json 2>&1 | FileCheck %s -check-prefix=DUMPOFM
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -emit-executable %s %S/Inputs/main.swift %S/Inputs/lib.swift -o /build/basic_output_file_map.out -module-name OutputFileMap -output-file-map %t.json 2>&1 | FileCheck %s -check-prefix=BINDINGS
+// RUN: %swiftc_driver -driver-print-output-file-map -target x86_64-apple-macosx10.9 -emit-executable %s %S/Inputs/main.swift %S/Inputs/lib.swift -o /build/basic_output_file_map.out -module-name OutputFileMap -output-file-map %t.json 2>&1 | %FileCheck %s -check-prefix=DUMPOFM
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -emit-executable %s %S/Inputs/main.swift %S/Inputs/lib.swift -o /build/basic_output_file_map.out -module-name OutputFileMap -output-file-map %t.json 2>&1 | %FileCheck %s -check-prefix=BINDINGS
 
 // DUMPOFM: {{.*}}/Inputs/lib.swift -> object: "/build/lib.o"
 // DUMPOFM: {{.*}}/Inputs/main.swift -> object: "/build/main.o"
diff --git a/test/Driver/bindings.swift b/test/Driver/bindings.swift
index ffade5c..7d48ef1 100644
--- a/test/Driver/bindings.swift
+++ b/test/Driver/bindings.swift
@@ -1,54 +1,54 @@
 // RUN: mkdir -p %t
 
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 %s 2>&1 | FileCheck %s -check-prefix=BASIC
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 %s 2>&1 | %FileCheck %s -check-prefix=BASIC
 // BASIC: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}bindings.swift"], output: {object: "[[OBJECT:.*\.o]]"}
 // BASIC: # "x86_64-apple-macosx10.9" - "ld", inputs: ["[[OBJECT]]"], output: {image: "bindings"}
 
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 - 2>&1 | FileCheck %s -check-prefix=STDIN
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 - 2>&1 | %FileCheck %s -check-prefix=STDIN
 // STDIN: # "x86_64-apple-macosx10.9" - "swift", inputs: ["-"], output: {object: "[[OBJECT:.*\.o]]"}
 // STDIN: # "x86_64-apple-macosx10.9" - "ld", inputs: ["[[OBJECT]]"], output: {image: "main"}
 
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 %S/Inputs/invalid-module-name.swift 2>&1 | FileCheck %s -check-prefix=INVALID-NAME-SINGLE-FILE
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 %S/Inputs/invalid-module-name.swift 2>&1 | %FileCheck %s -check-prefix=INVALID-NAME-SINGLE-FILE
 // INVALID-NAME-SINGLE-FILE: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}/Inputs/invalid-module-name.swift"], output: {object: "[[OBJECT:.*\.o]]"}
 // INVALID-NAME-SINGLE-FILE: # "x86_64-apple-macosx10.9" - "ld", inputs: ["[[OBJECT]]"], output: {image: "invalid-module-name"}
 
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -o NamedOutput %s 2>&1 | FileCheck %s -check-prefix=NAMEDIMG
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -module-name NamedOutput %s 2>&1 | FileCheck %s -check-prefix=NAMEDIMG
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -o NamedOutput %s 2>&1 | %FileCheck %s -check-prefix=NAMEDIMG
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -module-name NamedOutput %s 2>&1 | %FileCheck %s -check-prefix=NAMEDIMG
 // NAMEDIMG: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}bindings.swift"], output: {object: "[[OBJECT:.*\.o]]"}
 // NAMEDIMG: # "x86_64-apple-macosx10.9" - "ld", inputs: ["[[OBJECT]]"], output: {image: "NamedOutput"}
 
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -c %s 2>&1 | FileCheck %s -check-prefix=OBJ
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -c %s 2>&1 | %FileCheck %s -check-prefix=OBJ
 // OBJ: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}bindings.swift"], output: {object: "bindings.o"}
 
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -c %s -o /build/bindings.o 2>&1 | FileCheck %s -check-prefix=NAMEDOBJ
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -c %s -o /build/bindings.o 2>&1 | %FileCheck %s -check-prefix=NAMEDOBJ
 // NAMEDOBJ: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}bindings.swift"], output: {object: "/build/bindings.o"}
 
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -emit-sil %s 2>&1 | FileCheck %s -check-prefix=SIL
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -emit-sil %s 2>&1 | %FileCheck %s -check-prefix=SIL
 // SIL: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}bindings.swift"], output: {sil: "-"}
 
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -emit-ir %S/Inputs/empty.sil 2>&1 | FileCheck %s -check-prefix=SIL-INPUT
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -emit-ir %S/Inputs/empty.sil 2>&1 | %FileCheck %s -check-prefix=SIL-INPUT
 // SIL-INPUT: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}empty.sil"], output: {llvm-ir: "-"}
 
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -c -incremental %s 2>&1 | FileCheck %s -check-prefix=OBJ-AND-DEPS
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -c -incremental %s 2>&1 | %FileCheck %s -check-prefix=OBJ-AND-DEPS
 // OBJ-AND-DEPS: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}bindings.swift"], output: {
 // OBJ-AND-DEPS-DAG: swift-dependencies: "bindings.swiftdeps"
 // OBJ-AND-DEPS-DAG: object: "bindings.o"
 // OBJ-AND-DEPS: }
 
 // RUN: echo '{"%s": {"object": "objroot/bindings.o"}}' > %t/map.json
-// RUN: %swiftc_driver -driver-print-bindings -output-file-map %t/map.json -target x86_64-apple-macosx10.9 %s 2>&1 | FileCheck %s -check-prefix=MAP
+// RUN: %swiftc_driver -driver-print-bindings -output-file-map %t/map.json -target x86_64-apple-macosx10.9 %s 2>&1 | %FileCheck %s -check-prefix=MAP
 // MAP: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}bindings.swift"], output: {object: "objroot/bindings.o"}
 
 // RUN: echo '{"": {"object": "objroot/bindings.o"}}' > %t/map.json
-// RUN: %swiftc_driver -driver-print-bindings -output-file-map %t/map.json -whole-module-optimization -target x86_64-apple-macosx10.9 %s %S/Inputs/lib.swift 2>&1 | FileCheck %s -check-prefix=MAP-WFO
+// RUN: %swiftc_driver -driver-print-bindings -output-file-map %t/map.json -whole-module-optimization -target x86_64-apple-macosx10.9 %s %S/Inputs/lib.swift 2>&1 | %FileCheck %s -check-prefix=MAP-WFO
 // MAP-WFO: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}bindings.swift", "{{.*}}lib.swift"], output: {object: "objroot/bindings.o"}
 
 // RUN: touch %t/a.o %t/b.o
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 %t/a.o %t/b.o -o main 2>&1 | FileCheck %s -check-prefix=LINK-ONLY
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -g %t/a.o %t/b.o -o main 2>&1 | FileCheck %s -check-prefix=LINK-ONLY
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -g %t/a.o %t/b.o -o main 2>&1 | %FileCheck %s -check-prefix=LINK-ONLY
 // LINK-ONLY: # "x86_64-apple-macosx10.9" - "ld", inputs: ["{{.*}}/a.o", "{{.*}}/b.o"], output: {image: "main"}
 
 // RUN: touch %t/a.swiftmodule %t/b.swiftmodule
-// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -g %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | FileCheck %s -check-prefix=DEBUG-LINK-ONLY
+// RUN: %swiftc_driver -driver-print-bindings -target x86_64-apple-macosx10.9 -g %t/a.o %t/b.o %t/a.swiftmodule %t/b.swiftmodule -o main 2>&1 | %FileCheck %s -check-prefix=DEBUG-LINK-ONLY
 // DEBUG-LINK-ONLY: # "x86_64-apple-macosx10.9" - "swift", inputs: ["{{.*}}/a.swiftmodule", "{{.*}}/b.swiftmodule"], output: {swiftmodule: "[[MERGED:.+\.swiftmodule]]", swiftdoc: "{{.+}}.swiftdoc"}
 // DEBUG-LINK-ONLY: # "x86_64-apple-macosx10.9" - "ld", inputs: ["{{.*}}/a.o", "{{.*}}/b.o", "[[MERGED]]"], output: {image: "main"}
diff --git a/test/Driver/broken_output_file_map.swift b/test/Driver/broken_output_file_map.swift
index 7e2c48d..e1ffc0c 100644
--- a/test/Driver/broken_output_file_map.swift
+++ b/test/Driver/broken_output_file_map.swift
@@ -1,5 +1,5 @@
 // RUN: echo "{\"%s\": {\"object\": \"/build/broken_output_file_map.o\", \"completely-bogus-type\": \"\"}}" > %t.json
 
-// RUN: %swiftc_driver -driver-print-output-file-map -target x86_64-apple-macosx10.9 -emit-executable %s %S/Inputs/main.swift %S/Inputs/lib.swift -o /build/basic_output_file_map.out -module-name OutputFileMap -output-file-map %t.json 2>&1 | FileCheck %s
+// RUN: %swiftc_driver -driver-print-output-file-map -target x86_64-apple-macosx10.9 -emit-executable %s %S/Inputs/main.swift %S/Inputs/lib.swift -o /build/basic_output_file_map.out -module-name OutputFileMap -output-file-map %t.json 2>&1 | %FileCheck %s
 
 // CHECK: {{.*}}/broken_output_file_map.swift -> object: "/build/broken_output_file_map.o"
diff --git a/test/Driver/color-diagnostics.swift b/test/Driver/color-diagnostics.swift
index 81f7ed1..6a9b6ff 100644
--- a/test/Driver/color-diagnostics.swift
+++ b/test/Driver/color-diagnostics.swift
@@ -1,4 +1,4 @@
-// RUN: not %target-swiftc_driver -Xfrontend -color-diagnostics -emit-executable -o %t %s 2>&1 | FileCheck %s
+// RUN: not %target-swiftc_driver -Xfrontend -color-diagnostics -emit-executable -o %t %s 2>&1 | %FileCheck %s
 
 // CHECK: [0m1 = 2{{$}}
 1 = 2
diff --git a/test/Driver/continue-building-after-errors.swift b/test/Driver/continue-building-after-errors.swift
new file mode 100644
index 0000000..c4ece29
--- /dev/null
+++ b/test/Driver/continue-building-after-errors.swift
@@ -0,0 +1,13 @@
+// RUN: not %swiftc_driver %S/Inputs/error.swift %s 2>&1 | %FileCheck %s
+// RUN: not %swiftc_driver -continue-building-after-errors %S/Inputs/error.swift %s 2>&1 | %FileCheck -check-prefix=CHECK-CONTINUE %s
+
+// CHECK: self.bar = self.bar
+// CHECK-NOT: self.baz = self.baz
+// CHECK-CONTINUE: self.bar = self.bar
+// CHECK-CONTINUE: self.baz = self.baz
+struct Bar {
+  let baz: Int
+  init() {
+    self.baz = self.baz
+  }
+}
diff --git a/test/Driver/crash.swift b/test/Driver/crash.swift
index 79ba1ce..8d271c0 100644
--- a/test/Driver/crash.swift
+++ b/test/Driver/crash.swift
@@ -1,6 +1,6 @@
-// RUN: not %swiftc_driver -emit-executable -o %t.exe %s -Xfrontend -debug-crash-immediately 2>&1 | FileCheck %s
+// RUN: not %swiftc_driver -emit-executable -o %t.exe %s -Xfrontend -debug-crash-immediately 2>&1 | %FileCheck %s
 
-// RUN: not %swiftc_driver -emit-executable -o %t.exe %s -Xfrontend -debug-crash-after-parse 2>&1 | FileCheck %s
+// RUN: not %swiftc_driver -emit-executable -o %t.exe %s -Xfrontend -debug-crash-after-parse 2>&1 | %FileCheck %s
 
 // CHECK: error: compile command failed due to signal
 
diff --git a/test/Driver/createCompilerInvocation.swift b/test/Driver/createCompilerInvocation.swift
index 69ee6a2..834aaec 100644
--- a/test/Driver/createCompilerInvocation.swift
+++ b/test/Driver/createCompilerInvocation.swift
@@ -1,7 +1,7 @@
 // RUN: %swift-ide-test_plain -test-createCompilerInvocation %s 2>&1
 // RUN: %swift-ide-test_plain -test-createCompilerInvocation -emit-executable %s %S/Input/main.swift %S/Input/lib.swift -module-name createCompilerInvocation -emit-module -emit-objc-header -o %t.out 2>&1
 // RUN: %swift-ide-test_plain -test-createCompilerInvocation -c %s %S/Input/main.swift %S/Input/lib.swift -module-name createCompilerInvocation -emit-module -emit-objc-header 2>&1
-// RUN: not %swift-ide-test_plain -test-createCompilerInvocation -parse %s -emit-module-path %t.swiftmodule 2>&1 | FileCheck --check-prefix=CHECK-FAIL %s
-// RUN: not %swift-ide-test_plain -test-createCompilerInvocation -v 2>&1 | FileCheck --check-prefix=CHECK-FAIL %s
+// RUN: not %swift-ide-test_plain -test-createCompilerInvocation -parse %s -emit-module-path %t.swiftmodule 2>&1 | %FileCheck --check-prefix=CHECK-FAIL %s
+// RUN: not %swift-ide-test_plain -test-createCompilerInvocation -v 2>&1 | %FileCheck --check-prefix=CHECK-FAIL %s
 
 // CHECK-FAIL: error: unable to create a CompilerInvocation
diff --git a/test/Driver/debug-output.swift b/test/Driver/debug-output.swift
index c4afc6d..4d8cc42 100644
--- a/test/Driver/debug-output.swift
+++ b/test/Driver/debug-output.swift
@@ -1,6 +1,6 @@
 // REQUIRES: asserts
 
-// RUN: %target-swift-frontend -emit-ir %S/Inputs/single_int.swift -o /dev/null -print-stats 2>&1 | FileCheck %s -check-prefix=STATS
+// RUN: %target-swift-frontend -emit-ir %S/Inputs/single_int.swift -o /dev/null -print-stats 2>&1 | %FileCheck %s -check-prefix=STATS
 // STATS: Statistics Collected
 // Only print statistics once
 // STATS-NOT: Statistics Collected
diff --git a/test/Driver/driver-compile.swift b/test/Driver/driver-compile.swift
index 5e41897..5a91718 100644
--- a/test/Driver/driver-compile.swift
+++ b/test/Driver/driver-compile.swift
@@ -1,60 +1,60 @@
 // RUN: rm -rf %t && mkdir -p %t
 
 // RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s 2>&1 > %t.simple.txt
-// RUN: FileCheck %s < %t.simple.txt
+// RUN: %FileCheck %s < %t.simple.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s -sdk %S/../Inputs/clang-importer-sdk -Xfrontend -foo -Xfrontend -bar -Xllvm -baz -Xcc -garply -F /path/to/frameworks -F /path/to/more/frameworks -I /path/to/headers -I path/to/more/headers -module-cache-path /tmp/modules -incremental 2>&1 > %t.complex.txt
-// RUN: FileCheck %s < %t.complex.txt
-// RUN: FileCheck -check-prefix COMPLEX %s < %t.complex.txt
+// RUN: %FileCheck %s < %t.complex.txt
+// RUN: %FileCheck -check-prefix COMPLEX %s < %t.complex.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -emit-silgen -target x86_64-apple-macosx10.9 %s 2>&1 > %t.silgen.txt
-// RUN: FileCheck %s < %t.silgen.txt
-// RUN: FileCheck -check-prefix SILGEN %s < %t.silgen.txt
+// RUN: %FileCheck %s < %t.silgen.txt
+// RUN: %FileCheck -check-prefix SILGEN %s < %t.silgen.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -emit-sil -target x86_64-apple-macosx10.9 %s 2>&1 > %t.sil.txt
-// RUN: FileCheck %s < %t.sil.txt
-// RUN: FileCheck -check-prefix SIL %s < %t.sil.txt
+// RUN: %FileCheck %s < %t.sil.txt
+// RUN: %FileCheck -check-prefix SIL %s < %t.sil.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -emit-ir -target x86_64-apple-macosx10.9 %s 2>&1 > %t.ir.txt
-// RUN: FileCheck %s < %t.ir.txt
-// RUN: FileCheck -check-prefix IR %s < %t.ir.txt
+// RUN: %FileCheck %s < %t.ir.txt
+// RUN: %FileCheck -check-prefix IR %s < %t.ir.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -emit-bc -target x86_64-apple-macosx10.9 %s 2>&1 > %t.bc.txt
-// RUN: FileCheck %s < %t.bc.txt
-// RUN: FileCheck -check-prefix BC %s < %t.bc.txt
+// RUN: %FileCheck %s < %t.bc.txt
+// RUN: %FileCheck -check-prefix BC %s < %t.bc.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -S -target x86_64-apple-macosx10.9 %s 2>&1 > %t.s.txt
-// RUN: FileCheck %s < %t.s.txt
-// RUN: FileCheck -check-prefix ASM %s < %t.s.txt
+// RUN: %FileCheck %s < %t.s.txt
+// RUN: %FileCheck -check-prefix ASM %s < %t.s.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -c -target x86_64-apple-macosx10.9 %s 2>&1 > %t.c.txt
-// RUN: FileCheck %s < %t.c.txt
-// RUN: FileCheck -check-prefix OBJ %s < %t.c.txt
+// RUN: %FileCheck %s < %t.c.txt
+// RUN: %FileCheck -check-prefix OBJ %s < %t.c.txt
 
-// RUN: not %swiftc_driver -driver-print-jobs -c -target x86_64-apple-macosx10.9 %s %s 2>&1 | FileCheck -check-prefix DUPLICATE-NAME %s
+// RUN: not %swiftc_driver -driver-print-jobs -c -target x86_64-apple-macosx10.9 %s %s 2>&1 | %FileCheck -check-prefix DUPLICATE-NAME %s
 // RUN: cp %s %t
-// RUN: not %swiftc_driver -driver-print-jobs -c -target x86_64-apple-macosx10.9 %s %t/driver-compile.swift 2>&1 | FileCheck -check-prefix DUPLICATE-NAME %s
+// RUN: not %swiftc_driver -driver-print-jobs -c -target x86_64-apple-macosx10.9 %s %t/driver-compile.swift 2>&1 | %FileCheck -check-prefix DUPLICATE-NAME %s
 
-// RUN: %swiftc_driver -driver-print-jobs -c -target x86_64-apple-macosx10.9 %s %S/../Inputs/empty.swift -module-name main -driver-use-filelists 2>&1 | FileCheck -check-prefix=FILELIST %s
+// RUN: %swiftc_driver -driver-print-jobs -c -target x86_64-apple-macosx10.9 %s %S/../Inputs/empty.swift -module-name main -driver-use-filelists 2>&1 | %FileCheck -check-prefix=FILELIST %s
 
 // RUN: rm -rf %t && mkdir -p %t/DISTINCTIVE-PATH/usr/bin/
 // RUN: ln %swift_driver_plain %t/DISTINCTIVE-PATH/usr/bin/swiftc
 // RUN: ln -s "swiftc" %t/DISTINCTIVE-PATH/usr/bin/swift-update
 // RUN: %t/DISTINCTIVE-PATH/usr/bin/swiftc -driver-print-jobs -update-code -c -target x86_64-apple-macosx10.9 -emit-module -emit-module-path %t.mod %s 2>&1 > %t.upd.txt
-// RUN: FileCheck -check-prefix UPDATE-CODE %s < %t.upd.txt
+// RUN: %FileCheck -check-prefix UPDATE-CODE %s < %t.upd.txt
 // Clean up the test executable because hard links are expensive.
 // RUN: rm -rf %t/DISTINCTIVE-PATH/usr/bin/swiftc
 
 // RUN: %swiftc_driver -driver-print-jobs -fixit-code -c -target x86_64-apple-macosx10.9 -emit-module -emit-module-path %t.mod %s 2>&1 > %t.upd.txt
-// RUN: FileCheck -check-prefix FIXIT-CODE %s < %t.upd.txt
+// RUN: %FileCheck -check-prefix FIXIT-CODE %s < %t.upd.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -whole-module-optimization -incremental %s 2>&1 > %t.wmo-inc.txt
-// RUN: FileCheck %s < %t.wmo-inc.txt
-// RUN: FileCheck -check-prefix NO-REFERENCE-DEPENDENCIES %s < %t.wmo-inc.txt
+// RUN: %FileCheck %s < %t.wmo-inc.txt
+// RUN: %FileCheck -check-prefix NO-REFERENCE-DEPENDENCIES %s < %t.wmo-inc.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -embed-bitcode -incremental %s 2>&1 > %t.embed-inc.txt
-// RUN: FileCheck %s < %t.embed-inc.txt
-// RUN: FileCheck -check-prefix NO-REFERENCE-DEPENDENCIES %s < %t.embed-inc.txt
+// RUN: %FileCheck %s < %t.embed-inc.txt
+// RUN: %FileCheck -check-prefix NO-REFERENCE-DEPENDENCIES %s < %t.embed-inc.txt
 
 // REQUIRES: X86
 
diff --git a/test/Driver/driver-time-compilation.swift b/test/Driver/driver-time-compilation.swift
new file mode 100644
index 0000000..732afc6
--- /dev/null
+++ b/test/Driver/driver-time-compilation.swift
@@ -0,0 +1,10 @@
+// RUN: %swiftc_driver -parse -driver-time-compilation %s 2>&1 | %FileCheck %s
+// RUN: %swiftc_driver -parse -driver-time-compilation %s %S/../Inputs/empty.swift 2>&1 | %FileCheck -check-prefix CHECK-MULTIPLE %s
+
+// CHECK: Driver Time Compilation
+// CHECK: Total Execution Time: {{[0-9]+}}.{{[0-9]+}} seconds ({{[0-9]+}}.{{[0-9]+}} wall clock)
+// CHECK: ---Wall Time---
+// CHECK: --- Name ---
+// CHECK: compile {{.*}}driver-time-compilation.swift
+// CHECK-MULTIPLE: compile {{.*}}empty.swift
+// CHECK: {{[0-9]+}}.{{[0-9]+}} (100.0%)  Total
diff --git a/test/Driver/driver-use-frontend.swift b/test/Driver/driver-use-frontend.swift
index 719bbbf..6cae4bc 100644
--- a/test/Driver/driver-use-frontend.swift
+++ b/test/Driver/driver-use-frontend.swift
@@ -1,2 +1,2 @@
-// RUN: %swift_driver_plain -driver-use-frontend-path bin/completely-fake-driver -driver-print-jobs %s 2>&1 | FileCheck %s
+// RUN: %swift_driver_plain -driver-use-frontend-path bin/completely-fake-driver -driver-print-jobs %s 2>&1 | %FileCheck %s
 // CHECK: {{^}}bin/completely-fake-driver -frontend
diff --git a/test/Driver/driver_mode.swift b/test/Driver/driver_mode.swift
index 2b58e90..d455159 100644
--- a/test/Driver/driver_mode.swift
+++ b/test/Driver/driver_mode.swift
@@ -1,5 +1,5 @@
-// RUN: %swift_driver_plain --driver-mode=swiftc -driver-print-actions %s 2>&1 | FileCheck -check-prefix=CHECK-SWIFTC-%target-object-format %s
-// RUN: %swift_driver_plain -driver-print-actions %s --driver-mode=swiftc 2>&1 | FileCheck -check-prefix=CHECK-SWIFT %s
+// RUN: %swift_driver_plain --driver-mode=swiftc -driver-print-actions %s 2>&1 | %FileCheck -check-prefix=CHECK-SWIFTC-%target-object-format %s
+// RUN: %swift_driver_plain -driver-print-actions %s --driver-mode=swiftc 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT %s
 
 // CHECK-SWIFTC-macho: 0: input, "{{.*}}driver_mode.swift", swift
 // CHECK-SWIFTC-macho: 1: compile, {0}, object
diff --git a/test/Driver/dump-parse.swift b/test/Driver/dump-parse.swift
index ca89c8c..49ab9b3 100644
--- a/test/Driver/dump-parse.swift
+++ b/test/Driver/dump-parse.swift
@@ -1,5 +1,5 @@
-// RUN: not %target-swift-frontend -dump-parse %s 2>&1 | FileCheck %s
-// RUN: not %target-swift-frontend -dump-ast %s 2>&1 | FileCheck %s -check-prefix=CHECK-AST
+// RUN: not %target-swift-frontend -dump-parse %s 2>&1 | %FileCheck %s
+// RUN: not %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s -check-prefix=CHECK-AST
 
 // CHECK-LABEL: (func_decl "foo(_:)"
 // CHECK-AST-LABEL: (func_decl "foo(_:)"
diff --git a/test/Driver/embed-bitcode.swift b/test/Driver/embed-bitcode.swift
index 39e0f4f..946c91b 100644
--- a/test/Driver/embed-bitcode.swift
+++ b/test/Driver/embed-bitcode.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swiftc_driver -driver-print-bindings -embed-bitcode %s 2>&1 | FileCheck -check-prefix=CHECK-%target-object-format %s
+// RUN: %target-swiftc_driver -driver-print-bindings -embed-bitcode %s 2>&1 | %FileCheck -check-prefix=CHECK-%target-object-format %s
 // CHECK-macho: "swift", inputs: ["{{.*}}embed-bitcode.swift"], output: {llvm-bc: "[[BC:.*\.bc]]"}
 // CHECK-macho: "swift", inputs: ["[[BC]]"], output: {object: "[[OBJECT:.*\.o]]"}
 // CHECK-macho: "ld", inputs: ["[[OBJECT]]"], output: {image: "embed-bitcode"}
@@ -8,7 +8,7 @@
 // CHECK-elf: "swift-autolink-extract", inputs: ["[[OBJECT]]"], output: {autolink: "[[AUTOLINK:.*\.autolink]]"}
 // CHECK-elf: "clang++", inputs: ["[[OBJECT]]", "[[AUTOLINK]]"], output: {image: "main"}
 
-// RUN: %target-swiftc_driver -embed-bitcode %s 2>&1 -### | FileCheck %s -check-prefix=CHECK-FRONT -check-prefix=CHECK-FRONT-%target-object-format
+// RUN: %target-swiftc_driver -embed-bitcode %s 2>&1 -### | %FileCheck %s -check-prefix=CHECK-FRONT -check-prefix=CHECK-FRONT-%target-object-format
 // CHECK-FRONT: -frontend
 // CHECK-FRONT: -emit-bc
 // CHECK-FRONT: -frontend
@@ -18,7 +18,7 @@
 // CHECK-FRONT-macho: ld{{"? }}
 // CHECK-FRONT-macho: -bitcode_bundle
 
-// RUN: %target-swiftc_driver -embed-bitcode-marker %s 2>&1 -### | FileCheck %s -check-prefix=CHECK-MARKER -check-prefix=CHECK-MARKER-%target-object-format
+// RUN: %target-swiftc_driver -embed-bitcode-marker %s 2>&1 -### | %FileCheck %s -check-prefix=CHECK-MARKER -check-prefix=CHECK-MARKER-%target-object-format
 // CHECK-MARKER: -frontend
 // CHECK-MARKER: -c
 // CHECK-MARKER: -embed-bitcode-marker
@@ -26,7 +26,7 @@
 // CHECK-MARKER-macho: ld{{"? }}
 // CHECK-MARKER-macho: -bitcode_bundle
 
-// RUN: %target-swiftc_driver -embed-bitcode -Xcc -DDEBUG -Xllvm -fake-llvm-option -c -emit-module %s 2>&1 -### | FileCheck %s -check-prefix=CHECK-MODULE
+// RUN: %target-swiftc_driver -embed-bitcode -Xcc -DDEBUG -Xllvm -fake-llvm-option -c -emit-module %s 2>&1 -### | %FileCheck %s -check-prefix=CHECK-MODULE
 // CHECK-MODULE: -frontend
 // CHECK-MODULE: -emit-bc
 // CHECK-MODULE-DAG: -Xcc -DDEBUG
@@ -41,7 +41,7 @@
 // CHECK-MODULE-NOT: -fake-llvm-option
 // CHECK-MODULE-NOT: -emit-module-path
 
-// RUN: %target-swiftc_driver -embed-bitcode -force-single-frontend-invocation %s 2>&1 -### | FileCheck %s -check-prefix=CHECK-SINGLE
+// RUN: %target-swiftc_driver -embed-bitcode -force-single-frontend-invocation %s 2>&1 -### | %FileCheck %s -check-prefix=CHECK-SINGLE
 // CHECK-SINGLE: -frontend
 // CHECK-SINGLE: -emit-bc
 // CHECK-SINGLE: -frontend
@@ -49,7 +49,7 @@
 // CHECK-SINGLE: -embed-bitcode
 // CHECK-SINGLE: -disable-llvm-optzns
 
-// RUN: %target-swiftc_driver -embed-bitcode -c -parse-as-library -emit-module -force-single-frontend-invocation %s -parse-stdlib -module-name Swift 2>&1 -### | FileCheck %s -check-prefix=CHECK-LIB-WMO
+// RUN: %target-swiftc_driver -embed-bitcode -c -parse-as-library -emit-module -force-single-frontend-invocation %s -parse-stdlib -module-name Swift 2>&1 -### | %FileCheck %s -check-prefix=CHECK-LIB-WMO
 // CHECK-LIB-WMO: -frontend
 // CHECK-LIB-WMO: -emit-bc
 // CHECK-LIB-WMO: -parse-stdlib
@@ -59,7 +59,7 @@
 // CHECK-LIB-WMO: -embed-bitcode
 // CHECK-LIB-WMO: -disable-llvm-optzns
 
-// RUN: %target-swiftc_driver -embed-bitcode -c -parse-as-library -emit-module %s %S/../Inputs/empty.swift -module-name ABC 2>&1 -### | FileCheck %s -check-prefix=CHECK-LIB
+// RUN: %target-swiftc_driver -embed-bitcode -c -parse-as-library -emit-module %s %S/../Inputs/empty.swift -module-name ABC 2>&1 -### | %FileCheck %s -check-prefix=CHECK-LIB
 // CHECK-LIB: swift -frontend
 // CHECK-LIB: -emit-bc
 // CHECK-LIB: -primary-file
diff --git a/test/Driver/emit-sib-single-file.swift b/test/Driver/emit-sib-single-file.swift
index a7a7429..ad84496 100644
--- a/test/Driver/emit-sib-single-file.swift
+++ b/test/Driver/emit-sib-single-file.swift
@@ -1,18 +1,18 @@
 // RUN: %target-build-swift -Onone -emit-sib %s -o %t.sib
 // RUN: %target-build-swift %t.sib -o %t
-// RUN: %target-run %t | FileCheck %s
+// RUN: %target-run %t | %FileCheck %s
 
 // RUN: %target-build-swift -Onone -c %t.sib -o %t.o
 // RUN: %target-build-swift %t.o -o %t
-// RUN: %target-run %t | FileCheck %s
+// RUN: %target-run %t | %FileCheck %s
 
 // RUN: %target-build-swift -Onone -emit-sibgen %s -o %t.sib
 // RUN: %target-build-swift %t.sib -o %t
-// RUN: %target-run %t | FileCheck %s
+// RUN: %target-run %t | %FileCheck %s
 
 // RUN: %target-build-swift -Onone -c %t.sib -o %t.o
 // RUN: %target-build-swift %t.o -o %t
-// RUN: %target-run %t | FileCheck %s
+// RUN: %target-run %t | %FileCheck %s
 // REQUIRES: executable_test
 
 // CHECK: Hello World
diff --git a/test/Driver/environment.swift b/test/Driver/environment.swift
index dc712af..90a6cbd 100644
--- a/test/Driver/environment.swift
+++ b/test/Driver/environment.swift
@@ -1,7 +1,7 @@
 // UNSUPPORTED: objc_interop
 // Apple's "System Integrity Protection" makes this test fail on OS X.
 
-// RUN: %swift_driver -target x86_64-unknown-gnu-linux -L/foo/ -driver-use-frontend-path %S/Inputs/print-var.sh %s LD_LIBRARY_PATH | FileCheck -check-prefix=CHECK${LD_LIBRARY_PATH+_LAX} %s
+// RUN: %swift_driver -target x86_64-unknown-gnu-linux -L/foo/ -driver-use-frontend-path %S/Inputs/print-var.sh %s LD_LIBRARY_PATH | %FileCheck -check-prefix=CHECK${LD_LIBRARY_PATH+_LAX} %s
 
 // CHECK: {{^/foo/:[^:]+/lib/swift/linux$}}
 // CHECK_LAX: {{^/foo/:[^:]+/lib/swift/linux}}
diff --git a/test/Driver/filelists.swift b/test/Driver/filelists.swift
index 0f5aab6..57cf521 100644
--- a/test/Driver/filelists.swift
+++ b/test/Driver/filelists.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: touch %t/a.swift %t/b.swift %t/c.swift
 
-// RUN: (cd %t && %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -emit-module ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json 2>&1 | FileCheck %s)
+// RUN: (cd %t && %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -emit-module ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json 2>&1 | %FileCheck %s)
 
 // CHECK-NOT: Handled
 // CHECK: Handled a.swift
@@ -10,7 +10,7 @@
 // CHECK-NEXT: Handled modules
 // CHECK-NOT: Handled
 
-// RUN: %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -c %t/a.swift %t/b.swift %t/c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -force-single-frontend-invocation 2>&1 | FileCheck -check-prefix=CHECK-WMO %s
+// RUN: %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -c %t/a.swift %t/b.swift %t/c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -force-single-frontend-invocation 2>&1 | %FileCheck -check-prefix=CHECK-WMO %s
 
 // CHECK-WMO-NOT: Handled
 // CHECK-WMO: Handled all
@@ -21,10 +21,10 @@
 // RUN: mkdir %t/bin
 // RUN: ln -s %S/Inputs/filelists/fake-ld.py %t/bin/ld
 
-// RUN: (cd %t && %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -c ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json -force-single-frontend-invocation -num-threads 1 2>&1 | FileCheck -check-prefix=CHECK-WMO-THREADED %s)
-// RUN: (cd %t && %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -c ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json -force-single-frontend-invocation -num-threads 1 -embed-bitcode 2>&1 | FileCheck -check-prefix=CHECK-WMO-THREADED %s)
+// RUN: (cd %t && %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -c ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json -force-single-frontend-invocation -num-threads 1 2>&1 | %FileCheck -check-prefix=CHECK-WMO-THREADED %s)
+// RUN: (cd %t && %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -c ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json -force-single-frontend-invocation -num-threads 1 -embed-bitcode 2>&1 | %FileCheck -check-prefix=CHECK-WMO-THREADED %s)
 // RUN: mkdir %t/tmp/
-// RUN: (cd %t && env TMPDIR="%t/tmp/" %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -c ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json -force-single-frontend-invocation -num-threads 1 -save-temps 2>&1 | FileCheck -check-prefix=CHECK-WMO-THREADED %s)
+// RUN: (cd %t && env TMPDIR="%t/tmp/" %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -c ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json -force-single-frontend-invocation -num-threads 1 -save-temps 2>&1 | %FileCheck -check-prefix=CHECK-WMO-THREADED %s)
 // RUN: ls %t/tmp/sources-* %t/tmp/outputs-*
 
 // CHECK-WMO-THREADED-NOT: Handled
@@ -33,8 +33,8 @@
 // CHECK-WMO-THREADED-NOT: Handled
 
 
-// RUN: (cd %t && env PATH=%t/bin/:$PATH %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -emit-library ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json 2>&1 | FileCheck -check-prefix=CHECK-LINK %s)
-// RUN: (cd %t && env PATH=%t/bin/:$PATH %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -emit-library ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json -force-single-frontend-invocation -num-threads 1 2>&1 | FileCheck -check-prefix=CHECK-LINK %s)
+// RUN: (cd %t && env PATH=%t/bin/:$PATH %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -emit-library ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json 2>&1 | %FileCheck -check-prefix=CHECK-LINK %s)
+// RUN: (cd %t && env PATH=%t/bin/:$PATH %swiftc_driver_plain -driver-use-frontend-path %S/Inputs/filelists/check-filelist-abc.py -emit-library ./a.swift ./b.swift ./c.swift -module-name main -target x86_64-apple-macosx10.9 -driver-use-filelists -output-file-map=%S/Inputs/filelists/output.json -force-single-frontend-invocation -num-threads 1 2>&1 | %FileCheck -check-prefix=CHECK-LINK %s)
 
 // CHECK-LINK: Handled link
 
diff --git a/test/Driver/linker-autolink-extract.swift b/test/Driver/linker-autolink-extract.swift
index 19f7843..e7a6eae 100644
--- a/test/Driver/linker-autolink-extract.swift
+++ b/test/Driver/linker-autolink-extract.swift
@@ -1,4 +1,4 @@
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-linux-gnu -g %s | FileCheck -check-prefix DEBUG_LINUX %s
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-linux-gnu -g %s | %FileCheck -check-prefix DEBUG_LINUX %s
 
 // REQUIRES: autolink-extract
 
diff --git a/test/Driver/linker.swift b/test/Driver/linker.swift
index 70192c6..a233506 100644
--- a/test/Driver/linker.swift
+++ b/test/Driver/linker.swift
@@ -1,60 +1,60 @@
 // RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s 2>&1 > %t.simple.txt
-// RUN: FileCheck %s < %t.simple.txt
-// RUN: FileCheck -check-prefix SIMPLE %s < %t.simple.txt
+// RUN: %FileCheck %s < %t.simple.txt
+// RUN: %FileCheck -check-prefix SIMPLE %s < %t.simple.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-ios7.1 %s 2>&1 > %t.simple.txt
-// RUN: FileCheck -check-prefix IOS_SIMPLE %s < %t.simple.txt
+// RUN: %FileCheck -check-prefix IOS_SIMPLE %s < %t.simple.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-tvos9.0 %s 2>&1 > %t.simple.txt
-// RUN: FileCheck -check-prefix tvOS_SIMPLE %s < %t.simple.txt
+// RUN: %FileCheck -check-prefix tvOS_SIMPLE %s < %t.simple.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target i386-apple-watchos2.0 %s 2>&1 > %t.simple.txt
-// RUN: FileCheck -check-prefix watchOS_SIMPLE %s < %t.simple.txt
+// RUN: %FileCheck -check-prefix watchOS_SIMPLE %s < %t.simple.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-linux-gnu -Ffoo -framework bar -Lbaz -lboo -Xlinker -undefined %s 2>&1 > %t.linux.txt
-// RUN: FileCheck -check-prefix LINUX-x86_64 %s < %t.linux.txt
+// RUN: %FileCheck -check-prefix LINUX-x86_64 %s < %t.linux.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target armv6-unknown-linux-gnueabihf -Ffoo -framework bar -Lbaz -lboo -Xlinker -undefined %s 2>&1 > %t.linux.txt
-// RUN: FileCheck -check-prefix LINUX-armv6 %s < %t.linux.txt
+// RUN: %FileCheck -check-prefix LINUX-armv6 %s < %t.linux.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target armv7-unknown-linux-gnueabihf -Ffoo -framework bar -Lbaz -lboo -Xlinker -undefined %s 2>&1 > %t.linux.txt
-// RUN: FileCheck -check-prefix LINUX-armv7 %s < %t.linux.txt
+// RUN: %FileCheck -check-prefix LINUX-armv7 %s < %t.linux.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target thumbv7-unknown-linux-gnueabihf -Ffoo -framework bar -Lbaz -lboo -Xlinker -undefined %s 2>&1 > %t.linux.txt
-// RUN: FileCheck -check-prefix LINUX-thumbv7 %s < %t.linux.txt
+// RUN: %FileCheck -check-prefix LINUX-thumbv7 %s < %t.linux.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target armv7-none-linux-androideabi -Ffoo -framework bar -Lbaz -lboo -Xlinker -undefined %s 2>&1 > %t.android.txt
-// RUN: FileCheck -check-prefix ANDROID-armv7 %s < %t.android.txt
-// RUN: FileCheck -check-prefix ANDROID-armv7-NEGATIVE %s < %t.android.txt
+// RUN: %FileCheck -check-prefix ANDROID-armv7 %s < %t.android.txt
+// RUN: %FileCheck -check-prefix ANDROID-armv7-NEGATIVE %s < %t.android.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-windows-cygnus -Ffoo -framework bar -Lbaz -lboo -Xlinker -undefined %s 2>&1 > %t.cygwin.txt
-// RUN: FileCheck -check-prefix CYGWIN-x86_64 %s < %t.cygwin.txt
+// RUN: %FileCheck -check-prefix CYGWIN-x86_64 %s < %t.cygwin.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -emit-library -target x86_64-apple-macosx10.9.1 %s -sdk %S/../Inputs/clang-importer-sdk -lfoo -framework bar -Lbaz -Fgarply -Xlinker -undefined -Xlinker dynamic_lookup -o sdk.out 2>&1 > %t.complex.txt
-// RUN: FileCheck %s < %t.complex.txt
-// RUN: FileCheck -check-prefix COMPLEX %s < %t.complex.txt
+// RUN: %FileCheck %s < %t.complex.txt
+// RUN: %FileCheck -check-prefix COMPLEX %s < %t.complex.txt
 
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 -g %s | FileCheck -check-prefix DEBUG %s
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 -g %s | %FileCheck -check-prefix DEBUG %s
 
 // RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.10   %s > %t.simple-macosx10.10.txt
-// RUN: FileCheck %s < %t.simple-macosx10.10.txt
-// RUN: FileCheck -check-prefix SIMPLE %s < %t.simple-macosx10.10.txt
+// RUN: %FileCheck %s < %t.simple-macosx10.10.txt
+// RUN: %FileCheck -check-prefix SIMPLE %s < %t.simple-macosx10.10.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-ios8.0        %s > %t.simple-ios8.txt
-// RUN: FileCheck -check-prefix IOS_ARCLITE %s < %t.simple-ios8.txt
+// RUN: %FileCheck -check-prefix IOS_ARCLITE %s < %t.simple-ios8.txt
 
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.11   %s | FileCheck -check-prefix NO_ARCLITE %s
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-ios9.0        %s | FileCheck -check-prefix NO_ARCLITE %s
-// RUN: %swiftc_driver -driver-print-jobs -target arm64-apple-tvos9.0        %s | FileCheck -check-prefix NO_ARCLITE %s
-// RUN: %swiftc_driver -driver-print-jobs -target armv7k-apple-watchos2.0    %s | FileCheck -check-prefix NO_ARCLITE %s
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.11   %s | %FileCheck -check-prefix NO_ARCLITE %s
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-ios9.0        %s | %FileCheck -check-prefix NO_ARCLITE %s
+// RUN: %swiftc_driver -driver-print-jobs -target arm64-apple-tvos9.0        %s | %FileCheck -check-prefix NO_ARCLITE %s
+// RUN: %swiftc_driver -driver-print-jobs -target armv7k-apple-watchos2.0    %s | %FileCheck -check-prefix NO_ARCLITE %s
 
 // RUN: rm -rf %t && mkdir %t
 // RUN: touch %t/a.o
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s %t/a.o -o linker 2>&1 | FileCheck -check-prefix COMPILE_AND_LINK %s
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s %t/a.o -driver-use-filelists -o linker 2>&1 | FileCheck -check-prefix FILELIST %s
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s %t/a.o -o linker 2>&1 | %FileCheck -check-prefix COMPILE_AND_LINK %s
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s %t/a.o -driver-use-filelists -o linker 2>&1 | %FileCheck -check-prefix FILELIST %s
 
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 -emit-library %s -module-name LINKER | FileCheck -check-prefix INFERRED_NAME %s
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 -emit-library %s -o libLINKER.dylib | FileCheck -check-prefix INFERRED_NAME %s
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 -emit-library %s -module-name LINKER | %FileCheck -check-prefix INFERRED_NAME %s
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 -emit-library %s -o libLINKER.dylib | %FileCheck -check-prefix INFERRED_NAME %s
 
 // There are more RUN lines further down in the file.
 
@@ -279,7 +279,7 @@
 // RUN: touch %t/DISTINCTIVE-PATH/usr/bin/ld
 // RUN: chmod +x %t/DISTINCTIVE-PATH/usr/bin/ld
 // RUN: ln %swift_driver_plain %t/DISTINCTIVE-PATH/usr/bin/swiftc
-// RUN: %t/DISTINCTIVE-PATH/usr/bin/swiftc %s -### | FileCheck -check-prefix=RELATIVE-LINKER %s
+// RUN: %t/DISTINCTIVE-PATH/usr/bin/swiftc %s -### | %FileCheck -check-prefix=RELATIVE-LINKER %s
 
 // RELATIVE-LINKER: /DISTINCTIVE-PATH/usr/bin/swift
 // RELATIVE-LINKER: /DISTINCTIVE-PATH/usr/bin/ld
@@ -292,7 +292,7 @@
 // RUN: mkdir -p %t/ANOTHER-DISTINCTIVE-PATH/usr/lib/arc
 // RUN: cp %S/Inputs/xcrun-return-self.sh %t/ANOTHER-DISTINCTIVE-PATH/usr/bin/xcrun
 
-// RUN: env PATH=%t/ANOTHER-DISTINCTIVE-PATH/usr/bin %t/DISTINCTIVE-PATH/usr/bin/swiftc -target x86_64-apple-macosx10.9 %s -### | FileCheck -check-prefix=XCRUN_ARCLITE %s
+// RUN: env PATH=%t/ANOTHER-DISTINCTIVE-PATH/usr/bin %t/DISTINCTIVE-PATH/usr/bin/swiftc -target x86_64-apple-macosx10.9 %s -### | %FileCheck -check-prefix=XCRUN_ARCLITE %s
 
 // XCRUN_ARCLITE: bin/ld{{"? }}
 // XCRUN_ARCLITE: /ANOTHER-DISTINCTIVE-PATH/usr/lib/arc/libarclite_macosx.a
@@ -300,7 +300,7 @@
 
 // RUN: mkdir -p %t/DISTINCTIVE-PATH/usr/lib/arc
 
-// RUN: env PATH=%t/ANOTHER-DISTINCTIVE-PATH/usr/bin %t/DISTINCTIVE-PATH/usr/bin/swiftc -target x86_64-apple-macosx10.9 %s -### | FileCheck -check-prefix=RELATIVE_ARCLITE %s
+// RUN: env PATH=%t/ANOTHER-DISTINCTIVE-PATH/usr/bin %t/DISTINCTIVE-PATH/usr/bin/swiftc -target x86_64-apple-macosx10.9 %s -### | %FileCheck -check-prefix=RELATIVE_ARCLITE %s
 
 // RELATIVE_ARCLITE: bin/ld{{"? }}
 // RELATIVE_ARCLITE: /DISTINCTIVE-PATH/usr/lib/arc/libarclite_macosx.a
diff --git a/test/Driver/merge-module.swift b/test/Driver/merge-module.swift
index 2b806f1..7afea45 100644
--- a/test/Driver/merge-module.swift
+++ b/test/Driver/merge-module.swift
@@ -1,20 +1,20 @@
 // RUN: %swiftc_driver -emit-module -driver-print-jobs %s 2>&1 > %t.simple.txt
-// RUN: FileCheck %s < %t.simple.txt
-// RUN: FileCheck -check-prefix SIMPLE %s < %t.simple.txt
+// RUN: %FileCheck %s < %t.simple.txt
+// RUN: %FileCheck -check-prefix SIMPLE %s < %t.simple.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -emit-module %s -sdk %S/../Inputs/clang-importer-sdk -Xfrontend -foo -Xfrontend -bar -o sdk.out -emit-objc-header-path path/to/header.h -F /path/to/frameworks -F /path/to/more/frameworks -I /path/to/headers -I path/to/more/headers -module-cache-path /tmp/modules 2>&1 > %t.complex.txt
-// RUN: FileCheck %s < %t.complex.txt
-// RUN: FileCheck -check-prefix COMPLEX %s < %t.complex.txt
+// RUN: %FileCheck %s < %t.complex.txt
+// RUN: %FileCheck -check-prefix COMPLEX %s < %t.complex.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -c -emit-module %s -o sdk.foo.out 2>&1 > %t.complex.txt
-// RUN: FileCheck %s < %t.complex.txt
-// RUN: FileCheck -check-prefix TWO-OUTPUTS %s < %t.complex.txt
+// RUN: %FileCheck %s < %t.complex.txt
+// RUN: %FileCheck -check-prefix TWO-OUTPUTS %s < %t.complex.txt
 
 // RUN: %swiftc_driver -driver-print-jobs -c %s -emit-objc-header -o sdk.foo.out 2>&1 > %t.complex.txt
-// RUN: FileCheck %s < %t.complex.txt
-// RUN: FileCheck -check-prefix THREE-OUTPUTS %s < %t.complex.txt
+// RUN: %FileCheck %s < %t.complex.txt
+// RUN: %FileCheck -check-prefix THREE-OUTPUTS %s < %t.complex.txt
 
-// RUN: %swiftc_driver -emit-module -driver-print-jobs -driver-use-filelists %s %S/../Inputs/empty.swift -module-name main 2>&1 | FileCheck -check-prefix FILELISTS %s
+// RUN: %swiftc_driver -emit-module -driver-print-jobs -driver-use-filelists %s %S/../Inputs/empty.swift -module-name main 2>&1 | %FileCheck -check-prefix FILELISTS %s
 
 // CHECK: bin/swift{{c?}} -frontend
 // CHECK: -module-name {{[^ ]+}}
@@ -80,8 +80,8 @@
 
 
 // RUN: %swiftc_driver -driver-print-jobs -emit-module %S/Inputs/main.swift %S/Inputs/lib.swift -module-name merge -o /tmp/modules > %t.complex.txt
-// RUN: FileCheck %s < %t.complex.txt
-// RUN: FileCheck -check-prefix MERGE_1 %s < %t.complex.txt
+// RUN: %FileCheck %s < %t.complex.txt
+// RUN: %FileCheck -check-prefix MERGE_1 %s < %t.complex.txt
 
 // MERGE_1: bin/swift{{c?}} -frontend -emit-module -primary-file {{[^ ]+}}/Inputs/main.swift {{[^ ]+}}/Inputs/lib.swift
 // MERGE_1: -emit-module-doc-path [[PARTIAL_MODULE_A:[^ ]+]].swiftdoc
diff --git a/test/Driver/modulewrap.swift b/test/Driver/modulewrap.swift
index f28e6a6..54df4dd 100644
--- a/test/Driver/modulewrap.swift
+++ b/test/Driver/modulewrap.swift
@@ -1,4 +1,4 @@
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-linux-gnu -g %s | FileCheck %s
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-linux-gnu -g %s | %FileCheck %s
 
 // CHECK: bin/swift -frontend{{.*}}-emit-module-path [[MOD:.*\.swiftmodule]]
 // CHECK: bin/swift {{.*}}-emit-module [[MOD]]
diff --git a/test/Driver/multi-threaded.swift b/test/Driver/multi-threaded.swift
index b7551be..09e6970 100644
--- a/test/Driver/multi-threaded.swift
+++ b/test/Driver/multi-threaded.swift
@@ -1,27 +1,27 @@
 // REQUIRES: rdar23493035
 
 // RUN: rm -rf %t && mkdir %t
-// RUN: %target-swiftc_driver -driver-print-jobs -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -emit-module -o test.swiftmodule | FileCheck -check-prefix=MODULE %s
+// RUN: %target-swiftc_driver -driver-print-jobs -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -emit-module -o test.swiftmodule | %FileCheck -check-prefix=MODULE %s
 // RUN: echo "{\"%s\": {\"assembly\": \"/build/multi-threaded.s\"}, \"%S/Inputs/main.swift\": {\"assembly\": \"/build/main.s\"}}" > %t/ofms.json
-// RUN: %target-swiftc_driver -driver-print-jobs -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -output-file-map %t/ofms.json -S | FileCheck -check-prefix=ASSEMBLY %s
-// RUN: %target-swiftc_driver -driver-print-jobs -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -c | FileCheck -check-prefix=OBJECT %s
+// RUN: %target-swiftc_driver -driver-print-jobs -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -output-file-map %t/ofms.json -S | %FileCheck -check-prefix=ASSEMBLY %s
+// RUN: %target-swiftc_driver -driver-print-jobs -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -c | %FileCheck -check-prefix=OBJECT %s
 // RUN: %target-swiftc_driver -parseable-output -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -c 2> %t/parseable-output
-// RUN: cat %t/parseable-output | FileCheck -check-prefix=PARSEABLE %s
-// RUN: env TMPDIR=/tmp %swiftc_driver -driver-print-jobs -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -o a.out | FileCheck -check-prefix=EXEC %s
+// RUN: cat %t/parseable-output | %FileCheck -check-prefix=PARSEABLE %s
+// RUN: env TMPDIR=/tmp %swiftc_driver -driver-print-jobs -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -o a.out | %FileCheck -check-prefix=EXEC %s
 // RUN: echo "{\"%s\": {\"llvm-bc\": \"multi-threaded.bc\", \"object\": \"%t/multi-threaded.o\"}, \"%S/Inputs/main.swift\": {\"llvm-bc\": \"main.bc\", \"object\": \"%t/main.o\"}}" > %t/ofmo.json
 // RUN: %target-swiftc_driver -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s  -emit-dependencies -output-file-map %t/ofmo.json -c
-// RUN: cat %t/*.d | FileCheck -check-prefix=DEPENDENCIES %s
+// RUN: cat %t/*.d | %FileCheck -check-prefix=DEPENDENCIES %s
 
 // Check if -embed-bitcode works
-// RUN: %target-swiftc_driver -driver-print-jobs -module-name=ThisModule -embed-bitcode -wmo -num-threads 4 %S/Inputs/main.swift %s -output-file-map %t/ofmo.json -c | FileCheck -check-prefix=BITCODE %s
+// RUN: %target-swiftc_driver -driver-print-jobs -module-name=ThisModule -embed-bitcode -wmo -num-threads 4 %S/Inputs/main.swift %s -output-file-map %t/ofmo.json -c | %FileCheck -check-prefix=BITCODE %s
 
 // Check if -embed-bitcode works with -parseable-output
 // RUN: %target-swiftc_driver -parseable-output -module-name=ThisModule -embed-bitcode -wmo -num-threads 4 %S/Inputs/main.swift %s -output-file-map %t/ofmo.json -c 2> %t/parseable2
-// RUN: cat %t/parseable2 | FileCheck -check-prefix=PARSEABLE2 %s
+// RUN: cat %t/parseable2 | %FileCheck -check-prefix=PARSEABLE2 %s
 
 // Check if linking works with -parseable-output
 // RUN: %target-swiftc_driver -parseable-output -module-name=ThisModule -wmo -num-threads 4 %S/Inputs/main.swift %s -output-file-map %t/ofmo.json -o a.out 2> %t/parseable3
-// RUN: cat %t/parseable3 | FileCheck -check-prefix=PARSEABLE3 %s
+// RUN: cat %t/parseable3 | %FileCheck -check-prefix=PARSEABLE3 %s
 
 // MODULE: -frontend
 // MODULE-DAG: -num-threads 4
diff --git a/test/Driver/multiple_input.swift b/test/Driver/multiple_input.swift
index 8fa1125..22d89ea 100644
--- a/test/Driver/multiple_input.swift
+++ b/test/Driver/multiple_input.swift
@@ -1,6 +1,6 @@
 // RUN: %target-swift-frontend -parse %S/Inputs/main.swift %S/Inputs/lib.swift %s -module-name ThisModule
 // RUN: %target-swift-frontend -parse %s %S/Inputs/lib.swift %S/Inputs/main.swift -module-name ThisModule
 
-// RUN: not %target-swift-frontend -parse -parse-as-library %S/Inputs/main.swift %S/Inputs/lib.swift %s 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -parse -parse-as-library %S/Inputs/main.swift %S/Inputs/lib.swift %s 2>&1 | %FileCheck %s
 // CHECK: main.swift:
 // CHECK: expressions are not allowed at the top level
diff --git a/test/Driver/no-inputs.swift b/test/Driver/no-inputs.swift
index 49b0d2a..ea268c6 100644
--- a/test/Driver/no-inputs.swift
+++ b/test/Driver/no-inputs.swift
@@ -1,6 +1,6 @@
-// RUN: %swiftc_driver_plain -v 2>&1 | FileCheck %s
-// RUN: %swiftc_driver_plain -v -force-single-frontend-invocation 2>&1 | FileCheck %s
-// RUN: not %swiftc_driver_plain -emit-executable 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
+// RUN: %swiftc_driver_plain -v 2>&1 | %FileCheck %s
+// RUN: %swiftc_driver_plain -v -force-single-frontend-invocation 2>&1 | %FileCheck %s
+// RUN: not %swiftc_driver_plain -emit-executable 2>&1 | %FileCheck --check-prefix=CHECK-ERROR %s
 
 // CHECK-NOT: error: no input files
 
diff --git a/test/Driver/options-interpreter.swift b/test/Driver/options-interpreter.swift
index 67c75a5..3592ddf 100644
--- a/test/Driver/options-interpreter.swift
+++ b/test/Driver/options-interpreter.swift
@@ -1,67 +1,67 @@
-// RUN: not %swift_driver -deprecated-integrated-repl -emit-module 2>&1 | FileCheck -check-prefix=IMMEDIATE_NO_MODULE %s
-// RUN: not %swift_driver -emit-module 2>&1 | FileCheck -check-prefix=IMMEDIATE_NO_MODULE %s
+// RUN: not %swift_driver -deprecated-integrated-repl -emit-module 2>&1 | %FileCheck -check-prefix=IMMEDIATE_NO_MODULE %s
+// RUN: not %swift_driver -emit-module 2>&1 | %FileCheck -check-prefix=IMMEDIATE_NO_MODULE %s
 // REQUIRES: swift_interpreter
 // IMMEDIATE_NO_MODULE: error: unsupported option '-emit-module'
 
-// RUN: %swift_driver -### %s | FileCheck -check-prefix INTERPRET %s
+// RUN: %swift_driver -### %s | %FileCheck -check-prefix INTERPRET %s
 // INTERPRET: -interpret
 
-// RUN: %swift_driver -### %s a b c | FileCheck -check-prefix ARGS %s
+// RUN: %swift_driver -### %s a b c | %FileCheck -check-prefix ARGS %s
 // ARGS: -- a b c
 
-// RUN: %swift_driver -### -parse-stdlib %s | FileCheck -check-prefix PARSE_STDLIB %s
-// RUN: %swift_driver -### -parse-stdlib | FileCheck -check-prefix PARSE_STDLIB %s
+// RUN: %swift_driver -### -parse-stdlib %s | %FileCheck -check-prefix PARSE_STDLIB %s
+// RUN: %swift_driver -### -parse-stdlib | %FileCheck -check-prefix PARSE_STDLIB %s
 // PARSE_STDLIB: -parse-stdlib
 
 
-// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -resource-dir /RSRC/ %s | FileCheck -check-prefix=CHECK-RESOURCE-DIR-ONLY %s
+// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -resource-dir /RSRC/ %s | %FileCheck -check-prefix=CHECK-RESOURCE-DIR-ONLY %s
 // CHECK-RESOURCE-DIR-ONLY: # DYLD_LIBRARY_PATH=/RSRC/macosx{{$}}
 
-// RUN: %swift_driver -### -target x86_64-unknown-linux-gnu -resource-dir /RSRC/ %s | FileCheck -check-prefix=CHECK-RESOURCE-DIR-ONLY-LINUX${LD_LIBRARY_PATH+_LAX} %s
+// RUN: %swift_driver -### -target x86_64-unknown-linux-gnu -resource-dir /RSRC/ %s | %FileCheck -check-prefix=CHECK-RESOURCE-DIR-ONLY-LINUX${LD_LIBRARY_PATH+_LAX} %s
 // CHECK-RESOURCE-DIR-ONLY-LINUX: # LD_LIBRARY_PATH=/RSRC/linux{{$}}
 // CHECK-RESOURCE-DIR-ONLY-LINUX_LAX: # LD_LIBRARY_PATH=/RSRC/linux{{$|:}}
 
-// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -L/foo/ %s | FileCheck -check-prefix=CHECK-L %s
+// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -L/foo/ %s | %FileCheck -check-prefix=CHECK-L %s
 // CHECK-L: # DYLD_LIBRARY_PATH={{/foo/:[^:]+/lib/swift/macosx$}}
 
-// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -L/foo/ -L/bar/ %s | FileCheck -check-prefix=CHECK-L2 %s
+// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -L/foo/ -L/bar/ %s | %FileCheck -check-prefix=CHECK-L2 %s
 // CHECK-L2: # DYLD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/macosx$}}
 
-// RUN: env DYLD_LIBRARY_PATH=/abc/ %swift_driver_plain -### -target x86_64-apple-macosx10.9 -L/foo/ -L/bar/ %s | FileCheck -check-prefix=CHECK-L2-ENV %s
+// RUN: env DYLD_LIBRARY_PATH=/abc/ %swift_driver_plain -### -target x86_64-apple-macosx10.9 -L/foo/ -L/bar/ %s | %FileCheck -check-prefix=CHECK-L2-ENV %s
 // CHECK-L2-ENV: # DYLD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/macosx:/abc/$}}
 
-// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 %s | FileCheck -check-prefix=CHECK-NO-FRAMEWORKS %s
-// RUN: env DYLD_FRAMEWORK_PATH=/abc/ %swift_driver_plain -### -target x86_64-apple-macosx10.9 %s | FileCheck -check-prefix=CHECK-NO-FRAMEWORKS %s
+// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 %s | %FileCheck -check-prefix=CHECK-NO-FRAMEWORKS %s
+// RUN: env DYLD_FRAMEWORK_PATH=/abc/ %swift_driver_plain -### -target x86_64-apple-macosx10.9 %s | %FileCheck -check-prefix=CHECK-NO-FRAMEWORKS %s
 // CHECK-NO-FRAMEWORKS-NOT: DYLD_FRAMEWORK_PATH
 
-// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -F/foo/ %s | FileCheck -check-prefix=CHECK-F %s
+// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -F/foo/ %s | %FileCheck -check-prefix=CHECK-F %s
 // CHECK-F: -F /foo/
 // CHECK-F: #
 // CHECK-F: DYLD_FRAMEWORK_PATH=/foo/{{$}}
 
-// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -F/foo/ -F/bar/ %s | FileCheck -check-prefix=CHECK-F2 %s
+// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -F/foo/ -F/bar/ %s | %FileCheck -check-prefix=CHECK-F2 %s
 // CHECK-F2: -F /foo/
 // CHECK-F2: -F /bar/
 // CHECK-F2: #
 // CHECK-F2: DYLD_FRAMEWORK_PATH=/foo/:/bar/{{$}}
 
-// RUN: env DYLD_FRAMEWORK_PATH=/abc/ %swift_driver_plain -### -target x86_64-apple-macosx10.9 -F/foo/ -F/bar/ %s | FileCheck -check-prefix=CHECK-F2-ENV %s
+// RUN: env DYLD_FRAMEWORK_PATH=/abc/ %swift_driver_plain -### -target x86_64-apple-macosx10.9 -F/foo/ -F/bar/ %s | %FileCheck -check-prefix=CHECK-F2-ENV %s
 // CHECK-F2-ENV: -F /foo/
 // CHECK-F2-ENV: -F /bar/
 // CHECK-F2-ENV: #
 // CHECK-F2-ENV: DYLD_FRAMEWORK_PATH=/foo/:/bar/:/abc/{{$}}
 
-// RUN: env DYLD_FRAMEWORK_PATH=/abc/ %swift_driver_plain -### -target x86_64-apple-macosx10.9 -F/foo/ -F/bar/ -L/foo2/ -L/bar2/ %s | FileCheck -check-prefix=CHECK-COMPLEX %s
+// RUN: env DYLD_FRAMEWORK_PATH=/abc/ %swift_driver_plain -### -target x86_64-apple-macosx10.9 -F/foo/ -F/bar/ -L/foo2/ -L/bar2/ %s | %FileCheck -check-prefix=CHECK-COMPLEX %s
 // CHECK-COMPLEX: -F /foo/
 // CHECK-COMPLEX: -F /bar/
 // CHECK-COMPLEX: #
 // CHECK-COMPLEX-DAG: DYLD_FRAMEWORK_PATH=/foo/:/bar/:/abc/{{$| }}
 // CHECK-COMPLEX-DAG: DYLD_LIBRARY_PATH={{/foo2/:/bar2/:[^:]+/lib/swift/macosx($| )}}
 
-// RUN: %swift_driver -### -target x86_64-unknown-linux-gnu -L/foo/ %s | FileCheck -check-prefix=CHECK-L-LINUX${LD_LIBRARY_PATH+_LAX} %s
+// RUN: %swift_driver -### -target x86_64-unknown-linux-gnu -L/foo/ %s | %FileCheck -check-prefix=CHECK-L-LINUX${LD_LIBRARY_PATH+_LAX} %s
 // CHECK-L-LINUX: # LD_LIBRARY_PATH={{/foo/:[^:]+/lib/swift/linux$}}
 // CHECK-L-LINUX_LAX: # LD_LIBRARY_PATH={{/foo/:[^:]+/lib/swift/linux($|:)}}
 
-// RUN: env LD_LIBRARY_PATH=/abc/ %swift_driver_plain -### -target x86_64-unknown-linux-gnu -L/foo/ -L/bar/ %s | FileCheck -check-prefix=CHECK-LINUX-COMPLEX${LD_LIBRARY_PATH+_LAX} %s
+// RUN: env LD_LIBRARY_PATH=/abc/ %swift_driver_plain -### -target x86_64-unknown-linux-gnu -L/foo/ -L/bar/ %s | %FileCheck -check-prefix=CHECK-LINUX-COMPLEX${LD_LIBRARY_PATH+_LAX} %s
 // CHECK-LINUX-COMPLEX: # LD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/linux:/abc/$}}
 // CHECK-LINUX-COMPLEX_LAX: # LD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/linux:/abc/($|:)}}
diff --git a/test/Driver/options-repl-darwin.swift b/test/Driver/options-repl-darwin.swift
index fe0d4d8..636f786 100644
--- a/test/Driver/options-repl-darwin.swift
+++ b/test/Driver/options-repl-darwin.swift
@@ -4,20 +4,20 @@
 // like the Xcode installation environment. We use hard links to make sure
 // the Swift driver really thinks it's been moved.
 
-// RUN: %swift_driver -repl -### | FileCheck -check-prefix=INTEGRATED %s
-// RUN: %swift_driver -### | FileCheck -check-prefix=INTEGRATED %s
+// RUN: %swift_driver -repl -### | %FileCheck -check-prefix=INTEGRATED %s
+// RUN: %swift_driver -### | %FileCheck -check-prefix=INTEGRATED %s
 
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/usr/bin/
 // RUN: touch %t/usr/bin/lldb
 // RUN: chmod +x %t/usr/bin/lldb
 // RUN: ln %swift_driver_plain %t/usr/bin/swift
-// RUN: %t/usr/bin/swift -repl -### | FileCheck -check-prefix=LLDB %s
-// RUN: %t/usr/bin/swift -### | FileCheck -check-prefix=LLDB %s
+// RUN: %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
+// RUN: %t/usr/bin/swift -### | %FileCheck -check-prefix=LLDB %s
 
 // RUN: mkdir -p %t/Toolchains/Test.xctoolchain/usr/bin/
 // RUN: mv %t/usr/bin/swift %t/Toolchains/Test.xctoolchain/usr/bin/swift
-// RUN: %t/Toolchains/Test.xctoolchain/usr/bin/swift -repl -### | FileCheck -check-prefix=LLDB %s
+// RUN: %t/Toolchains/Test.xctoolchain/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
 
 // Clean up the test executable because hard links are expensive.
 // RUN: rm -rf %t/Toolchains/Test.xctoolchain/usr/bin/swift
diff --git a/test/Driver/options-repl.swift b/test/Driver/options-repl.swift
index bf31990..7dce7cc 100644
--- a/test/Driver/options-repl.swift
+++ b/test/Driver/options-repl.swift
@@ -1,19 +1,19 @@
-// RUN: not %swift -repl %s 2>&1 | FileCheck -check-prefix=REPL_NO_FILES %s
-// RUN: not %swift_driver -repl %s 2>&1 | FileCheck -check-prefix=REPL_NO_FILES %s
-// RUN: not %swift_driver -lldb-repl %s 2>&1 | FileCheck -check-prefix=REPL_NO_FILES %s
-// RUN: not %swift_driver -deprecated-integrated-repl %s 2>&1 | FileCheck -check-prefix=REPL_NO_FILES %s
+// RUN: not %swift -repl %s 2>&1 | %FileCheck -check-prefix=REPL_NO_FILES %s
+// RUN: not %swift_driver -repl %s 2>&1 | %FileCheck -check-prefix=REPL_NO_FILES %s
+// RUN: not %swift_driver -lldb-repl %s 2>&1 | %FileCheck -check-prefix=REPL_NO_FILES %s
+// RUN: not %swift_driver -deprecated-integrated-repl %s 2>&1 | %FileCheck -check-prefix=REPL_NO_FILES %s
 
 // REPL_NO_FILES: REPL mode requires no input files
 
 
-// RUN: %swift_driver -deprecated-integrated-repl -### | FileCheck -check-prefix=INTEGRATED %s
+// RUN: %swift_driver -deprecated-integrated-repl -### | %FileCheck -check-prefix=INTEGRATED %s
 
 // INTEGRATED: swift -frontend -repl
 // INTEGRATED: -module-name REPL
 
 
-// RUN: %swift_driver -lldb-repl -### | FileCheck -check-prefix=LLDB %s
-// RUN: %swift_driver -lldb-repl -DA,B,C -DD -L /path/to/libraries -L /path/to/more/libraries -F /path/to/frameworks -lsomelib -framework SomeFramework -sdk / -I "this folder" -module-name Test -### | FileCheck -check-prefix=LLDB-OPTS %s
+// RUN: %swift_driver -lldb-repl -### | %FileCheck -check-prefix=LLDB %s
+// RUN: %swift_driver -lldb-repl -DA,B,C -DD -L /path/to/libraries -L /path/to/more/libraries -F /path/to/frameworks -lsomelib -framework SomeFramework -sdk / -I "this folder" -module-name Test -### | %FileCheck -check-prefix=LLDB-OPTS %s
 
 // LLDB: lldb{{"?}} "--repl=
 // LLDB-NOT: -module-name
@@ -38,13 +38,13 @@
 // like the Xcode installation environment. We use hard links to make sure
 // the Swift driver really thinks it's been moved.
 
-// RUN: %swift_driver -repl -### | FileCheck -check-prefix=INTEGRATED %s
-// RUN: %swift_driver -### | FileCheck -check-prefix=INTEGRATED %s
+// RUN: %swift_driver -repl -### | %FileCheck -check-prefix=INTEGRATED %s
+// RUN: %swift_driver -### | %FileCheck -check-prefix=INTEGRATED %s
 
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/usr/bin/
 // RUN: touch %t/usr/bin/lldb
 // RUN: chmod +x %t/usr/bin/lldb
 // RUN: ln %swift_driver_plain %t/usr/bin/swift
-// RUN: %t/usr/bin/swift -repl -### | FileCheck -check-prefix=LLDB %s
-// RUN: %t/usr/bin/swift -### | FileCheck -check-prefix=LLDB %s
+// RUN: %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
+// RUN: %t/usr/bin/swift -### | %FileCheck -check-prefix=LLDB %s
diff --git a/test/Driver/options.swift b/test/Driver/options.swift
index 0096cce..7044c2c 100644
--- a/test/Driver/options.swift
+++ b/test/Driver/options.swift
@@ -1,29 +1,29 @@
 // rdar://13723332 Crash on -emit-sil with no input files
-// RUN: not %target-swift-frontend -emit-sil 2>&1 | FileCheck -check-prefix=NO_FILES %s
-// RUN: not %target-swift-frontend -emit-sil -parse-as-library 2>&1 | FileCheck -check-prefix=NO_FILES %s
+// RUN: not %target-swift-frontend -emit-sil 2>&1 | %FileCheck -check-prefix=NO_FILES %s
+// RUN: not %target-swift-frontend -emit-sil -parse-as-library 2>&1 | %FileCheck -check-prefix=NO_FILES %s
 // NO_FILES: this mode requires at least one input file
 
-// RUN: not %target-swift-frontend -parse-sil -emit-sil 2>&1 | FileCheck -check-prefix=SIL_FILES %s
-// RUN: not %target-swift-frontend -parse-sil -emit-sil %s %s 2>&1 | FileCheck -check-prefix=SIL_FILES %s
+// RUN: not %target-swift-frontend -parse-sil -emit-sil 2>&1 | %FileCheck -check-prefix=SIL_FILES %s
+// RUN: not %target-swift-frontend -parse-sil -emit-sil %s %s 2>&1 | %FileCheck -check-prefix=SIL_FILES %s
 // SIL_FILES: this mode requires a single input file
 
-// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %S/Inputs/invalid-module-name.swift 2>&1 | FileCheck -check-prefix=INVALID_MODULE_NAME %s
+// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %S/Inputs/invalid-module-name.swift 2>&1 | %FileCheck -check-prefix=INVALID_MODULE_NAME %s
 // INVALID_MODULE_NAME: error: module name "invalid-module-name" is not a valid identifier; use -module-name flag to specify an alternate name
 
-// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %S/Inputs/invalid.module.name.swift 2>&1 | FileCheck -check-prefix=INVALID_MODULE_NAME2 %s
+// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %S/Inputs/invalid.module.name.swift 2>&1 | %FileCheck -check-prefix=INVALID_MODULE_NAME2 %s
 // INVALID_MODULE_NAME2: error: module name "invalid.module.name" is not a valid identifier; use -module-name flag to specify an alternate name
 
-// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %S/Inputs/invalid-module-name.swift -module-name still-invalid 2>&1 | FileCheck -check-prefix=STILL_INVALID %s
+// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %S/Inputs/invalid-module-name.swift -module-name still-invalid 2>&1 | %FileCheck -check-prefix=STILL_INVALID %s
 // STILL_INVALID: error: module name "still-invalid" is not a valid identifier{{$}}
 
-// RUN: not %target-swiftc_driver -emit-silgen -parse-as-library %s -module-name "Swift" 2>&1 | FileCheck -check-prefix=STDLIB_MODULE %s
+// RUN: not %target-swiftc_driver -emit-silgen -parse-as-library %s -module-name "Swift" 2>&1 | %FileCheck -check-prefix=STDLIB_MODULE %s
 // RUN: %target-swiftc_driver -emit-silgen -parse-as-library %s -module-name "Swift" -parse-stdlib -###
 // STDLIB_MODULE: error: module name "Swift" is reserved for the standard library{{$}}
 
-// RUN: not %target-swift-frontend -parse -emit-module %s 2>&1 | FileCheck -check-prefix=PARSE_NO_MODULE %s
+// RUN: not %target-swift-frontend -parse -emit-module %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_MODULE %s
 // PARSE_NO_MODULE: error: this mode does not support emitting modules{{$}}
 
-// RUN: not %target-swift-frontend -dump-ast -emit-dependencies %s 2>&1 | FileCheck -check-prefix=DUMP_NO_DEPS %s
+// RUN: not %target-swift-frontend -dump-ast -emit-dependencies %s 2>&1 | %FileCheck -check-prefix=DUMP_NO_DEPS %s
 // DUMP_NO_DEPS: error: this mode does not support emitting dependency files{{$}}
 
 // Should not fail with non-zero exit code.
@@ -31,85 +31,85 @@
 // RUN: %target-swift-frontend -emit-silgen -parse-as-library %S/Inputs/invalid-module-name.swift -module-name foo > /dev/null
 // RUN: %target-swift-frontend -parse -parse-as-library %S/Inputs/invalid-module-name.swift -module-name foo
 
-// RUN: not %swiftc_driver -crazy-option-that-does-not-exist %s 2>&1 | FileCheck -check-prefix=INVALID_OPTION %s
-// RUN: not %swift_driver -crazy-option-that-does-not-exist 2>&1 | FileCheck -check-prefix=INVALID_OPTION %s
+// RUN: not %swiftc_driver -crazy-option-that-does-not-exist %s 2>&1 | %FileCheck -check-prefix=INVALID_OPTION %s
+// RUN: not %swift_driver -crazy-option-that-does-not-exist 2>&1 | %FileCheck -check-prefix=INVALID_OPTION %s
 // INVALID_OPTION: error: unknown argument: '-crazy-option-that-does-not-exist'
 
-// RUN: %swiftc_driver -assert-config Debug -### %s | FileCheck -check-prefix=ASSERTCONFIG %s
-// RUN: %swift_driver -assert-config Debug -### | FileCheck -check-prefix=ASSERTCONFIG %s
+// RUN: %swiftc_driver -assert-config Debug -### %s | %FileCheck -check-prefix=ASSERTCONFIG %s
+// RUN: %swift_driver -assert-config Debug -### | %FileCheck -check-prefix=ASSERTCONFIG %s
 // ASSERTCONFIG: -assert-config Debug
 
-// RUN: %swiftc_driver -assert-config Release -### %s | FileCheck -check-prefix=ASSERTCONFIG_RELEASE %s
-// RUN: %swift_driver -assert-config Release -### %s | FileCheck -check-prefix=ASSERTCONFIG_RELEASE %s
+// RUN: %swiftc_driver -assert-config Release -### %s | %FileCheck -check-prefix=ASSERTCONFIG_RELEASE %s
+// RUN: %swift_driver -assert-config Release -### %s | %FileCheck -check-prefix=ASSERTCONFIG_RELEASE %s
 // ASSERTCONFIG_RELEASE: -assert-config Release
 
-// RUN: %swiftc_driver -assert-config Unchecked -### %s | FileCheck -check-prefix=ASSERTCONFIG_UNCHECKED %s
-// RUN: %swift_driver -assert-config Unchecked -### %s | FileCheck -check-prefix=ASSERTCONFIG_UNCHECKED %s
+// RUN: %swiftc_driver -assert-config Unchecked -### %s | %FileCheck -check-prefix=ASSERTCONFIG_UNCHECKED %s
+// RUN: %swift_driver -assert-config Unchecked -### %s | %FileCheck -check-prefix=ASSERTCONFIG_UNCHECKED %s
 // ASSERTCONFIG_UNCHECKED: -assert-config Unchecked
 
-// RUN: %swiftc_driver -assert-config DisableReplacement -### %s | FileCheck -check-prefix=ASSERTCONFIG_DISABLEREPLACEMENT %s
-// RUN: %swift_driver -assert-config DisableReplacement -### %s | FileCheck -check-prefix=ASSERTCONFIG_DISABLEREPLACEMENT %s
+// RUN: %swiftc_driver -assert-config DisableReplacement -### %s | %FileCheck -check-prefix=ASSERTCONFIG_DISABLEREPLACEMENT %s
+// RUN: %swift_driver -assert-config DisableReplacement -### %s | %FileCheck -check-prefix=ASSERTCONFIG_DISABLEREPLACEMENT %s
 // ASSERTCONFIG_DISABLEREPLACEMENT: -assert-config DisableReplacement
 
-// RUN: not %swiftc_driver -import-objc-header fake.h -import-underlying-module -c %s 2>&1 | FileCheck -check-prefix=FRAMEWORK_BRIDGING_HEADER %s
+// RUN: not %swiftc_driver -import-objc-header fake.h -import-underlying-module -c %s 2>&1 | %FileCheck -check-prefix=FRAMEWORK_BRIDGING_HEADER %s
 // FRAMEWORK_BRIDGING_HEADER: error: using bridging headers with framework targets is unsupported
 
-// RUN: %swift_driver -### | FileCheck -check-prefix=DEFAULT_REPL %s
+// RUN: %swift_driver -### | %FileCheck -check-prefix=DEFAULT_REPL %s
 // DEFAULT_REPL: -repl
-// RUN: not %swiftc_driver 2>&1 | FileCheck -check-prefix=DEFAULT_EXEC_ERR  %s
+// RUN: not %swiftc_driver 2>&1 | %FileCheck -check-prefix=DEFAULT_EXEC_ERR  %s
 // DEFAULT_EXEC_ERR: error: no input files
-// RUN: %swiftc_driver %s -### 2>&1 | FileCheck -check-prefix=DEFAULT_EXEC  %s
+// RUN: %swiftc_driver %s -### 2>&1 | %FileCheck -check-prefix=DEFAULT_EXEC  %s
 // DEFAULT_EXEC: -c
 // DEFAULT_EXEC: ld
 
-// RUN: %swift_driver -repl -### 2>&1 | FileCheck -check-prefix=REPL %s
+// RUN: %swift_driver -repl -### 2>&1 | %FileCheck -check-prefix=REPL %s
 // REPL: warning: unnecessary option '-repl'
 
-// RUN: %swift_driver -lldb-repl -### 2>&1 | FileCheck -check-prefix=LLDB_REPL %s
+// RUN: %swift_driver -lldb-repl -### 2>&1 | %FileCheck -check-prefix=LLDB_REPL %s
 // LLDB_REPL-NOT: warning
 // LLDB_REPL: lldb
 // LLDB_REPL-NOT: warning
 
-// RUN: %swift_driver -deprecated-integrated-repl -### 2>&1 | FileCheck -check-prefix=INTEGRATED_REPL %s
+// RUN: %swift_driver -deprecated-integrated-repl -### 2>&1 | %FileCheck -check-prefix=INTEGRATED_REPL %s
 // INTEGRATED_REPL-NOT: warning
 // INTEGRATED_REPL: -repl
 // INTEGRATED_REPL-NOT: warning
 
-// RUN: %swift_driver -### %s | FileCheck -check-prefix=DEFAULT_I %s
+// RUN: %swift_driver -### %s | %FileCheck -check-prefix=DEFAULT_I %s
 // DEFAULT_I: -interpret
 
-// RUN: not %swift_driver -### -i %s 2>&1 | FileCheck -check-prefix=I_MODE %s
-// RUN: not %swift_driver -### -i 2>&1 | FileCheck -check-prefix=I_MODE %s
-// RUN: not %swiftc_driver -### -i %s 2>&1 | FileCheck -check-prefix=I_MODE %s
-// RUN: not %swiftc_driver -### -i 2>&1 | FileCheck -check-prefix=I_MODE %s
+// RUN: not %swift_driver -### -i %s 2>&1 | %FileCheck -check-prefix=I_MODE %s
+// RUN: not %swift_driver -### -i 2>&1 | %FileCheck -check-prefix=I_MODE %s
+// RUN: not %swiftc_driver -### -i %s 2>&1 | %FileCheck -check-prefix=I_MODE %s
+// RUN: not %swiftc_driver -### -i 2>&1 | %FileCheck -check-prefix=I_MODE %s
 // I_MODE: error: the flag '-i' is no longer required and has been removed; use 'swift input-filename'
 
-// RUN: not %swift_driver -### -c %s 2>&1 | FileCheck -check-prefix=C_MODE %s
+// RUN: not %swift_driver -### -c %s 2>&1 | %FileCheck -check-prefix=C_MODE %s
 // C_MODE: error: unsupported option '-c'
-// RUN: not %swift_driver -### -emit-object %s 2>&1 | FileCheck -check-prefix=OBJ_MODE %s
+// RUN: not %swift_driver -### -emit-object %s 2>&1 | %FileCheck -check-prefix=OBJ_MODE %s
 // OBJ_MODE: error: unsupported option '-emit-object'
-// RUN: not %swift_driver -### -emit-executable %s 2>&1 | FileCheck -check-prefix=EXEC_MODE %s
+// RUN: not %swift_driver -### -emit-executable %s 2>&1 | %FileCheck -check-prefix=EXEC_MODE %s
 // EXEC_MODE: error: unsupported option '-emit-executable'
-// RUN: not %swift_driver -### -o %t %s 2>&1 | FileCheck -check-prefix=ARG_o %s
+// RUN: not %swift_driver -### -o %t %s 2>&1 | %FileCheck -check-prefix=ARG_o %s
 // ARG_o: error: unsupported option '-o'
 
-// RUN: not %swiftc_driver -### -repl 2>&1 | FileCheck -check-prefix=REPL_MODE_SWIFTC %s
+// RUN: not %swiftc_driver -### -repl 2>&1 | %FileCheck -check-prefix=REPL_MODE_SWIFTC %s
 // REPL_MODE_SWIFTC: error: unsupported option '-repl'
-// RUN: not %swiftc_driver -### -lldb-repl 2>&1 | FileCheck -check-prefix=LLDB_REPL_MODE_SWIFTC %s
+// RUN: not %swiftc_driver -### -lldb-repl 2>&1 | %FileCheck -check-prefix=LLDB_REPL_MODE_SWIFTC %s
 // LLDB_REPL_MODE_SWIFTC: error: unsupported option '-lldb-repl'
-// RUN: not %swiftc_driver -### -deprecated-integrated-repl 2>&1 | FileCheck -check-prefix=INT_REPL_MODE_SWIFTC %s
+// RUN: not %swiftc_driver -### -deprecated-integrated-repl 2>&1 | %FileCheck -check-prefix=INT_REPL_MODE_SWIFTC %s
 // INT_REPL_MODE_SWIFTC: error: unsupported option '-deprecated-integrated-repl'
 
-// RUN: %swift_driver -g -### %s 2>&1 | FileCheck -check-prefix=OPTIONS_BEFORE_FILE %s
+// RUN: %swift_driver -g -### %s 2>&1 | %FileCheck -check-prefix=OPTIONS_BEFORE_FILE %s
 // OPTIONS_BEFORE_FILE: -g
 
-// RUN: not %swift_driver -target abc -### %s 2>&1 | FileCheck -check-prefix=BAD_TARGET %s
+// RUN: not %swift_driver -target abc -### %s 2>&1 | %FileCheck -check-prefix=BAD_TARGET %s
 // BAD_TARGET: error: unknown target 'abc'
 
-// RUN: %swiftc_driver -incremental %s -### 2>&1 | FileCheck -check-prefix=INCREMENTAL_WITHOUT_OFM %s
+// RUN: %swiftc_driver -incremental %s -### 2>&1 | %FileCheck -check-prefix=INCREMENTAL_WITHOUT_OFM %s
 // INCREMENTAL_WITHOUT_OFM: warning: ignoring -incremental (currently requires an output file map)
 // INCREMENTAL_WITHOUT_OFM: swift -frontend
 
-// RUN: %swiftc_driver -incremental -output-file-map %S/Inputs/empty-ofm.json %s -### 2>&1 | FileCheck -check-prefix=INCREMENTAL_WITHOUT_OFM_ENTRY %s
+// RUN: %swiftc_driver -incremental -output-file-map %S/Inputs/empty-ofm.json %s -### 2>&1 | %FileCheck -check-prefix=INCREMENTAL_WITHOUT_OFM_ENTRY %s
 // INCREMENTAL_WITHOUT_OFM_ENTRY: ignoring -incremental; output file map has no master dependencies entry ("swift-dependencies" under "")
 // INCREMENTAL_WITHOUT_OFM_ENTRY: swift -frontend
diff --git a/test/Driver/os-deployment.swift b/test/Driver/os-deployment.swift
index 4e97f69..7fd106d 100644
--- a/test/Driver/os-deployment.swift
+++ b/test/Driver/os-deployment.swift
@@ -1,7 +1,7 @@
-// RUN: not %swiftc_driver -target x86_64-apple-macosx10.8 %s 2>&1 | FileCheck --check-prefix=CHECK-OSX %s
-// RUN: not %swiftc_driver -target x86_64-apple-ios6.0 %s 2>&1 | FileCheck --check-prefix=CHECK-IOS %s
-// RUN: not %swiftc_driver -target x86_64-apple-tvos8.0 %s 2>&1 | FileCheck --check-prefix=CHECK-tvOS %s
-// RUN: not %swiftc_driver -target x86_64-apple-watchos1.0 %s 2>&1 | FileCheck --check-prefix=CHECK-watchOS %s
+// RUN: not %swiftc_driver -target x86_64-apple-macosx10.8 %s 2>&1 | %FileCheck --check-prefix=CHECK-OSX %s
+// RUN: not %swiftc_driver -target x86_64-apple-ios6.0 %s 2>&1 | %FileCheck --check-prefix=CHECK-IOS %s
+// RUN: not %swiftc_driver -target x86_64-apple-tvos8.0 %s 2>&1 | %FileCheck --check-prefix=CHECK-tvOS %s
+// RUN: not %swiftc_driver -target x86_64-apple-watchos1.0 %s 2>&1 | %FileCheck --check-prefix=CHECK-watchOS %s
 
 
 // CHECK-OSX: Swift requires a minimum deployment target of OS X 10.9
diff --git a/test/Driver/output.swift b/test/Driver/output.swift
index 5bd8894..8156441 100644
--- a/test/Driver/output.swift
+++ b/test/Driver/output.swift
@@ -11,8 +11,8 @@
 // RUN: %target-swift-frontend -emit-bc %s -o %t/explicit2.llvmbc -module-name explicit2
 // RUN: echo | %target-swift-frontend -emit-bc - -o %t/sub -module-name stdin
 
-// RUN: ls -1 %t | FileCheck %s
-// RUN: ls -1 %t/sub/ | FileCheck %s -check-prefix=SUB
+// RUN: ls -1 %t | %FileCheck %s
+// RUN: ls -1 %t/sub/ | %FileCheck %s -check-prefix=SUB
 
 // CHECK: explicit.bc
 // CHECK-NEXT: explicit.llvmbc
diff --git a/test/Driver/parseable_output.swift b/test/Driver/parseable_output.swift
index 842be0c..37c6e57 100644
--- a/test/Driver/parseable_output.swift
+++ b/test/Driver/parseable_output.swift
@@ -1,4 +1,4 @@
-// RUN: %swiftc_driver_plain -emit-executable %s -o %t.out -emit-module -emit-module-path %t.swiftmodule -emit-objc-header-path %t.h -serialize-diagnostics -emit-dependencies -parseable-output -driver-skip-execution 2>&1 | FileCheck %s
+// RUN: %swiftc_driver_plain -emit-executable %s -o %t.out -emit-module -emit-module-path %t.swiftmodule -emit-objc-header-path %t.h -serialize-diagnostics -emit-dependencies -parseable-output -driver-skip-execution 2>&1 | %FileCheck %s
 
 // XFAIL: freebsd, linux
 
diff --git a/test/Driver/parseable_output_unicode.swift b/test/Driver/parseable_output_unicode.swift
index aef49fe..8445518 100644
--- a/test/Driver/parseable_output_unicode.swift
+++ b/test/Driver/parseable_output_unicode.swift
@@ -1,4 +1,4 @@
-// RUN: %swiftc_driver_plain -emit-executable "%S/Inputs/你好.swift" -o %t.out -emit-module -emit-module-path %t.swiftmodule -emit-objc-header-path %t.h -serialize-diagnostics -emit-dependencies -parseable-output -driver-skip-execution 2>&1 | FileCheck %s
+// RUN: %swiftc_driver_plain -emit-executable "%S/Inputs/你好.swift" -o %t.out -emit-module -emit-module-path %t.swiftmodule -emit-objc-header-path %t.h -serialize-diagnostics -emit-dependencies -parseable-output -driver-skip-execution 2>&1 | %FileCheck %s
 
 // XFAIL: freebsd, linux
 
diff --git a/test/Driver/profiling.swift b/test/Driver/profiling.swift
index c7e24ee..ccf6aa0 100644
--- a/test/Driver/profiling.swift
+++ b/test/Driver/profiling.swift
@@ -1,23 +1,23 @@
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-macosx10.9 %s | FileCheck -check-prefix=CHECK -check-prefix=OSX %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-macosx10.9 %s | %FileCheck -check-prefix=CHECK -check-prefix=OSX %s
 
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-ios7.1 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=IOS %s
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target arm64-apple-ios7.1 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=IOS %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-ios7.1 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=IOS %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target arm64-apple-ios7.1 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=IOS %s
 
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-ios7.1 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=IOSSIM %s
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target arm64-apple-ios7.1 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=IOS %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-ios7.1 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=IOSSIM %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target arm64-apple-ios7.1 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=IOS %s
 
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-tvos9.0 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=tvOS %s
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target arm64-apple-tvos9.0 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=tvOS %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-tvos9.0 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=tvOS %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target arm64-apple-tvos9.0 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=tvOS %s
 
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-tvos9.0 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=tvOS_SIM %s
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target arm64-apple-tvos9.0 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=tvOS %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-apple-tvos9.0 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=tvOS_SIM %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target arm64-apple-tvos9.0 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=tvOS %s
 
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target i386-apple-watchos2.0 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=watchOS %s
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target armv7k-apple-watchos2.0 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=watchOS %s
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target i386-apple-watchos2.0 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=watchOS_SIM %s
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target armv7k-apple-watchos2.0 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | FileCheck -check-prefix=CHECK -check-prefix=watchOS %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target i386-apple-watchos2.0 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=watchOS %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target armv7k-apple-watchos2.0 -resource-dir %S/Inputs/fake-resource-dir-old/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=watchOS %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target i386-apple-watchos2.0 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=watchOS_SIM %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target armv7k-apple-watchos2.0 -resource-dir %S/Inputs/fake-resource-dir/lib/swift/ %s | %FileCheck -check-prefix=CHECK -check-prefix=watchOS %s
 
-// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-unknown-linux-gnu %s | FileCheck -check-prefix=CHECK -check-prefix=LINUX %s
+// RUN: %swiftc_driver -driver-print-jobs -profile-generate -target x86_64-unknown-linux-gnu %s | %FileCheck -check-prefix=CHECK -check-prefix=LINUX %s
 
 // CHECK: swift
 // CHECK: -profile-generate
diff --git a/test/Driver/sanitize_coverage.swift b/test/Driver/sanitize_coverage.swift
index 623c19b..efcccc2 100644
--- a/test/Driver/sanitize_coverage.swift
+++ b/test/Driver/sanitize_coverage.swift
@@ -1,21 +1,21 @@
 // XFAIL: linux
 // Different sanitizer coverage types
-// RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=func -sanitize=address %s | FileCheck -check-prefix=SANCOV_FUNC %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=bb -sanitize=address %s | FileCheck -check-prefix=SANCOV_BB %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=edge -sanitize=address %s | FileCheck -check-prefix=SANCOV_EDGE %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=func -sanitize=address %s | %FileCheck -check-prefix=SANCOV_FUNC %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=bb -sanitize=address %s | %FileCheck -check-prefix=SANCOV_BB %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=edge -sanitize=address %s | %FileCheck -check-prefix=SANCOV_EDGE %s
 
 // Try some options
-// RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=edge,indirect-calls,trace-bb,trace-cmp,8bit-counters  -sanitize=address %s | FileCheck -check-prefix=SANCOV_EDGE_WITH_OPTIONS %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=edge,indirect-calls,trace-bb,trace-cmp,8bit-counters  -sanitize=address %s | %FileCheck -check-prefix=SANCOV_EDGE_WITH_OPTIONS %s
 
 // Invalid command line arguments
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize-coverage=func %s 2>&1 | FileCheck -check-prefix=SANCOV_WITHOUT_XSAN %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize-coverage=bb %s 2>&1 | FileCheck -check-prefix=SANCOV_WITHOUT_XSAN %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize-coverage=edge %s 2>&1 | FileCheck -check-prefix=SANCOV_WITHOUT_XSAN %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=unknown %s 2>&1 | FileCheck -check-prefix=SANCOV_BAD_ARG %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=indirect-calls %s 2>&1 | FileCheck -check-prefix=SANCOV_MISSING_ARG %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=trace-bb %s 2>&1 | FileCheck -check-prefix=SANCOV_MISSING_ARG %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=trace-cmp %s 2>&1 | FileCheck -check-prefix=SANCOV_MISSING_ARG %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=8bit-counters %s 2>&1 | FileCheck -check-prefix=SANCOV_MISSING_ARG %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize-coverage=func %s 2>&1 | %FileCheck -check-prefix=SANCOV_WITHOUT_XSAN %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize-coverage=bb %s 2>&1 | %FileCheck -check-prefix=SANCOV_WITHOUT_XSAN %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize-coverage=edge %s 2>&1 | %FileCheck -check-prefix=SANCOV_WITHOUT_XSAN %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=unknown %s 2>&1 | %FileCheck -check-prefix=SANCOV_BAD_ARG %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=indirect-calls %s 2>&1 | %FileCheck -check-prefix=SANCOV_MISSING_ARG %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=trace-bb %s 2>&1 | %FileCheck -check-prefix=SANCOV_MISSING_ARG %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=trace-cmp %s 2>&1 | %FileCheck -check-prefix=SANCOV_MISSING_ARG %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=8bit-counters %s 2>&1 | %FileCheck -check-prefix=SANCOV_MISSING_ARG %s
 
 // SANCOV_FUNC: swift
 // SANCOV_FUNC-DAG: -sanitize-coverage=func
diff --git a/test/Driver/sanitizers.swift b/test/Driver/sanitizers.swift
index 8776efd..ecddad7 100644
--- a/test/Driver/sanitizers.swift
+++ b/test/Driver/sanitizers.swift
@@ -1,25 +1,25 @@
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-macosx10.9 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_OSX %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-ios7.1 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_IOSSIM %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target arm64-apple-ios7.1 %s  | FileCheck -check-prefix=ASAN -check-prefix=ASAN_IOS %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-tvos9.0 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_tvOS_SIM %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target arm64-apple-tvos9.0 %s  | FileCheck -check-prefix=ASAN -check-prefix=ASAN_tvOS %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target i386-apple-watchos2.0 %s   | FileCheck -check-prefix=ASAN -check-prefix=ASAN_watchOS_SIM %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target armv7k-apple-watchos2.0 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_watchOS %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-unknown-linux-gnu %s 2>&1 | FileCheck -check-prefix=ASAN_LINUX %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-macosx10.9 %s | %FileCheck -check-prefix=ASAN -check-prefix=ASAN_OSX %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-ios7.1 %s | %FileCheck -check-prefix=ASAN -check-prefix=ASAN_IOSSIM %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target arm64-apple-ios7.1 %s  | %FileCheck -check-prefix=ASAN -check-prefix=ASAN_IOS %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-tvos9.0 %s | %FileCheck -check-prefix=ASAN -check-prefix=ASAN_tvOS_SIM %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target arm64-apple-tvos9.0 %s  | %FileCheck -check-prefix=ASAN -check-prefix=ASAN_tvOS %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target i386-apple-watchos2.0 %s   | %FileCheck -check-prefix=ASAN -check-prefix=ASAN_watchOS_SIM %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target armv7k-apple-watchos2.0 %s | %FileCheck -check-prefix=ASAN -check-prefix=ASAN_watchOS %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-unknown-linux-gnu %s 2>&1 | %FileCheck -check-prefix=ASAN_LINUX %s
 
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-apple-macosx10.9 %s | FileCheck -check-prefix=TSAN -check-prefix=TSAN_OSX %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target x86-apple-macosx10.9 %s 2>&1 | FileCheck -check-prefix=TSAN_OSX_32 %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-apple-ios7.1 %s | FileCheck -check-prefix=TSAN -check-prefix=TSAN_IOSSIM %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target arm64-apple-ios7.1 %s 2>&1 | FileCheck -check-prefix=TSAN_IOS %s
-// RUN: %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-apple-tvos9.0 %s | FileCheck -check-prefix=TSAN -check-prefix=TSAN_tvOS_SIM %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target arm64-apple-tvos9.0 %s 2>&1 | FileCheck -check-prefix=TSAN_tvOS %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target i386-apple-watchos2.0 %s 2>&1 | FileCheck -check-prefix=TSAN_watchOS_SIM %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target armv7k-apple-watchos2.0 %s 2>&1  | FileCheck -check-prefix=TSAN_watchOS %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-unknown-linux-gnu %s 2>&1 | FileCheck -check-prefix=TSAN_LINUX %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-apple-macosx10.9 %s | %FileCheck -check-prefix=TSAN -check-prefix=TSAN_OSX %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target x86-apple-macosx10.9 %s 2>&1 | %FileCheck -check-prefix=TSAN_OSX_32 %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-apple-ios7.1 %s | %FileCheck -check-prefix=TSAN -check-prefix=TSAN_IOSSIM %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target arm64-apple-ios7.1 %s 2>&1 | %FileCheck -check-prefix=TSAN_IOS %s
+// RUN: %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-apple-tvos9.0 %s | %FileCheck -check-prefix=TSAN -check-prefix=TSAN_tvOS_SIM %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target arm64-apple-tvos9.0 %s 2>&1 | %FileCheck -check-prefix=TSAN_tvOS %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target i386-apple-watchos2.0 %s 2>&1 | %FileCheck -check-prefix=TSAN_watchOS_SIM %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target armv7k-apple-watchos2.0 %s 2>&1  | %FileCheck -check-prefix=TSAN_watchOS %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-unknown-linux-gnu %s 2>&1 | %FileCheck -check-prefix=TSAN_LINUX %s
 
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address,unknown %s 2>&1 | FileCheck -check-prefix=BADARG %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize=unknown %s 2>&1 | FileCheck -check-prefix=BADARG %s
-// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address,thread %s 2>&1 | FileCheck -check-prefix=INCOMPATIBLESANITIZERS %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address,unknown %s 2>&1 | %FileCheck -check-prefix=BADARG %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize=unknown %s 2>&1 | %FileCheck -check-prefix=BADARG %s
+// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address,thread %s 2>&1 | %FileCheck -check-prefix=INCOMPATIBLESANITIZERS %s
 
 // ASAN: swift
 // ASAN: -sanitize=address
diff --git a/test/Driver/sdk-apple.swift b/test/Driver/sdk-apple.swift
index c4c67dc..6100cf2 100644
--- a/test/Driver/sdk-apple.swift
+++ b/test/Driver/sdk-apple.swift
@@ -4,70 +4,70 @@
 // RUN: rm -rf %t && mkdir -p %t/usr/bin/
 
 // RUN: cp %S/Inputs/xcrun-bad.sh %t/usr/bin/xcrun
-// RUN: env PATH=%t/usr/bin %swift_driver_plain -deprecated-integrated-repl -### | FileCheck -check-prefix=NOSDK %s
-// RUN: env PATH=%t/usr/bin %swift_driver_plain -### %s | FileCheck -check-prefix=NOSDK %s
+// RUN: env PATH=%t/usr/bin %swift_driver_plain -deprecated-integrated-repl -### | %FileCheck -check-prefix=NOSDK %s
+// RUN: env PATH=%t/usr/bin %swift_driver_plain -### %s | %FileCheck -check-prefix=NOSDK %s
 
 // NOSDK-NOT: -sdk
 
 // RUN: cp %S/Inputs/xcrun.sh %t/usr/bin/xcrun
-// RUN: env PATH=%t/usr/bin %swift_driver_plain -deprecated-integrated-repl -### | FileCheck -check-prefix=XCRUN-SDK %s
-// RUN: env PATH=%t/usr/bin %swift_driver_plain -### %s | FileCheck -check-prefix=XCRUN-SDK %s
+// RUN: env PATH=%t/usr/bin %swift_driver_plain -deprecated-integrated-repl -### | %FileCheck -check-prefix=XCRUN-SDK %s
+// RUN: env PATH=%t/usr/bin %swift_driver_plain -### %s | %FileCheck -check-prefix=XCRUN-SDK %s
 
 // XCRUN-SDK: -sdk /path/to/sdk
 
 // RUN: cp %S/Inputs/xcrun-empty.sh %t/usr/bin/xcrun
-// RUN: env PATH=%t/usr/bin %swift_driver_plain -deprecated-integrated-repl -### | FileCheck -check-prefix=ROOT-SDK %s
-// RUN: env PATH=%t/usr/bin %swift_driver_plain -### %s | FileCheck -check-prefix=ROOT-SDK %s
+// RUN: env PATH=%t/usr/bin %swift_driver_plain -deprecated-integrated-repl -### | %FileCheck -check-prefix=ROOT-SDK %s
+// RUN: env PATH=%t/usr/bin %swift_driver_plain -### %s | %FileCheck -check-prefix=ROOT-SDK %s
 
 // ROOT-SDK: -sdk /{{ |$}}
 
 // RUN: rm -rf %t && mkdir %t
-// RUN: mkdir %t/MacOSX10.8.sdk && not %swift_driver -sdk %t/MacOSX10.8.sdk -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/MacOSX10.9.sdk && not %swift_driver -sdk %t/MacOSX10.9.sdk -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/MacOSX10.9.Internal.sdk && not %swift_driver -sdk %t/MacOSX10.9.Internal.sdk -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/MacOSX10.10.sdk && not %swift_driver -sdk %t/MacOSX10.10.sdk -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/MacOSX10.10.Internal.sdk && not %swift_driver -sdk %t/MacOSX10.10.Internal.sdk -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/MacOSX10.11.sdk && not %swift_driver -sdk %t/MacOSX10.11.sdk -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/MacOSX10.11.Internal.sdk && not %swift_driver -sdk %t/MacOSX10.11.Internal.sdk -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/MacOSX10.12.sdk && %swift_driver -sdk %t/MacOSX10.12.sdk -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
-// RUN: mkdir %t/OSX12.sdk && %swift_driver -sdk %t/OSX12.sdk -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
+// RUN: mkdir %t/MacOSX10.8.sdk && not %swift_driver -sdk %t/MacOSX10.8.sdk -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/MacOSX10.9.sdk && not %swift_driver -sdk %t/MacOSX10.9.sdk -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/MacOSX10.9.Internal.sdk && not %swift_driver -sdk %t/MacOSX10.9.Internal.sdk -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/MacOSX10.10.sdk && not %swift_driver -sdk %t/MacOSX10.10.sdk -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/MacOSX10.10.Internal.sdk && not %swift_driver -sdk %t/MacOSX10.10.Internal.sdk -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/MacOSX10.11.sdk && not %swift_driver -sdk %t/MacOSX10.11.sdk -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/MacOSX10.11.Internal.sdk && not %swift_driver -sdk %t/MacOSX10.11.Internal.sdk -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/MacOSX10.12.sdk && %swift_driver -sdk %t/MacOSX10.12.sdk -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
+// RUN: mkdir %t/OSX12.sdk && %swift_driver -sdk %t/OSX12.sdk -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
 
-// RUN: not %swift_driver -sdk %t/MacOSX10.9.sdk/ -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: not %swift_driver -sdk %t/MacOSX10.9.Internal.sdk/ -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: not %swift_driver -sdk %t/MacOSX10.10.sdk/ -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: not %swift_driver -sdk %t/MacOSX10.10.Internal.sdk/ -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: not %swift_driver -sdk %t/MacOSX10.11.sdk/ -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: not %swift_driver -sdk %t/MacOSX10.11.Internal.sdk/ -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: %swift_driver -sdk %t/MacOSX10.12.sdk/ -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
-// RUN: %swift_driver -sdk %t/MacOSX10.12.Internal.sdk/ -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
+// RUN: not %swift_driver -sdk %t/MacOSX10.9.sdk/ -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: not %swift_driver -sdk %t/MacOSX10.9.Internal.sdk/ -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: not %swift_driver -sdk %t/MacOSX10.10.sdk/ -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: not %swift_driver -sdk %t/MacOSX10.10.Internal.sdk/ -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: not %swift_driver -sdk %t/MacOSX10.11.sdk/ -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: not %swift_driver -sdk %t/MacOSX10.11.Internal.sdk/ -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: %swift_driver -sdk %t/MacOSX10.12.sdk/ -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
+// RUN: %swift_driver -sdk %t/MacOSX10.12.Internal.sdk/ -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
 
-// RUN: mkdir %t/iPhoneOS7.0.sdk && not %swift_driver -sdk %t/iPhoneOS7.0.sdk -target x86_64-apple-ios7 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/iPhoneOS7.0.Internal.sdk && not %swift_driver -sdk %t/iPhoneOS7.0.Internal.sdk -target x86_64-apple-ios7 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/iPhoneOS8.0.sdk && not %swift_driver -sdk %t/iPhoneOS8.0.sdk -target x86_64-apple-ios7 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/iPhoneOS8.0.Internal.sdk && not %swift_driver -sdk %t/iPhoneOS8.0.Internal.sdk -target x86_64-apple-ios7 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/iPhoneOS9.0.sdk && not %swift_driver -sdk %t/iPhoneOS9.0.sdk -target x86_64-apple-ios7 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/iPhoneOS10.0.sdk && %swift_driver -sdk %t/iPhoneOS10.0.sdk -target x86_64-apple-ios7 -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
+// RUN: mkdir %t/iPhoneOS7.0.sdk && not %swift_driver -sdk %t/iPhoneOS7.0.sdk -target x86_64-apple-ios7 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/iPhoneOS7.0.Internal.sdk && not %swift_driver -sdk %t/iPhoneOS7.0.Internal.sdk -target x86_64-apple-ios7 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/iPhoneOS8.0.sdk && not %swift_driver -sdk %t/iPhoneOS8.0.sdk -target x86_64-apple-ios7 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/iPhoneOS8.0.Internal.sdk && not %swift_driver -sdk %t/iPhoneOS8.0.Internal.sdk -target x86_64-apple-ios7 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/iPhoneOS9.0.sdk && not %swift_driver -sdk %t/iPhoneOS9.0.sdk -target x86_64-apple-ios7 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/iPhoneOS10.0.sdk && %swift_driver -sdk %t/iPhoneOS10.0.sdk -target x86_64-apple-ios7 -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
 
-// RUN: mkdir %t/tvOS8.0.sdk && not %swift_driver -sdk %t/tvOS8.0.sdk -target x86_64-apple-tvos9 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/tvOS8.0.Internal.sdk && not %swift_driver -sdk %t/tvOS8.0.Internal.sdk -target x86_64-apple-tvos9 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/tvOS9.0.sdk && not %swift_driver -sdk %t/tvOS9.0.sdk -target x86_64-apple-tvos9 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/tvOS10.0.sdk && %swift_driver -sdk %t/tvOS10.0.sdk -target x86_64-apple-tvos9 -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
+// RUN: mkdir %t/tvOS8.0.sdk && not %swift_driver -sdk %t/tvOS8.0.sdk -target x86_64-apple-tvos9 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/tvOS8.0.Internal.sdk && not %swift_driver -sdk %t/tvOS8.0.Internal.sdk -target x86_64-apple-tvos9 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/tvOS9.0.sdk && not %swift_driver -sdk %t/tvOS9.0.sdk -target x86_64-apple-tvos9 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/tvOS10.0.sdk && %swift_driver -sdk %t/tvOS10.0.sdk -target x86_64-apple-tvos9 -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
 
-// RUN: mkdir %t/watchOS1.0.sdk && not %swift_driver -sdk %t/watchOS1.0.sdk -target x86_64-apple-watchos2 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/watchOS1.0.Internal.sdk && not %swift_driver -sdk %t/watchOS1.0.Internal.sdk -target x86_64-apple-watchos2 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/watchOS2.0.sdk && not %swift_driver -sdk %t/watchOS2.0.sdk -target x86_64-apple-watchos2 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/watchOS3.0.sdk && %swift_driver -sdk %t/watchOS3.0.sdk -target x86_64-apple-watchos2 -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
+// RUN: mkdir %t/watchOS1.0.sdk && not %swift_driver -sdk %t/watchOS1.0.sdk -target x86_64-apple-watchos2 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/watchOS1.0.Internal.sdk && not %swift_driver -sdk %t/watchOS1.0.Internal.sdk -target x86_64-apple-watchos2 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/watchOS2.0.sdk && not %swift_driver -sdk %t/watchOS2.0.sdk -target x86_64-apple-watchos2 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/watchOS3.0.sdk && %swift_driver -sdk %t/watchOS3.0.sdk -target x86_64-apple-watchos2 -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
 
-// RUN: mkdir %t/iPhoneSimulator7.0.sdk && not %swift_driver -sdk %t/iPhoneSimulator7.0.sdk -target x86_64-apple-ios7 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/iPhoneSimulator8.0.sdk && not %swift_driver -sdk %t/iPhoneSimulator8.0.sdk -target x86_64-apple-ios7 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/AppleTVSimulator8.0.sdk && not %swift_driver -sdk %t/AppleTVSimulator8.0.sdk -target x86_64-apple-tvos9 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
-// RUN: mkdir %t/WatchSimulator1.0.sdk && not %swift_driver -sdk %t/WatchSimulator1.0.sdk -target i386-apple-watchos2 -### 2>&1 | FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/iPhoneSimulator7.0.sdk && not %swift_driver -sdk %t/iPhoneSimulator7.0.sdk -target x86_64-apple-ios7 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/iPhoneSimulator8.0.sdk && not %swift_driver -sdk %t/iPhoneSimulator8.0.sdk -target x86_64-apple-ios7 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/AppleTVSimulator8.0.sdk && not %swift_driver -sdk %t/AppleTVSimulator8.0.sdk -target x86_64-apple-tvos9 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
+// RUN: mkdir %t/WatchSimulator1.0.sdk && not %swift_driver -sdk %t/WatchSimulator1.0.sdk -target i386-apple-watchos2 -### 2>&1 | %FileCheck -check-prefix=SDK-TOO-OLD %s
 
-// RUN: mkdir %t/iPhoneOS.sdk && %swift_driver -sdk %t/iPhoneOS.sdk -target x86_64-apple-ios7 -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
-// RUN: mkdir %t/tvOS.sdk && %swift_driver -sdk %t/tvOS.sdk -target x86_64-apple-tvos9 -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
-// RUN: mkdir %t/watchOS.sdk && %swift_driver -sdk %t/watchOS.sdk -target x86_64-apple-watchos2 -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
+// RUN: mkdir %t/iPhoneOS.sdk && %swift_driver -sdk %t/iPhoneOS.sdk -target x86_64-apple-ios7 -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
+// RUN: mkdir %t/tvOS.sdk && %swift_driver -sdk %t/tvOS.sdk -target x86_64-apple-tvos9 -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
+// RUN: mkdir %t/watchOS.sdk && %swift_driver -sdk %t/watchOS.sdk -target x86_64-apple-watchos2 -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
 
-// RUN: mkdir %t/custom-sdk && %swift_driver -sdk %t/custom-sdk -### 2>&1 | FileCheck -check-prefix=SDK-OKAY %s
+// RUN: mkdir %t/custom-sdk && %swift_driver -sdk %t/custom-sdk -### 2>&1 | %FileCheck -check-prefix=SDK-OKAY %s
 
 // SDK-TOO-OLD: error: Swift does not support the SDK '{{.+}}.sdk'{{$}}
 // SDK-OKAY: -sdk {{.*}}/{{[^/ ]+}}sdk
diff --git a/test/Driver/sdk-link.swift b/test/Driver/sdk-link.swift
index a3b1cbd..d568fed 100644
--- a/test/Driver/sdk-link.swift
+++ b/test/Driver/sdk-link.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t/test.swiftmodule %s
 // RUN: %target-build-swift -g -o %t/sdk-link %s
-// RUN: %target-run %t/sdk-link | FileCheck %s
+// RUN: %target-run %t/sdk-link | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Driver/sdk.swift b/test/Driver/sdk.swift
index 7c54a4f..64e11d2 100644
--- a/test/Driver/sdk.swift
+++ b/test/Driver/sdk.swift
@@ -1,10 +1,10 @@
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9  -g -sdk %S/../Inputs/clang-importer-sdk %s 2>&1 | FileCheck %s --check-prefix OSX
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-linux-gnu -g -sdk %S/../Inputs/clang-importer-sdk %s 2>&1 | FileCheck %s --check-prefix LINUX 
-// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-freebsd   -g -sdk %S/../Inputs/clang-importer-sdk %s 2>&1 | FileCheck %s --check-prefix FREEBSD
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9  -g -sdk %S/../Inputs/clang-importer-sdk %s 2>&1 | %FileCheck %s --check-prefix OSX
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-linux-gnu -g -sdk %S/../Inputs/clang-importer-sdk %s 2>&1 | %FileCheck %s --check-prefix LINUX 
+// RUN: %swiftc_driver -driver-print-jobs -target x86_64-unknown-freebsd   -g -sdk %S/../Inputs/clang-importer-sdk %s 2>&1 | %FileCheck %s --check-prefix FREEBSD
 
-// RUN: env SDKROOT=%S/../Inputs/clang-importer-sdk %swiftc_driver_plain -target x86_64-apple-macosx10.9  -g -driver-print-jobs %s 2>&1 | FileCheck %s --check-prefix OSX
-// RUN: env SDKROOT=%S/../Inputs/clang-importer-sdk %swiftc_driver_plain -target x86_64-unknown-linux-gnu -g -driver-print-jobs %s 2>&1 | FileCheck %s --check-prefix LINUX
-// RUN: env SDKROOT=%S/../Inputs/clang-importer-sdk %swiftc_driver_plain -target x86_64-unknown-freebsd   -g -driver-print-jobs %s 2>&1 | FileCheck %s --check-prefix FREEBSD
+// RUN: env SDKROOT=%S/../Inputs/clang-importer-sdk %swiftc_driver_plain -target x86_64-apple-macosx10.9  -g -driver-print-jobs %s 2>&1 | %FileCheck %s --check-prefix OSX
+// RUN: env SDKROOT=%S/../Inputs/clang-importer-sdk %swiftc_driver_plain -target x86_64-unknown-linux-gnu -g -driver-print-jobs %s 2>&1 | %FileCheck %s --check-prefix LINUX
+// RUN: env SDKROOT=%S/../Inputs/clang-importer-sdk %swiftc_driver_plain -target x86_64-unknown-freebsd   -g -driver-print-jobs %s 2>&1 | %FileCheck %s --check-prefix FREEBSD
 
 // OSX-NOT: warning: no such SDK:
 // OSX: bin/swift
@@ -35,13 +35,13 @@
 // FREEBSD: {{-syslibroot|--sysroot}} {{.*}}/Inputs/clang-importer-sdk
 // FREEBSD: {{.*}}swift_end.o
 
-// RUN: %swift_driver -driver-print-jobs -repl -sdk %S/Inputs/nonexistent-sdk 2>&1 | FileCheck %s --check-prefix=SDKWARNING
-// RUN: %swift_driver -driver-print-jobs -sdk %S/Inputs/nonexistent-sdk 2>&1 | FileCheck %s --check-prefix=SDKWARNING
-// RUN: env SDKROOT=%S/Inputs/nonexistent-sdk %swift_driver_plain -driver-print-jobs -repl 2>&1 | FileCheck %s --check-prefix=SDKWARNING
+// RUN: %swift_driver -driver-print-jobs -repl -sdk %S/Inputs/nonexistent-sdk 2>&1 | %FileCheck %s --check-prefix=SDKWARNING
+// RUN: %swift_driver -driver-print-jobs -sdk %S/Inputs/nonexistent-sdk 2>&1 | %FileCheck %s --check-prefix=SDKWARNING
+// RUN: env SDKROOT=%S/Inputs/nonexistent-sdk %swift_driver_plain -driver-print-jobs -repl 2>&1 | %FileCheck %s --check-prefix=SDKWARNING
 
 // SDKWARNING: warning: no such SDK: '{{.*}}/Inputs/nonexistent-sdk'
 // SDKWARNING: -sdk {{.*}}/Inputs/nonexistent-sdk
 
-// RUN: %swiftc_driver -driver-print-jobs -parse -sdk %S/../Inputs/clang-importer-sdk -module-cache-path /path/to/cache %s 2>&1 | FileCheck %s --check-prefix=CACHE-PATH
+// RUN: %swiftc_driver -driver-print-jobs -parse -sdk %S/../Inputs/clang-importer-sdk -module-cache-path /path/to/cache %s 2>&1 | %FileCheck %s --check-prefix=CACHE-PATH
 
 // CACHE-PATH: -module-cache-path /path/to/cache
diff --git a/test/Driver/static-stdlib-linux.swift b/test/Driver/static-stdlib-linux.swift
index a52c293..47cbdfd 100644
--- a/test/Driver/static-stdlib-linux.swift
+++ b/test/Driver/static-stdlib-linux.swift
@@ -4,7 +4,7 @@
 print("hello world!")
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swiftc_driver -static-stdlib -o %t/static-stdlib %s
-// RUN: %t/static-stdlib | FileCheck %s
-// RUN: ldd %t/static-stdlib | FileCheck %s --check-prefix=LDD
+// RUN: %t/static-stdlib | %FileCheck %s
+// RUN: ldd %t/static-stdlib | %FileCheck %s --check-prefix=LDD
 // CHECK: hello world!
 // LDD-NOT: libswiftCore.so 
diff --git a/test/Driver/static-stdlib.swift b/test/Driver/static-stdlib.swift
index 503822c..bf6cbd8 100644
--- a/test/Driver/static-stdlib.swift
+++ b/test/Driver/static-stdlib.swift
@@ -4,7 +4,7 @@
 print("hello world!")
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-build-swift -static-stdlib -o %t/static-stdlib %s
-// RUN: %target-run %t/static-stdlib | FileCheck %s
-// RUN: otool -L %t/static-stdlib | FileCheck %s --check-prefix=OTOOL
+// RUN: %target-run %t/static-stdlib | %FileCheck %s
+// RUN: otool -L %t/static-stdlib | %FileCheck %s --check-prefix=OTOOL
 // CHECK: hello world!
 // OTOOL-NOT: libswiftCore.dylib 
diff --git a/test/Driver/subcommands.swift b/test/Driver/subcommands.swift
index feebed5..aef6109 100644
--- a/test/Driver/subcommands.swift
+++ b/test/Driver/subcommands.swift
@@ -2,9 +2,9 @@
 //
 // REQUIRES: swift_interpreter
 //
-// RUN: %swift_driver_plain -### 2>&1 | FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
-// RUN: %swift_driver_plain run -### 2>&1 | FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
-// RUN: %swift_driver_plain repl -### 2>&1 | FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
+// RUN: %swift_driver_plain -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
+// RUN: %swift_driver_plain run -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
+// RUN: %swift_driver_plain repl -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
 //
 // CHECK-SWIFT-INVOKES-REPL: {{.*}}/swift -frontend -repl
 
@@ -18,11 +18,11 @@
 // RUN: echo "print(\"exec: \" + #file)" > %t.dir/stdin
 // RUN: echo "print(\"exec: \" + #file)" > %t.dir/t.swift
 // RUN: echo "print(\"exec: \" + #file)" > %t.dir/subpath/build
-// RUN: cd %t.dir && %swift_driver_plain - < %t.dir/stdin -### 2>&1 | FileCheck -check-prefix=CHECK-SWIFT-STDIN-INVOKES-INTERPRETER %s
+// RUN: cd %t.dir && %swift_driver_plain - < %t.dir/stdin -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-STDIN-INVOKES-INTERPRETER %s
 // CHECK-SWIFT-STDIN-INVOKES-INTERPRETER: exec: <stdin>
-// RUN: cd %t.dir && %swift_driver_plain t.swift -### 2>&1 | FileCheck -check-prefix=CHECK-SWIFT-SUFFIX-INVOKES-INTERPRETER %s
+// RUN: cd %t.dir && %swift_driver_plain t.swift -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-SUFFIX-INVOKES-INTERPRETER %s
 // CHECK-SWIFT-SUFFIX-INVOKES-INTERPRETER: exec: t.swift
-// RUN: cd %t.dir && %swift_driver_plain subpath/build -### 2>&1 | FileCheck -check-prefix=CHECK-SWIFT-PATH-INVOKES-INTERPRETER %s
+// RUN: cd %t.dir && %swift_driver_plain subpath/build -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-PATH-INVOKES-INTERPRETER %s
 // CHECK-SWIFT-PATH-INVOKES-INTERPRETER: exec: subpath/build
 
 
@@ -33,5 +33,5 @@
 // RUN: echo "#!/bin/sh" > %t.dir/swift-foo
 // RUN: echo "echo \"exec: \$0\"" >> %t.dir/swift-foo
 // RUN: chmod +x %t.dir/swift-foo
-// RUN: env PATH=%t.dir %swift_driver_plain foo | FileCheck -check-prefix=CHECK-SWIFT-SUBCOMMAND %s
+// RUN: env PATH=%t.dir %swift_driver_plain foo | %FileCheck -check-prefix=CHECK-SWIFT-SUBCOMMAND %s
 // CHECK-SWIFT-SUBCOMMAND: exec: {{.*}}/swift-foo
diff --git a/test/Driver/temp-files.swift b/test/Driver/temp-files.swift
index f41f700..3fa22f7 100644
--- a/test/Driver/temp-files.swift
+++ b/test/Driver/temp-files.swift
@@ -4,7 +4,7 @@
 // RUN: rm -rf %t && mkdir -p %t/tmp/ && touch %t/tmp/dummy
 // RUN: env TMPDIR=%t/tmp/ %target-swiftc_driver -emit-executable %s -o %t/main
 // RUN: ls %t/main
-// RUN: ls %t/tmp | FileCheck -check-prefix=EMPTY %s
+// RUN: ls %t/tmp | %FileCheck -check-prefix=EMPTY %s
 
 // EMPTY-NOT: .{{(o|swiftmodule|swiftdoc)}}
 
@@ -12,19 +12,19 @@
 // RUN: env TMPDIR=%t/tmp/ %swiftc_driver -target %target-triple -sdk %sdk -module-cache-path %t -emit-executable %s -o %t/main2 -emit-module-path %t/main2.swiftmodule
 // RUN: ls %t/main2
 // RUN: ls %t/main2.swiftmodule
-// RUN: ls %t/tmp | FileCheck -check-prefix=EMPTY %s
+// RUN: ls %t/tmp | %FileCheck -check-prefix=EMPTY %s
 
 // RUN: rm -rf %t && mkdir -p %t/tmp/ && touch %t/tmp/dummy
 // RUN: env TMPDIR=%t/tmp/ %swiftc_driver -target %target-triple -sdk %sdk -module-cache-path %t -emit-executable %s -o %t/main3 -g
 // RUN: ls %t/main3
-// RUN: ls %t/tmp | FileCheck -check-prefix=EMPTY %s
+// RUN: ls %t/tmp | %FileCheck -check-prefix=EMPTY %s
 
 // RUN: rm -rf %t && mkdir -p %t/tmp/ && touch %t/tmp/dummy
 // RUN: env TMPDIR=%t/tmp/ %swiftc_driver -target %target-triple -sdk %sdk -module-cache-path %t -emit-executable %s -o %t/main4 -emit-module-path %t/main4.swiftmodule -g
 // RUN: ls %t/main4
 // RUN: ls %t/main4.swiftmodule
-// RUN: ls %t | FileCheck -check-prefix=MAIN4-%target-object-format %s
-// RUN: ls %t/tmp | FileCheck -check-prefix=EMPTY %s
+// RUN: ls %t | %FileCheck -check-prefix=MAIN4-%target-object-format %s
+// RUN: ls %t/tmp | %FileCheck -check-prefix=EMPTY %s
 
 // MAIN4-macho: main4.dSYM
 // MAIN4-elf-NOT: .dSYM
@@ -34,8 +34,8 @@
 // RUN: env TMPDIR=%t/tmp/ %swiftc_driver -target %target-triple -sdk %sdk -module-cache-path %t -emit-executable %s -o %t/main5 -output-file-map %t.json -g
 // RUN: ls %t/main5
 // RUN: ls %t/main5.o
-// RUN: ls %t | FileCheck -check-prefix=MAIN5-%target-object-format %s
-// RUN: ls %t/tmp | FileCheck -check-prefix=EMPTY %s
+// RUN: ls %t | %FileCheck -check-prefix=MAIN5-%target-object-format %s
+// RUN: ls %t/tmp | %FileCheck -check-prefix=EMPTY %s
 
 // MAIN5-macho: main5.dSYM
 // MAIN5-elf-NOT: .dSYM
@@ -43,9 +43,9 @@
 // RUN: rm -rf %t && mkdir -p %t/tmp/ && touch %t/tmp/dummy
 // RUN: env TMPDIR=%t/tmp/ %swiftc_driver -target %target-triple -sdk %sdk -module-cache-path %t -emit-executable %s -o %t/main6 -g -save-temps
 // RUN: ls %t/main6
-// RUN: ls %t | FileCheck -check-prefix=MAIN6-%target-object-format %s
-// RUN: ls %t/tmp | FileCheck -check-prefix=SAVE-TEMPS %s
-// RUN: ls %t/tmp | FileCheck -check-prefix=SAVE-TEMPS-%target-object-format %s
+// RUN: ls %t | %FileCheck -check-prefix=MAIN6-%target-object-format %s
+// RUN: ls %t/tmp | %FileCheck -check-prefix=SAVE-TEMPS %s
+// RUN: ls %t/tmp | %FileCheck -check-prefix=SAVE-TEMPS-%target-object-format %s
 
 // MAIN6-macho: main6.dSYM
 // MAIN6-elf-NOT: .dSYM
diff --git a/test/Driver/unknown-inputs.swift b/test/Driver/unknown-inputs.swift
index 34e0923..ab06ae3 100644
--- a/test/Driver/unknown-inputs.swift
+++ b/test/Driver/unknown-inputs.swift
@@ -10,11 +10,11 @@
 // COMPILE: 0: input
 // COMPILE: 1: compile, {0}, object
 
-// RUN: %swiftc_driver -driver-print-actions %t/empty 2>&1 | FileCheck -check-prefix=LINK-%target-object-format %s
-// RUN: not %swiftc_driver -driver-print-actions %t/empty.swiftmodule 2>&1 | FileCheck -check-prefix=ERROR %s
-// RUN: %swiftc_driver -driver-print-actions %t/empty.o 2>&1 | FileCheck -check-prefix=LINK-%target-object-format %s
-// RUN: not %swiftc_driver -driver-print-actions %t/empty.h 2>&1 | FileCheck -check-prefix=ERROR %s
-// RUN: %swiftc_driver -driver-print-actions %t/empty.swift 2>&1 | FileCheck -check-prefix=COMPILE %s
+// RUN: %swiftc_driver -driver-print-actions %t/empty 2>&1 | %FileCheck -check-prefix=LINK-%target-object-format %s
+// RUN: not %swiftc_driver -driver-print-actions %t/empty.swiftmodule 2>&1 | %FileCheck -check-prefix=ERROR %s
+// RUN: %swiftc_driver -driver-print-actions %t/empty.o 2>&1 | %FileCheck -check-prefix=LINK-%target-object-format %s
+// RUN: not %swiftc_driver -driver-print-actions %t/empty.h 2>&1 | %FileCheck -check-prefix=ERROR %s
+// RUN: %swiftc_driver -driver-print-actions %t/empty.swift 2>&1 | %FileCheck -check-prefix=COMPILE %s
 
 // LINK-macho: 0: input
 // LINK-macho: 1: link, {0}, image
@@ -23,17 +23,17 @@
 // LINK-elf: 1: swift-autolink-extract, {0}, autolink
 // LINK-elf: 2: link, {0, 1}, image
 
-// RUN: not %swiftc_driver -driver-print-actions -emit-module %t/empty 2>&1 | FileCheck -check-prefix=ERROR %s
-// RUN: %swiftc_driver -driver-print-actions -emit-module %t/empty.swiftmodule 2>&1 | FileCheck -check-prefix=MODULE %s
-// RUN: not %swiftc_driver -driver-print-actions -emit-module %t/empty.o 2>&1 | FileCheck -check-prefix=ERROR %s
-// RUN: not %swiftc_driver -driver-print-actions -emit-module %t/empty.h 2>&1 | FileCheck -check-prefix=ERROR %s
-// RUN: %swiftc_driver -driver-print-actions %t/empty.swift 2>&1 | FileCheck -check-prefix=COMPILE %s
+// RUN: not %swiftc_driver -driver-print-actions -emit-module %t/empty 2>&1 | %FileCheck -check-prefix=ERROR %s
+// RUN: %swiftc_driver -driver-print-actions -emit-module %t/empty.swiftmodule 2>&1 | %FileCheck -check-prefix=MODULE %s
+// RUN: not %swiftc_driver -driver-print-actions -emit-module %t/empty.o 2>&1 | %FileCheck -check-prefix=ERROR %s
+// RUN: not %swiftc_driver -driver-print-actions -emit-module %t/empty.h 2>&1 | %FileCheck -check-prefix=ERROR %s
+// RUN: %swiftc_driver -driver-print-actions %t/empty.swift 2>&1 | %FileCheck -check-prefix=COMPILE %s
 
 // MODULE: 0: input
 // MODULE: 1: merge-module, {0}, swiftmodule
 
-// RUN: not %swiftc_driver -driver-print-actions -parse %t/empty 2>&1 | FileCheck -check-prefix=ERROR %s
-// RUN: not %swiftc_driver -driver-print-actions -parse %t/empty.swiftmodule 2>&1 | FileCheck -check-prefix=ERROR %s
-// RUN: not %swiftc_driver -driver-print-actions -parse %t/empty.o 2>&1 | FileCheck -check-prefix=ERROR %s
-// RUN: not %swiftc_driver -driver-print-actions -parse %t/empty.h 2>&1 | FileCheck -check-prefix=ERROR %s
-// RUN: %swiftc_driver -driver-print-actions %t/empty.swift 2>&1 | FileCheck -check-prefix=COMPILE %s
+// RUN: not %swiftc_driver -driver-print-actions -parse %t/empty 2>&1 | %FileCheck -check-prefix=ERROR %s
+// RUN: not %swiftc_driver -driver-print-actions -parse %t/empty.swiftmodule 2>&1 | %FileCheck -check-prefix=ERROR %s
+// RUN: not %swiftc_driver -driver-print-actions -parse %t/empty.o 2>&1 | %FileCheck -check-prefix=ERROR %s
+// RUN: not %swiftc_driver -driver-print-actions -parse %t/empty.h 2>&1 | %FileCheck -check-prefix=ERROR %s
+// RUN: %swiftc_driver -driver-print-actions %t/empty.swift 2>&1 | %FileCheck -check-prefix=COMPILE %s
diff --git a/test/Driver/warnings-control.swift b/test/Driver/warnings-control.swift
index d512aa3..e99b230 100644
--- a/test/Driver/warnings-control.swift
+++ b/test/Driver/warnings-control.swift
@@ -1,8 +1,8 @@
-// RUN: not %target-swiftc_driver %s 2>&1 | FileCheck -check-prefix=DEFAULT %s
-// RUN: not %target-swiftc_driver -warnings-as-errors %s 2>&1 | FileCheck -check-prefix=WERR %s
-// RUN: not %target-swiftc_driver -suppress-warnings %s 2>&1 | FileCheck -check-prefix=NOWARN %s
+// RUN: not %target-swiftc_driver %s 2>&1 | %FileCheck -check-prefix=DEFAULT %s
+// RUN: not %target-swiftc_driver -warnings-as-errors %s 2>&1 | %FileCheck -check-prefix=WERR %s
+// RUN: not %target-swiftc_driver -suppress-warnings %s 2>&1 | %FileCheck -check-prefix=NOWARN %s
 
-// RUN: not %target-swiftc_driver -suppress-warnings -warnings-as-errors %s 2>&1 | FileCheck -check-prefix=FLAGS_CONFLICT %s
+// RUN: not %target-swiftc_driver -suppress-warnings -warnings-as-errors %s 2>&1 | %FileCheck -check-prefix=FLAGS_CONFLICT %s
 // FLAGS_CONFLICT: error: conflicting options '-warnings-as-errors' and '-suppress-warnings'
 
 func foo() -> Int {
diff --git a/test/FixCode/fixits-apply-objc.swift b/test/FixCode/fixits-apply-objc.swift
new file mode 100644
index 0000000..4393ed4
--- /dev/null
+++ b/test/FixCode/fixits-apply-objc.swift
@@ -0,0 +1,31 @@
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -disable-objc-attr-requires-foundation-module -parse %s -emit-fixits-path %t.remap
+// RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %s.result
+import ObjectiveC
+
+// REQUIRES: objc_interop
+
+@objc class Selectors {
+  func takeSel(_: Selector) {}
+  func mySel() {}
+  func test() {
+    takeSel("mySel")
+    takeSel(Selector("mySel"))
+  }
+}
+
+func foo(an : Any) {
+  let a1 : AnyObject
+  a1 = an
+  let a2 : AnyObject?
+  a2 = an
+  let a3 : AnyObject!
+  a3 = an
+}
+
+func foo1(_ an : Any) {
+  let obj: AnyObject = an
+}
+
+func foo2(_ messageData: Any?) -> AnyObject? {
+  return messageData
+}
diff --git a/test/FixCode/fixits-apply-objc.swift.result b/test/FixCode/fixits-apply-objc.swift.result
new file mode 100644
index 0000000..36b7883
--- /dev/null
+++ b/test/FixCode/fixits-apply-objc.swift.result
@@ -0,0 +1,31 @@
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -disable-objc-attr-requires-foundation-module -parse %s -emit-fixits-path %t.remap
+// RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %s.result
+import ObjectiveC
+
+// REQUIRES: objc_interop
+
+@objc class Selectors {
+  func takeSel(_: Selector) {}
+  func mySel() {}
+  func test() {
+    takeSel(#selector(Selectors.mySel))
+    takeSel(#selector(Selectors.mySel))
+  }
+}
+
+func foo(an : Any) {
+  let a1 : AnyObject
+  a1 = an as AnyObject
+  let a2 : AnyObject?
+  a2 = an as AnyObject?
+  let a3 : AnyObject!
+  a3 = an as AnyObject!
+}
+
+func foo1(_ an : Any) {
+  let obj: AnyObject = an as AnyObject
+}
+
+func foo2(_ messageData: Any?) -> AnyObject? {
+  return messageData as AnyObject?
+}
diff --git a/test/FixCode/fixits-apply-selector.swift b/test/FixCode/fixits-apply-selector.swift
deleted file mode 100644
index d64370d..0000000
--- a/test/FixCode/fixits-apply-selector.swift
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -disable-objc-attr-requires-foundation-module -parse %s -emit-fixits-path %t.remap
-// RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %s.result
-import ObjectiveC
-
-// REQUIRES: objc_interop
-
-@objc class Selectors {
-  func takeSel(_: Selector) {}
-  func mySel() {}
-  func test() {
-    takeSel("mySel")
-    takeSel(Selector("mySel"))
-  }
-}
diff --git a/test/FixCode/fixits-apply-selector.swift.result b/test/FixCode/fixits-apply-selector.swift.result
deleted file mode 100644
index c093689..0000000
--- a/test/FixCode/fixits-apply-selector.swift.result
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -disable-objc-attr-requires-foundation-module -parse %s -emit-fixits-path %t.remap
-// RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %s.result
-import ObjectiveC
-
-// REQUIRES: objc_interop
-
-@objc class Selectors {
-  func takeSel(_: Selector) {}
-  func mySel() {}
-  func test() {
-    takeSel(#selector(Selectors.mySel))
-    takeSel(#selector(Selectors.mySel))
-  }
-}
diff --git a/test/FixCode/fixits-apply.swift b/test/FixCode/fixits-apply.swift
index c32e908..b20312e 100644
--- a/test/FixCode/fixits-apply.swift
+++ b/test/FixCode/fixits-apply.swift
@@ -78,6 +78,24 @@
   testMask1(a: a) // no fix, nullability mismatch.
 }
 
+struct Wrapper {
+  typealias InnerMask = MyEventMask2
+}
+func sendItInner(_: Wrapper.InnerMask) {}
+func testInnerMask(a: UInt64) {
+  sendItInner(a)
+}
+
+struct SomeName : RawRepresentable {
+  init(_ rawValue: String) {}
+  init(rawValue: String) {}
+  var rawValue: String { return "" }
+}
+func testPassSomeName(_: SomeName) {}
+func testConvertSomeName(s: String) {
+  testPassSomeName("\(s)}")
+}
+
 enum MyEnumType : UInt32 {
   case invalid
 }
@@ -100,7 +118,7 @@
   x += 10
 }
 func foo(let y: String, inout x: Int) {
-  
+
 }
 
 struct Test1 : OptionSet {
@@ -215,9 +233,45 @@
   fnWithClosure { rec() }
 }
 
+@warn_unused_result func testDeprecatedAttr() -> Int { return 0 }
+
 protocol Prot1 {}
 protocol Prot2 {
   associatedtype Ty = Prot1
 }
 class Cls1 : Prot1 {}
 func testwhere<T: Prot2 where T.Ty == Cls1>(_: T) {}
+
+enum E {
+  case abc
+}
+func testEnumRename() { _ = E.Abc }
+
+func testAnyToAnyObject(x: Any) {
+  x.instMeth(p: 1)
+}
+
+func testProtocolCompositionSyntax() {
+  var _: protocol<>
+  var _: protocol<Prot1>
+  var _: protocol<Prot1, Prot2>
+}
+
+func disable_unnamed_param_reorder(p: Int, _: String) {}
+disable_unnamed_param_reorder(0, "") // no change.
+
+prefix operator ***** {}
+
+class BoolFoo : BooleanType {
+  var boolValue: Bool {return false}
+}
+func testBoolValue(a : BoolFoo) {
+  if a { }
+  guard a {}
+  if a as BoolFoo {}
+}
+
+protocol P1 {}
+protocol P2 {}
+var a : protocol<P1, P2>?
+var a2 : protocol<P1>= 17
diff --git a/test/FixCode/fixits-apply.swift.result b/test/FixCode/fixits-apply.swift.result
index df4739d..0c1bb3e 100644
--- a/test/FixCode/fixits-apply.swift.result
+++ b/test/FixCode/fixits-apply.swift.result
@@ -28,7 +28,7 @@
 }
 
 func supported() -> MyMask {
-  return MyMask.Bingo
+  return MyMask(rawValue: UInt(MyMask.Bingo))
 }
 
 struct MyEventMask2 : OptionSet {
@@ -78,6 +78,24 @@
   testMask1(a: a) // no fix, nullability mismatch.
 }
 
+struct Wrapper {
+  typealias InnerMask = MyEventMask2
+}
+func sendItInner(_: Wrapper.InnerMask) {}
+func testInnerMask(a: UInt64) {
+  sendItInner(Wrapper.InnerMask(rawValue: a))
+}
+
+struct SomeName : RawRepresentable {
+  init(_ rawValue: String) {}
+  init(rawValue: String) {}
+  var rawValue: String { return "" }
+}
+func testPassSomeName(_: SomeName) {}
+func testConvertSomeName(s: String) {
+  testPassSomeName(SomeName(rawValue: "\(s)}"))
+}
+
 enum MyEnumType : UInt32 {
   case invalid
 }
@@ -103,7 +121,7 @@
   x += 10
 }
 func foo(y: String, x: inout Int) {
-  
+
 }
 
 struct Test1 : OptionSet {
@@ -218,9 +236,45 @@
   fnWithClosure { rec() }
 }
 
+func testDeprecatedAttr() -> Int { return 0 }
+
 protocol Prot1 {}
 protocol Prot2 {
   associatedtype Ty = Prot1
 }
 class Cls1 : Prot1 {}
 func testwhere<T: Prot2>(_: T) where T.Ty == Cls1 {}
+
+enum E {
+  case abc
+}
+func testEnumRename() { _ = E.Abc }
+
+func testAnyToAnyObject(x: Any) {
+  (x as AnyObject).instMeth(p: 1)
+}
+
+func testProtocolCompositionSyntax() {
+  var _: Any
+  var _: Prot1
+  var _: Prot1 & Prot2
+}
+
+func disable_unnamed_param_reorder(p: Int, _: String) {}
+disable_unnamed_param_reorder(0, "") // no change.
+
+prefix operator *****
+
+class BoolFoo : Bool {
+  var boolValue: Bool {return false}
+}
+func testBoolValue(a : BoolFoo) {
+  if a.boolValue { }
+  guard a.boolValue {}
+  if (a as BoolFoo).boolValue {}
+}
+
+protocol P1 {}
+protocol P2 {}
+var a : (P1 & P2)?
+var a2 : (P1)= 17 as! P1
diff --git a/test/FixCode/multi-inputs.swift b/test/FixCode/multi-inputs.swift
index 3cdedf2..caa8840 100644
--- a/test/FixCode/multi-inputs.swift
+++ b/test/FixCode/multi-inputs.swift
@@ -2,7 +2,7 @@
 // RUN: echo "{\"%S/Inputs/t1.swift\": {\"remap\": \"%t.out/t1.remap\"}, \"%S/Inputs/t2.swift\": {\"remap\": \"%t.out/t2.remap\"}}" > %t.json
 // RUN: not %swiftc_driver -target %target-triple -module-name Blah -fixit-code %S/Inputs/t1.swift %S/Inputs/t2.swift -emit-module -emit-module-path %t.mod -emit-objc-header -emit-objc-header-path %t.h -j 1 -output-file-map %t.json 2> %t.err.txt
 // RUN: c-arcmt-test %t.out/t1.remap %t.out/t2.remap | arcmt-test -verify-transformed-files %S/Inputs/t1.swift.result %S/Inputs/t2.swift.result
-// RUN: FileCheck --input-file=%t.err.txt %s
+// RUN: %FileCheck --input-file=%t.err.txt %s
 
 // CHECK: error: use of unresolved identifier 'undeclared_foo1'
 // CHECK: error: use of unresolved identifier 'undeclared_foo2'
diff --git a/test/Frontend/InternalChecks.swift b/test/Frontend/InternalChecks.swift
index 80f91e3..eec55a9 100644
--- a/test/Frontend/InternalChecks.swift
+++ b/test/Frontend/InternalChecks.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -O -parse-stdlib -D INTERNAL_CHECKS_ENABLED -primary-file %s -emit-sil | FileCheck %s --check-prefix=CHECKS
-// RUN: %target-swift-frontend -O -parse-stdlib -primary-file %s -emit-sil | FileCheck %s --check-prefix=NOCHECKS
+// RUN: %target-swift-frontend -O -parse-stdlib -D INTERNAL_CHECKS_ENABLED -primary-file %s -emit-sil | %FileCheck %s --check-prefix=CHECKS
+// RUN: %target-swift-frontend -O -parse-stdlib -primary-file %s -emit-sil | %FileCheck %s --check-prefix=NOCHECKS
 
 import Swift
 
diff --git a/test/Frontend/OptimizationOptions-with-stdlib-checks.swift b/test/Frontend/OptimizationOptions-with-stdlib-checks.swift
index 747e9d3..cd7ba28 100644
--- a/test/Frontend/OptimizationOptions-with-stdlib-checks.swift
+++ b/test/Frontend/OptimizationOptions-with-stdlib-checks.swift
@@ -1,7 +1,7 @@
-// RUN: %target-swift-frontend -module-name OptimizationOptions -Onone -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=DEBUG
-// RUN: %target-swift-frontend -module-name OptimizationOptions -O -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=RELEASE
-// RUN: %target-swift-frontend -module-name OptimizationOptions -Ounchecked -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=UNCHECKED
-// RUN: %target-swift-frontend -module-name OptimizationOptions -Oplayground -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=PLAYGROUND
+// RUN: %target-swift-frontend -module-name OptimizationOptions -Onone -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=DEBUG
+// RUN: %target-swift-frontend -module-name OptimizationOptions -O -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=RELEASE
+// RUN: %target-swift-frontend -module-name OptimizationOptions -Ounchecked -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=UNCHECKED
+// RUN: %target-swift-frontend -module-name OptimizationOptions -Oplayground -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=PLAYGROUND
 
 // REQUIRES: optimized_stdlib
 // REQUIRES: swift_stdlib_asserts
diff --git a/test/Frontend/OptimizationOptions-without-stdlib-checks.swift b/test/Frontend/OptimizationOptions-without-stdlib-checks.swift
index 0adace8..8b9b11e 100644
--- a/test/Frontend/OptimizationOptions-without-stdlib-checks.swift
+++ b/test/Frontend/OptimizationOptions-without-stdlib-checks.swift
@@ -1,7 +1,7 @@
-// RUN: %target-swift-frontend -module-name OptimizationOptions -Onone -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=DEBUG
-// RUN: %target-swift-frontend -module-name OptimizationOptions -O -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=RELEASE
-// RUN: %target-swift-frontend -module-name OptimizationOptions -Ounchecked -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=UNCHECKED
-// RUN: %target-swift-frontend -module-name OptimizationOptions -Oplayground -emit-sil -primary-file %s 2>&1 | FileCheck %s --check-prefix=PLAYGROUND
+// RUN: %target-swift-frontend -module-name OptimizationOptions -Onone -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=DEBUG
+// RUN: %target-swift-frontend -module-name OptimizationOptions -O -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=RELEASE
+// RUN: %target-swift-frontend -module-name OptimizationOptions -Ounchecked -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=UNCHECKED
+// RUN: %target-swift-frontend -module-name OptimizationOptions -Oplayground -emit-sil -primary-file %s 2>&1 | %FileCheck %s --check-prefix=PLAYGROUND
 
 // REQUIRES: optimized_stdlib
 // REQUIRES: swift_stdlib_asserts
diff --git a/test/Frontend/Xllvm.swift b/test/Frontend/Xllvm.swift
index b6fd994..fe19983 100644
--- a/test/Frontend/Xllvm.swift
+++ b/test/Frontend/Xllvm.swift
@@ -1,5 +1,5 @@
-// RUN: %swift -repl -Xllvm -help 2>&1 | FileCheck %s --check-prefix=CHECK-HELP
+// RUN: %swift -repl -Xllvm -help 2>&1 | %FileCheck %s --check-prefix=CHECK-HELP
 // CHECK-HELP: -version
 
-// RUN: %swift -Xllvm -version -emit-sil %s 2>&1 | FileCheck %s -check-prefix=CHECK-SIL
+// RUN: %swift -Xllvm -version -emit-sil %s 2>&1 | %FileCheck %s -check-prefix=CHECK-SIL
 // CHECK-SIL: LLVM (http://llvm.org/)
diff --git a/test/Frontend/clang-args-diags.swift b/test/Frontend/clang-args-diags.swift
index ba9966f..00e319a 100644
--- a/test/Frontend/clang-args-diags.swift
+++ b/test/Frontend/clang-args-diags.swift
@@ -1,10 +1,10 @@
-// RUN: not %swift -Xcc -fake-argument -parse %s 2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-ARG
+// RUN: not %swift -Xcc -fake-argument -parse %s 2>&1 | %FileCheck %s -check-prefix=CHECK-UNKNOWN-ARG
 // CHECK-UNKNOWN-ARG: unknown argument: '-fake-argument'
 
-// RUN: not %swift -Xcc -ivfsoverlay -Xcc %t.nonexistent -parse %s 2>&1 | FileCheck %s -check-prefix=CHECK-VFS-NONEXISTENT
+// RUN: not %swift -Xcc -ivfsoverlay -Xcc %t.nonexistent -parse %s 2>&1 | %FileCheck %s -check-prefix=CHECK-VFS-NONEXISTENT
 // CHECK-VFS-NONEXISTENT: virtual filesystem overlay file '{{.*}}' not found
 
-// RUN: not %swift -Xcc --version -parse %s 2>&1 | FileCheck %s -check-prefix=CHECK-DRIVER-OPTION
+// RUN: not %swift -Xcc --version -parse %s 2>&1 | %FileCheck %s -check-prefix=CHECK-DRIVER-OPTION
 // CHECK-DRIVER-OPTION-DAG: {{clang|LLVM}} version {{[0-9]+\.[0-9]+}}
 // CHECK-DRIVER-OPTION-DAG: error: unable to handle compilation, expected exactly one compiler job
 // CHECK-DRIVER-OPTION-DAG: error: clang importer creation failed
diff --git a/test/Frontend/dependencies.swift b/test/Frontend/dependencies.swift
index a882965..c8a925b 100644
--- a/test/Frontend/dependencies.swift
+++ b/test/Frontend/dependencies.swift
@@ -2,12 +2,12 @@
 
 // RUN: rm -rf %t && mkdir %t
 
-// RUN: %target-swift-frontend -emit-dependencies-path - -parse %S/../Inputs/empty\ file.swift | FileCheck -check-prefix=CHECK-BASIC %s
-// RUN: %target-swift-frontend -emit-reference-dependencies-path - -parse -primary-file %S/../Inputs/empty\ file.swift | FileCheck -check-prefix=CHECK-BASIC-YAML %s
+// RUN: %target-swift-frontend -emit-dependencies-path - -parse %S/../Inputs/empty\ file.swift | %FileCheck -check-prefix=CHECK-BASIC %s
+// RUN: %target-swift-frontend -emit-reference-dependencies-path - -parse -primary-file %S/../Inputs/empty\ file.swift | %FileCheck -check-prefix=CHECK-BASIC-YAML %s
 
 // RUN: %target-swift-frontend -emit-dependencies-path %t.d -emit-reference-dependencies-path %t.swiftdeps -parse -primary-file %S/../Inputs/empty\ file.swift
-// RUN: FileCheck -check-prefix=CHECK-BASIC %s < %t.d
-// RUN: FileCheck -check-prefix=CHECK-BASIC-YAML %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=CHECK-BASIC %s < %t.d
+// RUN: %FileCheck -check-prefix=CHECK-BASIC-YAML %s < %t.swiftdeps
 
 // CHECK-BASIC-LABEL: - :
 // CHECK-BASIC: Inputs/empty\ file.swift
@@ -20,12 +20,12 @@
 // CHECK-BASIC-YAML-NOT: {{:$}}
 
 
-// RUN: %target-swift-frontend -emit-dependencies-path %t.d -emit-reference-dependencies-path %t.swiftdeps -parse %S/../Inputs/empty\ file.swift 2>&1 | FileCheck -check-prefix=NO-PRIMARY-FILE %s
+// RUN: %target-swift-frontend -emit-dependencies-path %t.d -emit-reference-dependencies-path %t.swiftdeps -parse %S/../Inputs/empty\ file.swift 2>&1 | %FileCheck -check-prefix=NO-PRIMARY-FILE %s
 
 // NO-PRIMARY-FILE: warning: ignoring -emit-reference-dependencies (requires -primary-file)
 
 
-// RUN: %target-swift-frontend -emit-dependencies-path - -emit-module %S/../Inputs/empty\ file.swift -o %t/empty\ file.swiftmodule -emit-module-doc-path %t/empty\ file.swiftdoc -emit-objc-header-path %t/empty\ file.h | FileCheck -check-prefix=CHECK-MULTIPLE-OUTPUTS %s
+// RUN: %target-swift-frontend -emit-dependencies-path - -emit-module %S/../Inputs/empty\ file.swift -o %t/empty\ file.swiftmodule -emit-module-doc-path %t/empty\ file.swiftdoc -emit-objc-header-path %t/empty\ file.h | %FileCheck -check-prefix=CHECK-MULTIPLE-OUTPUTS %s
 
 // CHECK-MULTIPLE-OUTPUTS-LABEL: empty\ file.swiftmodule :
 // CHECK-MULTIPLE-OUTPUTS: Inputs/empty\ file.swift
@@ -38,8 +38,8 @@
 // CHECK-MULTIPLE-OUTPUTS: Swift.swiftmodule
 // CHECK-MULTIPLE-OUTPUTS-NOT: :
 
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-dependencies-path - -parse %s | FileCheck -check-prefix=CHECK-IMPORT %s
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-reference-dependencies-path - -parse -primary-file %s | FileCheck -check-prefix=CHECK-IMPORT-YAML %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-dependencies-path - -parse %s | %FileCheck -check-prefix=CHECK-IMPORT %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-reference-dependencies-path - -parse -primary-file %s | %FileCheck -check-prefix=CHECK-IMPORT-YAML %s
 
 // CHECK-IMPORT-LABEL: - :
 // CHECK-IMPORT: dependencies.swift
@@ -66,8 +66,8 @@
 // CHECK-IMPORT-YAML-NOT: {{^-}}
 // CHECK-IMPORT-YAML-NOT: {{:$}}
 
-// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -DERROR -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-dependencies-path - -parse %s | FileCheck -check-prefix=CHECK-IMPORT %s
-// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -DERROR -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-reference-dependencies-path - -parse -primary-file %s | FileCheck -check-prefix=CHECK-IMPORT-YAML %s
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -DERROR -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-dependencies-path - -parse %s | %FileCheck -check-prefix=CHECK-IMPORT %s
+// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -DERROR -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-reference-dependencies-path - -parse -primary-file %s | %FileCheck -check-prefix=CHECK-IMPORT-YAML %s
 
 
 import Foundation
diff --git a/test/Frontend/embed-bitcode.ll b/test/Frontend/embed-bitcode.ll
index 2ca551a..2c60e88 100644
--- a/test/Frontend/embed-bitcode.ll
+++ b/test/Frontend/embed-bitcode.ll
@@ -2,13 +2,13 @@
 ; REQUIRES: rdar23493035
 ; RUN: llvm-as %s -o %t.bc
 ; RUN: %swift -target x86_64-apple-darwin10 -c -module-name someModule -embed-bitcode -disable-llvm-optzns -o %t2.o %t.bc -dump-clang-diagnostics 2> %t.diags.txt
-; RUN: llvm-objdump -macho -section="__LLVM,__bitcode" %t2.o | FileCheck %s
-; RUN: llvm-objdump -macho -section="__LLVM,__swift_cmdline" %t2.o | FileCheck -check-prefix=CHECK-CMD %s
-; RUN: FileCheck -check-prefix CHECK-IMPORTER %s < %t.diags.txt
+; RUN: llvm-objdump -macho -section="__LLVM,__bitcode" %t2.o | %FileCheck %s
+; RUN: llvm-objdump -macho -section="__LLVM,__swift_cmdline" %t2.o | %FileCheck -check-prefix=CHECK-CMD %s
+; RUN: %FileCheck -check-prefix CHECK-IMPORTER %s < %t.diags.txt
 
 ; RUN: %swift -target x86_64-apple-darwin10 -c -module-name someModule -embed-bitcode-marker  -o %t3.o %t.bc
-; RUN: llvm-objdump -macho -section="__LLVM,__bitcode" %t3.o | FileCheck -check-prefix=MARKER %s
-; RUN: llvm-objdump -macho -section="__LLVM,__swift_cmdline" %t3.o | FileCheck -check-prefix=MARKER-CMD %s
+; RUN: llvm-objdump -macho -section="__LLVM,__bitcode" %t3.o | %FileCheck -check-prefix=MARKER %s
+; RUN: llvm-objdump -macho -section="__LLVM,__swift_cmdline" %t3.o | %FileCheck -check-prefix=MARKER-CMD %s
 
 target triple = "x86_64-apple-darwin10"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/test/Frontend/embed-bitcode.swift b/test/Frontend/embed-bitcode.swift
index bdd3c2f..a1a3703 100644
--- a/test/Frontend/embed-bitcode.swift
+++ b/test/Frontend/embed-bitcode.swift
@@ -1,8 +1,8 @@
 // REQUIRES: CPU=x86_64
 // REQUIRES: rdar23493035
 // RUN: %target-swift-frontend -c -module-name someModule -embed-bitcode-marker  -o %t.o %s
-// RUN: llvm-objdump -macho -section="__LLVM,__bitcode" %t.o | FileCheck -check-prefix=MARKER %s
-// RUN: llvm-objdump -macho -section="__LLVM,__swift_cmdline" %t.o | FileCheck -check-prefix=MARKER-CMD %s
+// RUN: llvm-objdump -macho -section="__LLVM,__bitcode" %t.o | %FileCheck -check-prefix=MARKER %s
+// RUN: llvm-objdump -macho -section="__LLVM,__swift_cmdline" %t.o | %FileCheck -check-prefix=MARKER-CMD %s
 
 // This file tests Mach-O file output, but Linux variants do not produce Mach-O
 // files.
diff --git a/test/Frontend/filelist.swift b/test/Frontend/filelist.swift
index e88b03a..75d5d11 100644
--- a/test/Frontend/filelist.swift
+++ b/test/Frontend/filelist.swift
@@ -2,13 +2,13 @@
 // RUN: echo '%S/Inputs/filelist-other.swift' >> %t/input.txt
 // RUN: echo '%s' >> %t/input.txt
 // RUN: echo '%S/../Inputs/empty.swift' >> %t/input.txt
-// RUN: not %target-swift-frontend -parse -filelist %t/input.txt -primary-file %s 2>&1 | FileCheck %s
-// RUN: not %target-swift-frontend -parse -filelist %t/input.txt 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -parse -filelist %t/input.txt -primary-file %s 2>&1 | %FileCheck %s
+// RUN: not %target-swift-frontend -parse -filelist %t/input.txt 2>&1 | %FileCheck %s
 
-// RUN: not %target-swift-frontend -emit-bc -filelist %t/nonexistent-input.txt 2>&1 | FileCheck -check-prefix=CHECK-BADFILE %s
+// RUN: not %target-swift-frontend -emit-bc -filelist %t/nonexistent-input.txt 2>&1 | %FileCheck -check-prefix=CHECK-BADFILE %s
 // CHECK-BADFILE: error: cannot open file
 
-// RUN: not %target-swift-frontend -emit-bc -filelist %t/input.txt -primary-file nonexistent.swift 2>&1 | FileCheck -check-prefix=CHECK-BADPRIMARYFILE %s
+// RUN: not %target-swift-frontend -emit-bc -filelist %t/input.txt -primary-file nonexistent.swift 2>&1 | %FileCheck -check-prefix=CHECK-BADPRIMARYFILE %s
 // CHECK-BADPRIMARYFILE: error: primary file 'nonexistent.swift' was not found in file list
 
 // RUN: echo '%t/filelist-other.bc' >> %t/output.txt
diff --git a/test/Frontend/invalid-target.swift b/test/Frontend/invalid-target.swift
index 17e8ff3..3233326 100644
--- a/test/Frontend/invalid-target.swift
+++ b/test/Frontend/invalid-target.swift
@@ -1,5 +1,5 @@
-// RUN: not %swift %s -target 6502-apple-ios9.0 2>&1 | FileCheck %s -check-prefix=CHECKARCH
-// RUN: not %swift %s -target x86_64-apple-eyeOS 2>&1 | FileCheck %s -check-prefix=CHECKOS
+// RUN: not %swift %s -target 6502-apple-ios9.0 2>&1 | %FileCheck %s -check-prefix=CHECKARCH
+// RUN: not %swift %s -target x86_64-apple-eyeOS 2>&1 | %FileCheck %s -check-prefix=CHECKOS
 
 // CHECKARCH: <unknown>:0: error: unsupported target architecture: '6502'
 // CHECKOS: <unknown>:0: error: unsupported target OS: 'eyeOS'
diff --git a/test/Frontend/ir-support-codegen.ll b/test/Frontend/ir-support-codegen.ll
index ea9957c..731fbd7 100644
--- a/test/Frontend/ir-support-codegen.ll
+++ b/test/Frontend/ir-support-codegen.ll
@@ -1,7 +1,7 @@
 ; REQUIRES: CPU=x86_64
-; RUN: %swift -target x86_64-apple-darwin10 -S -module-name someModule -o - %s | FileCheck %s
+; RUN: %swift -target x86_64-apple-darwin10 -S -module-name someModule -o - %s | %FileCheck %s
 ; RUN: llvm-as %s -o %t.bc
-; RUN: %swift -target x86_64-apple-darwin10 -S -module-name someModule -o - %t.bc | FileCheck -check-prefix=CHECK-BC %s
+; RUN: %swift -target x86_64-apple-darwin10 -S -module-name someModule -o - %t.bc | %FileCheck -check-prefix=CHECK-BC %s
 
 target triple = "x86_64-apple-darwin10"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/test/Frontend/no-arguments.swift b/test/Frontend/no-arguments.swift
index 183e66e..7d4cf1f 100644
--- a/test/Frontend/no-arguments.swift
+++ b/test/Frontend/no-arguments.swift
@@ -1,8 +1,8 @@
-// RUN: not %swift 2>&1 | FileCheck %s -check-prefix=CHECK1
-// RUN: not %swift %s 2>&1 | FileCheck %s -check-prefix=CHECK1
-// RUN: not %swift -parse 2>&1 | FileCheck %s -check-prefix=CHECK2
-// RUN: not %swift -emit-sil 2>&1 | FileCheck %s -check-prefix=CHECK2
-// RUN: not %swift -emit-object 2>&1 | FileCheck %s -check-prefix=CHECK2
+// RUN: not %swift 2>&1 | %FileCheck %s -check-prefix=CHECK1
+// RUN: not %swift %s 2>&1 | %FileCheck %s -check-prefix=CHECK1
+// RUN: not %swift -parse 2>&1 | %FileCheck %s -check-prefix=CHECK2
+// RUN: not %swift -emit-sil 2>&1 | %FileCheck %s -check-prefix=CHECK2
+// RUN: not %swift -emit-object 2>&1 | %FileCheck %s -check-prefix=CHECK2
 
 // CHECK1: <unknown>:0: error: no frontend action was selected
 // CHECK2: <unknown>:0: error: this mode requires at least one input file
diff --git a/test/Frontend/sil-primary-file-with-sib.swift b/test/Frontend/sil-primary-file-with-sib.swift
index cf785c3..2f78629 100644
--- a/test/Frontend/sil-primary-file-with-sib.swift
+++ b/test/Frontend/sil-primary-file-with-sib.swift
@@ -6,7 +6,7 @@
 // RUN: %llvm-link %t/test-orig.ll -override %t/test-func.ll -o %t/test.bc
 // RUN: %target-swift-frontend -c %t/test.bc -o %t/test.o
 // RUN: %target-build-swift %t/test.o -o %t/test
-// RUN: %target-run %t/test | FileCheck %s
+// RUN: %target-run %t/test | %FileCheck %s
 // REQUIRES: executable_test
 
 
diff --git a/test/Frontend/unknown-arguments.swift b/test/Frontend/unknown-arguments.swift
index 2f27414..d80a2a7 100644
--- a/test/Frontend/unknown-arguments.swift
+++ b/test/Frontend/unknown-arguments.swift
@@ -1,8 +1,8 @@
-// RUN: not %swift -fake-argument -abcdef -c %s -o %t.o 2>&1 | FileCheck %s
+// RUN: not %swift -fake-argument -abcdef -c %s -o %t.o 2>&1 | %FileCheck %s
 
 // CHECK: <unknown>:0: error: unknown argument: '-fake-argument'
 // CHECK-NEXT: <unknown>:0: error: unknown argument: '-abcdef'
 
-// RUN: not %swiftc_driver -c %s -o %t.o -Xfrontend -fake-frontend-arg -Xfrontend fakevalue 2>&1 | FileCheck -check-prefix=XFRONTEND %s
+// RUN: not %swiftc_driver -c %s -o %t.o -Xfrontend -fake-frontend-arg -Xfrontend fakevalue 2>&1 | %FileCheck -check-prefix=XFRONTEND %s
 
 // XFRONTEND: <unknown>:0: error: unknown argument: '-fake-frontend-arg'
diff --git a/test/Generics/associated_type_typo.swift b/test/Generics/associated_type_typo.swift
index 3ab163c..e80d209 100644
--- a/test/Generics/associated_type_typo.swift
+++ b/test/Generics/associated_type_typo.swift
@@ -1,7 +1,7 @@
 // RUN: %target-parse-verify-swift
 
 // RUN: not %target-swift-frontend -parse -debug-generic-signatures %s > %t.dump 2>&1 
-// RUN: FileCheck -check-prefix CHECK-GENERIC %s < %t.dump
+// RUN: %FileCheck -check-prefix CHECK-GENERIC %s < %t.dump
 
 protocol P1 {
   associatedtype Assoc
diff --git a/test/Generics/generic_types.swift b/test/Generics/generic_types.swift
index 712024f..bb8ca96 100644
--- a/test/Generics/generic_types.swift
+++ b/test/Generics/generic_types.swift
@@ -162,7 +162,7 @@
 
 func useRangeOfPrintables(_ roi : RangeOfPrintables<[Int]>) {
   var rop : RangeOfPrintables<X> // expected-error{{type 'X' does not conform to protocol 'Sequence'}}
-  var rox : RangeOfPrintables<SequenceY> // expected-error{{type 'Element' (aka 'Y') does not conform to protocol 'MyFormattedPrintable'}}
+  var rox : RangeOfPrintables<SequenceY> // expected-error{{type 'SequenceY.Element' (aka 'Y') does not conform to protocol 'MyFormattedPrintable'}}
 }
 
 var dfail : Dictionary<Int> // expected-error{{generic type 'Dictionary' specialized with too few type parameters (got 1, but expected 2)}}
@@ -222,7 +222,7 @@
 
 struct X5<T, U> where T: P, T: Q, T.AssocP == T.AssocQ { } // expected-note{{requirement specified as 'T.AssocP' == 'T.AssocQ' [with T = X4]}}
 
-var y: X5<X4, Int> // expected-error{{'X5' requires the types 'AssocP' (aka 'Int') and 'AssocQ' (aka 'String') be equivalent}}
+var y: X5<X4, Int> // expected-error{{'X5' requires the types 'X4.AssocP' (aka 'Int') and 'X4.AssocQ' (aka 'String') be equivalent}}
 
 // Recursive generic signature validation.
 class Top {}
diff --git a/test/Generics/inheritance.swift b/test/Generics/inheritance.swift
index 8eccfcd..707eb6a 100644
--- a/test/Generics/inheritance.swift
+++ b/test/Generics/inheritance.swift
@@ -56,21 +56,27 @@
 
 
 struct SS<T> : T { } // expected-error{{inheritance from non-protocol type 'T'}}
-enum SE<T> : T { case X } // expected-error{{raw type 'T' is not expressible by any literal}}
-// expected-error@-1{{type 'SE<T>' does not conform to protocol 'RawRepresentable'}}
+enum SE<T> : T { case X } // expected-error{{raw type 'T' is not expressible by any literal}} expected-error {{SE<T>' declares raw type 'T', but does not conform to RawRepresentable and conformance could not be synthesized}}
 
 // Also need Equatable for init?(RawValue)
-enum SE2<T : ExpressibleByIntegerLiteral> 
-  : T // expected-error{{RawRepresentable 'init' cannot be synthesized because raw type 'T' is not Equatable}}
+enum SE2<T : ExpressibleByIntegerLiteral>
+  : T // expected-error {{'SE2<T>' declares raw type 'T', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-error{{RawRepresentable 'init' cannot be synthesized because raw type 'T' is not Equatable}}
 { case X }
 
-// ... but not if init?(RawValue) is directly implemented some other way.
-enum SE3<T : ExpressibleByIntegerLiteral> : T { 
+// ... but not if init?(RawValue) and `rawValue` are directly implemented some other way.
+protocol InstanceGettable {
+  static var someInstance : Self { get }
+}
+enum SE3<T : ExpressibleByIntegerLiteral> : T where T: InstanceGettable {
   case X 
 
   init?(rawValue: T) {
     self = SE3.X
   }
+
+  var rawValue : T {
+    return T.someInstance
+  }
 }
 
 enum SE4<T : ExpressibleByIntegerLiteral & Equatable> : T { case X }
diff --git a/test/Generics/requirement_inference.swift b/test/Generics/requirement_inference.swift
index 9f24b3b..19e3c78 100644
--- a/test/Generics/requirement_inference.swift
+++ b/test/Generics/requirement_inference.swift
@@ -1,6 +1,6 @@
 // RUN: %target-parse-verify-swift -parse %s -verify
 // RUN: %target-parse-verify-swift -parse -debug-generic-signatures %s > %t.dump 2>&1 
-// RUN: FileCheck %s < %t.dump
+// RUN: %FileCheck %s < %t.dump
 
 protocol P1 { 
   func p1()
diff --git a/test/Generics/superclass_constraint.swift b/test/Generics/superclass_constraint.swift
index b9ff602..6e5a18f 100644
--- a/test/Generics/superclass_constraint.swift
+++ b/test/Generics/superclass_constraint.swift
@@ -1,7 +1,7 @@
 // RUN: %target-parse-verify-swift
 
 // RUN: %target-parse-verify-swift -parse -debug-generic-signatures %s > %t.dump 2>&1 
-// RUN: FileCheck %s < %t.dump
+// RUN: %FileCheck %s < %t.dump
 
 class A {
   func foo() { }
@@ -57,7 +57,7 @@
 
 extension P2 where Self.T : C {
   // CHECK: superclass_constraint.(file).P2.concreteTypeWitnessViaSuperclass1
-  // CHECK: Generic signature: <Self where Self : P2, Self.T : C, Self.T : P3, Self.T.T == T>
+  // CHECK: Generic signature: <Self where Self : P2, Self.T : C, Self.T : P3, Self.T.T == C.T>
   // CHECK: Canonical generic signature: <τ_0_0 where τ_0_0 : P2, τ_0_0.T : C, τ_0_0.T : P3, τ_0_0.T.T == Int>
   func concreteTypeWitnessViaSuperclass1(x: Self.T.T) {}
 }
@@ -67,7 +67,7 @@
 // CHECK-NEXT: T witness marker
 // CHECK-NEXT: T : C [explicit @
 // CHECK-NEXT: T : P3 [redundant @
-// CHECK-NEXT: T[.P3].T == T [protocol]
+// CHECK-NEXT: T[.P3].T == C.T [protocol]
 // CHECK: Canonical generic signature for mangling: <τ_0_0 where τ_0_0 : C>
 func superclassConformance1<T>(t: T) where T : C, T : P3 {}
 
@@ -76,7 +76,7 @@
 // CHECK-NEXT: T witness marker
 // CHECK-NEXT: T : C [explicit @
 // CHECK-NEXT: T : P3 [redundant @
-// CHECK-NEXT: T[.P3].T == T [protocol]
+// CHECK-NEXT: T[.P3].T == C.T [protocol]
 // CHECK: Canonical generic signature for mangling: <τ_0_0 where τ_0_0 : C>
 func superclassConformance2<T>(t: T) where T : C, T : P3 {}
 
diff --git a/test/IDE/Inputs/custom-modules/ImportAsMemberError.h b/test/IDE/Inputs/custom-modules/ImportAsMemberError.h
index c3a59e7..96ee073 100644
--- a/test/IDE/Inputs/custom-modules/ImportAsMemberError.h
+++ b/test/IDE/Inputs/custom-modules/ImportAsMemberError.h
@@ -12,18 +12,6 @@
 @end
 typedef NSObject<ImportedProtocolBase> *ImportedProtocolBase_t;
 
-@protocol ErrorProto;
-@protocol ErrorProto <ImportedProtocolBase>
-@end
-
-typedef NSObject<ErrorProto> *ErrorProto_t;
-
-// Instance and static member onto protocol
-void mutateSomeStaticState(void)
-    __attribute__((swift_name("ErrorProto.mutateSomeStaticState()"))); // ok
-void mutateSomeInstanceState(ErrorProto_t self) __attribute__((
-    swift_name("ErrorProto.mutateSomeInstanceState(self:)"))); // error
-
 // Non-prototype declaration
 extern void IAMErrorStructHasPrototype(void)
     __attribute__((swift_name("ErrorStruct.hasPrototype()"))); // ok
diff --git a/test/IDE/Inputs/custom-modules/ImportAsMemberProto.h b/test/IDE/Inputs/custom-modules/ImportAsMemberProto.h
deleted file mode 100644
index afb49b7..0000000
--- a/test/IDE/Inputs/custom-modules/ImportAsMemberProto.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef IMPORT_AS_MEMBER_PROTO_H
-#define IMPORT_AS_MEMBER_PROTO_H
-
-@import Foundation;
-
-@protocol ImportedProtocolBase;
-@protocol ImportedProtocolBase <NSObject>
-@end
-typedef NSObject<ImportedProtocolBase> * ImportedProtocolBase_t;
-
-@protocol IAMProto;
-@protocol IAMProto <ImportedProtocolBase>
-@end
-
-typedef NSObject<IAMProto> * IAMProto_t;
-
-void mutateSomeState(IAMProto_t)
-__attribute__((swift_name("IAMProto.mutateSomeState(self:)")));
-
-void mutateSomeStateWithParameter(IAMProto_t, NSInteger)
-__attribute__((swift_name("IAMProto.mutateSomeState(self:withParameter:)")));
-
-void mutateSomeStateWithFirstParameter(NSInteger, IAMProto_t)
-__attribute__((swift_name("IAMProto.mutateSomeState(withFirstParameter:self:)")));
-
-int getSomeValue(IAMProto_t)
-__attribute__((swift_name("getter:IAMProto.someValue(self:)")));
-int setSomeValue(IAMProto_t, int v)
-__attribute__((swift_name("setter:IAMProto.someValue(self:_:)")));
-
-#endif // IMPORT_AS_MEMBER_PROTO_H
diff --git a/test/IDE/Inputs/custom-modules/module.map b/test/IDE/Inputs/custom-modules/module.map
index e10c151..56e566f 100644
--- a/test/IDE/Inputs/custom-modules/module.map
+++ b/test/IDE/Inputs/custom-modules/module.map
@@ -37,11 +37,6 @@
     header "ImportAsMemberC.h"
   }
 
-  module Proto {
-    requires objc
-    header "ImportAsMemberProto.h"
-  }
-
   module Class {
     requires objc
     header "ImportAsMemberClass.h"
diff --git a/test/IDE/annotation.swift b/test/IDE/annotation.swift
index 02365a6..cf1c87c 100644
--- a/test/IDE/annotation.swift
+++ b/test/IDE/annotation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -annotate -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -annotate -source-filename %s | %FileCheck %s
 
 // CHECK: import struct <iMod>Swift</iMod>.<iStruct@>Int</iStruct>
 import struct Swift.Int
diff --git a/test/IDE/annotation_foundation.swift b/test/IDE/annotation_foundation.swift
index e469675..6ee3443 100644
--- a/test/IDE/annotation_foundation.swift
+++ b/test/IDE/annotation_foundation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -annotate -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -annotate -source-filename %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/coloring.swift b/test/IDE/coloring.swift
index ad764e3..49eaf9b 100644
--- a/test/IDE/coloring.swift
+++ b/test/IDE/coloring.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -syntax-coloring -source-filename %s | FileCheck %s
-// RUN: %target-swift-ide-test -syntax-coloring -typecheck -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -syntax-coloring -source-filename %s | %FileCheck %s
+// RUN: %target-swift-ide-test -syntax-coloring -typecheck -source-filename %s | %FileCheck %s
 // XFAIL: broken_std_regex
 
 #line 17 "abc.swift"
diff --git a/test/IDE/coloring_configs.swift b/test/IDE/coloring_configs.swift
index 0d15972..7c8dfb3 100644
--- a/test/IDE/coloring_configs.swift
+++ b/test/IDE/coloring_configs.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -syntax-coloring -source-filename %s -D CONF | FileCheck %s
+// RUN: %target-swift-ide-test -syntax-coloring -source-filename %s -D CONF | %FileCheck %s
 
 // CHECK: <kw>var</kw> f : <type>Int</type>
 var f : Int
diff --git a/test/IDE/coloring_playground.swift b/test/IDE/coloring_playground.swift
index 15db69d..03b460c 100644
--- a/test/IDE/coloring_playground.swift
+++ b/test/IDE/coloring_playground.swift
@@ -1,6 +1,6 @@
 // REQUIRES: objc_interop
-// RUN: %target-swift-ide-test -syntax-coloring -playground -source-filename %s | FileCheck %s
-// RUN: %target-swift-ide-test -syntax-coloring -playground -typecheck -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -syntax-coloring -playground -source-filename %s | %FileCheck %s
+// RUN: %target-swift-ide-test -syntax-coloring -playground -typecheck -source-filename %s | %FileCheck %s
 
 //: playground doc comment line
 func playgroundCommentLine(f : () throws -> ()) rethrows {}
diff --git a/test/IDE/comment_attach.swift b/test/IDE/comment_attach.swift
index 3f2e848..0c00d6c 100644
--- a/test/IDE/comment_attach.swift
+++ b/test/IDE/comment_attach.swift
@@ -220,8 +220,8 @@
 func unterminatedBlockDocComment() {}
 
 // RUN: %target-swift-ide-test -print-comments -source-filename %s > %t.txt
-// RUN: FileCheck %s -check-prefix=WRONG < %t.txt
-// RUN: FileCheck %s < %t.txt
+// RUN: %FileCheck %s -check-prefix=WRONG < %t.txt
+// RUN: %FileCheck %s < %t.txt
 
 // Some comments are not attached to anything.
 // WRONG-NOT: IS_DOC_NOT_ATTACHED
diff --git a/test/IDE/comment_attach_huge.swift b/test/IDE/comment_attach_huge.swift
index 04f35b9..b7a8e31 100644
--- a/test/IDE/comment_attach_huge.swift
+++ b/test/IDE/comment_attach_huge.swift
@@ -846,7 +846,7 @@
 */
 func decl_func_1() {}
 
-// RUN: %target-swift-ide-test -print-comments -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -print-comments -source-filename %s | %FileCheck %s
 
 // CHECK: Func/decl_func_1 RawComment=[/**\nBEGIN\n{{[^]]*}}\nEND\n*/]
 
diff --git a/test/IDE/comment_brief.swift b/test/IDE/comment_brief.swift
index 1af3f27..1409f3e 100644
--- a/test/IDE/comment_brief.swift
+++ b/test/IDE/comment_brief.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -print-comments -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -print-comments -source-filename %s | %FileCheck %s
 // REQUIRES: no_asan
 
 ///
diff --git a/test/IDE/comment_extensions.swift b/test/IDE/comment_extensions.swift
index 664f326..1d48c13 100644
--- a/test/IDE/comment_extensions.swift
+++ b/test/IDE/comment_extensions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -print-comments -source-filename %S/Inputs/comment_extensions.swift -comments-xml-schema %S/../../bindings/xml/comment-xml-schema.rng | FileCheck %s
+// RUN: %target-swift-ide-test -print-comments -source-filename %S/Inputs/comment_extensions.swift -comments-xml-schema %S/../../bindings/xml/comment-xml-schema.rng | %FileCheck %s
 
 // Content is in separate file in ./Inputs due to the "requires" keyword getting
 // recognized by lit.
diff --git a/test/IDE/comment_inherited_class.swift b/test/IDE/comment_inherited_class.swift
index 0d52213..ca3ebff 100644
--- a/test/IDE/comment_inherited_class.swift
+++ b/test/IDE/comment_inherited_class.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -print-comments -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -print-comments -source-filename %s | %FileCheck %s
 // REQUIRES: no_asan
 
 class Base {
diff --git a/test/IDE/comment_inherited_protocol.swift b/test/IDE/comment_inherited_protocol.swift
index 6f984ad..ec813b8 100644
--- a/test/IDE/comment_inherited_protocol.swift
+++ b/test/IDE/comment_inherited_protocol.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -print-comments -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -print-comments -source-filename %s | %FileCheck %s
 
 protocol ParentProtocol1 {
   /// ParentProtocol1.onlyParent1()
diff --git a/test/IDE/comment_measurement.swift b/test/IDE/comment_measurement.swift
index 71a54d6..d1127e7 100644
--- a/test/IDE/comment_measurement.swift
+++ b/test/IDE/comment_measurement.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -print-comments -source-filename %s -comments-xml-schema %S/../../bindings/xml/comment-xml-schema.rng | FileCheck %s
+// RUN: %target-swift-ide-test -print-comments -source-filename %s -comments-xml-schema %S/../../bindings/xml/comment-xml-schema.rng | %FileCheck %s
 
 /// Brief.
 ///
diff --git a/test/IDE/comment_merge.swift b/test/IDE/comment_merge.swift
index 75ce666..563670d 100644
--- a/test/IDE/comment_merge.swift
+++ b/test/IDE/comment_merge.swift
@@ -93,8 +93,8 @@
 func is_doc19() {}
 
 // RUN: %target-swift-ide-test -print-comments -source-filename %s > %t.txt
-// RUN: FileCheck %s -check-prefix=WRONG < %t.txt
-// RUN: FileCheck %s < %t.txt
+// RUN: %FileCheck %s -check-prefix=WRONG < %t.txt
+// RUN: %FileCheck %s < %t.txt
 
 // Non-documentation comments should not be attached to anything.
 // WRONG-NOT: NOT_DOC
diff --git a/test/IDE/comment_to_xml.swift b/test/IDE/comment_to_xml.swift
index 85e3fb5..af833b3 100644
--- a/test/IDE/comment_to_xml.swift
+++ b/test/IDE/comment_to_xml.swift
@@ -2,8 +2,8 @@
 
 // RUN: %target-swift-frontend -parse -verify -disable-objc-attr-requires-foundation-module %S/../Inputs/comment_to_something_conversion.swift
 // RUN: %target-swift-ide-test -print-comments -source-filename %S/../Inputs/comment_to_something_conversion.swift -comments-xml-schema %S/../../bindings/xml/comment-xml-schema.rng > %t.txt
-// RUN: FileCheck %S/../Inputs/comment_to_something_conversion.swift < %t.txt
-// RUN: FileCheck %s -check-prefix=WRONG < %t.txt
+// RUN: %FileCheck %S/../Inputs/comment_to_something_conversion.swift < %t.txt
+// RUN: %FileCheck %s -check-prefix=WRONG < %t.txt
 
 // REQUIRES: no_asan
 // WRONG-NOT: CommentXMLInvalid
diff --git a/test/IDE/compatibility_alias.swift b/test/IDE/compatibility_alias.swift
index 776d5f8..947daa0 100644
--- a/test/IDE/compatibility_alias.swift
+++ b/test/IDE/compatibility_alias.swift
@@ -3,7 +3,7 @@
 // RUN: %build-clang-importer-objc-overlays
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk-nosource) -I %t -I %S/Inputs/custom-modules -print-module -source-filename %s -module-to-print=CompatibilityAlias > %t.printed.CompatibilityAlias.txt
-// RUN: FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.CompatibilityAlias.txt
+// RUN: %FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.CompatibilityAlias.txt
 // RUN: %target-parse-verify-swift -sdk %clang-importer-sdk -I %S/Inputs/custom-modules -I %t %s
 
 // REQUIRES: objc_interop
diff --git a/test/IDE/complete_after_self.swift b/test/IDE/complete_after_self.swift
index 3b62173..992a9dd 100644
--- a/test/IDE/complete_after_self.swift
+++ b/test/IDE/complete_after_self.swift
@@ -1,32 +1,32 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SELF_NO_DOT_1 > %t.self.txt
-// RUN: FileCheck %s -check-prefix=CONSTRUCTOR_SELF_NO_DOT_1 < %t.self.txt
-// RUN: FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SELF_NO_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SELF_DOT_1 > %t.self.txt
-// RUN: FileCheck %s -check-prefix=CONSTRUCTOR_SELF_DOT_1 < %t.self.txt
-// RUN: FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SELF_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SELF_NO_DOT_1 > %t.self.txt
-// RUN: FileCheck %s -check-prefix=DESTRUCTOR_SELF_NO_DOT_1 < %t.self.txt
-// RUN: FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SELF_NO_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SELF_DOT_1 > %t.self.txt
-// RUN: FileCheck %s -check-prefix=DESTRUCTOR_SELF_DOT_1 < %t.self.txt
-// RUN: FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SELF_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SELF_NO_DOT_1 > %t.self.txt
-// RUN: FileCheck %s -check-prefix=FUNC_SELF_NO_DOT_1 < %t.self.txt
-// RUN: FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=FUNC_SELF_NO_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_SELF_NO_DOT_1 < %t.self.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SELF_DOT_1 > %t.self.txt
-// RUN: FileCheck %s -check-prefix=FUNC_SELF_DOT_1 < %t.self.txt
-// RUN: FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=FUNC_SELF_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_SELF_DOT_1 < %t.self.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_STATIC_SELF_NO_DOT_1 > %t.self.txt
-// RUN: FileCheck %s -check-prefix=FUNC_STATIC_SELF_NO_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=FUNC_STATIC_SELF_NO_DOT_1 < %t.self.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_STATIC_SELF_DOT_1 > %t.self.txt
-// RUN: FileCheck %s -check-prefix=FUNC_STATIC_SELF_DOT_1 < %t.self.txt
+// RUN: %FileCheck %s -check-prefix=FUNC_STATIC_SELF_DOT_1 < %t.self.txt
 
 //===---
 //===--- Tests for code completion after 'self'.
diff --git a/test/IDE/complete_after_super.swift b/test/IDE/complete_after_super.swift
index 82ca414..624943b 100644
--- a/test/IDE/complete_after_super.swift
+++ b/test/IDE/complete_after_super.swift
@@ -2,105 +2,105 @@
 // RUN: %target-swift-frontend -verify -parse %t_no_errors.swift
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SUPER_NO_DOT_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_A_NO_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_NO_DOT_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_A_NO_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_NO_DOT_1 < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SUPER_DOT_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_DOT_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_DOT_1 < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SUPER_INIT_PAREN_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_INIT_PAREN_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_INIT_PAREN_1 < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SUPER_NO_DOT_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_A_NO_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=DESTRUCTOR_SUPER_NO_DOT_1 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_A_NO_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SUPER_NO_DOT_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SUPER_DOT_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=DESTRUCTOR_SUPER_DOT_1 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SUPER_DOT_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SUPER_NO_DOT_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_A_NO_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=FUNC_SUPER_NO_DOT_1 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_A_NO_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=FUNC_SUPER_NO_DOT_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SUPER_DOT_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=FUNC_SUPER_DOT_1 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=FUNC_SUPER_DOT_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SUPER_NO_DOT_2 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_B_NO_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_NO_DOT_2 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_B_NO_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_NO_DOT_2 < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRUCTOR_SUPER_DOT_2 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_B_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_DOT_2 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_B_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=CONSTRUCTOR_SUPER_DOT_2 < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SUPER_NO_DOT_2 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_B_NO_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=DESTRUCTOR_SUPER_NO_DOT_2 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_B_NO_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SUPER_NO_DOT_2 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DESTRUCTOR_SUPER_DOT_2 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_B_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=DESTRUCTOR_SUPER_DOT_2 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_B_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=DESTRUCTOR_SUPER_DOT_2 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SUPER_NO_DOT_2 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_B_NO_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=FUNC_SUPER_NO_DOT_2 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_B_NO_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=FUNC_SUPER_NO_DOT_2 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_SUPER_DOT_2 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_B_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=FUNC_SUPER_DOT_2 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_B_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=FUNC_SUPER_DOT_2 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_1 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_2 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_2 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_2 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_3 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_3 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_3 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_4 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_4 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_4 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_5 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_5 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=SEMANTIC_CONTEXT_OVERRIDDEN_DECL_5 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=CLOSURE_1 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=CLOSURE_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_2 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
-// RUN: FileCheck %s -check-prefix=CLOSURE_2 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=COMMON_BASE_A_DOT < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=CLOSURE_2 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_CAPTURE_1 > %t.super.txt
-// RUN: FileCheck %s -check-prefix=CLOSURE_CAPTURE_1 < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
-// RUN: FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=CLOSURE_CAPTURE_1 < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_SUPER_DECLS < %t.super.txt
+// RUN: %FileCheck %s -check-prefix=NO_CONSTRUCTORS < %t.super.txt
 
 // NO_CONSTRUCTORS-NOT: init(
 
diff --git a/test/IDE/complete_assignment.swift b/test/IDE/complete_assignment.swift
index 100d38e..80c5c93 100644
--- a/test/IDE/complete_assignment.swift
+++ b/test/IDE/complete_assignment.swift
@@ -1,24 +1,24 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_1 | FileCheck %s -check-prefix=ASSIGN_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_2 | FileCheck %s -check-prefix=ASSIGN_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_3 | FileCheck %s -check-prefix=ASSIGN_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_4 | FileCheck %s -check-prefix=ASSIGN_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_5 | FileCheck %s -check-prefix=ASSIGN_5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_6 | FileCheck %s -check-prefix=ASSIGN_6
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_1 | %FileCheck %s -check-prefix=ASSIGN_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_2 | %FileCheck %s -check-prefix=ASSIGN_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_3 | %FileCheck %s -check-prefix=ASSIGN_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_4 | %FileCheck %s -check-prefix=ASSIGN_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_5 | %FileCheck %s -check-prefix=ASSIGN_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_6 | %FileCheck %s -check-prefix=ASSIGN_6
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_7 | FileCheck %s -check-prefix=ASSIGN_7
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_8 | FileCheck %s -check-prefix=ASSIGN_8
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_9 | FileCheck %s -check-prefix=ASSIGN_9
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_10 | FileCheck %s -check-prefix=ASSIGN_10
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_11 | FileCheck %s -check-prefix=ASSIGN_11
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_12 | FileCheck %s -check-prefix=ASSIGN_12
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_7 | %FileCheck %s -check-prefix=ASSIGN_7
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_8 | %FileCheck %s -check-prefix=ASSIGN_8
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_9 | %FileCheck %s -check-prefix=ASSIGN_9
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_10 | %FileCheck %s -check-prefix=ASSIGN_10
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_11 | %FileCheck %s -check-prefix=ASSIGN_11
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_12 | %FileCheck %s -check-prefix=ASSIGN_12
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_13 | FileCheck %s -check-prefix=ASSIGN_13
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_14 | FileCheck %s -check-prefix=ASSIGN_14
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_15 | FileCheck %s -check-prefix=ASSIGN_15
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_16 | FileCheck %s -check-prefix=ASSIGN_16
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_17 | FileCheck %s -check-prefix=ASSIGN_17
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_18 | FileCheck %s -check-prefix=ASSIGN_18
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_19 | FileCheck %s -check-prefix=ASSIGN_19
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_13 | %FileCheck %s -check-prefix=ASSIGN_13
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_14 | %FileCheck %s -check-prefix=ASSIGN_14
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_15 | %FileCheck %s -check-prefix=ASSIGN_15
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_16 | %FileCheck %s -check-prefix=ASSIGN_16
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_17 | %FileCheck %s -check-prefix=ASSIGN_17
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_18 | %FileCheck %s -check-prefix=ASSIGN_18
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGN_19 | %FileCheck %s -check-prefix=ASSIGN_19
 
 class C1 {
 var I1 = 1
diff --git a/test/IDE/complete_associated_types.swift b/test/IDE/complete_associated_types.swift
index 49b8d75..4b05781 100644
--- a/test/IDE/complete_associated_types.swift
+++ b/test/IDE/complete_associated_types.swift
@@ -2,23 +2,23 @@
 // RUN: %target-swift-frontend -parse -verify %t_no_errors.swift
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_AS_TYPE > %t.types.txt
-// RUN: FileCheck %s -check-prefix=STRUCT_TYPE_COUNT < %t.types.txt
-// RUN: FileCheck %s -check-prefix=STRUCT_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=STRUCT_TYPE_COUNT < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=STRUCT_TYPES < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_AS_EXPR > %t.types.txt
-// RUN: FileCheck %s -check-prefix=STRUCT_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=STRUCT_TYPES < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INSTANCE > %t.types.txt
-// RUN: FileCheck %s -check-prefix=STRUCT_INSTANCE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=STRUCT_INSTANCE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSOCIATED_TYPES_UNQUAL_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=ASSOCIATED_TYPES_UNQUAL < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=ASSOCIATED_TYPES_UNQUAL < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSOCIATED_TYPES_UNQUAL_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=ASSOCIATED_TYPES_UNQUAL < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=ASSOCIATED_TYPES_UNQUAL < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BROKEN_CONFORMANCE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=BROKEN_CONFORMANCE_1 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=BROKEN_CONFORMANCE_1 < %t.types.txt
 
 // FIXME: extensions that introduce conformances?
 
@@ -267,35 +267,35 @@
   StructWithBrokenConformance.#^BROKEN_CONFORMANCE_1^#
 }
 // BROKEN_CONFORMANCE_1: Begin completions, 34 items
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DefaultedTypeCommonA[#DefaultedTypeCommonA#]; name=DefaultedTypeCommonA
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DefaultedTypeCommonB[#DefaultedTypeCommonB#]; name=DefaultedTypeCommonB
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDefaultedTypeB[#FooBaseDefaultedTypeB#]; name=FooBaseDefaultedTypeB
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DeducedTypeCommonA[#DeducedTypeCommonA#]; name=DeducedTypeCommonA
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DeducedTypeCommonB[#DeducedTypeCommonB#]; name=DeducedTypeCommonB
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DefaultedTypeCommonA[#StructWithBrokenConformance.DefaultedTypeCommonA#]; name=DefaultedTypeCommonA
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DefaultedTypeCommonB[#StructWithBrokenConformance.DefaultedTypeCommonB#]; name=DefaultedTypeCommonB
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDefaultedTypeB[#StructWithBrokenConformance.FooBaseDefaultedTypeB#]; name=FooBaseDefaultedTypeB
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DeducedTypeCommonA[#StructWithBrokenConformance.DeducedTypeCommonA#]; name=DeducedTypeCommonA
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DeducedTypeCommonB[#StructWithBrokenConformance.DeducedTypeCommonB#]; name=DeducedTypeCommonB
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceCommonA({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonA#]{{; name=.+$}}
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceCommonB({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonB#]{{; name=.+$}}
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceFooBaseB({#self: StructWithBrokenConformance.Type#})[#() -> Int#]{{; name=.+$}}
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooDefaultedType[#FooDefaultedType#]; name=FooDefaultedType
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooDeducedTypeB[#FooDeducedTypeB#]; name=FooDeducedTypeB
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooDeducedTypeC[#FooDeducedTypeC#]; name=FooDeducedTypeC
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooDeducedTypeD[#FooDeducedTypeD#]; name=FooDeducedTypeD
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooDefaultedType[#StructWithBrokenConformance.FooDefaultedType#]; name=FooDefaultedType
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooDeducedTypeB[#StructWithBrokenConformance.FooDeducedTypeB#]; name=FooDeducedTypeB
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooDeducedTypeC[#StructWithBrokenConformance.FooDeducedTypeC#]; name=FooDeducedTypeC
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooDeducedTypeD[#StructWithBrokenConformance.FooDeducedTypeD#]; name=FooDeducedTypeD
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceFooB({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooDeducedTypeB#]{{; name=.+$}}
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceFooC({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooDeducedTypeC#]{{; name=.+$}}
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceFooD({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooDeducedTypeD#]{{; name=.+$}}
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DefaultedTypeCommonC[#DefaultedTypeCommonC#]; name=DefaultedTypeCommonC
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DefaultedTypeCommonD[#DefaultedTypeCommonD#]; name=DefaultedTypeCommonD
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDefaultedTypeA[#FooBaseDefaultedTypeA#]; name=FooBaseDefaultedTypeA
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDefaultedTypeC[#FooBaseDefaultedTypeC#]; name=FooBaseDefaultedTypeC
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DeducedTypeCommonC[#DeducedTypeCommonC#]; name=DeducedTypeCommonC
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DeducedTypeCommonD[#DeducedTypeCommonD#]; name=DeducedTypeCommonD
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DefaultedTypeCommonC[#StructWithBrokenConformance.DefaultedTypeCommonC#]; name=DefaultedTypeCommonC
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DefaultedTypeCommonD[#StructWithBrokenConformance.DefaultedTypeCommonD#]; name=DefaultedTypeCommonD
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDefaultedTypeA[#StructWithBrokenConformance.FooBaseDefaultedTypeA#]; name=FooBaseDefaultedTypeA
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDefaultedTypeC[#StructWithBrokenConformance.FooBaseDefaultedTypeC#]; name=FooBaseDefaultedTypeC
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DeducedTypeCommonC[#StructWithBrokenConformance.DeducedTypeCommonC#]; name=DeducedTypeCommonC
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        DeducedTypeCommonD[#StructWithBrokenConformance.DeducedTypeCommonD#]; name=DeducedTypeCommonD
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceCommonA({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonA#]{{; name=.+$}}
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceCommonB({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonB#]{{; name=.+$}}
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceCommonC({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonC#]{{; name=.+$}}
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceCommonD({#self: StructWithBrokenConformance.Type#})[#() -> Self.DeducedTypeCommonD#]{{; name=.+$}}
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDeducedTypeA[#FooBaseDeducedTypeA#]; name=FooBaseDeducedTypeA
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDeducedTypeB[#FooBaseDeducedTypeB#]; name=FooBaseDeducedTypeB
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDeducedTypeC[#FooBaseDeducedTypeC#]; name=FooBaseDeducedTypeC
-// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDeducedTypeD[#FooBaseDeducedTypeD#]; name=FooBaseDeducedTypeD
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDeducedTypeA[#StructWithBrokenConformance.FooBaseDeducedTypeA#]; name=FooBaseDeducedTypeA
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDeducedTypeB[#StructWithBrokenConformance.FooBaseDeducedTypeB#]; name=FooBaseDeducedTypeB
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDeducedTypeC[#StructWithBrokenConformance.FooBaseDeducedTypeC#]; name=FooBaseDeducedTypeC
+// BROKEN_CONFORMANCE_1-DAG: Decl[TypeAlias]/CurrNominal:        FooBaseDeducedTypeD[#StructWithBrokenConformance.FooBaseDeducedTypeD#]; name=FooBaseDeducedTypeD
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceFooBaseA({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooBaseDeducedTypeA#]{{; name=.+$}}
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceFooBaseB({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooBaseDeducedTypeB#]{{; name=.+$}}
 // BROKEN_CONFORMANCE_1-DAG: Decl[InstanceMethod]/Super:         deduceFooBaseC({#self: StructWithBrokenConformance.Type#})[#() -> Self.FooBaseDeducedTypeC#]{{; name=.+$}}
diff --git a/test/IDE/complete_at_eof_1.swift b/test/IDE/complete_at_eof_1.swift
index 60e2e49..d2fba46 100644
--- a/test/IDE/complete_at_eof_1.swift
+++ b/test/IDE/complete_at_eof_1.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 
 // Make sure we can code complete at EOF.
 // Don't add any tests at the end of the file!
diff --git a/test/IDE/complete_at_eof_in_call_1.swift b/test/IDE/complete_at_eof_in_call_1.swift
index 9cb31c9..e8b5bd8 100644
--- a/test/IDE/complete_at_eof_in_call_1.swift
+++ b/test/IDE/complete_at_eof_in_call_1.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 
 // Make sure we can code complete at EOF.
 // Don't add any tests at the end of the file!
diff --git a/test/IDE/complete_at_eof_in_call_no_newline_1.swift b/test/IDE/complete_at_eof_in_call_no_newline_1.swift
index 9cb31c9..81e7347 100644
--- a/test/IDE/complete_at_eof_in_call_no_newline_1.swift
+++ b/test/IDE/complete_at_eof_in_call_no_newline_1.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 
 // Make sure we can code complete at EOF.
 // Don't add any tests at the end of the file!
@@ -7,4 +7,4 @@
 // A-DAG: Pattern/ExprSpecific:               ['(']{#(x): Int#})[#Void#]{{; name=.+$}}
 // A: End completions
 func f(_ x: Int) {}
-f(#^A^#
+f(#^A^#
\ No newline at end of file
diff --git a/test/IDE/complete_at_eof_no_newline_1.swift b/test/IDE/complete_at_eof_no_newline_1.swift
index 6d4651a..dd0df39 100644
--- a/test/IDE/complete_at_eof_no_newline_1.swift
+++ b/test/IDE/complete_at_eof_no_newline_1.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 
 // Make sure we can code complete at EOF when there is no newline in the last
 // line.
@@ -13,4 +13,4 @@
 }
 var fooObject: FooStruct
 // There is no newline on the following line.  Don't fix this!
-fooObject.#^A^#
+fooObject.#^A^#
\ No newline at end of file
diff --git a/test/IDE/complete_at_eof_no_newline_2.swift b/test/IDE/complete_at_eof_no_newline_2.swift
index 740d2db..eb9065b 100644
--- a/test/IDE/complete_at_eof_no_newline_2.swift
+++ b/test/IDE/complete_at_eof_no_newline_2.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 
 // Make sure we can code complete at EOF when there is no newline in the last
 // line.
@@ -10,4 +10,4 @@
 // A: End completions
 func f() {}
 // There is no newline on the following line.  Don't fix this!
-#^A^#
+#^A^#
\ No newline at end of file
diff --git a/test/IDE/complete_at_start_1.swift b/test/IDE/complete_at_start_1.swift
index d604a10..c5c410b 100644
--- a/test/IDE/complete_at_start_1.swift
+++ b/test/IDE/complete_at_start_1.swift
@@ -2,7 +2,7 @@
 
 // Make sure we can code complete at the beginning of the file.
 // rdar://14585108
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 // A: Begin completions
 // A-DAG: Keyword[func]/None: func{{; name=.+$}}
 // A-DAG: Literal[Boolean]/None: true[#Bool#]{{; name=.+$}}
diff --git a/test/IDE/complete_at_top_level.swift b/test/IDE/complete_at_top_level.swift
index 378dd72..f45d409 100644
--- a/test/IDE/complete_at_top_level.swift
+++ b/test/IDE/complete_at_top_level.swift
@@ -1,117 +1,117 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_1 | FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_2 | FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_3 | FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_4 | FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_5 | FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_6 | FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_1 | %FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_2 | %FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_3 | %FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_4 | %FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_5 | %FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_6 | %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_KW_1 | FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_KW_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_WITH_ERROR_IN_INIT_1 | FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_WITH_ERROR_IN_INIT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_KW_1 | %FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_KW_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_CHECKED_EXPR_WITH_ERROR_IN_INIT_1 | %FileCheck %s -check-prefix=TYPE_CHECKED_EXPR_WITH_ERROR_IN_INIT_1
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_INIT_1 > %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_INIT_1 < %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_INIT_1_NEGATIVE < %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_INIT_1 < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_INIT_1_NEGATIVE < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_INIT_2 | FileCheck %s -check-prefix=TOP_LEVEL_VAR_INIT_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_INIT_2 | %FileCheck %s -check-prefix=TOP_LEVEL_VAR_INIT_2
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLAIN_TOP_LEVEL_1 > %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=PLAIN_TOP_LEVEL_NO_DUPLICATES < %t.toplevel.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLAIN_TOP_LEVEL_2 | FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
+// RUN: %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL_NO_DUPLICATES < %t.toplevel.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLAIN_TOP_LEVEL_2 | %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_CLOSURE_1 | FileCheck %s -check-prefix=TOP_LEVEL_CLOSURE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_CLOSURE_1 | %FileCheck %s -check-prefix=TOP_LEVEL_CLOSURE_1
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_TYPE_1 > %t.toplevel.1.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.1.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.1.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.1.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.1.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.1.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.1.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_TYPE_2 > %t.toplevel.2.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.2.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.2.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.2.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.2.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.2.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.2.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_TYPE_3 > %t.toplevel.3.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.3.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.3.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.3.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.3.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.3.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.3.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_TYPE_4 > %t.toplevel.4.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.4.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.4.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.4.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.4.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.4.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE < %t.toplevel.4.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_TYPE_5 > %t.toplevel.5.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.5.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.5.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.5.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.5.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_TYPE_5 > %t.toplevel.5.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.5.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.5.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.5.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.5.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_VAR_TYPE_6 > %t.toplevel.6.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.6.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.6.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel.6.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel.6.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_EXPR_TYPE_1 > %t.toplevel-expr.1.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.1.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.1.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.1.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.1.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_EXPR_TYPE_2 > %t.toplevel-expr.2.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.2.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.2.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.2.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.2.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_EXPR_TYPE_3 > %t.toplevel-expr.3.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.3.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.3.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.3.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.3.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_EXPR_TYPE_4 > %t.toplevel-expr.4.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.4.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.4.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.4.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.4.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_EXPR_TYPE_2 > %t.toplevel-expr.2.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.2.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.2.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_1 < %t.toplevel-expr.2.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_VAR_TYPE_NEGATIVE_1 < %t.toplevel-expr.2.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_1 | FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_2 | FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_3 | FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_4 | FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_1 | %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_2 | %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_3 | %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_4 | %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_5 > %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_STMT_5 < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_STMT_5 < %t.toplevel.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_6 > %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_STMT_6 < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_STMT_6 < %t.toplevel.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_7 > %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_STMT_7 < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_STMT_7 < %t.toplevel.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_8 > %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_STMT_8 < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_STMT_8 < %t.toplevel.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_9 | FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_10 | FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_9 | %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_STMT_10 | %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_AUTOCLOSURE_1 | FileCheck %s -check-prefix=AUTOCLOSURE_STRING
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_AUTOCLOSURE_1 | %FileCheck %s -check-prefix=AUTOCLOSURE_STRING
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_SWITCH_CASE_1 | FileCheck %s -check-prefix=TOP_LEVEL_SWITCH_CASE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_SWITCH_CASE_1 | %FileCheck %s -check-prefix=TOP_LEVEL_SWITCH_CASE_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_BEFORE_GUARD_NAME_1 | FileCheck %s -check-prefix=TOP_LEVEL_BEFORE_GUARD_NAME
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_BEFORE_GUARD_NAME_2 | FileCheck %s -check-prefix=TOP_LEVEL_BEFORE_GUARD_NAME
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_BEFORE_GUARD_NAME_1 | %FileCheck %s -check-prefix=TOP_LEVEL_BEFORE_GUARD_NAME
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_BEFORE_GUARD_NAME_2 | %FileCheck %s -check-prefix=TOP_LEVEL_BEFORE_GUARD_NAME
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_GUARD_1 | FileCheck %s -check-prefix=TOP_LEVEL_GUARD
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_GUARD_2 | FileCheck %s -check-prefix=TOP_LEVEL_GUARD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_GUARD_1 | %FileCheck %s -check-prefix=TOP_LEVEL_GUARD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_GUARD_2 | %FileCheck %s -check-prefix=TOP_LEVEL_GUARD
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERP_1 | FileCheck %s -check-prefix=STRING_INTERP
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERP_2 | FileCheck %s -check-prefix=STRING_INTERP
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERP_3 | FileCheck %s -check-prefix=STRING_INTERP
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERP_4 | FileCheck %s -check-prefix=STRING_INTERP
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERP_1 | %FileCheck %s -check-prefix=STRING_INTERP
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERP_2 | %FileCheck %s -check-prefix=STRING_INTERP
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERP_3 | %FileCheck %s -check-prefix=STRING_INTERP
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRING_INTERP_4 | %FileCheck %s -check-prefix=STRING_INTERP
 
 // Test code completion in top-level code.
 //
diff --git a/test/IDE/complete_attributes.swift b/test/IDE/complete_attributes.swift
index 9f24c21..3a46ca8 100644
--- a/test/IDE/complete_attributes.swift
+++ b/test/IDE/complete_attributes.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_ATTR_1 -code-completion-keywords=false | FileCheck %s -check-prefix=ERROR_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_DECL_ATTR_1 -code-completion-keywords=false | FileCheck %s -check-prefix=ERROR_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_ATTR_1 -code-completion-keywords=false | %FileCheck %s -check-prefix=ERROR_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_DECL_ATTR_1 -code-completion-keywords=false | %FileCheck %s -check-prefix=ERROR_COMMON
 
 // ERROR_COMMON: found code completion token
 // ERROR_COMMON-NOT: Begin completions
diff --git a/test/IDE/complete_cache.swift b/test/IDE/complete_cache.swift
index e354d57..8e3f272 100644
--- a/test/IDE/complete_cache.swift
+++ b/test/IDE/complete_cache.swift
@@ -2,42 +2,42 @@
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CLANG_UNQUAL_1 -completion-cache-path=%t.ccp > %t.ccp1.compl.txt
 // RUN: cp -r %t.ccp %t.ccp.bak
-// RUN: FileCheck %s -check-prefix=CLANG_CTYPES < %t.ccp1.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_MACROS < %t.ccp1.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_DARWIN < %t.ccp1.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_DARWIN_NEG < %t.ccp1.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_CTYPES < %t.ccp1.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_MACROS < %t.ccp1.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_DARWIN < %t.ccp1.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_DARWIN_NEG < %t.ccp1.compl.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CLANG_UNQUAL_1 -completion-cache-path=%t.ccp > %t.ccp2.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_CTYPES < %t.ccp2.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_MACROS < %t.ccp2.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_DARWIN < %t.ccp2.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_DARWIN_NEG < %t.ccp2.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_CTYPES < %t.ccp2.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_MACROS < %t.ccp2.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_DARWIN < %t.ccp2.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_DARWIN_NEG < %t.ccp2.compl.txt
 
 // Check for modifications to cache
 // RUN: diff -r -u %t.ccp %t.ccp.bak
 
 // Check the individual cache items.
-// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/macros-* | FileCheck %s -check-prefix=CLANG_MACROS
-// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/ctypes-* | FileCheck %s -check-prefix=CLANG_CTYPES
-// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/Darwin-* | FileCheck %s -check-prefix=CLANG_DARWIN
-// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/Darwin-* | FileCheck %s -check-prefix=CLANG_DARWIN_NEG
+// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/macros-* | %FileCheck %s -check-prefix=CLANG_MACROS
+// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/ctypes-* | %FileCheck %s -check-prefix=CLANG_CTYPES
+// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/Darwin-* | %FileCheck %s -check-prefix=CLANG_DARWIN
+// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/Darwin-* | %FileCheck %s -check-prefix=CLANG_DARWIN_NEG
 
 
 // Qualified.
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CLANG_QUAL_MACROS_1 -completion-cache-path=%t.ccp > %t.macros.ccp1.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_QUAL_MACROS_1 -check-prefix=CLANG_QUAL_MACROS_1-%target-runtime < %t.macros.ccp1.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_QUAL_MACROS_1 -check-prefix=CLANG_QUAL_MACROS_1-%target-runtime < %t.macros.ccp1.compl.txt
 // RUN: diff -r -u %t.ccp %t.ccp.bak
 
 // Check the individual cache item.
-// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/macros-* | FileCheck %s -check-prefix=CLANG_QUAL_MACROS_1
+// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/macros-* | %FileCheck %s -check-prefix=CLANG_QUAL_MACROS_1
 
 
 // Qualified with dot.
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CLANG_QUAL_MACROS_2 -completion-cache-path=%t.ccp > %t.macros2.ccp1.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_QUAL_MACROS_2 -check-prefix=CLANG_QUAL_MACROS_2-%target-runtime < %t.macros2.ccp1.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_QUAL_MACROS_2 -check-prefix=CLANG_QUAL_MACROS_2-%target-runtime < %t.macros2.ccp1.compl.txt
 
 // Check the individual cache item.
-// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/macros-dot-* | FileCheck %s -check-prefix=CLANG_QUAL_MACROS_2
+// RUN: %target-swift-ide-test -dump-completion-cache %t.ccp/macros-dot-* | %FileCheck %s -check-prefix=CLANG_QUAL_MACROS_2
 
 // Ensure the testable import showed up mangled correctly.
 // RUN: ls %t.ccp/Darwin-testable*
diff --git a/test/IDE/complete_call_arg.swift b/test/IDE/complete_call_arg.swift
index 31ad114..2228b91 100644
--- a/test/IDE/complete_call_arg.swift
+++ b/test/IDE/complete_call_arg.swift
@@ -1,44 +1,44 @@
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG1 | FileCheck %s -check-prefix=EXPECT_OINT
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG2 | FileCheck %s -check-prefix=ARG-NAME1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG3 | FileCheck %s -check-prefix=ARG-NAME2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG4 | FileCheck %s -check-prefix=EXPECT_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG5 | FileCheck %s -check-prefix=EXPECT_OSTRING
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG6 | FileCheck %s -check-prefix=ARG-NAME2
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG7 | FileCheck %s -check-prefix=ARG-NAME1
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG8 | FileCheck %s -check-prefix=EXPECT_STRING
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG1 | %FileCheck %s -check-prefix=EXPECT_OINT
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG2 | %FileCheck %s -check-prefix=ARG-NAME1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG3 | %FileCheck %s -check-prefix=ARG-NAME2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG4 | %FileCheck %s -check-prefix=EXPECT_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG5 | %FileCheck %s -check-prefix=EXPECT_OSTRING
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG6 | %FileCheck %s -check-prefix=ARG-NAME2
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG7 | %FileCheck %s -check-prefix=ARG-NAME1
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG8 | %FileCheck %s -check-prefix=EXPECT_STRING
 
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOAD1 | FileCheck %s -check-prefix=OVERLOAD1
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOAD2 | FileCheck %s -check-prefix=OVERLOAD2
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOAD3 | FileCheck %s -check-prefix=OVERLOAD3
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOAD4 | FileCheck %s -check-prefix=OVERLOAD4
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOAD1 | %FileCheck %s -check-prefix=OVERLOAD1
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOAD2 | %FileCheck %s -check-prefix=OVERLOAD2
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOAD3 | %FileCheck %s -check-prefix=OVERLOAD3
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERLOAD4 | %FileCheck %s -check-prefix=OVERLOAD4
 
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER1 | FileCheck %s -check-prefix=MEMBER1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER2 | FileCheck %s -check-prefix=MEMBER2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER3 | FileCheck %s -check-prefix=MEMBER3
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER4 | FileCheck %s -check-prefix=MEMBER4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER5 | FileCheck %s -check-prefix=MEMBER2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER6 | FileCheck %s -check-prefix=MEMBER4
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER7 | FileCheck %s -check-prefix=MEMBER7
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER8 | FileCheck %s -check-prefix=MEMBER8
-// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER9 | FileCheck %s -check-prefix=MEMBER1
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER1 | %FileCheck %s -check-prefix=MEMBER1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER2 | %FileCheck %s -check-prefix=MEMBER2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER3 | %FileCheck %s -check-prefix=MEMBER3
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER4 | %FileCheck %s -check-prefix=MEMBER4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER5 | %FileCheck %s -check-prefix=MEMBER2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER6 | %FileCheck %s -check-prefix=MEMBER4
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER7 | %FileCheck %s -check-prefix=MEMBER7
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER8 | %FileCheck %s -check-prefix=MEMBER8
+// RUN-FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER9 | %FileCheck %s -check-prefix=MEMBER1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG1 | FileCheck %s -check-prefix=EXPECT_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG2 | FileCheck %s -check-prefix=EXPECT_STRING
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG3 | FileCheck %s -check-prefix=MEMBER2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG4 | FileCheck %s -check-prefix=MEMBER4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG5 | FileCheck %s -check-prefix=MEMBER2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG6 | FileCheck %s -check-prefix=FARG6
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG7 | FileCheck %s -check-prefix=EXPECT_OINT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG1 | %FileCheck %s -check-prefix=EXPECT_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG2 | %FileCheck %s -check-prefix=EXPECT_STRING
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG3 | %FileCheck %s -check-prefix=MEMBER2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG4 | %FileCheck %s -check-prefix=MEMBER4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG5 | %FileCheck %s -check-prefix=MEMBER2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG6 | %FileCheck %s -check-prefix=FARG6
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FARG7 | %FileCheck %s -check-prefix=EXPECT_OINT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIRST_ARG_NAME_1 | FileCheck %s -check-prefix=FIRST_ARG_NAME_PATTERN
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIRST_ARG_NAME_2 | FileCheck %s -check-prefix=FIRST_ARG_NAME_PATTERN
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIRST_ARG_NAME_3 | FileCheck %s -check-prefix=FIRST_ARG_NAME_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIRST_ARG_NAME_1 | %FileCheck %s -check-prefix=FIRST_ARG_NAME_PATTERN
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIRST_ARG_NAME_2 | %FileCheck %s -check-prefix=FIRST_ARG_NAME_PATTERN
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIRST_ARG_NAME_3 | %FileCheck %s -check-prefix=FIRST_ARG_NAME_3
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BOUND_GENERIC_1_1 | FileCheck %s -check-prefix=BOUND_GENERIC_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BOUND_GENERIC_1_2 | FileCheck %s -check-prefix=BOUND_GENERIC_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BOUND_GENERIC_1_1 | %FileCheck %s -check-prefix=BOUND_GENERIC_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BOUND_GENERIC_1_2 | %FileCheck %s -check-prefix=BOUND_GENERIC_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EMPTY_OVERLOAD_1 | FileCheck %s -check-prefix=EMPTY_OVERLOAD
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EMPTY_OVERLOAD_2 | FileCheck %s -check-prefix=EMPTY_OVERLOAD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EMPTY_OVERLOAD_1 | %FileCheck %s -check-prefix=EMPTY_OVERLOAD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EMPTY_OVERLOAD_2 | %FileCheck %s -check-prefix=EMPTY_OVERLOAD
 
 var i1 = 1
 var i2 = 2
diff --git a/test/IDE/complete_constructor.swift b/test/IDE/complete_constructor.swift
index fb1267b..7d1190a 100644
--- a/test/IDE/complete_constructor.swift
+++ b/test/IDE/complete_constructor.swift
@@ -1,30 +1,35 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_1 | FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_1P | FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_1P
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_2 | FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_2P | FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_2P
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_1 | %FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_1P | %FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_1P
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_2 | %FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_CONSTRUCTORS_2P | %FileCheck %s -check-prefix=IMPLICIT_CONSTRUCTORS_2P
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_1 | FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_1P | FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_1P
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_1 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_1P | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_1P
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_2 | FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_2P | FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_2P
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_2 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_2P | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_2P
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_3P | FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_3P
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_3P | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_3P
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_SELECTOR_1 | FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_SELECTOR_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_SELECTOR_1 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_SELECTOR_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_BASE_DERIVED_1 | FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_BASE_DERIVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPLICIT_CONSTRUCTORS_BASE_DERIVED_1 | %FileCheck %s -check-prefix=EXPLICIT_CONSTRUCTORS_BASE_DERIVED_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE1 | FileCheck %s -check-prefix=INIT_FROM_METATYPE1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE2 | FileCheck %s -check-prefix=INIT_FROM_METATYPE2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE3 | FileCheck %s -check-prefix=INIT_FROM_METATYPE3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE4 | FileCheck %s -check-prefix=INIT_FROM_METATYPE4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE5 | FileCheck %s -check-prefix=INIT_FROM_METATYPE4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE6 | FileCheck %s -check-prefix=INIT_FROM_METATYPE6
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE1 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE2 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE3 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE4 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE5 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_FROM_METATYPE6 | %FileCheck %s -check-prefix=INIT_FROM_METATYPE6
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_RPAREN_1 | FileCheck %s -check-prefix=HAVE_RPAREN_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_RPAREN_2 | FileCheck %s -check-prefix=HAVE_RPAREN_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_COMMA_1 | FileCheck %s -check-prefix=HAVE_COMMA_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_RPAREN_1 | %FileCheck %s -check-prefix=HAVE_RPAREN_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_RPAREN_2 | %FileCheck %s -check-prefix=HAVE_RPAREN_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAVE_COMMA_1 | %FileCheck %s -check-prefix=HAVE_COMMA_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_ALIAS_1 | %FileCheck %s -check-prefix=WITH_ALIAS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_1 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_2 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_3 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_4 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
 
 func freeFunc() {}
 
@@ -237,3 +242,30 @@
   ExplicitConstructors1(#^HAVE_COMMA_1^#,
 // HAVE_COMMA_1-NOT: Decl[Constructor]
 }
+
+class WithAlias1 {
+  init(busted: B) {}
+  init(working: Int) {}
+}
+typealias Alias1 = WithAlias1
+func testWithAlias1() {
+  Alias1#^WITH_ALIAS_1^#
+}
+// WITH_ALIAS_1: Decl[Constructor]/CurrNominal:      ({#working: Int#})[#Alias1#];
+
+struct ClosureInInit1 {
+  struct S{}
+  var prop1: S = {
+    return S(#^CLOSURE_IN_INIT_1^#
+  }
+// CLOSURE_IN_INIT_1: Decl[Constructor]/CurrNominal:      ['('])[#ClosureInInit1.S#];
+  var prop2: S = {
+    return S(#^CLOSURE_IN_INIT_2^#
+  }()
+  var prop3: S = {
+    S(#^CLOSURE_IN_INIT_3^#
+  }
+  var prop3: S = {
+    S(#^CLOSURE_IN_INIT_4^#
+  }()
+}
diff --git a/test/IDE/complete_crashes.swift b/test/IDE/complete_crashes.swift
index f7a14b0..801dea4 100644
--- a/test/IDE/complete_crashes.swift
+++ b/test/IDE/complete_crashes.swift
@@ -1,6 +1,6 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BAD_MEMBERS_1 | FileCheck %s -check-prefix=BAD_MEMBERS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BAD_MEMBERS_2 | FileCheck %s -check-prefix=BAD_MEMBERS_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_CALLED_IN_PLACE_1 | FileCheck %s -check-prefix=WITH_GLOBAL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BAD_MEMBERS_1 | %FileCheck %s -check-prefix=BAD_MEMBERS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BAD_MEMBERS_2 | %FileCheck %s -check-prefix=BAD_MEMBERS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_CALLED_IN_PLACE_1 | %FileCheck %s -check-prefix=WITH_GLOBAL
 
 class BadMembers1 {
   var prop: Int {
@@ -36,7 +36,7 @@
 
 func globalFunc() {}
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LET_COMPUTED | FileCheck %s -check-prefix=WITH_GLOBAL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LET_COMPUTED | %FileCheck %s -check-prefix=WITH_GLOBAL
 class C {
   let x : Int { #^LET_COMPUTED^# }
 }
@@ -56,12 +56,12 @@
 }
 
 // rdar://problem/21197042
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_PARAM_AND_ASSOC_TYPE | FileCheck %s -check-prefix=GENERIC_PARAM_AND_ASSOC_TYPE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_PARAM_AND_ASSOC_TYPE | %FileCheck %s -check-prefix=GENERIC_PARAM_AND_ASSOC_TYPE
 struct CustomGenericCollection<Key> : ExpressibleByDictionaryLiteral {
   // GENERIC_PARAM_AND_ASSOC_TYPE: Begin completions
   // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[InstanceVar]/CurrNominal:      count[#Int#]; name=count
-  // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[TypeAlias]/CurrNominal:        Key[#Key#]; name=Key
-  // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[TypeAlias]/CurrNominal:        Value[#Value#]; name=Value
+  // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[GenericTypeParam]/CurrNominal: Key[#Key#]; name=Key
+  // GENERIC_PARAM_AND_ASSOC_TYPE-DAG: Decl[TypeAlias]/CurrNominal:        Value[#CustomGenericCollection.Value#]; name=Value
   // GENERIC_PARAM_AND_ASSOC_TYPE: End completions
 
   var count: Int { #^GENERIC_PARAM_AND_ASSOC_TYPE^# }
@@ -126,7 +126,7 @@
 }
 
 // rdar://problem/22688199
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_22688199 | FileCheck %s -check-prefix=FLIP_CURRIED
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_22688199 | %FileCheck %s -check-prefix=FLIP_CURRIED
 func curried(_ a: Int)(_ b1: Int, _ b2: Int) { }
 func flip<A, B, C>(_ f: A -> B -> C) -> B -> A -> C { }
 func rdar22688199() {
@@ -147,7 +147,7 @@
   }
 }
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_22834017 | FileCheck %s -check-prefix=INVALID_TYPE_INIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_22834017 | %FileCheck %s -check-prefix=INVALID_TYPE_INIT
 struct Foo {
   let a: Anosuchtype
   let b: Bnosuchtype
@@ -160,13 +160,13 @@
 // FIXME: We could provide a useful completion here. rdar://problem/22846558
 // INVALID_TYPE_INIT-NOT: Begin completions
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_23173692 | FileCheck %s -check-prefix=RDAR_23173692
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_23173692 | %FileCheck %s -check-prefix=RDAR_23173692
 func rdar23173692() {
   return IndexingIterator(#^RDAR_23173692^#)
 }
 // RDAR_23173692: Begin completions
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_22769393 | FileCheck %s -check-prefix=RDAR_22769393
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_22769393 | %FileCheck %s -check-prefix=RDAR_22769393
 public enum PropertyListItem {
   case PLString(String)
   case PLDict([String:PropertyListItem])
diff --git a/test/IDE/complete_decl_attribute.swift b/test/IDE/complete_decl_attribute.swift
index 8363f0f..9e6899d 100644
--- a/test/IDE/complete_decl_attribute.swift
+++ b/test/IDE/complete_decl_attribute.swift
@@ -1,11 +1,11 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABILITY1 | FileCheck %s -check-prefix=AVAILABILITY1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABILITY2 | FileCheck %s -check-prefix=AVAILABILITY2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD1 | FileCheck %s -check-prefix=KEYWORD1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD2 | FileCheck %s -check-prefix=KEYWORD2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD3 | FileCheck %s -check-prefix=KEYWORD3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD4 | FileCheck %s -check-prefix=KEYWORD4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD5 | FileCheck %s -check-prefix=KEYWORD5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD_LAST | FileCheck %s -check-prefix=KEYWORD_LAST
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABILITY1 | %FileCheck %s -check-prefix=AVAILABILITY1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABILITY2 | %FileCheck %s -check-prefix=AVAILABILITY2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD1 | %FileCheck %s -check-prefix=KEYWORD1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD2 | %FileCheck %s -check-prefix=KEYWORD2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD3 | %FileCheck %s -check-prefix=KEYWORD3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD4 | %FileCheck %s -check-prefix=KEYWORD4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD5 | %FileCheck %s -check-prefix=KEYWORD5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=KEYWORD_LAST | %FileCheck %s -check-prefix=KEYWORD_LAST
 
 @available(#^AVAILABILITY1^#)
 
@@ -25,10 +25,10 @@
 
 // AVAILABILITY2:             Begin completions, 5 items
 // AVAILABILITY2-NEXT:        Keyword/None:                       unavailable; name=unavailable{{$}}
-// AVAILABILITY2-NEXT:        Keyword/None:                       message=[#Specify message#]; name=message{{$}}
-// AVAILABILITY2-NEXT:        Keyword/None:                       renamed=[#Specify replacing name#]; name=renamed{{$}}
-// AVAILABILITY2-NEXT:        Keyword/None:                       introduced=[#Specify version number#]; name=introduced{{$}}
-// AVAILABILITY2-NEXT:        Keyword/None:                       deprecated=[#Specify version number#]; name=deprecated{{$}}
+// AVAILABILITY2-NEXT:        Keyword/None:                       message: [#Specify message#]; name=message{{$}}
+// AVAILABILITY2-NEXT:        Keyword/None:                       renamed: [#Specify replacing name#]; name=renamed{{$}}
+// AVAILABILITY2-NEXT:        Keyword/None:                       introduced: [#Specify version number#]; name=introduced{{$}}
+// AVAILABILITY2-NEXT:        Keyword/None:                       deprecated: [#Specify version number#]; name=deprecated{{$}}
 // AVAILABILITY2-NEXT:        End completions
 
 
@@ -44,10 +44,9 @@
 @#^KEYWORD2^#
 func method(){}
 
-// KEYWORD2:                  Begin completions, 10 items
+// KEYWORD2:                  Begin completions, 9 items
 // KEYWORD2-NEXT:             Keyword/None:                       available[#Func Attribute#]; name=available{{$}}
 // KEYWORD2-NEXT:             Keyword/None:                       objc[#Func Attribute#]; name=objc{{$}}
-// KEYWORD2-NEXT:             Keyword/None:                       swift3_migration[#Func Attribute#]; name=swift3_migration{{$}}
 // KEYWORD2-NEXT:             Keyword/None:                       noreturn[#Func Attribute#]; name=noreturn{{$}}
 // KEYWORD2-NEXT:             Keyword/None:                       IBAction[#Func Attribute#]; name=IBAction{{$}}
 // KEYWORD2-NEXT:             Keyword/None:                       NSManaged[#Func Attribute#]; name=NSManaged{{$}}
@@ -60,10 +59,9 @@
 @#^KEYWORD3^#
 class C {}
 
-// KEYWORD3:                  Begin completions, 8 items
+// KEYWORD3:                  Begin completions, 7 items
 // KEYWORD3-NEXT:             Keyword/None:                       available[#Class Attribute#]; name=available{{$}}
 // KEYWORD3-NEXT:             Keyword/None:                       objc[#Class Attribute#]; name=objc{{$}}
-// KEYWORD3-NEXT:             Keyword/None:                       swift3_migration[#Class Attribute#]; name=swift3_migration{{$}}
 // KEYWORD3-NEXT:             Keyword/None:                       IBDesignable[#Class Attribute#]; name=IBDesignable{{$}}
 // KEYWORD3-NEXT:             Keyword/None:                       UIApplicationMain[#Class Attribute#]; name=UIApplicationMain{{$}}
 // KEYWORD3-NEXT:             Keyword/None:                       requires_stored_property_inits[#Class Attribute#]; name=requires_stored_property_inits{{$}}
@@ -73,27 +71,24 @@
 
 @#^KEYWORD4^#
 enum E {}
-// KEYWORD4:                  Begin completions, 3 items
+// KEYWORD4:                  Begin completions, 2 items
 // KEYWORD4-NEXT:             Keyword/None:                       available[#Enum Attribute#]; name=available{{$}}
 // KEYWORD4-NEXT:             Keyword/None:                       objc[#Enum Attribute#]; name=objc{{$}}
-// KEYWORD4-NEXT:             Keyword/None:                       swift3_migration[#Enum Attribute#]; name=swift3_migration{{$}}
 // KEYWORD4-NEXT:             End completions
 
 
 @#^KEYWORD5^#
 struct S{}
-// KEYWORD5:                  Begin completions, 2 items
+// KEYWORD5:                  Begin completions, 1 item
 // KEYWORD5-NEXT:             Keyword/None:                       available[#Struct Attribute#]; name=available{{$}}
-// KEYWORD5-NEXT:             Keyword/None:                       swift3_migration[#Struct Attribute#]; name=swift3_migration{{$}}
 // KEYWORD5-NEXT:             End completions
 
 
 @#^KEYWORD_LAST^#
 
-// KEYWORD_LAST:                  Begin completions, 22 items
+// KEYWORD_LAST:                  Begin completions, 21 items
 // KEYWORD_LAST-NEXT:             Keyword/None:                       available[#Declaration Attribute#]; name=available{{$}}
 // KEYWORD_LAST-NEXT:             Keyword/None:                       objc[#Declaration Attribute#]; name=objc{{$}}
-// KEYWORD_LAST-NEXT:             Keyword/None:                       swift3_migration[#Declaration Attribute#]; name=swift3_migration{{$}}
 // KEYWORD_LAST-NEXT:             Keyword/None:                       noreturn[#Declaration Attribute#]; name=noreturn{{$}}
 // KEYWORD_LAST-NEXT:             Keyword/None:                       NSCopying[#Declaration Attribute#]; name=NSCopying{{$}}
 // KEYWORD_LAST-NEXT:             Keyword/None:                       IBAction[#Declaration Attribute#]; name=IBAction{{$}}
diff --git a/test/IDE/complete_default_arguments.swift b/test/IDE/complete_default_arguments.swift
index a680264..06b3f97 100644
--- a/test/IDE/complete_default_arguments.swift
+++ b/test/IDE/complete_default_arguments.swift
@@ -1,26 +1,26 @@
 // RUN: sed -n -e '1,/NO_ERRORS_UP_TO_HERE$/ p' %s > %t_no_errors.swift
 // RUN: %target-swift-frontend -verify -parse %t_no_errors.swift
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_1 | FileCheck %s -check-prefix=DEFAULT_ARGS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_2 | FileCheck %s -check-prefix=DEFAULT_ARGS_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_3 | FileCheck %s -check-prefix=DEFAULT_ARGS_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_4 | FileCheck %s -check-prefix=DEFAULT_ARGS_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_5 | FileCheck %s -check-prefix=DEFAULT_ARGS_5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_6 | FileCheck %s -check-prefix=DEFAULT_ARGS_6
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_7 | FileCheck %s -check-prefix=DEFAULT_ARGS_7
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_1 | %FileCheck %s -check-prefix=DEFAULT_ARGS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_2 | %FileCheck %s -check-prefix=DEFAULT_ARGS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_3 | %FileCheck %s -check-prefix=DEFAULT_ARGS_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_4 | %FileCheck %s -check-prefix=DEFAULT_ARGS_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_5 | %FileCheck %s -check-prefix=DEFAULT_ARGS_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_6 | %FileCheck %s -check-prefix=DEFAULT_ARGS_6
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_7 | %FileCheck %s -check-prefix=DEFAULT_ARGS_7
 //
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_8 > %t
-// RUN: FileCheck %s -check-prefix=DEFAULT_ARGS_8 < %t
-// RUN: FileCheck %s -check-prefix=NEGATIVE_DEFAULT_ARGS_8 < %t
+// RUN: %FileCheck %s -check-prefix=DEFAULT_ARGS_8 < %t
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_DEFAULT_ARGS_8 < %t
 //
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_9 > %t
-// RUN: FileCheck %s -check-prefix=DEFAULT_ARGS_9 < %t
-// RUN: FileCheck %s -check-prefix=NEGATIVE_DEFAULT_ARGS_9 < %t
+// RUN: %FileCheck %s -check-prefix=DEFAULT_ARGS_9 < %t
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_DEFAULT_ARGS_9 < %t
 //
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_1 | FileCheck %s -check-prefix=DEFAULT_ARG_INIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_2 | FileCheck %s -check-prefix=DEFAULT_ARG_INIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_3 | FileCheck %s -check-prefix=DEFAULT_ARG_INIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_4 | FileCheck %s -check-prefix=DEFAULT_ARG_INIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_1 | %FileCheck %s -check-prefix=DEFAULT_ARG_INIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_2 | %FileCheck %s -check-prefix=DEFAULT_ARG_INIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_3 | %FileCheck %s -check-prefix=DEFAULT_ARG_INIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_4 | %FileCheck %s -check-prefix=DEFAULT_ARG_INIT
 
 func freeFuncWithDefaultArgs1(
     _ a: Int, b: Int = 42, file: String = #file, line: Int = #line,
diff --git a/test/IDE/complete_doc_keyword.swift b/test/IDE/complete_doc_keyword.swift
index a84659f..7ed141c 100644
--- a/test/IDE/complete_doc_keyword.swift
+++ b/test/IDE/complete_doc_keyword.swift
@@ -1,6 +1,6 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE1 | FileCheck %s -check-prefix=TYPE1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER1 | FileCheck %s -check-prefix=MEMBER1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER2 | FileCheck %s -check-prefix=MEMBER2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE1 | %FileCheck %s -check-prefix=TYPE1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER1 | %FileCheck %s -check-prefix=MEMBER1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER2 | %FileCheck %s -check-prefix=MEMBER2
 
 /**
   - keyword: C1, Class
diff --git a/test/IDE/complete_dynamic_lookup.swift b/test/IDE/complete_dynamic_lookup.swift
index 5a9e7b7..9161fbd 100644
--- a/test/IDE/complete_dynamic_lookup.swift
+++ b/test/IDE/complete_dynamic_lookup.swift
@@ -6,60 +6,60 @@
 // RUN: cp %S/Inputs/AnyObject/module.map %t
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_FUNC_PARAM_NO_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_INSTANCE_NO_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_INSTANCE_NO_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_FUNC_PARAM_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_INSTANCE_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_INSTANCE_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_VAR_NO_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_INSTANCE_NO_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_INSTANCE_NO_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_VAR_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_INSTANCE_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_INSTANCE_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_RETURN_VAL_NO_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_INSTANCE_NO_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_INSTANCE_NO_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_RETURN_VAL_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_INSTANCE_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_INSTANCE_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_CALL_RETURN_VAL_NO_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=TLOC_MEMBERS_NO_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=TLOC_MEMBERS_NO_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_CALL_RETURN_VAL_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=TLOC_MEMBERS_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=TLOC_MEMBERS_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_FUNC_NAME_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_FUNC_NAME_1 < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_FUNC_NAME_1 < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_FUNC_NAME_PAREN_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_FUNC_NAME_PAREN_1 < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_FUNC_NAME_PAREN_1 < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_FUNC_NAME_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_FUNC_NAME_DOT_1 < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_FUNC_NAME_DOT_1 < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_FUNC_NAME_BANG_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_FUNC_NAME_BANG_1 < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_FUNC_NAME_BANG_1 < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_CLASS_NO_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_CLASS_NO_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_CLASS_NO_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -disable-objc-attr-requires-foundation-module -code-completion-token=DL_CLASS_DOT_1 > %t.dl.txt
-// RUN: FileCheck %s -check-prefix=DL_CLASS_DOT < %t.dl.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=DL_CLASS_DOT < %t.dl.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.dl.txt
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/complete_enum_elements.swift b/test/IDE/complete_enum_elements.swift
index d1ab5bc..7219d3b 100644
--- a/test/IDE/complete_enum_elements.swift
+++ b/test/IDE/complete_enum_elements.swift
@@ -1,71 +1,71 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_1 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
-// RUN: FileCheck %s -check-prefix=FOO_ENUM_TYPE_CONTEXT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=FOO_ENUM_TYPE_CONTEXT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_2 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
-// RUN: FileCheck %s -check-prefix=FOO_ENUM_TYPE_CONTEXT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=FOO_ENUM_TYPE_CONTEXT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_3 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
-// RUN: FileCheck %s -check-prefix=BAR_ENUM_TYPE_CONTEXT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=BAR_ENUM_TYPE_CONTEXT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_4 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
-// RUN: FileCheck %s -check-prefix=BAZ_ENUM_TYPE_CONTEXT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=BAZ_ENUM_TYPE_CONTEXT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_5 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
-// RUN: FileCheck %s -check-prefix=QUX_ENUM_TYPE_CONTEXT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=QUX_ENUM_TYPE_CONTEXT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_WITH_DOT_1 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=FOO_ENUM_DOT_ELEMENTS < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=FOO_ENUM_DOT_ELEMENTS < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_WITH_QUAL_1 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=FOO_ENUM_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=FOO_ENUM_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_EXPR_ERROR_1 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=FOO_ENUM_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=FOO_ENUM_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_IN_PATTERN_1 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
-// RUN: FileCheck %s -check-prefix=ENUM_SW_IN_PATTERN_1 < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_RESULTS < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=ENUM_SW_IN_PATTERN_1 < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_SW_IN_PATTERN_2 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=ENUM_SW_IN_PATTERN_2 < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=ENUM_SW_IN_PATTERN_2 < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_NO_DOT_1 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=FOO_ENUM_NO_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=FOO_ENUM_NO_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_NO_DOT_2 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=BAR_ENUM_NO_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=BAR_ENUM_NO_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_NO_DOT_3 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=BAZ_INT_ENUM_NO_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=BAZ_INT_ENUM_NO_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_NO_DOT_4 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=BAZ_T_ENUM_NO_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=BAZ_T_ENUM_NO_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_NO_DOT_5 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=QUX_ENUM_NO_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=QUX_ENUM_NO_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_DOT_1 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=FOO_ENUM_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=FOO_ENUM_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_DOT_2 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=BAR_ENUM_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=BAR_ENUM_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_DOT_3 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=BAZ_INT_ENUM_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=BAZ_INT_ENUM_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_DOT_4 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=BAZ_T_ENUM_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=BAZ_T_ENUM_DOT < %t.enum.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_QUAL_DOT_5 > %t.enum.txt
-// RUN: FileCheck %s -check-prefix=QUX_ENUM_DOT < %t.enum.txt
+// RUN: %FileCheck %s -check-prefix=QUX_ENUM_DOT < %t.enum.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_INVALID_DOT_1 | FileCheck %s -check-prefix=WITH_INVALID_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_1 | FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_INVALID_DOT_1 | %FileCheck %s -check-prefix=WITH_INVALID_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_1 | %FileCheck %s -check-prefix=UNRESOLVED_1
 
 //===---
 //===--- Test that we can complete enum elements.
diff --git a/test/IDE/complete_exception.swift b/test/IDE/complete_exception.swift
index 0db98fc..a3e18e1 100644
--- a/test/IDE/complete_exception.swift
+++ b/test/IDE/complete_exception.swift
@@ -1,53 +1,53 @@
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CATCH1 | FileCheck %s -check-prefix=CATCH1
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CATCH1 | %FileCheck %s -check-prefix=CATCH1
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=THROW1 > %t.throw1
-// RUN: FileCheck %s -check-prefix=THROW1 < %t.throw1
-// RUN: FileCheck %s -check-prefix=THROW1-LOCAL < %t.throw1
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CATCH2 | FileCheck %s -check-prefix=CATCH2
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=THROW2 | FileCheck %s -check-prefix=THROW2
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CATCH3 | FileCheck %s -check-prefix=CATCH3
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_CATCH1 | FileCheck %s -check-prefix=CATCH1
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_THROW1 | FileCheck %s -check-prefix=THROW1
+// RUN: %FileCheck %s -check-prefix=THROW1 < %t.throw1
+// RUN: %FileCheck %s -check-prefix=THROW1-LOCAL < %t.throw1
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CATCH2 | %FileCheck %s -check-prefix=CATCH2
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=THROW2 | %FileCheck %s -check-prefix=THROW2
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CATCH3 | %FileCheck %s -check-prefix=CATCH3
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_CATCH1 | %FileCheck %s -check-prefix=CATCH1
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_THROW1 | %FileCheck %s -check-prefix=THROW1
 
 // FIXME: <rdar://problem/21001526> No dot code completion results in switch case or catch stmt at top-level
-// RUNdisabled: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_CATCH2 | FileCheck %s -check-prefix=CATCH2
-// RUNdisabled: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_THROW2 | FileCheck %s -check-prefix=THROW2
+// RUNdisabled: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_CATCH2 | %FileCheck %s -check-prefix=CATCH2
+// RUNdisabled: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_THROW2 | %FileCheck %s -check-prefix=THROW2
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH1 > %t.inside_catch1
-// RUN: FileCheck %s -check-prefix=STMT < %t.inside_catch1
-// RUN: FileCheck %s -check-prefix=IMPLICIT_ERROR < %t.inside_catch1
+// RUN: %FileCheck %s -check-prefix=STMT < %t.inside_catch1
+// RUN: %FileCheck %s -check-prefix=IMPLICIT_ERROR < %t.inside_catch1
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH2 > %t.inside_catch2
-// RUN: FileCheck %s -check-prefix=STMT < %t.inside_catch2
-// RUN: FileCheck %s -check-prefix=EXPLICIT_ERROR_E < %t.inside_catch2
+// RUN: %FileCheck %s -check-prefix=STMT < %t.inside_catch2
+// RUN: %FileCheck %s -check-prefix=EXPLICIT_ERROR_E < %t.inside_catch2
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH3 > %t.inside_catch3
-// RUN: FileCheck %s -check-prefix=STMT < %t.inside_catch3
-// RUN: FileCheck %s -check-prefix=EXPLICIT_NSERROR_E < %t.inside_catch3
+// RUN: %FileCheck %s -check-prefix=STMT < %t.inside_catch3
+// RUN: %FileCheck %s -check-prefix=EXPLICIT_NSERROR_E < %t.inside_catch3
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH4 > %t.inside_catch4
-// RUN: FileCheck %s -check-prefix=STMT < %t.inside_catch4
-// RUN: FileCheck %s -check-prefix=EXPLICIT_ERROR_PAYLOAD_I < %t.inside_catch4
+// RUN: %FileCheck %s -check-prefix=STMT < %t.inside_catch4
+// RUN: %FileCheck %s -check-prefix=EXPLICIT_ERROR_PAYLOAD_I < %t.inside_catch4
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH5 > %t.inside_catch5
-// RUN: FileCheck %s -check-prefix=STMT < %t.inside_catch5
-// RUN: FileCheck %s -check-prefix=EXPLICIT_ERROR_E < %t.inside_catch5
-// RUN: FileCheck %s -check-prefix=NO_ERROR_AND_A < %t.inside_catch5
+// RUN: %FileCheck %s -check-prefix=STMT < %t.inside_catch5
+// RUN: %FileCheck %s -check-prefix=EXPLICIT_ERROR_E < %t.inside_catch5
+// RUN: %FileCheck %s -check-prefix=NO_ERROR_AND_A < %t.inside_catch5
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH6 > %t.inside_catch6
-// RUN: FileCheck %s -check-prefix=STMT < %t.inside_catch6
-// RUN: FileCheck %s -check-prefix=NO_E < %t.inside_catch6
-// RUN: FileCheck %s -check-prefix=NO_ERROR_AND_A < %t.inside_catch6
+// RUN: %FileCheck %s -check-prefix=STMT < %t.inside_catch6
+// RUN: %FileCheck %s -check-prefix=NO_E < %t.inside_catch6
+// RUN: %FileCheck %s -check-prefix=NO_ERROR_AND_A < %t.inside_catch6
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH_ERR_DOT1 | FileCheck %s -check-prefix=ERROR_DOT
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH_ERR_DOT2 | FileCheck %s -check-prefix=ERROR_DOT
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH_ERR_DOT3 | FileCheck %s -check-prefix=NSERROR_DOT
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH_ERR_DOT4 | FileCheck %s -check-prefix=INT_DOT
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH_ERR_DOT1 | %FileCheck %s -check-prefix=ERROR_DOT
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH_ERR_DOT2 | %FileCheck %s -check-prefix=ERROR_DOT
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH_ERR_DOT3 | %FileCheck %s -check-prefix=NSERROR_DOT
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=INSIDE_CATCH_ERR_DOT4 | %FileCheck %s -check-prefix=INT_DOT
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_INSIDE_CATCH1 > %t.top_level_inside_catch1
-// RUN: FileCheck %s -check-prefix=STMT < %t.top_level_inside_catch1
-// RUN: FileCheck %s -check-prefix=IMPLICIT_ERROR < %t.top_level_inside_catch1
+// RUN: %FileCheck %s -check-prefix=STMT < %t.top_level_inside_catch1
+// RUN: %FileCheck %s -check-prefix=IMPLICIT_ERROR < %t.top_level_inside_catch1
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_INSIDE_CATCH_ERR_DOT1 | FileCheck %s -check-prefix=ERROR_DOT
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_INSIDE_CATCH_ERR_DOT1 | %FileCheck %s -check-prefix=ERROR_DOT
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/complete_expr_postfix_begin.swift b/test/IDE/complete_expr_postfix_begin.swift
index 2ccf2ac..9470a1c 100644
--- a/test/IDE/complete_expr_postfix_begin.swift
+++ b/test/IDE/complete_expr_postfix_begin.swift
@@ -1,68 +1,68 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_1 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_2 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_3 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_4 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_5 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_6 | FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_1 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_2 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_3 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_4 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_5 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_6 | %FileCheck %s -check-prefix=COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IGNORED_1 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IGNORED_2 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IGNORED_3 | FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IGNORED_1 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IGNORED_2 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IGNORED_3 | %FileCheck %s -check-prefix=COMMON
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_1 > %t.param.txt
-// RUN: FileCheck %s -check-prefix=COMMON < %t.param.txt
-// RUN: FileCheck %s -check-prefix=FIND_FUNC_PARAM_1 < %t.param.txt
-// RUN: FileCheck %s -check-prefix=NO_SELF < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=COMMON < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=FIND_FUNC_PARAM_1 < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=NO_SELF < %t.param.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_2 > %t.param.txt
-// RUN: FileCheck %s -check-prefix=COMMON < %t.param.txt
-// RUN: FileCheck %s -check-prefix=FIND_FUNC_PARAM_2 < %t.param.txt
-// RUN: FileCheck %s -check-prefix=NO_SELF < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=COMMON < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=FIND_FUNC_PARAM_2 < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=NO_SELF < %t.param.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_3 | FileCheck %s -check-prefix=FIND_FUNC_PARAM_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_4 | FileCheck %s -check-prefix=FIND_FUNC_PARAM_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_5 | FileCheck %s -check-prefix=FIND_FUNC_PARAM_5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_6 | FileCheck %s -check-prefix=FIND_FUNC_PARAM_6
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_7 | FileCheck %s -check-prefix=FIND_FUNC_PARAM_7
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_3 | %FileCheck %s -check-prefix=FIND_FUNC_PARAM_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_4 | %FileCheck %s -check-prefix=FIND_FUNC_PARAM_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_5 | %FileCheck %s -check-prefix=FIND_FUNC_PARAM_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_6 | %FileCheck %s -check-prefix=FIND_FUNC_PARAM_6
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_7 | %FileCheck %s -check-prefix=FIND_FUNC_PARAM_7
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_FUNC_PARAM_SELECTOR_1 > %t.param.txt
-// RUN: FileCheck %s -check-prefix=COMMON < %t.param.txt
-// RUN: FileCheck %s -check-prefix=FIND_FUNC_PARAM_SELECTOR_1 < %t.param.txt
-// RUN: FileCheck %s -check-prefix=NO_SELF < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=COMMON < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=FIND_FUNC_PARAM_SELECTOR_1 < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=NO_SELF < %t.param.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_1 | FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_2 | FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_3 | FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_4 | FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_5 | FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_1 | %FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_2 | %FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_3 | %FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_4 | %FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_5 | %FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_5
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_SELECTOR_1 | FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_SELECTOR_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_CONSTRUCTOR_PARAM_SELECTOR_1 | %FileCheck %s -check-prefix=FIND_CONSTRUCTOR_PARAM_SELECTOR_1
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_DESTRUCTOR_PARAM_1 > %t.param.txt
-// RUN: FileCheck %s -check-prefix=FIND_DESTRUCTOR_PARAM_1 < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=FIND_DESTRUCTOR_PARAM_1 < %t.param.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FIND_DESTRUCTOR_PARAM_2 > %t.param.txt
-// RUN: FileCheck %s -check-prefix=FIND_DESTRUCTOR_PARAM_2 < %t.param.txt
+// RUN: %FileCheck %s -check-prefix=FIND_DESTRUCTOR_PARAM_2 < %t.param.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NO_PLACEHOLDER_NAMES_1 | FileCheck %s -check-prefix=NO_PLACEHOLDER_NAMES_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NO_PLACEHOLDER_NAMES_1 | %FileCheck %s -check-prefix=NO_PLACEHOLDER_NAMES_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_1 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_2 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_3 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_5 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_6 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_7 | FileCheck %s -check-prefix=COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_8 | FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_1 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_2 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_3 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_5 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_6 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_7 | %FileCheck %s -check-prefix=COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INVALID_8 | %FileCheck %s -check-prefix=COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_1 | FileCheck %s -check-prefix=MY_ALIAS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_2 | FileCheck %s -check-prefix=MY_ALIAS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_1 | %FileCheck %s -check-prefix=MY_ALIAS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_2 | %FileCheck %s -check-prefix=MY_ALIAS
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_1 | FileCheck %s -check-prefix=IN_FOR_EACH_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_2 | FileCheck %s -check-prefix=IN_FOR_EACH_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_3 | FileCheck %s -check-prefix=IN_FOR_EACH_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_4 | FileCheck %s -check-prefix=IN_FOR_EACH_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_1 | %FileCheck %s -check-prefix=IN_FOR_EACH_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_2 | %FileCheck %s -check-prefix=IN_FOR_EACH_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_3 | %FileCheck %s -check-prefix=IN_FOR_EACH_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FOR_EACH_4 | %FileCheck %s -check-prefix=IN_FOR_EACH_3
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPRECATED_1 | FileCheck %s -check-prefix=DEPRECATED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPRECATED_1 | %FileCheck %s -check-prefix=DEPRECATED_1
 
 //
 // Test code completion at the beginning of expr-postfix.
diff --git a/test/IDE/complete_expr_tuple.swift b/test/IDE/complete_expr_tuple.swift
index 4f0bb75..b2bfb9f 100644
--- a/test/IDE/complete_expr_tuple.swift
+++ b/test/IDE/complete_expr_tuple.swift
@@ -1,23 +1,23 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TUPLE_NO_DOT_1 > %t.tuple.txt
-// RUN: FileCheck %s -check-prefix=TUPLE_NO_DOT_1 < %t.tuple.txt
+// RUN: %FileCheck %s -check-prefix=TUPLE_NO_DOT_1 < %t.tuple.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TUPLE_NO_DOT_2 > %t.tuple.txt
-// RUN: FileCheck %s -check-prefix=TUPLE_NO_DOT_2 < %t.tuple.txt
+// RUN: %FileCheck %s -check-prefix=TUPLE_NO_DOT_2 < %t.tuple.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TUPLE_NO_DOT_3 > %t.tuple.txt
-// RUN: FileCheck %s -check-prefix=TUPLE_NO_DOT_3 < %t.tuple.txt
+// RUN: %FileCheck %s -check-prefix=TUPLE_NO_DOT_3 < %t.tuple.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TUPLE_DOT_1 > %t.tuple.txt
-// RUN: FileCheck %s -check-prefix=TUPLE_DOT_1 < %t.tuple.txt
+// RUN: %FileCheck %s -check-prefix=TUPLE_DOT_1 < %t.tuple.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TUPLE_DOT_2 > %t.tuple.txt
-// RUN: FileCheck %s -check-prefix=TUPLE_DOT_2 < %t.tuple.txt
+// RUN: %FileCheck %s -check-prefix=TUPLE_DOT_2 < %t.tuple.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TUPLE_DOT_3 > %t.tuple.txt
-// RUN: FileCheck %s -check-prefix=TUPLE_DOT_3 < %t.tuple.txt
+// RUN: %FileCheck %s -check-prefix=TUPLE_DOT_3 < %t.tuple.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TUPLE_NESTED_1 > %t.tuple.txt
-// RUN: FileCheck %s -check-prefix=TUPLE_NESTED_1 < %t.tuple.txt
+// RUN: %FileCheck %s -check-prefix=TUPLE_NESTED_1 < %t.tuple.txt
 
 //===---
 //===--- Test code completion for expressions that have tuple type.
diff --git a/test/IDE/complete_from_clang_framework.swift b/test/IDE/complete_from_clang_framework.swift
index 95f51f0..308ea48 100644
--- a/test/IDE/complete_from_clang_framework.swift
+++ b/test/IDE/complete_from_clang_framework.swift
@@ -1,32 +1,32 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=SWIFT_COMPLETIONS | FileCheck %s -check-prefix=SWIFT_COMPLETIONS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=SWIFT_COMPLETIONS | %FileCheck %s -check-prefix=SWIFT_COMPLETIONS
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=FW_UNQUAL_1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_FOO < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_FOO_SUB < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_FOO_HELPER < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_FOO_HELPER_SUB < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_BAR < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_BOTH_FOO_BAR < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_FOO < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_FOO_SUB < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_FOO_HELPER < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_FOO_HELPER_SUB < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_BAR < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_BOTH_FOO_BAR < %t.compl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_QUAL_FOO_1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_FOO < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_FOO_SUB < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_QUAL_FOO_NEGATIVE < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_FOO < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_FOO_SUB < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_QUAL_FOO_NEGATIVE < %t.compl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_QUAL_BAR_1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_QUAL_BAR_1 < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_BAR < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_QUAL_BAR_NEGATIVE < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_QUAL_BAR_1 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_BAR < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_QUAL_BAR_NEGATIVE < %t.compl.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_QUAL_FOO_2 | FileCheck %s -check-prefix=CLANG_QUAL_FOO_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_QUAL_FOO_2 | %FileCheck %s -check-prefix=CLANG_QUAL_FOO_2
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=FUNCTION_CALL_1 | FileCheck %s -check-prefix=FUNCTION_CALL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=FUNCTION_CALL_2 | FileCheck %s -check-prefix=FUNCTION_CALL_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=FUNCTION_CALL_1 | %FileCheck %s -check-prefix=FUNCTION_CALL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=FUNCTION_CALL_2 | %FileCheck %s -check-prefix=FUNCTION_CALL_2
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_STRUCT_MEMBERS_1 | FileCheck %s -check-prefix=CLANG_STRUCT_MEMBERS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_CLASS_MEMBERS_1 | FileCheck %s -check-prefix=CLANG_CLASS_MEMBERS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_CLASS_MEMBERS_2 | FileCheck %s -check-prefix=CLANG_CLASS_MEMBERS_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_INSTANCE_MEMBERS_1 | FileCheck %s -check-prefix=CLANG_INSTANCE_MEMBERS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_STRUCT_MEMBERS_1 | %FileCheck %s -check-prefix=CLANG_STRUCT_MEMBERS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_CLASS_MEMBERS_1 | %FileCheck %s -check-prefix=CLANG_CLASS_MEMBERS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_CLASS_MEMBERS_2 | %FileCheck %s -check-prefix=CLANG_CLASS_MEMBERS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_INSTANCE_MEMBERS_1 | %FileCheck %s -check-prefix=CLANG_INSTANCE_MEMBERS_1
 
 // XFAIL: linux
 
diff --git a/test/IDE/complete_from_clang_importer_framework.swift b/test/IDE/complete_from_clang_importer_framework.swift
index 0953eed..3979d7b 100644
--- a/test/IDE/complete_from_clang_importer_framework.swift
+++ b/test/IDE/complete_from_clang_importer_framework.swift
@@ -1,11 +1,11 @@
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CLANG_UNQUAL_1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_CTYPES < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_MACROS < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_DARWIN < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_DARWIN_NEG < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_CTYPES < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_MACROS < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_DARWIN < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_DARWIN_NEG < %t.compl.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=CLANG_MEMBER1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=CLANG_MEMBERS1 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=CLANG_MEMBERS1 < %t.compl.txt
 
 import macros
 import ctypes
diff --git a/test/IDE/complete_from_constraint_extensions.swift b/test/IDE/complete_from_constraint_extensions.swift
index b2942d4..1b91f54 100644
--- a/test/IDE/complete_from_constraint_extensions.swift
+++ b/test/IDE/complete_from_constraint_extensions.swift
@@ -1,6 +1,6 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRAINT1 | FileCheck %s -check-prefix=CONSTRAINT1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRAINT2 | FileCheck %s -check-prefix=CONSTRAINT2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRAINT3 | FileCheck %s -check-prefix=CONSTRAINT3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRAINT1 | %FileCheck %s -check-prefix=CONSTRAINT1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRAINT2 | %FileCheck %s -check-prefix=CONSTRAINT2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONSTRAINT3 | %FileCheck %s -check-prefix=CONSTRAINT3
 
 public protocol P1 {}
 public protocol P2 {}
diff --git a/test/IDE/complete_from_foundation_overlay.swift b/test/IDE/complete_from_foundation_overlay.swift
index 26ee5b9..71bc169 100644
--- a/test/IDE/complete_from_foundation_overlay.swift
+++ b/test/IDE/complete_from_foundation_overlay.swift
@@ -1,12 +1,12 @@
 import Foundation
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLAIN_TOP_LEVEL_1 > %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.toplevel.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_1 > %t.members.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_1 < %t.members.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_1 < %t.members.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members.txt
 
 // REQUIRES: objc_interop
 
@@ -28,5 +28,5 @@
 
 // FIXME: we should show the qualified String.Index type.
 // rdar://problem/20788802
-// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#Index#]{{; name=.+$}}
+// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]{{; name=.+$}}
 // PRIVATE_NOMINAL_MEMBERS_1: End completions
diff --git a/test/IDE/complete_from_reexport.swift b/test/IDE/complete_from_reexport.swift
index 3336d7f..90f2b74 100644
--- a/test/IDE/complete_from_reexport.swift
+++ b/test/IDE/complete_from_reexport.swift
@@ -5,8 +5,8 @@
 // RUN: %target-swift-frontend -emit-module -module-name FooSwiftModuleOverlay %S/Inputs/foo_swift_module_overlay.swift -I %t -o %t
 //
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_1 -I %t > %t.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_1 < %t.txt
-// RUN: FileCheck %s -check-prefix=NO_DUPLICATES < %t.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_1 < %t.txt
+// RUN: %FileCheck %s -check-prefix=NO_DUPLICATES < %t.txt
 
 // TOP_LEVEL_1: Begin completions
 // TOP_LEVEL_1-DAG: Decl[FreeFunction]/OtherModule[FooSwiftModuleOverlay]:     overlayedFoo()[#Void#]{{; name=.+$}}
diff --git a/test/IDE/complete_from_stdlib.swift b/test/IDE/complete_from_stdlib.swift
index f444c06..44b2965 100644
--- a/test/IDE/complete_from_stdlib.swift
+++ b/test/IDE/complete_from_stdlib.swift
@@ -1,70 +1,70 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLAIN_TOP_LEVEL_1 > %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.toplevel.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_1 > %t.members1.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_1 < %t.members1.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members1.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_1 < %t.members1.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members1.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_2B > %t.members2a.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_2 < %t.members2a.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2 < %t.members2a.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_2 < %t.members2a.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2 < %t.members2a.txt
 // FIXME: filter?
-// RUN-disabled: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members2a.txt
+// RUN-disabled: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members2a.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_2B > %t.members2b.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_2 < %t.members2b.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2 < %t.members2b.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_2 < %t.members2b.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2 < %t.members2b.txt
 // FIXME: filter?
-// RUN-disabled: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members2b.txt
+// RUN-disabled: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members2b.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_3 > %t.members3.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_3 < %t.members3.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_3 < %t.members3.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_3 < %t.members3.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_3 < %t.members3.txt
 // FIXME: filter?
-// RUN-disabled: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members3.txt
+// RUN-disabled: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members3.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_4 > %t.members4.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_4 < %t.members4.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members4.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_4 < %t.members4.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members4.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_5 > %t.members5.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_5 < %t.members5.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members5.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_5 < %t.members5.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members5.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_6 > %t.members6.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_6 < %t.members6.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members6.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_6 < %t.members6.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members6.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_7 > %t.members7.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_7 < %t.members7.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members7.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_7 < %t.members7.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members7.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_8 > %t.members8.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_8 < %t.members8.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members8.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_8 < %t.members8.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members8.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_9 > %t.members9.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_9 < %t.members9.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members9.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_9 < %t.members9.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members9.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_10 > %t.members10.txt
-// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_10 < %t.members10.txt
-// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members10.txt
+// RUN: %FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_10 < %t.members10.txt
+// RUN: %FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members10.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURNS_ANY_SEQUENCE | FileCheck %s -check-prefix=RETURNS_ANY_SEQUENCE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURNS_ANY_SEQUENCE | %FileCheck %s -check-prefix=RETURNS_ANY_SEQUENCE
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_INT_1 | FileCheck %s -check-prefix=POSTFIX_RVALUE_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_INT_2 | FileCheck %s -check-prefix=POSTFIX_LVALUE_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_OPTIONAL_1 | FileCheck %s -check-prefix=POSTFIX_OPTIONAL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_INT_1 | %FileCheck %s -check-prefix=POSTFIX_RVALUE_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_INT_2 | %FileCheck %s -check-prefix=POSTFIX_LVALUE_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_OPTIONAL_1 | %FileCheck %s -check-prefix=POSTFIX_OPTIONAL
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_INT_1 > %t
-// RUN: FileCheck %s -check-prefix=INFIX_INT < %t
-// RUN: FileCheck %s -check-prefix=NEGATIVE_INFIX_INT < %t
+// RUN: %FileCheck %s -check-prefix=INFIX_INT < %t
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_INFIX_INT < %t
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_INT_2 | FileCheck %s -check-prefix=INFIX_LVALUE_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_STRING_1 | FileCheck %s -check-prefix=INFIX_STRING
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_EXT_STRING_1 | FileCheck %s -check-prefix=INFIX_EXT_STRING
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_INT_2 | %FileCheck %s -check-prefix=INFIX_LVALUE_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_STRING_1 | %FileCheck %s -check-prefix=INFIX_STRING
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_EXT_STRING_1 | %FileCheck %s -check-prefix=INFIX_EXT_STRING
 
 // NO_STDLIB_PRIVATE: Begin completions
 // NO_STDLIB_PRIVATE: End completions
@@ -83,7 +83,7 @@
 
 // FIXME: we should show the qualified String.Index type.
 // rdar://problem/20788802
-// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#Index#]{{; name=.+$}}
+// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]{{; name=.+$}}
 // PRIVATE_NOMINAL_MEMBERS_1: End completions
 
 func protocolExtCollection1a<C : Collection>(_ a: C) {
diff --git a/test/IDE/complete_from_swift_module.swift b/test/IDE/complete_from_swift_module.swift
index 4c99c35..10eef60 100644
--- a/test/IDE/complete_from_swift_module.swift
+++ b/test/IDE/complete_from_swift_module.swift
@@ -6,35 +6,35 @@
 // Note: this test checks both module import case and file import case.
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=MODULE_QUALIFIED_1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=MODULE_QUALIFIED_1 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=MODULE_QUALIFIED_1 < %t.compl.txt
 //
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %S/Inputs -enable-source-import -code-completion-token=MODULE_QUALIFIED_1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=MODULE_QUALIFIED_1 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=MODULE_QUALIFIED_1 < %t.compl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=MODULE_QUALIFIED_2 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=MODULE_QUALIFIED_2 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=MODULE_QUALIFIED_2 < %t.compl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=MODULE_QUALIFIED_3 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=MODULE_QUALIFIED_3 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=MODULE_QUALIFIED_3 < %t.compl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=MODULE_QUALIFIED_4 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=MODULE_QUALIFIED_4 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=MODULE_QUALIFIED_4 < %t.compl.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=MODULE_QUALIFIED_5 | FileCheck %s -check-prefix=ERROR_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=MODULE_QUALIFIED_5 | %FileCheck %s -check-prefix=ERROR_COMMON
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=POSTFIX_OPERATOR_1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=POSTFIX_OPERATOR_1 < %t.compl.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE_POSTFIX_OPERATOR_1 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=POSTFIX_OPERATOR_1 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_POSTFIX_OPERATOR_1 < %t.compl.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=TOP_LEVEL_1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_1 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_1 < %t.compl.txt
 // rdar://15305873 Code completion: implement proper shadowing of declarations represented by cached results
-// FIXME: FileCheck %s -check-prefix=TOP_LEVEL_1_NEGATIVE < %t.compl.txt
+// FIXME: %FileCheck %s -check-prefix=TOP_LEVEL_1_NEGATIVE < %t.compl.txt
 //
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -I %S/Inputs -enable-source-import -code-completion-token=TOP_LEVEL_1 > %t.compl.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_1 < %t.compl.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_1 < %t.compl.txt
 // rdar://15305873 Code completion: implement proper shadowing of declarations represented by cached results
-// FIXME: FileCheck %s -check-prefix=TOP_LEVEL_1_NEGATIVE < %t.compl.txt
+// FIXME: %FileCheck %s -check-prefix=TOP_LEVEL_1_NEGATIVE < %t.compl.txt
 
 // ERROR_COMMON: found code completion token
 // ERROR_COMMON-NOT: Begin completions
diff --git a/test/IDE/complete_func_body_typechecking.swift b/test/IDE/complete_func_body_typechecking.swift
index 283728a..7c4d1d1 100644
--- a/test/IDE/complete_func_body_typechecking.swift
+++ b/test/IDE/complete_func_body_typechecking.swift
@@ -1,29 +1,29 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_1 | FileCheck %s -check-prefix=FOO_STRUCT_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_2 | FileCheck %s -check-prefix=FOO_STRUCT_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_3 | FileCheck %s -check-prefix=ERROR_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_4 | FileCheck %s -check-prefix=FOO_STRUCT_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_5 | FileCheck %s -check-prefix=FOO_STRUCT_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_6 | FileCheck %s -check-prefix=FOO_STRUCT_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_7 | FileCheck %s -check-prefix=ERROR_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_1 | %FileCheck %s -check-prefix=FOO_STRUCT_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_2 | %FileCheck %s -check-prefix=FOO_STRUCT_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_3 | %FileCheck %s -check-prefix=ERROR_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_4 | %FileCheck %s -check-prefix=FOO_STRUCT_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_5 | %FileCheck %s -check-prefix=FOO_STRUCT_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_6 | %FileCheck %s -check-prefix=FOO_STRUCT_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_7 | %FileCheck %s -check-prefix=ERROR_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IN_CONSTRUCTOR_1 | FileCheck %s -check-prefix=FOO_STRUCT_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IN_CONSTRUCTOR_2 | FileCheck %s -check-prefix=FOO_STRUCT_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IN_CONSTRUCTOR_1 | %FileCheck %s -check-prefix=FOO_STRUCT_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IN_CONSTRUCTOR_2 | %FileCheck %s -check-prefix=FOO_STRUCT_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IN_DESTRUCTOR_1 | FileCheck %s -check-prefix=FOO_STRUCT_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IN_DESTRUCTOR_1 | %FileCheck %s -check-prefix=FOO_STRUCT_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_1 | FileCheck %s -check-prefix=LOCALS_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_2 | FileCheck %s -check-prefix=LOCALS_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_3 | FileCheck %s -check-prefix=LOCALS_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_4 | FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_1 | %FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_2 | %FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_3 | %FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_4 | %FileCheck %s -check-prefix=LOCALS_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_IN_CONSTRUCTOR_1 | FileCheck %s -check-prefix=LOCALS_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_IN_DESTRUCTOR_1 | FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_IN_CONSTRUCTOR_1 | %FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_VAR_IF_IN_DESTRUCTOR_1 | %FileCheck %s -check-prefix=LOCALS_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_1 | FileCheck %s -check-prefix=LOCALS_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_2 | FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_1 | %FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_2 | %FileCheck %s -check-prefix=LOCALS_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IN_CONSTRUCTOR_1 | FileCheck %s -check-prefix=LOCALS_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IN_DESTRUCTOR_1 | FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IN_CONSTRUCTOR_1 | %FileCheck %s -check-prefix=LOCALS_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_POSTFIX_BEGIN_IN_DESTRUCTOR_1 | %FileCheck %s -check-prefix=LOCALS_COMMON
 
 struct FooStruct {
   var instanceVar = 0
diff --git a/test/IDE/complete_func_no_closing_brace.swift b/test/IDE/complete_func_no_closing_brace.swift
index b6b5ea4..e50e2ae 100644
--- a/test/IDE/complete_func_no_closing_brace.swift
+++ b/test/IDE/complete_func_no_closing_brace.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 
 // Make sure we don't crash on a function without a closing brace before EOF.
 // Don't add any tests at the end of the file!
diff --git a/test/IDE/complete_func_no_closing_brace_at_eof_1.swift b/test/IDE/complete_func_no_closing_brace_at_eof_1.swift
index e7619db..2da557e 100644
--- a/test/IDE/complete_func_no_closing_brace_at_eof_1.swift
+++ b/test/IDE/complete_func_no_closing_brace_at_eof_1.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 
 // rdar://14592634
 // Make sure we can code complete at EOF inside a function that does not have a
diff --git a/test/IDE/complete_func_no_closing_brace_at_eof_2.swift b/test/IDE/complete_func_no_closing_brace_at_eof_2.swift
index 4354cf6..2d980ab 100644
--- a/test/IDE/complete_func_no_closing_brace_at_eof_2.swift
+++ b/test/IDE/complete_func_no_closing_brace_at_eof_2.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 
 // rdar://14585132
 // Make sure we can resolve function parameters if function body is missing the
diff --git a/test/IDE/complete_func_no_closing_brace_at_eof_3.swift b/test/IDE/complete_func_no_closing_brace_at_eof_3.swift
index 3c79c66..2d31329 100644
--- a/test/IDE/complete_func_no_closing_brace_at_eof_3.swift
+++ b/test/IDE/complete_func_no_closing_brace_at_eof_3.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | FileCheck %s -check-prefix=A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=A | %FileCheck %s -check-prefix=A
 
 // Make sure we partially type check the function body even if function body is
 // missing the right brace.
diff --git a/test/IDE/complete_generic_optional.swift b/test/IDE/complete_generic_optional.swift
index 0f30035..588760c 100644
--- a/test/IDE/complete_generic_optional.swift
+++ b/test/IDE/complete_generic_optional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OPTIONAL_1 | FileCheck %s -check-prefix=FOO_OPTIONAL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OPTIONAL_1 | %FileCheck %s -check-prefix=FOO_OPTIONAL_1
 
 struct Bar {
 }
diff --git a/test/IDE/complete_generic_param.swift b/test/IDE/complete_generic_param.swift
index e162a5d..d37bff8 100644
--- a/test/IDE/complete_generic_param.swift
+++ b/test/IDE/complete_generic_param.swift
@@ -1,9 +1,9 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT1 | FileCheck %s -check-prefix=INHERIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT2 | FileCheck %s -check-prefix=INHERIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT3 | FileCheck %s -check-prefix=INHERIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT4 | FileCheck %s -check-prefix=INHERIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT5 | FileCheck %s -check-prefix=INHERIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT6 | FileCheck %s -check-prefix=INHERIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT1 | %FileCheck %s -check-prefix=INHERIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT2 | %FileCheck %s -check-prefix=INHERIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT3 | %FileCheck %s -check-prefix=INHERIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT4 | %FileCheck %s -check-prefix=INHERIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT5 | %FileCheck %s -check-prefix=INHERIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INHERIT6 | %FileCheck %s -check-prefix=INHERIT
 
 class C1{}
 protocol P1{}
diff --git a/test/IDE/complete_import.swift b/test/IDE/complete_import.swift
index 9cf95a6..3d717b8 100644
--- a/test/IDE/complete_import.swift
+++ b/test/IDE/complete_import.swift
@@ -1,11 +1,11 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT1 | FileCheck %s -check-prefix=CLANG_IMPORT1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT2 | FileCheck %s -check-prefix=CLANG_IMPORT2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT3 | FileCheck %s -check-prefix=CLANG_IMPORT3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT4 | FileCheck %s -check-prefix=CLANG_IMPORT4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT5 | FileCheck %s -check-prefix=CLANG_IMPORT5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT6 | FileCheck %s -check-prefix=CLANG_IMPORT6
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT7 | FileCheck %s -check-prefix=CLANG_IMPORT7
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT8 | FileCheck %s -check-prefix=CLANG_IMPORT8
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT1 | %FileCheck %s -check-prefix=CLANG_IMPORT1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT2 | %FileCheck %s -check-prefix=CLANG_IMPORT2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT3 | %FileCheck %s -check-prefix=CLANG_IMPORT3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT4 | %FileCheck %s -check-prefix=CLANG_IMPORT4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT5 | %FileCheck %s -check-prefix=CLANG_IMPORT5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT6 | %FileCheck %s -check-prefix=CLANG_IMPORT6
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT7 | %FileCheck %s -check-prefix=CLANG_IMPORT7
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT8 | %FileCheck %s -check-prefix=CLANG_IMPORT8
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/complete_import_multifile1.swift b/test/IDE/complete_import_multifile1.swift
index 4f7f26e..5f4b877 100644
--- a/test/IDE/complete_import_multifile1.swift
+++ b/test/IDE/complete_import_multifile1.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT1 | FileCheck %s -check-prefix=CLANG_IMPORT1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -second-source-filename %S/Inputs/complete_import_multifile2.swift -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT1 | FileCheck %s -check-prefix=CLANG_IMPORT1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT1 | %FileCheck %s -check-prefix=CLANG_IMPORT1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -second-source-filename %S/Inputs/complete_import_multifile2.swift -F %S/Inputs/mock-sdk -code-completion-token=CLANG_IMPORT1 | %FileCheck %s -check-prefix=CLANG_IMPORT1
 // REQUIRES: objc_interop
 
 import #^CLANG_IMPORT1^#
diff --git a/test/IDE/complete_in_accessors.swift b/test/IDE/complete_in_accessors.swift
index 1d38f84..99ea62a 100644
--- a/test/IDE/complete_in_accessors.swift
+++ b/test/IDE/complete_in_accessors.swift
@@ -1,117 +1,117 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_IMPLICIT_GET_1 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_IMPLICIT_GET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_IMPLICIT_GET_1 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_IMPLICIT_GET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_GET_1 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_GET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_GET_1 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_GET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_SET_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_SET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_SET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_SET_3 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_SET_4 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_SET_4 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_WILLSET_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_WILLSET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_WILLSET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_WILLSET_3 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_DIDSET_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_DIDSET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_DIDSET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_DIDSET_3 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_INIT_1 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_INIT_2 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_INIT_1 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_ACCESSOR_INIT_2 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS1
 
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_IMPLICIT_GET_1 | FileCheck %s -check-prefix=WITH_MEMBER_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_IMPLICIT_GET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_IMPLICIT_GET_1 | %FileCheck %s -check-prefix=WITH_MEMBER_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_IMPLICIT_GET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_GET_1 | FileCheck %s -check-prefix=WITH_MEMBER_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_GET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_GET_1 | %FileCheck %s -check-prefix=WITH_MEMBER_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_GET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_SET_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_SET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_SET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_SET_3 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_SET_4 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_SET_4 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_WILLSET_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_WILLSET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_WILLSET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_WILLSET_3 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_DIDSET_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_DIDSET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_DIDSET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_DIDSET_3 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_INIT_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS_INIT < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS_INIT_WRONG < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS_INIT < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS_INIT_WRONG < %t.txt
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_ACCESSOR_INIT_2 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS_INIT < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_MEMBER_DECLS_INIT_WRONG < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS_INIT < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_MEMBER_DECLS_INIT_WRONG < %t.txt
 
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_IMPLICIT_GET_1 | FileCheck %s -check-prefix=WITH_LOCAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_IMPLICIT_GET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_IMPLICIT_GET_1 | %FileCheck %s -check-prefix=WITH_LOCAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_IMPLICIT_GET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_GET_1 | FileCheck %s -check-prefix=WITH_LOCAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_GET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_GET_1 | %FileCheck %s -check-prefix=WITH_LOCAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_GET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_SET_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_SET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_SET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_SET_3 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_SET_4 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_SET_4 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_WILLSET_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_WILLSET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_WILLSET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_WILLSET_3 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_NEWVALUE < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_DIDSET_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_DIDSET_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_DIDSET_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_DIDSET_3 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_LOCAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_OLDVALUE < %t.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_INIT_1 | FileCheck %s -check-prefix=WITH_LOCAL_DECLS1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_INIT_2 | FileCheck %s -check-prefix=WITH_LOCAL_DECLS1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_INIT_1 | %FileCheck %s -check-prefix=WITH_LOCAL_DECLS1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOCAL_ACCESSOR_INIT_2 | %FileCheck %s -check-prefix=WITH_LOCAL_DECLS1
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ACCESSOR_IN_MEMBER_FUNC_1 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_DECLS1 < %t.txt
-// RUN: FileCheck %s -check-prefix=ACCESSORS_IN_MEMBER_FUNC_1 < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS1 < %t.txt
+// RUN: %FileCheck %s -check-prefix=ACCESSORS_IN_MEMBER_FUNC_1 < %t.txt
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ACCESSOR_IN_MEMBER_FUNC_2 > %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
-// RUN: FileCheck %s -check-prefix=ACCESSORS_IN_MEMBER_FUNC_2 < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS < %t.txt
+// RUN: %FileCheck %s -check-prefix=ACCESSORS_IN_MEMBER_FUNC_2 < %t.txt
 
 //===--- Helper types that are used in this test
 
diff --git a/test/IDE/complete_in_closures.swift b/test/IDE/complete_in_closures.swift
index 23dd57e..3643fab 100644
--- a/test/IDE/complete_in_closures.swift
+++ b/test/IDE/complete_in_closures.swift
@@ -1,56 +1,56 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CLOSURE_PARAM_1 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CLOSURE_PARAM_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CLOSURE_PARAM_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CLOSURE_PARAM_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_1 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_3 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_4 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_5 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_6 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_3 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_4 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_5 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_PARENT_PARAM_6 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_1 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_1 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_1 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_2 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_3 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_4 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_5 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_6 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_7 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_8 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_9 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_10 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS_AND_LOCAL1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_1 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_2 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_3 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_4 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_5 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_6 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_7 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_8 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_9 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DELAYED_10 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS_AND_LOCAL1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_1 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_3 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_4 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_5 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_6 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_7 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_8 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_9 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_10 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_11 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_12 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_13 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_14 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_15 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_16 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_17 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_18 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_19 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INHERITANCE_IN_CLOSURE_0 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_INHERITANCE_IN_CLOSURE_0 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARGUMENT_TYPE_IN_CLOSURE_0 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INHERITANCE_IN_CLOSURE_1 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_INHERITANCE_IN_CLOSURE_1 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARGUMENT_TYPE_IN_CLOSURE_1 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INHERITANCE_IN_CLOSURE_2 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_INHERITANCE_IN_CLOSURE_2 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARGUMENT_TYPE_IN_CLOSURE_2 | FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_PARAM_1 | FileCheck %s -check-prefix=CLOSURE_PARAM_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_PARAM_2 | FileCheck %s -check-prefix=CLOSURE_PARAM_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_1 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_3 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_4 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_5 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_6 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_7 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_8 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_9 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_10 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_11 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_12 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_13 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_14 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_15 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_16 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_17 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_18 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_TRAILING_CLOSURE_19 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INHERITANCE_IN_CLOSURE_0 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_INHERITANCE_IN_CLOSURE_0 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARGUMENT_TYPE_IN_CLOSURE_0 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INHERITANCE_IN_CLOSURE_1 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_INHERITANCE_IN_CLOSURE_1 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARGUMENT_TYPE_IN_CLOSURE_1 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=STRUCT_INHERITANCE_IN_CLOSURE_2 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_INHERITANCE_IN_CLOSURE_2 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARGUMENT_TYPE_IN_CLOSURE_2 | %FileCheck %s -check-prefix=WITH_GLOBAL_DECLS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_PARAM_1 | %FileCheck %s -check-prefix=CLOSURE_PARAM_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_PARAM_2 | %FileCheck %s -check-prefix=CLOSURE_PARAM_2
 
 // ERROR_COMMON: found code completion token
 // ERROR_COMMON-NOT: Begin completions
diff --git a/test/IDE/complete_in_enum_decl.swift b/test/IDE/complete_in_enum_decl.swift
index 8ec8cef..1390911 100644
--- a/test/IDE/complete_in_enum_decl.swift
+++ b/test/IDE/complete_in_enum_decl.swift
@@ -1,9 +1,9 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_1 | FileCheck %s -check-prefix=NO_RESULTS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_2 | FileCheck %s -check-prefix=NO_RESULTS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_3 | FileCheck %s -check-prefix=NO_RESULTS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_4 | FileCheck %s -check-prefix=NO_RESULTS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_5 | FileCheck %s -check-prefix=NO_RESULTS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_6 | FileCheck %s -check-prefix=NO_RESULTS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_1 | %FileCheck %s -check-prefix=NO_RESULTS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_2 | %FileCheck %s -check-prefix=NO_RESULTS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_3 | %FileCheck %s -check-prefix=NO_RESULTS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_4 | %FileCheck %s -check-prefix=NO_RESULTS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_5 | %FileCheck %s -check-prefix=NO_RESULTS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_CASE_6 | %FileCheck %s -check-prefix=NO_RESULTS
 
 // NO_RESULTS: found code completion token
 // NO_RESULTS-NOT: Begin completions
diff --git a/test/IDE/complete_init.swift b/test/IDE/complete_init.swift
index f529eb7..0b788b3 100644
--- a/test/IDE/complete_init.swift
+++ b/test/IDE/complete_init.swift
@@ -2,18 +2,18 @@
 // RUN: %target-swift-frontend -parse -verify %t_no_errors.swift
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=TOP_LEVEL_0 > %t
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_0 < %t
-// RUN: FileCheck %s -check-prefix=NEGATIVE_TOP_LEVEL_0 < %t
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_0 < %t
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_TOP_LEVEL_0 < %t
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=TOP_LEVEL_1 > %t.generic
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL_0 < %t.generic
-// RUN: FileCheck %s -check-prefix=GENERIC_PARAM_0 < %t.generic
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=K_QUALIFIED_0 | FileCheck %s -check-prefix=K_QUALIFIED_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=L_QUALIFIED_0 | FileCheck %s -check-prefix=L_QUALIFIED_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=L_QUALIFIED_0 | FileCheck %s -check-prefix=NEGATIVE_L_QUALIFIED_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=INSIDE_L_0 | FileCheck %s -check-prefix=INSIDE_L_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=INSIDE_M_0 | FileCheck %s -check-prefix=INSIDE_M_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ALIAS_CONSTRUCTOR_0 | FileCheck %s -check-prefix=ALIAS_CONSTRUCTOR_0
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL_0 < %t.generic
+// RUN: %FileCheck %s -check-prefix=GENERIC_PARAM_0 < %t.generic
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=K_QUALIFIED_0 | %FileCheck %s -check-prefix=K_QUALIFIED_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=L_QUALIFIED_0 | %FileCheck %s -check-prefix=L_QUALIFIED_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=L_QUALIFIED_0 | %FileCheck %s -check-prefix=NEGATIVE_L_QUALIFIED_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=INSIDE_L_0 | %FileCheck %s -check-prefix=INSIDE_L_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=INSIDE_M_0 | %FileCheck %s -check-prefix=INSIDE_M_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ALIAS_CONSTRUCTOR_0 | %FileCheck %s -check-prefix=ALIAS_CONSTRUCTOR_0
 
 struct A {
   // implicit init()
diff --git a/test/IDE/complete_init_inherited.swift b/test/IDE/complete_init_inherited.swift
index e65b1d9..f661695 100644
--- a/test/IDE/complete_init_inherited.swift
+++ b/test/IDE/complete_init_inherited.swift
@@ -1,7 +1,7 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_A | FileCheck %s -check-prefix=TEST_A
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_B | FileCheck %s -check-prefix=TEST_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_C | FileCheck %s -check-prefix=TEST_C
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_D | FileCheck %s -check-prefix=TEST_D
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_A | %FileCheck %s -check-prefix=TEST_A
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_B | %FileCheck %s -check-prefix=TEST_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_C | %FileCheck %s -check-prefix=TEST_C
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_D | %FileCheck %s -check-prefix=TEST_D
 
 class A {
   init(int i: Int) {}
diff --git a/test/IDE/complete_keywords.swift b/test/IDE/complete_keywords.swift
index 5531262..deae5c6 100644
--- a/test/IDE/complete_keywords.swift
+++ b/test/IDE/complete_keywords.swift
@@ -1,82 +1,82 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_1 > %t.top1
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.top1
-// RUN: FileCheck %s -check-prefix=KW_NO_RETURN < %t.top1
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.top1
+// RUN: %FileCheck %s -check-prefix=KW_NO_RETURN < %t.top1
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_2 > %t.top2
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.top2
-// RUN: FileCheck %s -check-prefix=KW_NO_RETURN < %t.top2
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.top2
+// RUN: %FileCheck %s -check-prefix=KW_NO_RETURN < %t.top2
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_1 > %t.func1
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func1
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func1
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.func1
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.func1
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_2 > %t.func2
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func2
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func2
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.func2
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.func2
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_3 > %t.func3
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func3
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func3
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.func3
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.func3
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_4 > %t.func4
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func4
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func4
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.func4
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.func4
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNC_BODY_5 > %t.func5
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.func5
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.func5
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.func5
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.func5
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLOSURE_1 > %t.clos1
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos1
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.clos1
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos1
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.clos1
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLOSURE_2 > %t.clos2
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos2
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.clos2
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos2
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.clos2
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLOSURE_3 > %t.clos3
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos3
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.clos3
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos3
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.clos3
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLOSURE_4 > %t.clos4
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos4
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.clos4
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.clos4
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.clos4
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SUBSCRIPT_1 > %t.subs
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.subs
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.subs
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.subs
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.subs
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_INIT_1 > %t.init
-// RUN: FileCheck %s -check-prefix=KW_DECL_STMT < %t.init
-// RUN: FileCheck %s -check-prefix=KW_RETURN < %t.init
+// RUN: %FileCheck %s -check-prefix=KW_DECL_STMT < %t.init
+// RUN: %FileCheck %s -check-prefix=KW_RETURN < %t.init
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_1 | FileCheck %s -check-prefix=KW_DECL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_2 | FileCheck %s -check-prefix=KW_DECL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_3 | FileCheck %s -check-prefix=KW_DECL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_4 | FileCheck %s -check-prefix=KW_DECL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_5 | FileCheck %s -check-prefix=KW_DECL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_6 | FileCheck %s -check-prefix=KW_DECL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_7 | FileCheck %s -check-prefix=KW_DECL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_8 | FileCheck %s -check-prefix=KW_DECL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_9 | FileCheck %s -check-prefix=KW_DECL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_10 | FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_1 | %FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_2 | %FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_3 | %FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_4 | %FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_5 | %FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_6 | %FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_7 | %FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_8 | %FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_9 | %FileCheck %s -check-prefix=KW_DECL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_NOMINAL_DECL_10 | %FileCheck %s -check-prefix=KW_DECL
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUPER_KEYWORD0 | FileCheck %s -check-prefix=SUPER_KEYWORD0
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUPER_KEYWORD1 | FileCheck %s -check-prefix=SUPER_KEYWORD1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUPER_KEYWORD2 | FileCheck %s -check-prefix=SUPER_KEYWORD2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUPER_KEYWORD3 | FileCheck %s -check-prefix=SUPER_KEYWORD3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUPER_KEYWORD0 | %FileCheck %s -check-prefix=SUPER_KEYWORD0
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUPER_KEYWORD1 | %FileCheck %s -check-prefix=SUPER_KEYWORD1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUPER_KEYWORD2 | %FileCheck %s -check-prefix=SUPER_KEYWORD2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUPER_KEYWORD3 | %FileCheck %s -check-prefix=SUPER_KEYWORD3
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_1 > %t.expr1
-// RUN: FileCheck %s -check-prefix=KW_EXPR < %t.expr1
-// RUN: FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr1
+// RUN: %FileCheck %s -check-prefix=KW_EXPR < %t.expr1
+// RUN: %FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr1
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_2 > %t.expr2
-// RUN: FileCheck %s -check-prefix=KW_EXPR < %t.expr2
-// RUN: FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr2
+// RUN: %FileCheck %s -check-prefix=KW_EXPR < %t.expr2
+// RUN: %FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr2
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_3 > %t.expr3
-// RUN: FileCheck %s -check-prefix=KW_EXPR < %t.expr3
-// RUN: FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr3
+// RUN: %FileCheck %s -check-prefix=KW_EXPR < %t.expr3
+// RUN: %FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr3
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_4 > %t.expr4
-// RUN: FileCheck %s -check-prefix=KW_EXPR < %t.expr4
-// RUN: FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr4
+// RUN: %FileCheck %s -check-prefix=KW_EXPR < %t.expr4
+// RUN: %FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr4
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_5 > %t.expr5
-// RUN: FileCheck %s -check-prefix=KW_EXPR < %t.expr5
-// RUN: FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr5
+// RUN: %FileCheck %s -check-prefix=KW_EXPR < %t.expr5
+// RUN: %FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr5
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=EXPR_6 > %t.expr6
-// RUN: FileCheck %s -check-prefix=KW_EXPR < %t.expr6
-// RUN: FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr6
+// RUN: %FileCheck %s -check-prefix=KW_EXPR < %t.expr6
+// RUN: %FileCheck %s -check-prefix=KW_EXPR_NEG < %t.expr6
 
 // KW_RETURN: Keyword[return]/None: return{{; name=.+$}}
 // KW_NO_RETURN-NOT: Keyword[return]
diff --git a/test/IDE/complete_lazy_initialized_var.swift b/test/IDE/complete_lazy_initialized_var.swift
index c708b17..b287a40 100644
--- a/test/IDE/complete_lazy_initialized_var.swift
+++ b/test/IDE/complete_lazy_initialized_var.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LAZY_IN_CLASS_1 | FileCheck %s -check-prefix=LAZYVAR1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LAZY_IN_CLASS_1 | %FileCheck %s -check-prefix=LAZYVAR1
 class FooClass1 {
  lazy var lazyVar1 = 0
 }
diff --git a/test/IDE/complete_literal.swift b/test/IDE/complete_literal.swift
index bffeafb..bfe4776 100644
--- a/test/IDE/complete_literal.swift
+++ b/test/IDE/complete_literal.swift
@@ -1,10 +1,10 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL1 | FileCheck %s -check-prefix=LITERAL1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL2 | FileCheck %s -check-prefix=LITERAL2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL3 | FileCheck %s -check-prefix=LITERAL3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL4 | FileCheck %s -check-prefix=LITERAL4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL5 | FileCheck %s -check-prefix=LITERAL5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL6 | FileCheck %s -check-prefix=LITERAL6
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL7 | FileCheck %s -check-prefix=LITERAL7
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL1 | %FileCheck %s -check-prefix=LITERAL1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL2 | %FileCheck %s -check-prefix=LITERAL2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL3 | %FileCheck %s -check-prefix=LITERAL3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL4 | %FileCheck %s -check-prefix=LITERAL4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL5 | %FileCheck %s -check-prefix=LITERAL5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL6 | %FileCheck %s -check-prefix=LITERAL6
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LITERAL7 | %FileCheck %s -check-prefix=LITERAL7
 
 {
   1.#^LITERAL1^#
@@ -42,12 +42,12 @@
 
 // FIXME: we should show the qualified String.Index type.
 // rdar://problem/20788802
-// LITERAL4-DAG:     Decl[InstanceVar]/CurrNominal:      startIndex[#Index#]; name=startIndex{{$}}
-// LITERAL4-DAG:     Decl[InstanceVar]/CurrNominal:      endIndex[#Index#]; name=endIndex{{$}}
+// LITERAL4-DAG:     Decl[InstanceVar]/CurrNominal:      startIndex[#String.Index#]; name=startIndex{{$}}
+// LITERAL4-DAG:     Decl[InstanceVar]/CurrNominal:      endIndex[#String.Index#]; name=endIndex{{$}}
 // LITERAL4-DAG:     Decl[InstanceMethod]/CurrNominal:   append({#(c): Character#})[#Void#]; name=append(c: Character){{$}}
 // LITERAL4-DAG:     Decl[InstanceMethod]/CurrNominal:   append({#contentsOf: S#})[#Void#]; name=append(contentsOf: S){{$}}
-// LITERAL4-DAG:     Decl[InstanceMethod]/CurrNominal:   insert({#contentsOf: S#}, {#at: Index#})[#Void#]; name=insert(contentsOf: S, at: Index){{$}}
-// LITERAL4-DAG:     Decl[InstanceMethod]/CurrNominal:   remove({#at: Index#})[#Character#]; name=remove(at: Index){{$}}
+// LITERAL4-DAG:     Decl[InstanceMethod]/CurrNominal:   insert({#contentsOf: S#}, {#at: String.Index#})[#Void#]; name=insert(contentsOf: S, at: String.Index){{$}}
+// LITERAL4-DAG:     Decl[InstanceMethod]/CurrNominal:   remove({#at: String.Index#})[#Character#]; name=remove(at: String.Index){{$}}
 // LITERAL4-DAG:     Decl[InstanceMethod]/CurrNominal:      lowercased()[#String#]; name=lowercased(){{$}}
 
 func giveMeAString() -> Int {
@@ -56,7 +56,7 @@
 }
 
 // LITERAL5-DAG:     Decl[InstanceVar]/CurrNominal:      characters[#String.CharacterView#]{{; name=.+$}}
-// LITERAL5-DAG:     Decl[InstanceVar]/CurrNominal:      endIndex[#Index#]{{; name=.+$}}
+// LITERAL5-DAG:     Decl[InstanceVar]/CurrNominal:      endIndex[#String.Index#]{{; name=.+$}}
 // LITERAL5-DAG:     Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: reserveCapacity({#(n): Int#})[#Void#]{{; name=.+$}}
 // LITERAL5-DAG:     Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: append({#(c): Character#})[#Void#]{{; name=.+$}}
 // LITERAL5-DAG:     Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: append({#contentsOf: S#})[#Void#]{{; name=.+$}}
diff --git a/test/IDE/complete_loop.swift b/test/IDE/complete_loop.swift
index 1f55600..8642f82 100644
--- a/test/IDE/complete_loop.swift
+++ b/test/IDE/complete_loop.swift
@@ -1,10 +1,10 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_1 | FileCheck %s -check-prefix=LOOP_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_1 | %FileCheck %s -check-prefix=LOOP_1
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_2 > %t.loop2.txt
-// RUN: FileCheck %s -check-prefix=LOOP_2 < %t.loop2.txt
-// RUN: FileCheck %s -check-prefix=LOOP_2_NEGATIVE < %t.loop2.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_3 | FileCheck %s -check-prefix=LOOP_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_4 | FileCheck %s -check-prefix=LOOP_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_5 | FileCheck %s -check-prefix=LOOP_5
+// RUN: %FileCheck %s -check-prefix=LOOP_2 < %t.loop2.txt
+// RUN: %FileCheck %s -check-prefix=LOOP_2_NEGATIVE < %t.loop2.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_3 | %FileCheck %s -check-prefix=LOOP_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_4 | %FileCheck %s -check-prefix=LOOP_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=LOOP_5 | %FileCheck %s -check-prefix=LOOP_5
 
 class Gen {
 	func IntGen() -> Int { return 0 }
diff --git a/test/IDE/complete_member_decls_from_parent_decl_context.swift b/test/IDE/complete_member_decls_from_parent_decl_context.swift
index 4c92771..7d93383 100644
--- a/test/IDE/complete_member_decls_from_parent_decl_context.swift
+++ b/test/IDE/complete_member_decls_from_parent_decl_context.swift
@@ -1,38 +1,38 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_INSTANCE_METHOD_1 | FileCheck %s -check-prefix=IN_CLASS_INSTANCE_METHOD_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_STATIC_METHOD_1 | FileCheck %s -check-prefix=IN_CLASS_STATIC_METHOD_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_STATIC_METHOD_1 | FileCheck %s -check-prefix=IN_CLASS_STATIC_METHOD_1_NEGATIVE
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_CONSTRUCTOR_1 | FileCheck %s -check-prefix=IN_CLASS_CONSTRUCTOR_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_DESTRUCTOR_1 | FileCheck %s -check-prefix=IN_CLASS_DESTRUCTOR_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_INSTANCE_METHOD_1 | %FileCheck %s -check-prefix=IN_CLASS_INSTANCE_METHOD_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_STATIC_METHOD_1 | %FileCheck %s -check-prefix=IN_CLASS_STATIC_METHOD_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_STATIC_METHOD_1 | %FileCheck %s -check-prefix=IN_CLASS_STATIC_METHOD_1_NEGATIVE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_CONSTRUCTOR_1 | %FileCheck %s -check-prefix=IN_CLASS_CONSTRUCTOR_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_CLASS_DESTRUCTOR_1 | %FileCheck %s -check-prefix=IN_CLASS_DESTRUCTOR_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_STRUCT_INSTANCE_METHOD_1 | FileCheck %s -check-prefix=IN_STRUCT_INSTANCE_METHOD_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_STRUCT_STATIC_METHOD_1 | FileCheck %s -check-prefix=IN_STRUCT_STATIC_METHOD_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_STRUCT_STATIC_METHOD_1 | FileCheck %s -check-prefix=IN_STRUCT_STATIC_METHOD_1_NEGATIVE
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_STRUCT_CONSTRUCTOR_1 | FileCheck %s -check-prefix=IN_STRUCT_CONSTRUCTOR_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_STRUCT_INSTANCE_METHOD_1 | %FileCheck %s -check-prefix=IN_STRUCT_INSTANCE_METHOD_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_STRUCT_STATIC_METHOD_1 | %FileCheck %s -check-prefix=IN_STRUCT_STATIC_METHOD_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_STRUCT_STATIC_METHOD_1 | %FileCheck %s -check-prefix=IN_STRUCT_STATIC_METHOD_1_NEGATIVE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_STRUCT_CONSTRUCTOR_1 | %FileCheck %s -check-prefix=IN_STRUCT_CONSTRUCTOR_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_1 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_2 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_3 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_4 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_5 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_1 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_2 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_3 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_4 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_A_5 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_A_5
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_1 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_2 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_3 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_4 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_5 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_1 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_2 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_3 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_4 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_B_5 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_B_5
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_1 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_2 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_3 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_4 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_5 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_1 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_2 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_3 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_4 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_C_5 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_C_5
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_D_1 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_D_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_D_1 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_D_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_E_1 | FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_E_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL_DECL_E_1 | %FileCheck %s -check-prefix=NESTED_NOMINAL_DECL_E_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SR627_SUBCLASS | FileCheck %s -check-prefix=SR627_SUBCLASS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SR627_SUB_SUBCLASS | FileCheck %s -check-prefix=SR627_SUB_SUBCLASS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SR627_SUBCLASS | %FileCheck %s -check-prefix=SR627_SUBCLASS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SR627_SUB_SUBCLASS | %FileCheck %s -check-prefix=SR627_SUB_SUBCLASS
 
 //===---
 //===--- Test that we can code complete in methods, and correctly distinguish
diff --git a/test/IDE/complete_members_optional.swift b/test/IDE/complete_members_optional.swift
index 39a33ba..db2afd7 100644
--- a/test/IDE/complete_members_optional.swift
+++ b/test/IDE/complete_members_optional.swift
@@ -1,8 +1,8 @@
 // RUN: sed -n -e '1,/NO_ERRORS_UP_TO_HERE$/ p' %s > %t_no_errors.swift
 // RUN: %target-swift-frontend -parse -verify -disable-objc-attr-requires-foundation-module %t_no_errors.swift
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OPTIONAL_MEMBERS_1 | FileCheck %s -check-prefix=OPTIONAL_MEMBERS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OPTIONAL_MEMBERS_2 | FileCheck %s -check-prefix=OPTIONAL_MEMBERS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OPTIONAL_MEMBERS_1 | %FileCheck %s -check-prefix=OPTIONAL_MEMBERS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OPTIONAL_MEMBERS_2 | %FileCheck %s -check-prefix=OPTIONAL_MEMBERS_2
 
 @objc
 protocol HasOptionalMembers1 {
diff --git a/test/IDE/complete_multiple_files.swift b/test/IDE/complete_multiple_files.swift
index 3bc97cc..c3f9410 100644
--- a/test/IDE/complete_multiple_files.swift
+++ b/test/IDE/complete_multiple_files.swift
@@ -1,10 +1,10 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=T1 \
-// RUN:     %S/Inputs/multiple-files-1.swift %S/Inputs/multiple-files-2.swift | FileCheck %s -check-prefix=T1
+// RUN:     %S/Inputs/multiple-files-1.swift %S/Inputs/multiple-files-2.swift | %FileCheck %s -check-prefix=T1
 //
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_1 \
-// RUN:     %S/Inputs/multiple-files-1.swift %S/Inputs/multiple-files-2.swift | FileCheck %s -check-prefix=TOP_LEVEL_1
+// RUN:     %S/Inputs/multiple-files-1.swift %S/Inputs/multiple-files-2.swift | %FileCheck %s -check-prefix=TOP_LEVEL_1
 //
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MODULE_SCOPED %S/Inputs/multiple-files-1.swift %S/Inputs/multiple-files-2.swift | FileCheck %s -check-prefix=MODULE_SCOPED
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MODULE_SCOPED %S/Inputs/multiple-files-1.swift %S/Inputs/multiple-files-2.swift | %FileCheck %s -check-prefix=MODULE_SCOPED
 
 func testObjectExpr() {
   fooObject.#^T1^#
diff --git a/test/IDE/complete_name_lookup.swift b/test/IDE/complete_name_lookup.swift
index 9169242..3319439 100644
--- a/test/IDE/complete_name_lookup.swift
+++ b/test/IDE/complete_name_lookup.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_1 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BAR_OBJECT_DOT_1 | FileCheck %s -check-prefix=BAR_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BAR_OBJECT_DOT_1 | %FileCheck %s -check-prefix=BAR_OBJECT_DOT
 
 protocol FooBaseProtocol {
   var instanceProperty: Int { get }
diff --git a/test/IDE/complete_not_recommended.swift b/test/IDE/complete_not_recommended.swift
index a51d880..e90b7e4 100644
--- a/test/IDE/complete_not_recommended.swift
+++ b/test/IDE/complete_not_recommended.swift
@@ -1,10 +1,10 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER | FileCheck %s -check-prefix=CHECK1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER | %FileCheck %s -check-prefix=CHECK1
 // CHECK1: Begin completions, 2 items
 // CHECK1: Decl[InstanceMethod]/CurrNominal:   foo({#self: A#})[#() -> Void#]
 // CHECK1: Decl[Constructor]/CurrNominal:      init()[#A#]; name=init(){{$}}
 // CHECK1: End completions
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERRIDE_1 | FileCheck %s -check-prefix=OVERRIDE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVERRIDE_1 | %FileCheck %s -check-prefix=OVERRIDE_1
 
 class A {
   func foo() {}
diff --git a/test/IDE/complete_operators.swift b/test/IDE/complete_operators.swift
index 988a4b2..d16da90 100644
--- a/test/IDE/complete_operators.swift
+++ b/test/IDE/complete_operators.swift
@@ -1,61 +1,61 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_1 | FileCheck %s -check-prefix=POSTFIX_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_1 | %FileCheck %s -check-prefix=POSTFIX_1
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_2 > %t
-// RUN: FileCheck %s -check-prefix=POSTFIX_2 < %t
-// RUN: FileCheck %s -check-prefix=NEGATIVE_POSTFIX_2 < %t
+// RUN: %FileCheck %s -check-prefix=POSTFIX_2 < %t
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_POSTFIX_2 < %t
 
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_3 | FileCheck %s -check-prefix=POSTFIX_3
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_4 | FileCheck %s -check-prefix=POSTFIX_4
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_5 | FileCheck %s -check-prefix=POSTFIX_5
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_6 | FileCheck %s -check-prefix=POSTFIX_6
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_7 | FileCheck %s -check-prefix=POSTFIX_7
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_8 | FileCheck %s -check-prefix=POSTFIX_8
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_9 | FileCheck %s -check-prefix=POSTFIX_9
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_10 | FileCheck %s -check-prefix=POSTFIX_10
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=S_POSTFIX_SPACE | FileCheck %s -check-prefix=S_POSTFIX_SPACE
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_3 | %FileCheck %s -check-prefix=POSTFIX_3
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_4 | %FileCheck %s -check-prefix=POSTFIX_4
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_5 | %FileCheck %s -check-prefix=POSTFIX_5
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_6 | %FileCheck %s -check-prefix=POSTFIX_6
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_7 | %FileCheck %s -check-prefix=POSTFIX_7
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_8 | %FileCheck %s -check-prefix=POSTFIX_8
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_9 | %FileCheck %s -check-prefix=POSTFIX_9
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=POSTFIX_10 | %FileCheck %s -check-prefix=POSTFIX_10
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=S_POSTFIX_SPACE | %FileCheck %s -check-prefix=S_POSTFIX_SPACE
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_1 > %t
-// RUN: FileCheck %s -check-prefix=S2_INFIX < %t
-// RUN: FileCheck %s -check-prefix=NEGATIVE_S2_INFIX < %t
+// RUN: %FileCheck %s -check-prefix=S2_INFIX < %t
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_S2_INFIX < %t
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_2 > %t
-// RUN: FileCheck %s -check-prefix=S2_INFIX_LVALUE < %t
-// RUN: FileCheck %s -check-prefix=NEGATIVE_S2_INFIX_LVALUE < %t
+// RUN: %FileCheck %s -check-prefix=S2_INFIX_LVALUE < %t
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_S2_INFIX_LVALUE < %t
 
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_3 | FileCheck %s -check-prefix=S2_INFIX_LVALUE
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_4 | FileCheck %s -check-prefix=S2_INFIX
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_5 | FileCheck %s -check-prefix=S2_INFIX
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_6 | FileCheck %s -check-prefix=S2_INFIX
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_3 | %FileCheck %s -check-prefix=S2_INFIX_LVALUE
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_4 | %FileCheck %s -check-prefix=S2_INFIX
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_5 | %FileCheck %s -check-prefix=S2_INFIX
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_6 | %FileCheck %s -check-prefix=S2_INFIX
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_7 > %t
-// RUN: FileCheck %s -check-prefix=S2_INFIX_OPTIONAL < %t
-// RUN: FileCheck %s -check-prefix=NEGATIVE_S2_INFIX_OPTIONAL < %t
+// RUN: %FileCheck %s -check-prefix=S2_INFIX_OPTIONAL < %t
+// RUN: %FileCheck %s -check-prefix=NEGATIVE_S2_INFIX_OPTIONAL < %t
 
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_8 | FileCheck %s -check-prefix=S3_INFIX_OPTIONAL
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_9 | FileCheck %s -check-prefix=FOOABLE_INFIX
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_10 | FileCheck %s -check-prefix=FOOABLE_INFIX
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_11 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_12 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_13 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_14 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_15 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_16 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_17 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_18 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_19 | FileCheck %s -check-prefix=EMPTYCLASS_INFIX
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_20 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_21 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_22 | FileCheck %s -check-prefix=NO_OPERATORS
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=S2_INFIX_SPACE | FileCheck %s -check-prefix=S2_INFIX_SPACE
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_1 | FileCheck %s -check-prefix=S2_INFIX
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_8 | %FileCheck %s -check-prefix=S3_INFIX_OPTIONAL
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_9 | %FileCheck %s -check-prefix=FOOABLE_INFIX
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_10 | %FileCheck %s -check-prefix=FOOABLE_INFIX
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_11 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_12 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_13 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_14 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_15 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_16 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_17 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_18 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_19 | %FileCheck %s -check-prefix=EMPTYCLASS_INFIX
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_20 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_21 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INFIX_22 | %FileCheck %s -check-prefix=NO_OPERATORS
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=S2_INFIX_SPACE | %FileCheck %s -check-prefix=S2_INFIX_SPACE
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_1 | %FileCheck %s -check-prefix=S2_INFIX
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_2 > %t.ext_infix_2
-// RUN: FileCheck %s -check-prefix=S4_EXT_INFIX < %t.ext_infix_2
-// RUN: FileCheck %s -check-prefix=S4_EXT_INFIX_NEG < %t.ext_infix_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_3 | FileCheck %s -check-prefix=S4_EXT_INFIX_SIMPLE
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_4 | FileCheck %s -check-prefix=S4_EXT_INFIX_SIMPLE
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ASSIGN_TUPLE_1| FileCheck %s -check-prefix=ASSIGN_TUPLE_1
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ASSIGN_TUPLE_2| FileCheck %s -check-prefix=ASSIGN_TUPLE_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ASSIGN_TUPLE_3| FileCheck %s -check-prefix=ASSIGN_TUPLE_1
+// RUN: %FileCheck %s -check-prefix=S4_EXT_INFIX < %t.ext_infix_2
+// RUN: %FileCheck %s -check-prefix=S4_EXT_INFIX_NEG < %t.ext_infix_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_3 | %FileCheck %s -check-prefix=S4_EXT_INFIX_SIMPLE
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=EXT_INFIX_4 | %FileCheck %s -check-prefix=S4_EXT_INFIX_SIMPLE
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ASSIGN_TUPLE_1| %FileCheck %s -check-prefix=ASSIGN_TUPLE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ASSIGN_TUPLE_2| %FileCheck %s -check-prefix=ASSIGN_TUPLE_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ASSIGN_TUPLE_3| %FileCheck %s -check-prefix=ASSIGN_TUPLE_1
 
 struct S {}
 postfix operator ++ {}
diff --git a/test/IDE/complete_overridden_decls.swift b/test/IDE/complete_overridden_decls.swift
index ff408b4..8cba89a 100644
--- a/test/IDE/complete_overridden_decls.swift
+++ b/test/IDE/complete_overridden_decls.swift
@@ -2,13 +2,13 @@
 // RUN: %target-swift-frontend -parse -verify %t_no_errors.swift
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVER_BASE_1 > %t.over.txt
-// RUN: FileCheck %s -check-prefix=OVER_BASE_1 < %t.over.txt
+// RUN: %FileCheck %s -check-prefix=OVER_BASE_1 < %t.over.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVER_DERIVED_1 > %t.over.txt
-// RUN: FileCheck %s -check-prefix=OVER_DERIVED_1 < %t.over.txt
+// RUN: %FileCheck %s -check-prefix=OVER_DERIVED_1 < %t.over.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OVER_MORE_DERIVED_1 > %t.over.txt
-// RUN: FileCheck %s -check-prefix=OVER_MORE_DERIVED_1 < %t.over.txt
+// RUN: %FileCheck %s -check-prefix=OVER_MORE_DERIVED_1 < %t.over.txt
 
 //===---
 //===--- Check that we don't show overridden decls (only show the overriding decl).
diff --git a/test/IDE/complete_override.swift b/test/IDE/complete_override.swift
index b67bfdb..8ba54a3 100644
--- a/test/IDE/complete_override.swift
+++ b/test/IDE/complete_override.swift
@@ -2,109 +2,110 @@
 // RUN: %target-swift-frontend -parse -verify -disable-objc-attr-requires-foundation-module %t_no_errors.swift
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_PA -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_PA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_PA_EXT_1 -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_PA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_PA_EXT_2 -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_PA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_PB -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_PB < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PB < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_PB < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PB < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_PA_PB -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_PA_PB < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PB < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_PA_PB < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PB < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BA -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BA_PA -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BA_PA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BA_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BA_PA_EXT1 -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BA_PA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BA_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BA_PA_EXT2 -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BA_PA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BA_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BA_PB -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BA_PB < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PB < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BA_PB < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PB < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BB -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BB < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BB < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BB < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BB < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BE -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BE < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BE < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BE < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BE_PA -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BE_PA < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BE < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BE_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BE_PA_PE -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BE_PA_PE < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BE < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BE_PA_PE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BE_PA_PE_EXT1 -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BE_PA_PE < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BE < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BE_PA_PE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_BE_PA_PE_EXT2 -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_BE_PA_PE < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_BE < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PA < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_BE_PA_PE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_BE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PA < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLASS_PEI_PE -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=CLASS_PEI_PE < %t.txt
-// RUN: FileCheck %s -check-prefix=WITH_PEI < %t.txt
+// RUN: %FileCheck %s -check-prefix=CLASS_PEI_PE < %t.txt
+// RUN: %FileCheck %s -check-prefix=WITH_PEI < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_NOMINAL -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=NESTED_NOMINAL < %t.txt
+// RUN: %FileCheck %s -check-prefix=NESTED_NOMINAL < %t.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_CLOSURE_1 -code-completion-keywords=false | FileCheck %s -check-prefix=NESTED_CLOSURE_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_CLOSURE_2 -code-completion-keywords=false | FileCheck %s -check-prefix=NESTED_CLOSURE_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_CLOSURE_1 -code-completion-keywords=false | %FileCheck %s -check-prefix=NESTED_CLOSURE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NESTED_CLOSURE_2 -code-completion-keywords=false | %FileCheck %s -check-prefix=NESTED_CLOSURE_2
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD1 -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=OMIT_KEYWORD1< %t.txt
+// RUN: %FileCheck %s -check-prefix=OMIT_KEYWORD1< %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD2 -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=OMIT_KEYWORD2< %t.txt
+// RUN: %FileCheck %s -check-prefix=OMIT_KEYWORD2< %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD3 -code-completion-keywords=false > %t.txt
-// RUN: FileCheck %s -check-prefix=OMIT_KEYWORD3< %t.txt
+// RUN: %FileCheck %s -check-prefix=OMIT_KEYWORD3< %t.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD4 -code-completion-keywords=false | FileCheck %s -check-prefix=OMIT_KEYWORD4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD5 -code-completion-keywords=false | FileCheck %s -check-prefix=OMIT_KEYWORD1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD6 -code-completion-keywords=false | FileCheck %s -check-prefix=OMIT_KEYWORD2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD7 -code-completion-keywords=false | FileCheck %s -check-prefix=OMIT_KEYWORD3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD8 -code-completion-keywords=false | FileCheck %s -check-prefix=OMIT_KEYWORD4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD9 -code-completion-keywords=false | FileCheck %s -check-prefix=OMIT_KEYWORD4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD10 -code-completion-keywords=false | FileCheck %s -check-prefix=WITH_PA_NO_PROTOFUNCA
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD4 -code-completion-keywords=false | %FileCheck %s -check-prefix=OMIT_KEYWORD4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD5 -code-completion-keywords=false | %FileCheck %s -check-prefix=OMIT_KEYWORD1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD6 -code-completion-keywords=false | %FileCheck %s -check-prefix=OMIT_KEYWORD2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD7 -code-completion-keywords=false | %FileCheck %s -check-prefix=OMIT_KEYWORD3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD8 -code-completion-keywords=false | %FileCheck %s -check-prefix=OMIT_KEYWORD4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD9 -code-completion-keywords=false | %FileCheck %s -check-prefix=OMIT_KEYWORD4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OMIT_KEYWORD10 -code-completion-keywords=false | %FileCheck %s -check-prefix=WITH_PA_NO_PROTOFUNCA
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAS_THROWING -code-completion-keywords=false | FileCheck %s -check-prefix=HAS_THROWING
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSOC_TYPE1 -code-completion-keywords=false | FileCheck %s -check-prefix=ASSOC_TYPE1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HAS_THROWING -code-completion-keywords=false | %FileCheck %s -check-prefix=HAS_THROWING
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSOC_TYPE1 -code-completion-keywords=false | %FileCheck %s -check-prefix=ASSOC_TYPE1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPRECATED_1 -code-completion-keywords=false | FileCheck %s -check-prefix=DEPRECATED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPRECATED_1 -code-completion-keywords=false | %FileCheck %s -check-prefix=DEPRECATED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ESCAPING_1 -code-completion-keywords=false | %FileCheck %s -check-prefix=ESCAPING_1
 
 @objc
 class TagPA {}
@@ -463,8 +464,7 @@
 // HAS_THROWING: Begin completions
 // HAS_THROWING-DAG: Decl[InstanceMethod]/Super:         func foo() throws {|}; name=foo() throws
 // HAS_THROWING-DAG: Decl[InstanceMethod]/Super:         override func bar() throws {|}; name=bar() throws
-// FIXME: SR-2214 make the below require printing @escaping 
-// HAS_THROWING-DAG: Decl[InstanceMethod]/Super:         override func baz(x: {{(@escaping )?}}() throws -> ()) rethrows {|}; name=baz(x: {{(@escaping )?}}() throws -> ()) rethrows
+// HAS_THROWING-DAG: Decl[InstanceMethod]/Super:         override func baz(x: @escaping () throws -> ()) rethrows {|}; name=baz(x: {{(@escaping )?}}() throws -> ()) rethrows
 // HAS_THROWING-DAG: Decl[Constructor]/Super:            init() throws {|}; name=init() throws
 // HAS_THROWING: End completions
 
@@ -490,3 +490,11 @@
   override func #^DEPRECATED_1^#
 }
 // DEPRECATED_1: Decl[InstanceMethod]/Super/NotRecommended: deprecated() {|};
+
+class EscapingBase {
+  func method(_ x: @escaping (@escaping ()->()) -> (@escaping ()->())) -> (@escaping (@escaping ()->() )->()) { }
+}
+class Escaping : EscapingBase {
+  override func #^ESCAPING_1^#
+}
+// ESCAPING_1: Decl[InstanceMethod]/Super:         method(_ x: @escaping (@escaping () -> ()) -> (@escaping () -> ())) -> ((@escaping () -> ()) -> ()) {|};
diff --git a/test/IDE/complete_override_access_control_class.swift b/test/IDE/complete_override_access_control_class.swift
new file mode 100644
index 0000000..4d79a32
--- /dev/null
+++ b/test/IDE/complete_override_access_control_class.swift
@@ -0,0 +1,190 @@
+// RUN: sed -n -e '1,/NO_ERRORS_UP_TO_HERE$/ p' %s > %t_no_errors.swift
+// RUN: %target-swift-frontend -parse -verify -disable-objc-attr-requires-foundation-module %t_no_errors.swift
+//
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_AD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_AD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_FILEPRIVATE_AD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_AD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_AD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_INTERNAL_AD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_AD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PUBLIC_AD
+//
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_BD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_BD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_FILEPRIVATE_BD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_BD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_BD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_INTERNAL_BD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_BD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PUBLIC_BD
+//
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_CD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_CD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_FILEPRIVATE_CD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_CD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_CD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_INTERNAL_CD
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_CD -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PUBLIC_CD
+
+@objc
+private class TagPA {}
+
+@objc
+class TagPB {}
+
+@objc
+public class TagPC {}
+
+@objc
+private class BaseAPrivate {
+  fileprivate init(fromBase: TagPA) {}
+
+  fileprivate func baseAFunc(x: TagPA) {}
+
+  fileprivate subscript(a: TagPA) -> Int { return 1 }
+
+  fileprivate var baseAVarRW: TagPA
+  fileprivate let baseAVarRO: TagPA
+
+  fileprivate func colliding() {}
+  fileprivate func collidingGeneric<T>(x: T) {}
+}
+
+@objc
+class BaseBInternal {
+  init(fromBaseB: TagPB) {}
+
+  func baseBFunc(x: TagPB) {}
+
+  subscript(a: TagPB) -> Int { return 1 }
+
+  var baseBVarRW: TagPB
+  let baseBVarRO: TagPB
+
+  func colliding() {}
+  func collidingGeneric<T>(x: T) {}
+}
+
+@objc
+public class BaseCPublic {
+  public init(fromBaseC: TagPC) {}
+
+  public func baseCFunc(x: TagPC) {}
+
+  public subscript(a: TagPC) -> Int { return 1 }
+
+  public var baseCVarRW: TagPC
+  public let baseCVarRO: TagPC
+
+  public func colliding() {}
+  public func collidingGeneric<T>(x: T) {}
+}
+
+public protocol ProtocolD {
+  func colliding()
+  func collidingGeneric<T>(x: T)
+}
+
+// NO_ERRORS_UP_TO_HERE
+
+private class TestPrivateAD : BaseAPrivate, ProtocolD {
+  #^TEST_PRIVATE_AD^#
+}
+fileprivate class TestFilePrivateAD : BaseAPrivate, ProtocolD {
+  #^TEST_FILEPRIVATE_AD^#
+  // Same as TEST_PRIVATE_AD.
+}
+class TestInternalAD : BaseAPrivate, ProtocolD {
+  #^TEST_INTERNAL_AD^#
+}
+public class TestPublicAD : ProtocolAPrivate, ProtocolD {
+  #^TEST_PUBLIC_AD^#
+}
+
+// TEST_PRIVATE_AD: Begin completions, 5 items
+// TEST_PRIVATE_AD-DAG: Decl[InstanceMethod]/Super:         override func baseAFunc(x: TagPA) {|}; name=baseAFunc(x: TagPA)
+// TEST_PRIVATE_AD-DAG: Decl[InstanceVar]/Super:            override var baseAVarRW: TagPA; name=baseAVarRW: TagPA
+// TEST_PRIVATE_AD-DAG: Decl[InstanceMethod]/Super:         override func colliding() {|}; name=colliding()
+// TEST_PRIVATE_AD-DAG: Decl[InstanceMethod]/Super:         override func collidingGeneric<T>(x: T) {|}; name=collidingGeneric<T>(x: T)
+// TEST_PRIVATE_AD-DAG: Decl[Constructor]/Super:            init(fromBase: TagPA) {|}; name=init(fromBase: TagPA)
+// TEST_PRIVATE_AD: End completions
+
+// TEST_INTERNAL_AD: Begin completions, 5 items
+// TEST_INTERNAL_AD-DAG: Decl[InstanceMethod]/Super:         override func baseAFunc(x: TagPA) {|}; name=baseAFunc(x: TagPA)
+// TEST_INTERNAL_AD-DAG: Decl[InstanceVar]/Super:            override var baseAVarRW: TagPA; name=baseAVarRW: TagPA
+// TEST_INTERNAL_AD-DAG: Decl[InstanceMethod]/Super:         override func colliding() {|}; name=colliding()
+// TEST_INTERNAL_AD-DAG: Decl[InstanceMethod]/Super:         override func collidingGeneric<T>(x: T) {|}; name=collidingGeneric<T>(x: T)
+// TEST_INTERNAL_AD-DAG: Decl[Constructor]/Super:            init(fromBase: TagPA) {|}; name=init(fromBase: TagPA)
+// TEST_INTERNAL_AD: End completions
+
+// TEST_PUBLIC_AD: Begin completions, 2 items
+// TEST_PUBLIC_AD-DAG: Decl[InstanceMethod]/Super:         public func colliding() {|}; name=colliding()
+// TEST_PUBLIC_AD-DAG: Decl[InstanceMethod]/Super:         public func collidingGeneric<T>(x: T) {|}; name=collidingGeneric<T>(x: T)
+// TEST_PUBLIC_AD: End completions
+
+private class TestPrivateBD : BaseBInternal, ProtocolD {
+  #^TEST_PRIVATE_BD^#
+}
+fileprivate class TestFilePrivateBD : BaseBInternal, ProtocolD {
+  #^TEST_FILEPRIVATE_BD^#
+  // Same as TEST_PRIVATE_BD.
+}
+class TestInternalBD : BaseBInternal, ProtocolD {
+  #^TEST_INTERNAL_BD^#
+}
+public class TestPublicBD : BaseBInternal, ProtocolD {
+  #^TEST_PUBLIC_BD^#
+}
+
+// TEST_PRIVATE_BD: Begin completions, 5 items
+// TEST_PRIVATE_BD-DAG: Decl[InstanceMethod]/Super:         override func baseBFunc(x: TagPB) {|}; name=baseBFunc(x: TagPB)
+// TEST_PRIVATE_BD-DAG: Decl[InstanceVar]/Super:            override var baseBVarRW: TagPB; name=baseBVarRW: TagPB
+// TEST_PRIVATE_BD-DAG: Decl[InstanceMethod]/Super:         override func colliding() {|}; name=colliding()
+// TEST_PRIVATE_BD-DAG: Decl[InstanceMethod]/Super:         override func collidingGeneric<T>(x: T) {|}; name=collidingGeneric<T>(x: T)
+// TEST_PRIVATE_BD-DAG: Decl[Constructor]/Super:            init(fromBaseB: TagPB) {|}; name=init(fromBaseB: TagPB)
+// TEST_PRIVATE_BD: End completions
+
+// TEST_INTERNAL_BD: Begin completions, 5 items
+// TEST_INTERNAL_BD-DAG: Decl[InstanceMethod]/Super:         override func baseBFunc(x: TagPB) {|}; name=baseBFunc(x: TagPB)
+// TEST_INTERNAL_BD-DAG: Decl[InstanceVar]/Super:            override var baseBVarRW: TagPB; name=baseBVarRW: TagPB
+// TEST_INTERNAL_BD-DAG: Decl[InstanceMethod]/Super:         override func colliding() {|}; name=colliding()
+// TEST_INTERNAL_BD-DAG: Decl[InstanceMethod]/Super:         override func collidingGeneric<T>(x: T) {|}; name=collidingGeneric<T>(x: T)
+// TEST_INTERNAL_BD-DAG: Decl[Constructor]/Super:            init(fromBaseB: TagPB) {|}; name=init(fromBaseB: TagPB)
+// TEST_INTERNAL_BD: End completions
+
+// TEST_PUBLIC_BD: Begin completions, 5 items
+// TEST_PUBLIC_BD-DAG: Decl[InstanceMethod]/Super:         override func baseBFunc(x: TagPB) {|}; name=baseBFunc(x: TagPB)
+// TEST_PUBLIC_BD-DAG: Decl[InstanceVar]/Super:            override var baseBVarRW: TagPB; name=baseBVarRW: TagPB
+// TEST_PUBLIC_BD-DAG: Decl[InstanceMethod]/Super:         public override func colliding() {|}; name=colliding()
+// TEST_PUBLIC_BD-DAG: Decl[InstanceMethod]/Super:         public override func collidingGeneric<T>(x: T) {|}; name=collidingGeneric<T>(x: T)
+// TEST_PUBLIC_BD-DAG: Decl[Constructor]/Super:            init(fromBaseB: TagPB) {|}; name=init(fromBaseB: TagPB)
+// TEST_PUBLIC_BD: End completions
+
+private class TestPrivateCD : BaseCPublic, ProtocolD {
+  #^TEST_PRIVATE_CD^#
+}
+fileprivate class TestFilePrivateCD : BaseCPublic, ProtocolD {
+  #^TEST_FILEPRIVATE_CD^#
+  // Same as TEST_PRIVATE_CD.
+}
+class TestInternalCD : BaseCPublic, ProtocolD {
+  #^TEST_INTERNAL_CD^#
+}
+public class TestPublicCD : BaseCPublic, ProtocolD {
+  #^TEST_PUBLIC_CD^#
+}
+
+// TEST_PRIVATE_CD: Begin completions, 5 items
+// TEST_PRIVATE_CD-DAG: Decl[InstanceMethod]/Super:         override func baseCFunc(x: TagPC) {|}; name=baseCFunc(x: TagPC)
+// TEST_PRIVATE_CD-DAG: Decl[InstanceVar]/Super:            override var baseCVarRW: TagPC; name=baseCVarRW: TagPC
+// TEST_PRIVATE_CD-DAG: Decl[InstanceMethod]/Super:         override func colliding() {|}; name=colliding()
+// TEST_PRIVATE_CD-DAG: Decl[InstanceMethod]/Super:         override func collidingGeneric<T>(x: T) {|}; name=collidingGeneric<T>(x: T)
+// TEST_PRIVATE_CD-DAG: Decl[Constructor]/Super:            init(fromBaseC: TagPC) {|}; name=init(fromBaseC: TagPC)
+// TEST_PRIVATE_CD: End completions
+
+// TEST_INTERNAL_CD: Begin completions, 5 items
+// TEST_INTERNAL_CD-DAG: Decl[InstanceMethod]/Super:         override func baseCFunc(x: TagPC) {|}; name=baseCFunc(x: TagPC)
+// TEST_INTERNAL_CD-DAG: Decl[InstanceVar]/Super:            override var baseCVarRW: TagPC; name=baseCVarRW: TagPC
+// TEST_INTERNAL_CD-DAG: Decl[InstanceMethod]/Super:         override func colliding() {|}; name=colliding()
+// TEST_INTERNAL_CD-DAG: Decl[InstanceMethod]/Super:         override func collidingGeneric<T>(x: T) {|}; name=collidingGeneric<T>(x: T)
+// TEST_INTERNAL_CD-DAG: Decl[Constructor]/Super:            init(fromBaseC: TagPC) {|}; name=init(fromBaseC: TagPC)
+// TEST_INTERNAL_CD: End completions
+
+// TEST_PUBLIC_CD: Begin completions, 5 items
+// TEST_PUBLIC_CD-DAG: Decl[InstanceMethod]/Super:         public override func baseCFunc(x: TagPC) {|}; name=baseCFunc(x: TagPC)
+// TEST_PUBLIC_CD-DAG: Decl[InstanceVar]/Super:            public override var baseCVarRW: TagPC; name=baseCVarRW: TagPC
+// TEST_PUBLIC_CD-DAG: Decl[InstanceMethod]/Super:         public override func colliding() {|}; name=colliding()
+// TEST_PUBLIC_CD-DAG: Decl[InstanceMethod]/Super:         public override func collidingGeneric<T>(x: T) {|}; name=collidingGeneric<T>(x: T)
+// TEST_PUBLIC_CD-DAG: Decl[Constructor]/Super:            init(fromBaseC: TagPC) {|}; name=init(fromBaseC: TagPC)
+// TEST_PUBLIC_CD: End completions
+
diff --git a/test/IDE/complete_override_access_control.swift b/test/IDE/complete_override_access_control_protocol.swift
similarity index 70%
rename from test/IDE/complete_override_access_control.swift
rename to test/IDE/complete_override_access_control_protocol.swift
index 166d7d9..93d99ed 100644
--- a/test/IDE/complete_override_access_control.swift
+++ b/test/IDE/complete_override_access_control_protocol.swift
@@ -1,21 +1,25 @@
 // RUN: sed -n -e '1,/NO_ERRORS_UP_TO_HERE$/ p' %s > %t_no_errors.swift
 // RUN: %target-swift-frontend -parse -verify -disable-objc-attr-requires-foundation-module %t_no_errors.swift
 //
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_ABC -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_PRIVATE_ABC
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_ABC -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_INTERNAL_ABC
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_ABC -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_PUBLIC_ABC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_ABC -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_ABC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_FILEPRIVATE_ABC -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_ABC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_ABC -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_INTERNAL_ABC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_ABC -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PUBLIC_ABC
 //
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_DE -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_PRIVATE_DE
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_DE -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_INTERNAL_DE
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_DE -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_PUBLIC_DE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_DE -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_DE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_FILEPRIVATE_DE -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_DE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_DE -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_INTERNAL_DE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_DE -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PUBLIC_DE
 //
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_ED -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_PRIVATE_ED
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_ED -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_INTERNAL_ED
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_ED -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_PUBLIC_ED
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_ED -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_ED
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_FILEPRIVATE_ED -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_ED
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_ED -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_INTERNAL_ED
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_ED -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PUBLIC_ED
 //
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_EF -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_PRIVATE_EF
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_EF -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_INTERNAL_EF
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_EF -code-completion-keywords=false | FileCheck %s -check-prefix=TEST_PUBLIC_EF
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PRIVATE_EF -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_EF
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_FILEPRIVATE_EF -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PRIVATE_EF
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_INTERNAL_EF -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_INTERNAL_EF
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_PUBLIC_EF -code-completion-keywords=false | %FileCheck %s -check-prefix=TEST_PUBLIC_EF
 
 @objc
 private class TagPA {}
@@ -85,6 +89,10 @@
 private class TestPrivateABC : ProtocolAPrivate, ProtocolBInternal, ProtocolCPublic {
   #^TEST_PRIVATE_ABC^#
 }
+fileprivate class TestFilePrivateABC : ProtocolAPrivate, ProtocolBInternal, ProtocolCPublic {
+  #^TEST_FILEPRIVATE_ABC^#
+  // Same as TEST_PRIVATE_ABC.
+}
 class TestInternalABC : ProtocolAPrivate, ProtocolBInternal, ProtocolCPublic {
   #^TEST_INTERNAL_ABC^#
 }
@@ -94,20 +102,20 @@
 
 // TEST_PRIVATE_ABC: Begin completions, 15 items
 // TEST_PRIVATE_ABC-DAG: Decl[Constructor]/Super:    init(fromProtocolA: TagPA) {|}{{; name=.+$}}
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: private func protoAFunc(x: TagPA) {|}{{; name=.+$}}
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: private func protoAFuncOptional(x: TagPA) {|}{{; name=.+$}}
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: func protoAFunc(x: TagPA) {|}{{; name=.+$}}
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: func protoAFuncOptional(x: TagPA) {|}{{; name=.+$}}
 // TEST_PRIVATE_ABC-DAG: Decl[Constructor]/Super:    init(fromProtocolB: TagPB) {|}{{; name=.+$}}
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: private func protoBFunc(x: TagPB) {|}{{; name=.+$}}
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: private func protoBFuncOptional(x: TagPB) {|}{{; name=.+$}}
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: func protoBFunc(x: TagPB) {|}{{; name=.+$}}
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: func protoBFuncOptional(x: TagPB) {|}{{; name=.+$}}
 // TEST_PRIVATE_ABC-DAG: Decl[Constructor]/Super:    init(fromProtocolC: TagPC) {|}{{; name=.+$}}
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: private func protoCFunc(x: TagPC) {|}{{; name=.+$}}
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: private func protoCFuncOptional(x: TagPC) {|}{{; name=.+$}}
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    private var protoAVarRW: TagPA
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    private var protoAVarRO: TagPA
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    private var protoBVarRW: TagPB
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    private var protoBVarRO: TagPB
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    private var protoCVarRW: TagPC
-// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    private var protoCVarRO: TagPC
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: func protoCFunc(x: TagPC) {|}{{; name=.+$}}
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceMethod]/Super: func protoCFuncOptional(x: TagPC) {|}{{; name=.+$}}
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    var protoAVarRW: TagPA
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    var protoAVarRO: TagPA
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    var protoBVarRW: TagPB
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    var protoBVarRO: TagPB
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    var protoCVarRW: TagPC
+// TEST_PRIVATE_ABC-DAG: Decl[InstanceVar]/Super:    var protoCVarRO: TagPC
 // TEST_PRIVATE_ABC: End completions
 
 // TEST_INTERNAL_ABC: Begin completions, 15 items
@@ -149,6 +157,10 @@
 private class TestPrivateDE : ProtocolDPrivate, ProtocolEPublic {
   #^TEST_PRIVATE_DE^#
 }
+fileprivate class TestPrivateDE : ProtocolDPrivate, ProtocolEPublic {
+  #^TEST_FILEPRIVATE_DE^#
+  // Same as TEST_PRIVATE_DE.
+}
 class TestInternalDE : ProtocolDPrivate, ProtocolEPublic {
   #^TEST_INTERNAL_DE^#
 }
@@ -157,8 +169,8 @@
 }
 
 // TEST_PRIVATE_DE: Begin completions, 2 items
-// TEST_PRIVATE_DE-DAG: Decl[InstanceMethod]/Super: private func colliding() {|}{{; name=.+$}}
-// TEST_PRIVATE_DE-DAG: Decl[InstanceMethod]/Super: private func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
+// TEST_PRIVATE_DE-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
+// TEST_PRIVATE_DE-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
 
 // TEST_INTERNAL_DE: Begin completions, 2 items
 // TEST_INTERNAL_DE-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
@@ -171,6 +183,10 @@
 private class TestPrivateED : ProtocolEPublic, ProtocolDPrivate {
   #^TEST_PRIVATE_ED^#
 }
+fileprivate class TestPrivateED : ProtocolEPublic, ProtocolDPrivate {
+  #^TEST_FILEPRIVATE_ED^#
+  // Same as TEST_PRIVATE_ED.
+}
 class TestInternalED : ProtocolEPublic, ProtocolDPrivate {
   #^TEST_INTERNAL_ED^#
 }
@@ -179,8 +195,8 @@
 }
 
 // TEST_PRIVATE_ED: Begin completions, 2 items
-// TEST_PRIVATE_ED-DAG: Decl[InstanceMethod]/Super: private func colliding() {|}{{; name=.+$}}
-// TEST_PRIVATE_ED-DAG: Decl[InstanceMethod]/Super: private func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
+// TEST_PRIVATE_ED-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
+// TEST_PRIVATE_ED-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
 
 // TEST_INTERNAL_ED: Begin completions, 2 items
 // TEST_INTERNAL_ED-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
@@ -193,6 +209,10 @@
 private class TestPrivateEF : ProtocolEPublic, ProtocolFPublic {
   #^TEST_PRIVATE_EF^#
 }
+fileprivate class TestPrivateEF : ProtocolEPublic, ProtocolFPublic {
+  #^TEST_FILEPRIVATE_EF^#
+  // Same as TEST_PRIVATE_EF.
+}
 class TestInternalEF : ProtocolEPublic, ProtocolFPublic {
   #^TEST_INTERNAL_EF^#
 }
@@ -201,8 +221,8 @@
 }
 
 // TEST_PRIVATE_EF: Begin completions, 2 items
-// TEST_PRIVATE_EF-DAG: Decl[InstanceMethod]/Super: private func colliding() {|}{{; name=.+$}}
-// TEST_PRIVATE_EF-DAG: Decl[InstanceMethod]/Super: private func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
+// TEST_PRIVATE_EF-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
+// TEST_PRIVATE_EF-DAG: Decl[InstanceMethod]/Super: func collidingGeneric<T>(x: T) {|}{{; name=.+$}}
 
 // TEST_INTERNAL_EF: Begin completions, 2 items
 // TEST_INTERNAL_EF-DAG: Decl[InstanceMethod]/Super: func colliding() {|}{{; name=.+$}}
diff --git a/test/IDE/complete_override_objc.swift b/test/IDE/complete_override_objc.swift
index 168de4d..012ebf2 100644
--- a/test/IDE/complete_override_objc.swift
+++ b/test/IDE/complete_override_objc.swift
@@ -1,6 +1,6 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PA -code-completion-keywords=false -F %S/Inputs/mock-sdk > %t.txt
-// RUN: FileCheck %s -check-prefix=CHECK1 < %t.txt
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROPERTY -code-completion-keywords=false -F %S/Inputs/mock-sdk | FileCheck %s -check-prefix=PROPERTY
+// RUN: %FileCheck %s -check-prefix=CHECK1 < %t.txt
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROPERTY -code-completion-keywords=false -F %S/Inputs/mock-sdk | %FileCheck %s -check-prefix=PROPERTY
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/complete_pattern.swift b/test/IDE/complete_pattern.swift
index 6717235..3b3446b 100644
--- a/test/IDE/complete_pattern.swift
+++ b/test/IDE/complete_pattern.swift
@@ -1,29 +1,29 @@
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_IS_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_IS_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_IS_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_IS_GENERIC_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
-// RUN: FileCheck %s -check-prefix=PATTERN_IS_GENERIC_1 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=PATTERN_IS_GENERIC_1 < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PATTERN_IS_GENERIC_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
-// RUN: FileCheck %s -check-prefix=PATTERN_IS_GENERIC_2 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=PATTERN_IS_GENERIC_2 < %t.types.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AFTER_PATTERN_IS | FileCheck %s -check-prefix=AFTER_PATTERN_IS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AFTER_PATTERN_IS | %FileCheck %s -check-prefix=AFTER_PATTERN_IS
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTI_PATTERN_1 | FileCheck %s -check-prefix=MULTI_PATTERN_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTI_PATTERN_2 | FileCheck %s -check-prefix=MULTI_PATTERN_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTI_PATTERN_3 | FileCheck %s -check-prefix=MULTI_PATTERN_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTI_PATTERN_4 | FileCheck %s -check-prefix=MULTI_PATTERN_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTI_PATTERN_1 | %FileCheck %s -check-prefix=MULTI_PATTERN_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTI_PATTERN_2 | %FileCheck %s -check-prefix=MULTI_PATTERN_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTI_PATTERN_3 | %FileCheck %s -check-prefix=MULTI_PATTERN_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTI_PATTERN_4 | %FileCheck %s -check-prefix=MULTI_PATTERN_4
 
 
 //===--- Helper types that are used in this test
diff --git a/test/IDE/complete_pound_decl.swift b/test/IDE/complete_pound_decl.swift
new file mode 100644
index 0000000..ce12e65
--- /dev/null
+++ b/test/IDE/complete_pound_decl.swift
@@ -0,0 +1,53 @@
+// Testing #if condition does not disturb code completion
+
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_IF_MEMATTR | %FileCheck %s -check-prefix=ATTR
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_IF_MEMBER | %FileCheck %s -check-prefix=MEMBER
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_ELSE_MEMBER | %FileCheck %s -check-prefix=MEMBER
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_ELSE_MEMATTR | %FileCheck %s -check-prefix=ATTR
+
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_IF_GBLATTR | %FileCheck %s -check-prefix=ATTR
+// FIXME: RUN: not --crash %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_IF_GBLNAME 
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_ELIF_GBLNAME | %FileCheck %s -check-prefix=GLOBAL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_ELIF_GBLATTR | %FileCheck %s -check-prefix=ATTR
+
+// MEMBER: Begin completions
+// MEMBER: override func foo() {|}; name=foo()
+// MEMBER: End completions
+
+// ATTR: Begin completions
+// ATTR: available[#Func Attribute#]; name=available
+// ATTR: End completions
+
+// GLOBAL: Begin completions
+// GLOBAL: Foo[#Foo#]; name=Foo
+// GLOBAL: End completions
+
+class Foo {
+  func foo() {}
+}
+
+class Bar : Foo {
+#if true
+  @#^POUND_IF_MEMATTR^#
+  func f1() {}
+
+  #^POUND_IF_MEMBER^#
+#else
+  #^POUND_ELSE_MEMBER^#
+
+  @#^POUND_ELSE_MEMATTR^#
+  func f1() {}
+#endif
+}
+
+#if true
+@#^POUND_IF_GBLATTR^#
+func bar() {}
+
+#^POUND_IF_GBLNAME^#
+#elseif false
+#^POUND_ELIF_GBLNAME^#
+
+@#^POUND_ELIF_GBLATTR^#
+func bar() {}
+#endif
diff --git a/test/IDE/complete_pound_keypath.swift b/test/IDE/complete_pound_keypath.swift
index bdda373..78f2a91 100644
--- a/test/IDE/complete_pound_keypath.swift
+++ b/test/IDE/complete_pound_keypath.swift
@@ -1,10 +1,10 @@
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=AFTER_POUND | FileCheck -check-prefix=CHECK-AFTER_POUND %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=AFTER_POUND | %FileCheck -check-prefix=CHECK-AFTER_POUND %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=KEYPATH_ARG | FileCheck -check-prefix=CHECK-KEYPATH_ARG %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=KEYPATH_ARG | %FileCheck -check-prefix=CHECK-KEYPATH_ARG %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_KEYPATH_1 | FileCheck -check-prefix=CHECK-IN_KEYPATH %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_KEYPATH_1 | %FileCheck -check-prefix=CHECK-IN_KEYPATH %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_KEYPATH_2 | FileCheck -check-prefix=CHECK-IN_KEYPATH %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_KEYPATH_2 | %FileCheck -check-prefix=CHECK-IN_KEYPATH %s
 
 
 // REQUIRES: objc_interop
diff --git a/test/IDE/complete_pound_selector.swift b/test/IDE/complete_pound_selector.swift
index e5ac3fe..bbe2770 100644
--- a/test/IDE/complete_pound_selector.swift
+++ b/test/IDE/complete_pound_selector.swift
@@ -1,22 +1,22 @@
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=AFTER_POUND | FileCheck -check-prefix=CHECK-AFTER_POUND %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=AFTER_POUND | %FileCheck -check-prefix=CHECK-AFTER_POUND %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=SELECTOR_BASIC | FileCheck -check-prefix=CHECK-SELECTOR_BASIC %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=SELECTOR_BASIC | %FileCheck -check-prefix=CHECK-SELECTOR_BASIC %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=SELECTOR_ARG1 | FileCheck -check-prefix=CHECK-SELECTOR_ARG %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=SELECTOR_ARG1 | %FileCheck -check-prefix=CHECK-SELECTOR_ARG %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=SELECTOR_ARG2 | FileCheck -check-prefix=CHECK-SELECTOR_ARG %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=SELECTOR_ARG2 | %FileCheck -check-prefix=CHECK-SELECTOR_ARG %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR1 | FileCheck -check-prefix=CHECK-IN_SELECTOR %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR1 | %FileCheck -check-prefix=CHECK-IN_SELECTOR %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR2 | FileCheck -check-prefix=CHECK-IN_SELECTOR %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR2 | %FileCheck -check-prefix=CHECK-IN_SELECTOR %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR3 | FileCheck -check-prefix=CHECK-IN_SELECTOR %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR3 | %FileCheck -check-prefix=CHECK-IN_SELECTOR %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR4 | FileCheck -check-prefix=CHECK-IN_SELECTOR %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR4 | %FileCheck -check-prefix=CHECK-IN_SELECTOR %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR5 | FileCheck -check-prefix=CHECK-IN_SUPER_SELECTOR %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR5 | %FileCheck -check-prefix=CHECK-IN_SUPER_SELECTOR %s
 
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR6 | FileCheck -check-prefix=CHECK-IN_SUPER_SELECTOR %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -code-completion -source-filename %s -code-completion-token=IN_SELECTOR6 | %FileCheck -check-prefix=CHECK-IN_SUPER_SELECTOR %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/complete_pound_statement.swift b/test/IDE/complete_pound_statement.swift
index 0f3007e..ce4dfa2 100644
--- a/test/IDE/complete_pound_statement.swift
+++ b/test/IDE/complete_pound_statement.swift
@@ -1,10 +1,10 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLATFORM1 | FileCheck %s -check-prefix=PLATFORM1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLATFORM2 | FileCheck %s -check-prefix=PLATFORM1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLATFORM3 | FileCheck %s -check-prefix=PLATFORM1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLATFORM4 | FileCheck %s -check-prefix=PLATFORM1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAIL1 | FileCheck %s -check-prefix=AVAILABLE
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAIL2 | FileCheck %s -check-prefix=AVAILABLE
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAIL3 | FileCheck %s -check-prefix=AVAILABLE1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLATFORM1 | %FileCheck %s -check-prefix=PLATFORM1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLATFORM2 | %FileCheck %s -check-prefix=PLATFORM1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLATFORM3 | %FileCheck %s -check-prefix=PLATFORM1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLATFORM4 | %FileCheck %s -check-prefix=PLATFORM1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAIL1 | %FileCheck %s -check-prefix=AVAILABLE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAIL2 | %FileCheck %s -check-prefix=AVAILABLE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAIL3 | %FileCheck %s -check-prefix=AVAILABLE1
 
 {
   if #available(#^PLATFORM1^#
diff --git a/test/IDE/complete_repeat.swift b/test/IDE/complete_repeat.swift
index 8355a5d..2403e85 100644
--- a/test/IDE/complete_repeat.swift
+++ b/test/IDE/complete_repeat.swift
@@ -1,9 +1,9 @@
-// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_1 -source-filename=%s | FileCheck %s -check-prefix=REPEAT_1
-// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_2 -source-filename=%s | FileCheck %s -check-prefix=REPEAT_2
-// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_3 -source-filename=%s | FileCheck %s -check-prefix=REPEAT_3
-// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_4 -source-filename=%s | FileCheck %s -check-prefix=REPEAT_4
-// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_5 -source-filename=%s | FileCheck %s -check-prefix=REPEAT_5
-// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_COND_1 -source-filename=%s | FileCheck %s -check-prefix=REPEAT_COND_1
+// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_1 -source-filename=%s | %FileCheck %s -check-prefix=REPEAT_1
+// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_2 -source-filename=%s | %FileCheck %s -check-prefix=REPEAT_2
+// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_3 -source-filename=%s | %FileCheck %s -check-prefix=REPEAT_3
+// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_4 -source-filename=%s | %FileCheck %s -check-prefix=REPEAT_4
+// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_5 -source-filename=%s | %FileCheck %s -check-prefix=REPEAT_5
+// RUN: %swift-ide-test -code-completion -code-completion-token=REPEAT_COND_1 -source-filename=%s | %FileCheck %s -check-prefix=REPEAT_COND_1
 
 repeat {
   let local1 = 1
diff --git a/test/IDE/complete_repl_empty_file.swift b/test/IDE/complete_repl_empty_file.swift
index 97848d1..ec36399 100644
--- a/test/IDE/complete_repl_empty_file.swift
+++ b/test/IDE/complete_repl_empty_file.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -repl-code-completion -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -repl-code-completion -source-filename %s | %FileCheck %s
 
 // CHECK: Begin completions
 // CHECK-DAG: {{^}}true: Bool{{$}}
diff --git a/test/IDE/complete_repl_identifier_prefix_1.swift b/test/IDE/complete_repl_identifier_prefix_1.swift
index 435c3de..6d2bb25 100644
--- a/test/IDE/complete_repl_identifier_prefix_1.swift
+++ b/test/IDE/complete_repl_identifier_prefix_1.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -repl-code-completion -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -repl-code-completion -source-filename %s | %FileCheck %s
 
 // CHECK: Begin completions
 // CHECK-NEXT: {{^}}true: Bool{{$}}
diff --git a/test/IDE/complete_repl_in_func_1.swift b/test/IDE/complete_repl_in_func_1.swift
index f6ec38f..97da5d7 100644
--- a/test/IDE/complete_repl_in_func_1.swift
+++ b/test/IDE/complete_repl_in_func_1.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -repl-code-completion -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -repl-code-completion -source-filename %s | %FileCheck %s
 
 // Make sure we partially type check the function body even if function body is
 // missing the right brace.
diff --git a/test/IDE/complete_return.swift b/test/IDE/complete_return.swift
index f324802..8252086 100644
--- a/test/IDE/complete_return.swift
+++ b/test/IDE/complete_return.swift
@@ -1,12 +1,12 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_VOID_1 | FileCheck %s -check-prefix=RETURN_VOID_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_INT_1 | FileCheck %s -check-prefix=RETURN_INT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_INT_2 | FileCheck %s -check-prefix=RETURN_INT_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_VOID_1 | %FileCheck %s -check-prefix=RETURN_VOID_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_INT_1 | %FileCheck %s -check-prefix=RETURN_INT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_INT_2 | %FileCheck %s -check-prefix=RETURN_INT_2
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TRY_RETURN_INT | FileCheck %s -check-prefix=RETURN_INT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TRY_RETURN_VOID | FileCheck %s -check-prefix=RETURN_VOID_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR1 | FileCheck %s -check-prefix=RETURN_TR1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR2 | FileCheck %s -check-prefix=RETURN_TR2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR3 | FileCheck %s -check-prefix=RETURN_TR3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TRY_RETURN_INT | %FileCheck %s -check-prefix=RETURN_INT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TRY_RETURN_VOID | %FileCheck %s -check-prefix=RETURN_VOID_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR1 | %FileCheck %s -check-prefix=RETURN_TR1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR2 | %FileCheck %s -check-prefix=RETURN_TR2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_TR3 | %FileCheck %s -check-prefix=RETURN_TR3
 
 struct FooStruct {
   var instanceVar : Int
diff --git a/test/IDE/complete_stdlib_builtin.swift b/test/IDE/complete_stdlib_builtin.swift
index 4afa085..7bcf8e8 100644
--- a/test/IDE/complete_stdlib_builtin.swift
+++ b/test/IDE/complete_stdlib_builtin.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BUILTIN_1 | FileCheck %s -check-prefix=NO_CRASH
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BUILTIN_2 | FileCheck %s -check-prefix=NO_CRASH
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BUILTIN_1 | %FileCheck %s -check-prefix=NO_CRASH
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BUILTIN_2 | %FileCheck %s -check-prefix=NO_CRASH
 
 // NO_CRASH-NOT: Begin completions
 
diff --git a/test/IDE/complete_stdlib_optional.swift b/test/IDE/complete_stdlib_optional.swift
index 03084b2..06cdc44 100644
--- a/test/IDE/complete_stdlib_optional.swift
+++ b/test/IDE/complete_stdlib_optional.swift
@@ -1,59 +1,59 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_NO_DOT_1 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OPT_NO_DOT_FOOSTRUCT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OPT_NO_DOT_FOOSTRUCT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_NO_DOT_2 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OPT_NO_DOT_FOOSTRUCT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OPT_NO_DOT_FOOSTRUCT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_DOT_1 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OPT_DOT_FOOSTRUCT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OPT_DOT_FOOSTRUCT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_DOT_1_SPACES > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OPT_DOT_FOOSTRUCT_SPACES < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OPT_DOT_FOOSTRUCT_SPACES < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_DOT_2 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OPT_DOT_FOOSTRUCT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OPT_DOT_FOOSTRUCT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=UN_OPT_NO_DOT_1 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=UN_OPT_NO_DOT_FOOSTRUCT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=UN_OPT_NO_DOT_FOOSTRUCT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=UN_OPT_NO_DOT_2 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=UN_OPT_NO_DOT_FOOSTRUCT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=UN_OPT_NO_DOT_FOOSTRUCT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=UN_OPT_NO_DOT_3 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=UN_OPT_NO_DOT_INT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=UN_OPT_NO_DOT_INT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=UN_OPT_DOT_1 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=UN_OPT_DOT_FOOSTRUCT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=UN_OPT_DOT_FOOSTRUCT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=UN_OPT_DOT_2 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=UN_OPT_DOT_FOOSTRUCT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=UN_OPT_DOT_FOOSTRUCT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=UN_OPT_DOT_3 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=UN_OPT_DOT_INT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=UN_OPT_DOT_INT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_DL_NO_DOT_1 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OBJCCLASS_MEMBERS_NO_DOT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OBJCCLASS_MEMBERS_NO_DOT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_DL_NO_DOT_2 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OBJCCLASS_MEMBERS_NO_DOT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OBJCCLASS_MEMBERS_NO_DOT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_DL_DOT_1 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OBJCCLASS_MEMBERS_DOT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OBJCCLASS_MEMBERS_DOT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_DL_DOT_2 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OBJCCLASS_MEMBERS_DOT < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OBJCCLASS_MEMBERS_DOT < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_DL_FORCE_RETURN_OPTIONAL_1 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OPT_NO_DOT_OBJCCLASS < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OPT_NO_DOT_OBJCCLASS < %t.opt.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_CAST_AS_RESULT_1 > %t.opt.txt
-// RUN: FileCheck %s -check-prefix=OPT_NO_DOT_OBJCCLASS < %t.opt.txt
+// RUN: %FileCheck %s -check-prefix=OPT_NO_DOT_OBJCCLASS < %t.opt.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_1 | FileCheck %s -check-prefix=OPT_TUPLE_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_2 | FileCheck %s -check-prefix=OPT_TUPLE_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_3 | FileCheck %s -check-prefix=OPT_TUPLE_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_4 | FileCheck %s -check-prefix=OPT_TUPLE_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_5 | FileCheck %s -check-prefix=OPT_TUPLE_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_1 | %FileCheck %s -check-prefix=OPT_TUPLE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_2 | %FileCheck %s -check-prefix=OPT_TUPLE_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_3 | %FileCheck %s -check-prefix=OPT_TUPLE_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_4 | %FileCheck %s -check-prefix=OPT_TUPLE_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -disable-objc-attr-requires-foundation-module -code-completion-token=OPT_TUPLE_5 | %FileCheck %s -check-prefix=OPT_TUPLE_5
 
 //===---
 //===--- Test code completion for stdlib Optional<T> type.
diff --git a/test/IDE/complete_stmt_controlling_expr.swift b/test/IDE/complete_stmt_controlling_expr.swift
index 31aaf93..2308d39 100644
--- a/test/IDE/complete_stmt_controlling_expr.swift
+++ b/test/IDE/complete_stmt_controlling_expr.swift
@@ -1,136 +1,136 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_1 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_2 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_3 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_4 | FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_1 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_2 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_3 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_4 | %FileCheck %s -check-prefix=COND_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_1 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_2 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_3 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_4 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_5 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_6 | FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_1 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_2 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_3 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_4 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_5 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_IF_ELSE_IF_6 | %FileCheck %s -check-prefix=COND_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_WHILE_1 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_WHILE_2 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_WHILE_3 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_WHILE_4 | FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_WHILE_1 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_WHILE_2 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_WHILE_3 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_WHILE_4 | %FileCheck %s -check-prefix=COND_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_DO_WHILE_1 | FileCheck %s -check-prefix=COND-WITH-RELATION
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_DO_WHILE_2 | FileCheck %s -check-prefix=COND-WITH-RELATION1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_DO_WHILE_1 | %FileCheck %s -check-prefix=COND-WITH-RELATION
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COND_DO_WHILE_2 | %FileCheck %s -check-prefix=COND-WITH-RELATION1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INIT_1 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INIT_2 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INIT_3 | FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INIT_1 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INIT_2 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INIT_3 | %FileCheck %s -check-prefix=COND_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_COND_1 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_COND_2 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_COND_3 | FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_COND_1 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_COND_2 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_COND_3 | %FileCheck %s -check-prefix=COND_COMMON
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_COND_I_1 > %t.cond.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.cond.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.cond.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.cond.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.cond.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_COND_I_2 > %t.cond.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.cond.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_ERROR_EXPR_SPECIFIC < %t.cond.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.cond.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_ERROR_EXPR_SPECIFIC < %t.cond.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_COND_I_E_1 > %t.cond.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.cond.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_E_EXPR_SPECIFIC < %t.cond.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.cond.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_E_EXPR_SPECIFIC < %t.cond.txt
 
 
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INCR_1 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INCR_2 | FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INCR_1 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INCR_2 | %FileCheck %s -check-prefix=COND_COMMON
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INCR_I_1 > %t.incr.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.incr.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INCR_I_2 > %t.incr.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.incr.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INCR_I_3 > %t.incr.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.incr.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INCR_I_4 > %t.incr.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_ERROR_EXPR_SPECIFIC < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_ERROR_EXPR_SPECIFIC < %t.incr.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_INCR_I_E_1 > %t.incr.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_E_EXPR_SPECIFIC < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.incr.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_E_EXPR_SPECIFIC < %t.incr.txt
 
 
 // FIXME: should have 'i' in these results.
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_BODY_I_1 > %t.body.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
-// FIXME: FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
+// FIXME: %FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.body.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_BODY_I_2 > %t.body.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_EXPR_SPECIFIC < %t.body.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_BODY_I_3 > %t.body.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_ERROR_EXPR_SPECIFIC < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_ERROR_EXPR_SPECIFIC < %t.body.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_BODY_I_4 > %t.body.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.body.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_BODY_I_5 > %t.body.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.body.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=C_STYLE_FOR_BODY_I_6 > %t.body.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.body.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.body.txt
 
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOR_EACH_EXPR_1 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOR_EACH_EXPR_2 | FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOR_EACH_EXPR_1 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOR_EACH_EXPR_2 | %FileCheck %s -check-prefix=COND_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_EXPR_1 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_EXPR_2 | FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_EXPR_1 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_EXPR_2 | %FileCheck %s -check-prefix=COND_COMMON
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_CASE_WHERE_EXPR_1 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_CASE_WHERE_EXPR_2 | FileCheck %s -check-prefix=COND_COMMON
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_CASE_WHERE_EXPR_3 | FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_CASE_WHERE_EXPR_1 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_CASE_WHERE_EXPR_2 | %FileCheck %s -check-prefix=COND_COMMON
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_CASE_WHERE_EXPR_3 | %FileCheck %s -check-prefix=COND_COMMON
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_CASE_WHERE_EXPR_I_1 > %t.where.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.where.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.where.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.where.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.where.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_CASE_WHERE_EXPR_I_2 > %t.where.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.where.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.where.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.where.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.where.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SWITCH_CASE_WHERE_EXPR_I_J_1 > %t.where.txt
-// RUN: FileCheck %s -check-prefix=COND_COMMON < %t.where.txt
-// RUN: FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.where.txt
-// RUN: FileCheck %s -check-prefix=WITH_J_INT < %t.where.txt
+// RUN: %FileCheck %s -check-prefix=COND_COMMON < %t.where.txt
+// RUN: %FileCheck %s -check-prefix=WITH_I_INT_LOCAL < %t.where.txt
+// RUN: %FileCheck %s -check-prefix=WITH_J_INT < %t.where.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_IF_1 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_IF_2 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_IF_3 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_IF_4 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_WHILE_1 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_WHILE_2 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_WHILE_3 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_WHILE_4 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_1 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_2 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_3 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_4 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_5 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_6 | FileCheck %s -check-prefix=UNRESOLVED_B
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_7 | FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_IF_1 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_IF_2 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_IF_3 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_IF_4 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_WHILE_1 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_WHILE_2 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_WHILE_3 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_WHILE_4 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_1 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_2 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_3 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_4 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_5 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_6 | %FileCheck %s -check-prefix=UNRESOLVED_B
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_GUARD_7 | %FileCheck %s -check-prefix=UNRESOLVED_B
 
 
 struct FooStruct {
diff --git a/test/IDE/complete_testable.swift b/test/IDE/complete_testable.swift
index a28db91..9d19bc7 100644
--- a/test/IDE/complete_testable.swift
+++ b/test/IDE/complete_testable.swift
@@ -2,20 +2,20 @@
 // RUN: %target-swift-frontend -emit-module -enable-testing -o %t %S/Inputs/complete_testable_helper.swift
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL -I %t > %t.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL -check-prefix=TOP_LEVEL-ALL < %t.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL-NEG -check-prefix=TOP_LEVEL-ALL-NEG < %t.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL -check-prefix=TOP_LEVEL-ALL < %t.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL-NEG -check-prefix=TOP_LEVEL-ALL-NEG < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL -I %t -D TESTABLE > %t.testable.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL-TESTABLE -check-prefix=TOP_LEVEL-ALL < %t.testable.txt
-// RUN: FileCheck %s -check-prefix=TOP_LEVEL-TESTABLE-NEG -check-prefix=TOP_LEVEL-ALL-NEG < %t.testable.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL-TESTABLE -check-prefix=TOP_LEVEL-ALL < %t.testable.txt
+// RUN: %FileCheck %s -check-prefix=TOP_LEVEL-TESTABLE-NEG -check-prefix=TOP_LEVEL-ALL-NEG < %t.testable.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER -I %t > %t.txt
-// RUN: FileCheck %s -check-prefix=MEMBER -check-prefix=MEMBER-ALL < %t.txt
-// RUN: FileCheck %s -check-prefix=MEMBER-NEG -check-prefix=MEMBER-ALL-NEG < %t.txt
+// RUN: %FileCheck %s -check-prefix=MEMBER -check-prefix=MEMBER-ALL < %t.txt
+// RUN: %FileCheck %s -check-prefix=MEMBER-NEG -check-prefix=MEMBER-ALL-NEG < %t.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER -I %t -D TESTABLE > %t.testable.txt
-// RUN: FileCheck %s -check-prefix=MEMBER-TESTABLE -check-prefix=MEMBER-ALL < %t.testable.txt
-// RUN: FileCheck %s -check-prefix=MEMBER-TESTABLE-NEG -check-prefix=MEMBER-ALL-NEG < %t.testable.txt
+// RUN: %FileCheck %s -check-prefix=MEMBER-TESTABLE -check-prefix=MEMBER-ALL < %t.testable.txt
+// RUN: %FileCheck %s -check-prefix=MEMBER-TESTABLE-NEG -check-prefix=MEMBER-ALL-NEG < %t.testable.txt
 
 #if TESTABLE
 @testable import complete_testable_helper
diff --git a/test/IDE/complete_trailing_closure.swift b/test/IDE/complete_trailing_closure.swift
index 821b64f..3d45a7c 100644
--- a/test/IDE/complete_trailing_closure.swift
+++ b/test/IDE/complete_trailing_closure.swift
@@ -1,29 +1,29 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=GLOBAL_1 > %t
-// RUN: FileCheck %s -check-prefix=GLOBAL_1 < %t
-// RUN: FileCheck %s -check-prefix=NONTRIVIAL < %t
+// RUN: %FileCheck %s -check-prefix=GLOBAL_1 < %t
+// RUN: %FileCheck %s -check-prefix=NONTRIVIAL < %t
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=METHOD_1 > %t
-// RUN: FileCheck %s -check-prefix=METHOD_1 < %t
-// RUN: FileCheck %s -check-prefix=NONTRIVIAL < %t
+// RUN: %FileCheck %s -check-prefix=METHOD_1 < %t
+// RUN: %FileCheck %s -check-prefix=NONTRIVIAL < %t
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=METHOD_2 > %t
-// RUN: FileCheck %s -check-prefix=GLOBAL_1 < %t
-// RUN: FileCheck %s -check-prefix=METHOD_1 < %t
-// RUN: FileCheck %s -check-prefix=NONTRIVIAL < %t
+// RUN: %FileCheck %s -check-prefix=GLOBAL_1 < %t
+// RUN: %FileCheck %s -check-prefix=METHOD_1 < %t
+// RUN: %FileCheck %s -check-prefix=NONTRIVIAL < %t
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=METHOD_3 > %t
-// RUN: FileCheck %s -check-prefix=METHOD_1 < %t
-// RUN: FileCheck %s -check-prefix=NONTRIVIAL < %t
+// RUN: %FileCheck %s -check-prefix=METHOD_1 < %t
+// RUN: %FileCheck %s -check-prefix=NONTRIVIAL < %t
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=STATIC_METHOD_1 > %t
-// RUN: FileCheck %s -check-prefix=STATIC_METHOD_1 < %t
+// RUN: %FileCheck %s -check-prefix=STATIC_METHOD_1 < %t
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=METHOD_4 > %t
-// RUN: FileCheck %s -check-prefix=METHOD_4 < %t
-// RUN: FileCheck %s -check-prefix=NONTRIVIAL < %t
+// RUN: %FileCheck %s -check-prefix=METHOD_4 < %t
+// RUN: %FileCheck %s -check-prefix=NONTRIVIAL < %t
 
 // RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=CLASS_METHOD_1 > %t
-// RUN: FileCheck %s -check-prefix=CLASS_METHOD_1 < %t
+// RUN: %FileCheck %s -check-prefix=CLASS_METHOD_1 < %t
 
 // NONTRIVIAL-NOT: nonTrivial{{.*}} {|}
 
diff --git a/test/IDE/complete_type.swift b/test/IDE/complete_type.swift
index 9ff3d32..b5c0a44 100644
--- a/test/IDE/complete_type.swift
+++ b/test/IDE/complete_type.swift
@@ -1,382 +1,382 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PROTOCOL_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_PROTOCOL < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_PROTOCOL < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_GENERIC_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_1 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_1 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_GENERIC_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_2 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_2 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_GENERIC_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_3 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_3 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_GENERIC_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_4 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_4 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_GENERIC_5 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_5 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_FUNC_PARAM_GENERIC_5 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_GENERIC_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_CONSTRUCTOR_PARAM_GENERIC_1 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_CONSTRUCTOR_PARAM_GENERIC_1 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_GENERIC_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_CONSTRUCTOR_PARAM_GENERIC_2 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_CONSTRUCTOR_PARAM_GENERIC_2 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_GENERIC_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_CONSTRUCTOR_PARAM_GENERIC_3 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_CONSTRUCTOR_PARAM_GENERIC_3 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_LOCAL_VAR_IN_FREE_FUNC_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_LOCAL_VAR_IN_FREE_FUNC_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_LOCAL_VAR_IN_FREE_FUNC_2 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_LOCAL_VAR_IN_FREE_FUNC_2 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_LOCAL_VAR_IN_CONSTRUCTOR_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_LOCAL_VAR_IN_MEMBER_FUNC_1 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_LOCAL_VAR_IN_MEMBER_FUNC_1 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_LOCAL_VAR_IN_DESTRUCTOR_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_LOCAL_VAR_IN_MEMBER_FUNC_1 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_LOCAL_VAR_IN_MEMBER_FUNC_1 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_LOCAL_VAR_IN_INSTANCE_FUNC_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_LOCAL_VAR_IN_MEMBER_FUNC_1 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_LOCAL_VAR_IN_MEMBER_FUNC_1 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_GLOBAL_VAR_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_TYPEALIAS_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_TYPEALIAS_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_TYPEALIAS_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_ASSOC_TYPE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_ASSOC_TYPE_INHERITANCE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_EXTENSION_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_EXTENSION_INHERITANCE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_EXTENSION_INHERITANCE_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_EXTENSION_INHERITANCE_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_STRUCT_INHERITANCE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_STRUCT_INHERITANCE_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_STRUCT_INHERITANCE_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_STRUCT_INHERITANCE_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_STRUCT_INHERITANCE_5 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_STRUCT_INHERITANCE_6 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_STRUCT_INHERITANCE_7 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_STRUCT_INHERITANCE_8 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CLASS_INHERITANCE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CLASS_INHERITANCE_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_ENUM_INHERITANCE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_ENUM_INHERITANCE_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PROTOCOL_INHERITANCE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PROTOCOL_INHERITANCE_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_TUPLE_TYPE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_TUPLE_TYPE_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_TUPLE_TYPE_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_TUPLE_TYPE_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_TUPLE_TYPE_5 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_TUPLE_TYPE_6 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNCTION_TYPE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNCTION_TYPE_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNCTION_TYPE_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNCTION_TYPE_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNCTION_TYPE_5 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNCTION_TYPE_6 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PROTOCOL_COMPOSITION_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PROTOCOL_COMPOSITION_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PROTOCOL_COMPOSITION_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_NESTED_TYPES_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_NESTED_TYPES_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_NESTED_TYPES_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_NESTED_TYPES_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_INSTANCE_VAR_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_INSTANCE_VAR_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_INSTANCE_VAR_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_INSTANCE_VAR_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_LOCAL_VAR_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_LOCAL_VAR_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_LOCAL_VAR_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_LOCAL_VAR_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_BASE_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_BASE_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_BASE_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_BASE_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_BASE_NO_DOT_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_NO_DOT_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_NO_DOT_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_BASE_NO_DOT_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_NO_DOT_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_NO_DOT_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_BASE_NO_DOT_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_BASE_1_NO_DOT_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_BASE_1_NO_DOT_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_DERIVED_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_DERIVED_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_DERIVED_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=VAR_DERIVED_1_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_GENERIC_1 > %t.types.txt
-// FIXME: FileCheck %s -check-prefix=TYPE_IDENTIFIER_GENERIC_1 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// FIXME: %FileCheck %s -check-prefix=TYPE_IDENTIFIER_GENERIC_1 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_GENERIC_2 > %t.types.txt
-// FIXME: FileCheck %s -check-prefix=TYPE_IDENTIFIER_GENERIC_2 < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// FIXME: %FileCheck %s -check-prefix=TYPE_IDENTIFIER_GENERIC_2 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITHOUT_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_GENERIC_3 | FileCheck %s -check-prefix=TYPE_IDENTIFIER_GENERIC_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_GENERIC_3 | %FileCheck %s -check-prefix=TYPE_IDENTIFIER_GENERIC_3
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IDENTIFIER_IRRELEVANT_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IDENTIFIER_IRRELEVANT_1 < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IDENTIFIER_IRRELEVANT_1 < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_AS_CAST_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_1 | FileCheck %s -check-prefix=GENERIC_TYPEALIAS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_1 | %FileCheck %s -check-prefix=GENERIC_TYPEALIAS_1
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_2 > %t.gentypealias.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.gentypealias.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.gentypealias.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.gentypealias.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.gentypealias.txt
 
 //===--- Helper types that are used in this test
 
diff --git a/test/IDE/complete_type_any.swift b/test/IDE/complete_type_any.swift
index 5a3b05e..0473b3e 100644
--- a/test/IDE/complete_type_any.swift
+++ b/test/IDE/complete_type_any.swift
@@ -1,17 +1,17 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ANY_IN_FUNC_PARAM > %t.types.txt
-// RUN: FileCheck %s -check-prefix=ANY_IN_FUNC_PARAM < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=ANY_IN_FUNC_PARAM < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ANY_IN_VAR_TYPE > %t.types.txt
-// RUN: FileCheck %s -check-prefix=ANY_IN_VAR_TYPE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=ANY_IN_VAR_TYPE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ANY_METATYPE_VARIABLE > %t.types.txt
-// RUN: FileCheck %s -check-prefix=ANY_METATYPE_VARIABLE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=ANY_METATYPE_VARIABLE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ANY_METATYPE_MEMBER > %t.types.txt
-// RUN: FileCheck %s -check-prefix=ANY_METATYPE_MEMBER < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=ANY_METATYPE_MEMBER < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ANY_IN_TYPEALIAS > %t.types.txt
-// RUN: FileCheck %s -check-prefix=ANY_IN_TYPEALIAS < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=ANY_IN_TYPEALIAS < %t.types.txt
 
 
 func testAnyInParamList(a: #^ANY_IN_FUNC_PARAM^#
diff --git a/test/IDE/complete_type_in_func_param.swift b/test/IDE/complete_type_in_func_param.swift
index 2adb558..516098c 100644
--- a/test/IDE/complete_type_in_func_param.swift
+++ b/test/IDE/complete_type_in_func_param.swift
@@ -1,154 +1,154 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_5 > %t.types.txt
-// FIXME: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// FIXME: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// FIXME: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// FIXME: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_6 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_7 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_8 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_PARAM_9 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_5 > %t.types.txt
-// FIXME: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// FIXME: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// FIXME: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// FIXME: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_6 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_7 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_8 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_CONSTRUCTOR_PARAM_9 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_RESULT_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_RESULT_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_RESULT_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_RESULT_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_RESULT_5 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_RESULT_6 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_RESULT_7 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_FUNC_RESULT_8 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PARAM_FORWARD_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PARAM_FORWARD_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PARAM_FORWARD_3 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PARAM_FORWARD_4 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PARAM_FORWARD_5 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PARAM_FORWARD_6 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PARAM_FORWARD_7 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_IN_PARAM_FORWARD_8 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
-// RUN: FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
-// RUN: FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=TYPE_IN_PARAM_FORWARD < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=GLOBAL_NEGATIVE < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_NO_NAME_1 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=NO_COMPLETION < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=NO_COMPLETION < %t.types.txt
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE_NO_NAME_2 > %t.types.txt
-// RUN: FileCheck %s -check-prefix=NO_COMPLETION < %t.types.txt
+// RUN: %FileCheck %s -check-prefix=NO_COMPLETION < %t.types.txt
 
 //===--- Helper types that are used in this test
 
diff --git a/test/IDE/complete_unicode.swift b/test/IDE/complete_unicode.swift
index 8f17924..c5228d5 100644
--- a/test/IDE/complete_unicode.swift
+++ b/test/IDE/complete_unicode.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNICODE_1 > %t.unicode.txt
-// RUN: FileCheck %s -check-prefix=UNICODE_1 < %t.unicode.txt
+// RUN: %FileCheck %s -check-prefix=UNICODE_1 < %t.unicode.txt
 
 struct Unicode1 {
   func Идентификаторы_с_кириллицей_допустимы() {}
diff --git a/test/IDE/complete_unresolved_members.swift b/test/IDE/complete_unresolved_members.swift
index c23993e..e9811c7 100644
--- a/test/IDE/complete_unresolved_members.swift
+++ b/test/IDE/complete_unresolved_members.swift
@@ -1,54 +1,54 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_1 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_2 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_3 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_4 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_5 | FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_1 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_2 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_3 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_4 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_5 | %FileCheck %s -check-prefix=UNRESOLVED_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_6 | FileCheck %s -check-prefix=UNRESOLVED_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_7 | FileCheck %s -check-prefix=UNRESOLVED_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_10 | FileCheck %s -check-prefix=UNRESOLVED_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_11 | FileCheck %s -check-prefix=UNRESOLVED_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_6 | %FileCheck %s -check-prefix=UNRESOLVED_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_7 | %FileCheck %s -check-prefix=UNRESOLVED_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_10 | %FileCheck %s -check-prefix=UNRESOLVED_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_11 | %FileCheck %s -check-prefix=UNRESOLVED_2
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_8 | FileCheck %s -check-prefix=UNRESOLVED_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_9 | FileCheck %s -check-prefix=UNRESOLVED_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_8 | %FileCheck %s -check-prefix=UNRESOLVED_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_9 | %FileCheck %s -check-prefix=UNRESOLVED_3
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_12 | FileCheck %s -check-prefix=UNRESOLVED_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_13 | FileCheck %s -check-prefix=UNRESOLVED_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_14 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_15 | FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_12 | %FileCheck %s -check-prefix=UNRESOLVED_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_13 | %FileCheck %s -check-prefix=UNRESOLVED_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_14 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_15 | %FileCheck %s -check-prefix=UNRESOLVED_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_16 | FileCheck %s -check-prefix=UNRESOLVED_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_17 | FileCheck %s -check-prefix=UNRESOLVED_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_18 | FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_16 | %FileCheck %s -check-prefix=UNRESOLVED_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_17 | %FileCheck %s -check-prefix=UNRESOLVED_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_18 | %FileCheck %s -check-prefix=UNRESOLVED_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_19 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_20 | FileCheck %s -check-prefix=UNRESOLVED_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_21 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_22 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_23 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_24 | FileCheck %s -check-prefix=UNRESOLVED_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_25 | FileCheck %s -check-prefix=UNRESOLVED_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_26 | FileCheck %s -check-prefix=UNRESOLVED_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_27 | FileCheck %s -check-prefix=UNRESOLVED_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_19 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_20 | %FileCheck %s -check-prefix=UNRESOLVED_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_21 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_22 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_23 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_24 | %FileCheck %s -check-prefix=UNRESOLVED_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_25 | %FileCheck %s -check-prefix=UNRESOLVED_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_26 | %FileCheck %s -check-prefix=UNRESOLVED_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_27 | %FileCheck %s -check-prefix=UNRESOLVED_3
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_27_NOCRASH > /dev/null
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_28 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_29 | FileCheck %s -check-prefix=UNRESOLVED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_30 | FileCheck %s -check-prefix=UNRESOLVED_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_28 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_29 | %FileCheck %s -check-prefix=UNRESOLVED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNRESOLVED_30 | %FileCheck %s -check-prefix=UNRESOLVED_2
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_AVAIL_1 | FileCheck %s -check-prefix=ENUM_AVAIL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OPTIONS_AVAIL_1 | FileCheck %s -check-prefix=OPTIONS_AVAIL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ENUM_AVAIL_1 | %FileCheck %s -check-prefix=ENUM_AVAIL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OPTIONS_AVAIL_1 | %FileCheck %s -check-prefix=OPTIONS_AVAIL_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_LITERAL_1 | FileCheck %s -check-prefix=WITH_LITERAL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_LITERAL_2 | FileCheck %s -check-prefix=WITH_LITERAL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_LITERAL_3 | FileCheck %s -check-prefix=WITH_LITERAL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_LITERAL_1 | %FileCheck %s -check-prefix=WITH_LITERAL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_LITERAL_2 | %FileCheck %s -check-prefix=WITH_LITERAL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WITH_LITERAL_3 | %FileCheck %s -check-prefix=WITH_LITERAL_1
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INVALID_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OTHER_FILE_1 %S/Inputs/EnumFromOtherFile.swift | FileCheck %s -check-prefix=OTHER_FILE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OTHER_FILE_1 %S/Inputs/EnumFromOtherFile.swift | %FileCheck %s -check-prefix=OTHER_FILE_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NON_OPT_SET_1 | FileCheck %s -check-prefix=NON_OPT_SET_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NON_OPT_SET_2 | FileCheck %s -check-prefix=NON_OPT_SET_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NON_OPT_SET_3 | FileCheck %s -check-prefix=NON_OPT_SET_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NON_OPT_SET_1 | %FileCheck %s -check-prefix=NON_OPT_SET_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NON_OPT_SET_2 | %FileCheck %s -check-prefix=NON_OPT_SET_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NON_OPT_SET_3 | %FileCheck %s -check-prefix=NON_OPT_SET_1
 
 enum SomeEnum1 {
   case South
diff --git a/test/IDE/complete_unwrapping_if_while.swift b/test/IDE/complete_unwrapping_if_while.swift
index 9671287..a845072 100644
--- a/test/IDE/complete_unwrapping_if_while.swift
+++ b/test/IDE/complete_unwrapping_if_while.swift
@@ -1,22 +1,22 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_IF_1 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_IF_2 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_IF_3 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_IF_4 | FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_IF_1 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_IF_2 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_IF_3 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_IF_4 | %FileCheck %s -check-prefix=UNWRAPPED_INT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_WHILE_1 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_WHILE_2 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_WHILE_3 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_WHILE_4 | FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_WHILE_1 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_WHILE_2 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_WHILE_3 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_WHILE_4 | %FileCheck %s -check-prefix=UNWRAPPED_INT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_IF_1 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_IF_2 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_IF_3 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_IF_4 | FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_IF_1 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_IF_2 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_IF_3 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_IF_4 | %FileCheck %s -check-prefix=UNWRAPPED_INT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_WHILE_1 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_WHILE_2 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_WHILE_3 | FileCheck %s -check-prefix=UNWRAPPED_INT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_WHILE_4 | FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_WHILE_1 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_WHILE_2 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_WHILE_3 | %FileCheck %s -check-prefix=UNWRAPPED_INT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_FUNCTION_WHILE_4 | %FileCheck %s -check-prefix=UNWRAPPED_INT
 
 // UNWRAPPED_INT: Begin completions
 // UNWRAPPED_INT-DAG: Decl[LocalVar]/Local: unwrapped[#Int#]{{; name=.+$}}
diff --git a/test/IDE/complete_value_expr.swift b/test/IDE/complete_value_expr.swift
index c7ad1f8..602603c 100644
--- a/test/IDE/complete_value_expr.swift
+++ b/test/IDE/complete_value_expr.swift
@@ -1,166 +1,166 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_1 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_3 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_4 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_5 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_NO_DOT_1 | FileCheck %s -check-prefix=FOO_OBJECT_NO_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_NO_DOT_2 | FileCheck %s -check-prefix=FOO_OBJECT_NO_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_STRUCT_DOT_1 | FileCheck %s -check-prefix=FOO_STRUCT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_STRUCT_NO_DOT_1 | FileCheck %s -check-prefix=FOO_STRUCT_NO_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_3 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_4 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_5 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_NO_DOT_1 | %FileCheck %s -check-prefix=FOO_OBJECT_NO_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_NO_DOT_2 | %FileCheck %s -check-prefix=FOO_OBJECT_NO_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_STRUCT_DOT_1 | %FileCheck %s -check-prefix=FOO_STRUCT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_STRUCT_NO_DOT_1 | %FileCheck %s -check-prefix=FOO_STRUCT_NO_DOT
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_FUNC_0 | FileCheck %s -check-prefix=IMPLICITLY_CURRIED_FUNC_0
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_FUNC_1 | FileCheck %s -check-prefix=IMPLICITLY_CURRIED_FUNC_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_FUNC_2 | FileCheck %s -check-prefix=IMPLICITLY_CURRIED_FUNC_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_FUNC_0 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_FUNC_0
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_FUNC_1 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_FUNC_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_FUNC_2 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_FUNC_2
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_VARARG_FUNC_0 | FileCheck %s -check-prefix=IMPLICITLY_CURRIED_VARARG_FUNC_0
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_VARARG_FUNC_1 | FileCheck %s -check-prefix=IMPLICITLY_CURRIED_VARARG_FUNC_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_VARARG_FUNC_2 | FileCheck %s -check-prefix=IMPLICITLY_CURRIED_VARARG_FUNC_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_VARARG_FUNC_0 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_VARARG_FUNC_0
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_VARARG_FUNC_1 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_VARARG_FUNC_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_VARARG_FUNC_2 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_VARARG_FUNC_2
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_OVERLOADED_FUNC_1 | FileCheck %s -check-prefix=IMPLICITLY_CURRIED_OVERLOADED_FUNC_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_OVERLOADED_FUNC_2 | FileCheck %s -check-prefix=IMPLICITLY_CURRIED_OVERLOADED_FUNC_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_OVERLOADED_FUNC_1 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_OVERLOADED_FUNC_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICITLY_CURRIED_OVERLOADED_FUNC_2 | %FileCheck %s -check-prefix=IMPLICITLY_CURRIED_OVERLOADED_FUNC_2
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_1 | FileCheck %s -check-prefix=IN_SWITCH_CASE
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_2 | FileCheck %s -check-prefix=IN_SWITCH_CASE
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_3 | FileCheck %s -check-prefix=IN_SWITCH_CASE
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_4 | FileCheck %s -check-prefix=IN_SWITCH_CASE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_1 | %FileCheck %s -check-prefix=IN_SWITCH_CASE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_2 | %FileCheck %s -check-prefix=IN_SWITCH_CASE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_3 | %FileCheck %s -check-prefix=IN_SWITCH_CASE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_SWITCH_CASE_4 | %FileCheck %s -check-prefix=IN_SWITCH_CASE
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=VF1 | FileCheck %s -check-prefix=VF1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=VF2 | FileCheck %s -check-prefix=VF2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BASE_MEMBERS | FileCheck %s -check-prefix=BASE_MEMBERS
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BASE_MEMBERS_STATIC | FileCheck %s -check-prefix=BASE_MEMBERS_STATIC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=VF1 | %FileCheck %s -check-prefix=VF1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=VF2 | %FileCheck %s -check-prefix=VF2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BASE_MEMBERS | %FileCheck %s -check-prefix=BASE_MEMBERS
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BASE_MEMBERS_STATIC | %FileCheck %s -check-prefix=BASE_MEMBERS_STATIC
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_NO_DOT_1 | FileCheck %s -check-prefix=PROTO_MEMBERS_NO_DOT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_NO_DOT_2 | FileCheck %s -check-prefix=PROTO_MEMBERS_NO_DOT_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_NO_DOT_3 | FileCheck %s -check-prefix=PROTO_MEMBERS_NO_DOT_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_NO_DOT_1 | %FileCheck %s -check-prefix=PROTO_MEMBERS_NO_DOT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_NO_DOT_2 | %FileCheck %s -check-prefix=PROTO_MEMBERS_NO_DOT_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_NO_DOT_3 | %FileCheck %s -check-prefix=PROTO_MEMBERS_NO_DOT_3
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_1 | FileCheck %s -check-prefix=PROTO_MEMBERS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_2 | FileCheck %s -check-prefix=PROTO_MEMBERS_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_3 | FileCheck %s -check-prefix=PROTO_MEMBERS_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_4 | FileCheck %s -check-prefix=PROTO_MEMBERS_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_1 | %FileCheck %s -check-prefix=PROTO_MEMBERS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_2 | %FileCheck %s -check-prefix=PROTO_MEMBERS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_3 | %FileCheck %s -check-prefix=PROTO_MEMBERS_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTO_MEMBERS_4 | %FileCheck %s -check-prefix=PROTO_MEMBERS_4
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_0 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_0
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_1 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_2 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_3 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_4 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_5 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_6 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_6
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_7 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_7
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_8 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_8
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_9 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_9
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_10 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_10
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_11 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_11
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_12 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_12
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_0 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_0
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_1 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_2 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_3 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_4 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_5 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_6 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_6
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_7 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_7
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_8 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_8
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_9 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_9
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_10 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_10
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_11 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_11
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_12 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_12
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_VARARG_FUNCTION_CALL_1 | FileCheck %s -check-prefix=INSIDE_VARARG_FUNCTION_CALL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_VARARG_FUNCTION_CALL_2 | FileCheck %s -check-prefix=INSIDE_VARARG_FUNCTION_CALL_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_VARARG_FUNCTION_CALL_3 | FileCheck %s -check-prefix=INSIDE_VARARG_FUNCTION_CALL_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_VARARG_FUNCTION_CALL_1 | %FileCheck %s -check-prefix=INSIDE_VARARG_FUNCTION_CALL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_VARARG_FUNCTION_CALL_2 | %FileCheck %s -check-prefix=INSIDE_VARARG_FUNCTION_CALL_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_VARARG_FUNCTION_CALL_3 | %FileCheck %s -check-prefix=INSIDE_VARARG_FUNCTION_CALL_3
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_OVERLOADED_FUNCTION_CALL_1 | FileCheck %s -check-prefix=INSIDE_OVERLOADED_FUNCTION_CALL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_OVERLOADED_FUNCTION_CALL_1 | %FileCheck %s -check-prefix=INSIDE_OVERLOADED_FUNCTION_CALL_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_ON_CLASS_INSTANCE_1 | FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_ON_CLASS_INSTANCE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INSIDE_FUNCTION_CALL_ON_CLASS_INSTANCE_1 | %FileCheck %s -check-prefix=INSIDE_FUNCTION_CALL_ON_CLASS_INSTANCE_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_1 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_2 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_3 | FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_4 | FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_5 | FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_6 | FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_6
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_2 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_3 | %FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_4 | %FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_5 | %FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_FUNC_PARAM_6 | %FileCheck %s -check-prefix=RESOLVE_FUNC_PARAM_6
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CONSTRUCTOR_PARAM_1 | FileCheck %s -check-prefix=FOO_OBJECT_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CONSTRUCTOR_PARAM_2 | FileCheck %s -check-prefix=RESOLVE_CONSTRUCTOR_PARAM_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CONSTRUCTOR_PARAM_3 | FileCheck %s -check-prefix=RESOLVE_CONSTRUCTOR_PARAM_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CONSTRUCTOR_PARAM_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CONSTRUCTOR_PARAM_2 | %FileCheck %s -check-prefix=RESOLVE_CONSTRUCTOR_PARAM_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_CONSTRUCTOR_PARAM_3 | %FileCheck %s -check-prefix=RESOLVE_CONSTRUCTOR_PARAM_3
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_PAREN_PATTERN_1 | FileCheck %s -check-prefix=FUNC_PAREN_PATTERN_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_PAREN_PATTERN_2 | FileCheck %s -check-prefix=FUNC_PAREN_PATTERN_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_PAREN_PATTERN_3 | FileCheck %s -check-prefix=FUNC_PAREN_PATTERN_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_PAREN_PATTERN_1 | %FileCheck %s -check-prefix=FUNC_PAREN_PATTERN_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_PAREN_PATTERN_2 | %FileCheck %s -check-prefix=FUNC_PAREN_PATTERN_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FUNC_PAREN_PATTERN_3 | %FileCheck %s -check-prefix=FUNC_PAREN_PATTERN_3
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_1 | FileCheck %s -check-prefix=CHAINED_CALLS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_2 | FileCheck %s -check-prefix=CHAINED_CALLS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_1 | %FileCheck %s -check-prefix=CHAINED_CALLS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_2 | %FileCheck %s -check-prefix=CHAINED_CALLS_2
 
 // Disabled because we aren't handling failures well.
-// FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_3 | FileCheck %s -check-prefix=CHAINED_CALLS_3
+// FIXME: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CHAINED_CALLS_3 | %FileCheck %s -check-prefix=CHAINED_CALLS_3
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_1 | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_2 | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_3 | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_4 | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_5 | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_5
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_ERROR_1 | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_ERROR_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_1 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_2 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_3 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_4 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_5 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_5
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_ERROR_1 | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_ERROR_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_1_STATIC | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_1_STATIC
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_2_STATIC | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_2_STATIC
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_3_STATIC | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_3_STATIC
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_4_STATIC | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_4_STATIC
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_5_STATIC | FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_5_STATIC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_1_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_1_STATIC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_2_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_2_STATIC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_3_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_3_STATIC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_4_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_4_STATIC
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_GENERIC_PARAMS_5_STATIC | %FileCheck %s -check-prefix=RESOLVE_GENERIC_PARAMS_5_STATIC
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_1 | FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_2 | FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_3 | FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_4 | FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_1 | %FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_2 | %FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_3 | %FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TC_UNSOLVED_VARIABLES_4 | %FileCheck %s -check-prefix=TC_UNSOLVED_VARIABLES_4
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_MODULES_1 | FileCheck %s -check-prefix=RESOLVE_MODULES_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RESOLVE_MODULES_1 | %FileCheck %s -check-prefix=RESOLVE_MODULES_1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INTERPOLATED_STRING_1 | FileCheck %s -check-prefix=FOO_OBJECT_DOT1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INTERPOLATED_STRING_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT1
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P1 | FileCheck %s -check-prefix=PROTOCOL_EXT_P1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P2 | FileCheck %s -check-prefix=PROTOCOL_EXT_P2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P3 | FileCheck %s -check-prefix=PROTOCOL_EXT_P3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_WILLCONFORMP1 | FileCheck %s -check-prefix=PROTOCOL_EXT_WILLCONFORMP1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DIDCONFORMP2 | FileCheck %s -check-prefix=PROTOCOL_EXT_DIDCONFORMP2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DIDCONFORMP3 | FileCheck %s -check-prefix=PROTOCOL_EXT_DIDCONFORMP3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP1 | FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP2 | FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP3 | FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE1 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE2 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_1 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_2 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE1_1 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE1_2 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE3 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE3_SUB | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME_SUB
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE4 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_3 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_3_SUB | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME_SUB
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE2_1 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE2_2 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_TA_1 | FileCheck %s -check-prefix=PROTOCOL_EXT_TA
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_TA_2 | FileCheck %s -check-prefix=PROTOCOL_EXT_TA
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_1 | FileCheck %s -check-prefix=PROTOCOL_EXT_INIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_2 | FileCheck %s -check-prefix=PROTOCOL_EXT_INIT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_DOT_1 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_DOT_2 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_DOT
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_T_DOT_1 | FileCheck %s -check-prefix=PROTOCOL_EXT_P4_T_DOT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_UNUSABLE_EXISTENTIAL | FileCheck %s -check-prefix=PROTOCOL_EXT_UNUSABLE_EXISTENTIAL
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DEDUP_1 | FileCheck %s -check-prefix=PROTOCOL_EXT_DEDUP_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DEDUP_2 | FileCheck %s -check-prefix=PROTOCOL_EXT_DEDUP_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DEDUP_3 | FileCheck %s -check-prefix=PROTOCOL_EXT_DEDUP_3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=THROWS1 | FileCheck %s -check-prefix=THROWS1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=THROWS2 | FileCheck %s -check-prefix=THROWS2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_THROWS1 | FileCheck %s -check-prefix=MEMBER_THROWS1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_THROWS2 | FileCheck %s -check-prefix=MEMBER_THROWS2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_THROWS3 | FileCheck %s -check-prefix=MEMBER_THROWS3
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_THROWS1 | FileCheck %s -check-prefix=INIT_THROWS1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_WILLCONFORMP1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_WILLCONFORMP1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DIDCONFORMP2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DIDCONFORMP2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DIDCONFORMP3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DIDCONFORMP3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_GENERICP3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_GENERICP3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE1_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE1_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_P1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE3_SUB | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME_SUB
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONCRETE4 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_CONSTRAINED_GENERIC_3_SUB | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME_SUB
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE2_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INSIDE_CONCRETE2_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_ONLYME
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_TA_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_TA
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_TA_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_TA
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_DOT_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_DOT_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_T_DOT_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_T_DOT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_UNUSABLE_EXISTENTIAL | %FileCheck %s -check-prefix=PROTOCOL_EXT_UNUSABLE_EXISTENTIAL
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DEDUP_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DEDUP_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DEDUP_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DEDUP_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_DEDUP_3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_DEDUP_3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=THROWS1 | %FileCheck %s -check-prefix=THROWS1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=THROWS2 | %FileCheck %s -check-prefix=THROWS2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_THROWS1 | %FileCheck %s -check-prefix=MEMBER_THROWS1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_THROWS2 | %FileCheck %s -check-prefix=MEMBER_THROWS2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MEMBER_THROWS3 | %FileCheck %s -check-prefix=MEMBER_THROWS3
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_THROWS1 | %FileCheck %s -check-prefix=INIT_THROWS1
 
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE1 > %t.autoclosure1
-// RUN: FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure1
+// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure1
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE2 > %t.autoclosure2
-// RUN: FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure2
+// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure2
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE3 > %t.autoclosure3
-// RUN: FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure3
+// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure3
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE4 > %t.autoclosure4
-// RUN: FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure4
+// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure4
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AUTOCLOSURE5 > %t.autoclosure5
-// RUN: FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure5
+// RUN: %FileCheck %s -check-prefix=AUTOCLOSURE_STRING < %t.autoclosure5
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_1 | FileCheck %s -check-prefix=GENERIC_TYPEALIAS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_2 | FileCheck %s -check-prefix=GENERIC_TYPEALIAS_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_1 | %FileCheck %s -check-prefix=GENERIC_TYPEALIAS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_TYPEALIAS_2 | %FileCheck %s -check-prefix=GENERIC_TYPEALIAS_2
 
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPRECATED_1 | FileCheck %s -check-prefix=DEPRECATED_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DOT_EXPR_NON_NOMINAL_1 | FileCheck %s -check-prefix=DOT_EXPR_NON_NOMINAL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DOT_EXPR_NON_NOMINAL_2 | FileCheck %s -check-prefix=DOT_EXPR_NON_NOMINAL_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPRECATED_1 | %FileCheck %s -check-prefix=DEPRECATED_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DOT_EXPR_NON_NOMINAL_1 | %FileCheck %s -check-prefix=DOT_EXPR_NON_NOMINAL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DOT_EXPR_NON_NOMINAL_2 | %FileCheck %s -check-prefix=DOT_EXPR_NON_NOMINAL_2
 
 // Test code completion of expressions that produce a value.
 
diff --git a/test/IDE/complete_value_literals.swift b/test/IDE/complete_value_literals.swift
index 44c41a1..4397299 100644
--- a/test/IDE/complete_value_literals.swift
+++ b/test/IDE/complete_value_literals.swift
@@ -1,33 +1,33 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=NO_CONTEXT_0 | FileCheck %s -check-prefix=NO_CONTEXT_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=NIL_0 | FileCheck %s -check-prefix=NIL_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=NIL_1 | FileCheck %s -check-prefix=NIL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=NIL_2 | FileCheck %s -check-prefix=NIL_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_0 | FileCheck %s -check-prefix=BOOL_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_1 | FileCheck %s -check-prefix=BOOL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_2 | FileCheck %s -check-prefix=BOOL_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_3 | FileCheck %s -check-prefix=BOOL_3
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_4 | FileCheck %s -check-prefix=BOOL_4
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INT_0 | FileCheck %s -check-prefix=INT_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INT_1 | FileCheck %s -check-prefix=INT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INT_2 | FileCheck %s -check-prefix=INT_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=DOUBLE_0 | FileCheck %s -check-prefix=DOUBLE_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=STRING_0 | FileCheck %s -check-prefix=STRING_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=STRING_1 | FileCheck %s -check-prefix=STRING_1
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=STRING_2 | FileCheck %s -check-prefix=STRING_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ARRAY_0 | FileCheck %s -check-prefix=ARRAY_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ARRAY_1 | FileCheck %s -check-prefix=ARRAY_1
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ARRAY_2 | FileCheck %s -check-prefix=ARRAY_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=DICT_0 | FileCheck %s -check-prefix=DICT_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=DICT_1 | FileCheck %s -check-prefix=DICT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=DICT_2 | FileCheck %s -check-prefix=DICT_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=TUPLE_0 | FileCheck %s -check-prefix=TUPLE_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=TUPLE_1 | FileCheck %s -check-prefix=TUPLE_1
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=TUPLE_2 | FileCheck %s -check-prefix=TUPLE_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=COLOR_0 | FileCheck %s -check-prefix=COLOR_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=COLOR_1 | FileCheck %s -check-prefix=COLOR_1
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=COLOR_2 | FileCheck %s -check-prefix=COLOR_2
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=IMAGE_0 | FileCheck %s -check-prefix=IMAGE_0
-// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=IMAGE_1 | FileCheck %s -check-prefix=IMAGE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=NO_CONTEXT_0 | %FileCheck %s -check-prefix=NO_CONTEXT_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=NIL_0 | %FileCheck %s -check-prefix=NIL_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=NIL_1 | %FileCheck %s -check-prefix=NIL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=NIL_2 | %FileCheck %s -check-prefix=NIL_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_0 | %FileCheck %s -check-prefix=BOOL_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_1 | %FileCheck %s -check-prefix=BOOL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_2 | %FileCheck %s -check-prefix=BOOL_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_3 | %FileCheck %s -check-prefix=BOOL_3
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=BOOL_4 | %FileCheck %s -check-prefix=BOOL_4
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INT_0 | %FileCheck %s -check-prefix=INT_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INT_1 | %FileCheck %s -check-prefix=INT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=INT_2 | %FileCheck %s -check-prefix=INT_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=DOUBLE_0 | %FileCheck %s -check-prefix=DOUBLE_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=STRING_0 | %FileCheck %s -check-prefix=STRING_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=STRING_1 | %FileCheck %s -check-prefix=STRING_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=STRING_2 | %FileCheck %s -check-prefix=STRING_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ARRAY_0 | %FileCheck %s -check-prefix=ARRAY_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ARRAY_1 | %FileCheck %s -check-prefix=ARRAY_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ARRAY_2 | %FileCheck %s -check-prefix=ARRAY_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=DICT_0 | %FileCheck %s -check-prefix=DICT_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=DICT_1 | %FileCheck %s -check-prefix=DICT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=DICT_2 | %FileCheck %s -check-prefix=DICT_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=TUPLE_0 | %FileCheck %s -check-prefix=TUPLE_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=TUPLE_1 | %FileCheck %s -check-prefix=TUPLE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=TUPLE_2 | %FileCheck %s -check-prefix=TUPLE_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=COLOR_0 | %FileCheck %s -check-prefix=COLOR_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=COLOR_1 | %FileCheck %s -check-prefix=COLOR_1
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=COLOR_2 | %FileCheck %s -check-prefix=COLOR_2
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=IMAGE_0 | %FileCheck %s -check-prefix=IMAGE_0
+// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=IMAGE_1 | %FileCheck %s -check-prefix=IMAGE_1
 
 func testAll0() {
   // Not type context.
diff --git a/test/IDE/complete_vararg.swift b/test/IDE/complete_vararg.swift
index c8e7f76..c46ee6f 100644
--- a/test/IDE/complete_vararg.swift
+++ b/test/IDE/complete_vararg.swift
@@ -1,13 +1,13 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_1 | FileCheck %s -check-prefix=TOP_LEVEL_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OBJ_DOT_1 | FileCheck %s -check-prefix=OBJ_DOT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FREE_FUNC_1 | FileCheck %s -check-prefix=FREE_FUNC_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FREE_FUNC_2 | FileCheck %s -check-prefix=FREE_FUNC_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_1 | FileCheck %s -check-prefix=INIT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=METHOD_1 | FileCheck %s -check-prefix=METHOD_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=METHOD_2 | FileCheck %s -check-prefix=METHOD_2
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUBSCRIPT_1 | FileCheck %s -check-prefix=SUBSCRIPT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_FREE_FUNC_1 | FileCheck %s -check-prefix=GENERIC_FREE_FUNC_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INTERESTING_TYPE_1 | FileCheck %s -check-prefix=INTERESTING_TYPE_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP_LEVEL_1 | %FileCheck %s -check-prefix=TOP_LEVEL_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=OBJ_DOT_1 | %FileCheck %s -check-prefix=OBJ_DOT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FREE_FUNC_1 | %FileCheck %s -check-prefix=FREE_FUNC_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FREE_FUNC_2 | %FileCheck %s -check-prefix=FREE_FUNC_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_1 | %FileCheck %s -check-prefix=INIT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=METHOD_1 | %FileCheck %s -check-prefix=METHOD_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=METHOD_2 | %FileCheck %s -check-prefix=METHOD_2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=SUBSCRIPT_1 | %FileCheck %s -check-prefix=SUBSCRIPT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_FREE_FUNC_1 | %FileCheck %s -check-prefix=GENERIC_FREE_FUNC_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INTERESTING_TYPE_1 | %FileCheck %s -check-prefix=INTERESTING_TYPE_1
 
 func freeFunc1(x x: Int...) { }
 func freeFunc2(x x: Int, y y: Int...) { }
diff --git a/test/IDE/complete_weak.swift b/test/IDE/complete_weak.swift
index e6d4ea0..735e9dd 100644
--- a/test/IDE/complete_weak.swift
+++ b/test/IDE/complete_weak.swift
@@ -1,8 +1,8 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WEAK_VARS_1 | FileCheck %s -check-prefix=WEAK_VARS_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WEAK_NO_DOT_1 | FileCheck %s -check-prefix=WEAK_NO_DOT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WEAK_DOT_1 | FileCheck %s -check-prefix=WEAK_DOT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNOWNED_NO_DOT_1 | FileCheck %s -check-prefix=UNOWNED_NO_DOT_1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNOWNED_DOT_1 | FileCheck %s -check-prefix=UNOWNED_DOT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WEAK_VARS_1 | %FileCheck %s -check-prefix=WEAK_VARS_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WEAK_NO_DOT_1 | %FileCheck %s -check-prefix=WEAK_NO_DOT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=WEAK_DOT_1 | %FileCheck %s -check-prefix=WEAK_DOT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNOWNED_NO_DOT_1 | %FileCheck %s -check-prefix=UNOWNED_NO_DOT_1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=UNOWNED_DOT_1 | %FileCheck %s -check-prefix=UNOWNED_DOT_1
 
 class CompleteWeak {
   func instanceFunc() {}
diff --git a/test/IDE/complete_where_clause.swift b/test/IDE/complete_where_clause.swift
index 67cd2a4..f6d9abe 100644
--- a/test/IDE/complete_where_clause.swift
+++ b/test/IDE/complete_where_clause.swift
@@ -1,8 +1,8 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP1 | FileCheck %s -check-prefix=A1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP2 | FileCheck %s -check-prefix=A1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP3 | FileCheck %s -check-prefix=A1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP4 | FileCheck %s -check-prefix=TYPE1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP5 | FileCheck %s -check-prefix=TYPE1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP1 | %FileCheck %s -check-prefix=A1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP2 | %FileCheck %s -check-prefix=A1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP3 | %FileCheck %s -check-prefix=A1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP4 | %FileCheck %s -check-prefix=TYPE1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GP5 | %FileCheck %s -check-prefix=TYPE1
 
 class A1<T1, T2, T3> {}
 
diff --git a/test/IDE/complete_with_closure_param.swift b/test/IDE/complete_with_closure_param.swift
index 7799351..43f86bd 100644
--- a/test/IDE/complete_with_closure_param.swift
+++ b/test/IDE/complete_with_closure_param.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE | FileCheck %s
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE | %FileCheck %s
 
 typealias FunctionTypealias = (Int, Int) -> Bool
 typealias OptionalFunctionTypealias = ((Int, Int) -> Bool)?
@@ -20,7 +20,7 @@
 // CHECK-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod2({#(callback): ((Int, Int) -> Void)?##(Int, Int) -> Void#})[#Void#]{{; name=.+$}}
 // CHECK-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod3({#(callback): ((Int, Int) -> Void)??##(Int, Int) -> Void#})[#Void#]{{; name=.+$}}
 // CHECK-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod4({#(callback): ((Int, Int) -> Void)!##(Int, Int) -> Void#})[#Void#]{{; name=.+$}}
-// CHECK-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod5({#(callback): FunctionTypealias##(Int, Int) -> Bool#})[#Void#]{{; name=.+$}}
+// CHECK-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod5({#(callback): (Int, Int) -> Bool##(Int, Int) -> Bool#})[#Void#]{{; name=.+$}}
 // CHECK-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod6({#(callback): FunctionTypealias?##(Int, Int) -> Bool#})[#Void#]{{; name=.+$}}
 // CHECK-DAG: Decl[InstanceMethod]/CurrNominal: instanceMethod7({#(callback): OptionalFunctionTypealias##(Int, Int) -> Bool#})[#Void#]{{; name=.+$}}
 // CHECK: End completions
diff --git a/test/IDE/complete_with_header_import.swift b/test/IDE/complete_with_header_import.swift
index cbf46e6..41d9086 100644
--- a/test/IDE/complete_with_header_import.swift
+++ b/test/IDE/complete_with_header_import.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP -import-objc-header %S/Inputs/header.h | FileCheck %s -check-prefix=CHECK-TOP
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE -import-objc-header %S/Inputs/header.h | FileCheck %s -check-prefix=CHECK-TYPE
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TOP -import-objc-header %S/Inputs/header.h | %FileCheck %s -check-prefix=CHECK-TOP
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TYPE -import-objc-header %S/Inputs/header.h | %FileCheck %s -check-prefix=CHECK-TYPE
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/complete_with_multiple_imports.swift b/test/IDE/complete_with_multiple_imports.swift
index 2f672a8..1d30f0b 100644
--- a/test/IDE/complete_with_multiple_imports.swift
+++ b/test/IDE/complete_with_multiple_imports.swift
@@ -2,7 +2,7 @@
 import FooHelper
 
 // This checks that we don't provide duplicate results because FooHelper is also imported through Foo.
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=TOP_COMPLETIONS | FileCheck %s -check-prefix=CHECK-TOP
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=TOP_COMPLETIONS | %FileCheck %s -check-prefix=CHECK-TOP
 
 func testClangModule() {
   #^TOP_COMPLETIONS^#
diff --git a/test/IDE/dump_swift_lookup_tables.swift b/test/IDE/dump_swift_lookup_tables.swift
index b194872..5b88268 100644
--- a/test/IDE/dump_swift_lookup_tables.swift
+++ b/test/IDE/dump_swift_lookup_tables.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-ide-test -dump-importer-lookup-table -source-filename %s -import-objc-header %S/Inputs/swift_name.h -I %S/Inputs/custom-modules > %t.log 2>&1
-// RUN: FileCheck %s < %t.log
+// RUN: %FileCheck %s < %t.log
 
 // REQUIRES: objc_interop
 import ImportAsMember
diff --git a/test/IDE/dump_swift_lookup_tables_objc.swift b/test/IDE/dump_swift_lookup_tables_objc.swift
index 5f833d5..0428976 100644
--- a/test/IDE/dump_swift_lookup_tables_objc.swift
+++ b/test/IDE/dump_swift_lookup_tables_objc.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-ide-test -dump-importer-lookup-table -source-filename %s -import-objc-header %S/Inputs/swift_name_objc.h > %t.log 2>&1
-// RUN: FileCheck %s < %t.log
+// RUN: %FileCheck %s < %t.log
 
 // REQUIRES: objc_interop
 // REQUIRES: OS=macosx
diff --git a/test/IDE/importProtocols.swift b/test/IDE/importProtocols.swift
index 49d1d80..d5bcdcc 100644
--- a/test/IDE/importProtocols.swift
+++ b/test/IDE/importProtocols.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -I %t -I %S/Inputs/custom-modules -print-module -module-to-print=ImportedProtocols.SubModule -source-filename %s > %t.printed.txt
-// RUN: FileCheck %s < %t.printed.txt 
+// RUN: %FileCheck %s < %t.printed.txt 
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/import_as_member.swift b/test/IDE/import_as_member.swift
index 7547819..a7bbad0 100644
--- a/test/IDE/import_as_member.swift
+++ b/test/IDE/import_as_member.swift
@@ -1,8 +1,8 @@
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -I %t -I %S/Inputs/custom-modules -print-module -source-filename %s -module-to-print=ImportAsMember.A -always-argument-labels > %t.printed.A.txt
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -I %t -I %S/Inputs/custom-modules -print-module -source-filename %s -module-to-print=ImportAsMember.B -always-argument-labels > %t.printed.B.txt
 
-// RUN: FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.A.txt
-// RUN: FileCheck %s -check-prefix=PRINTB -strict-whitespace < %t.printed.B.txt
+// RUN: %FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.A.txt
+// RUN: %FileCheck %s -check-prefix=PRINTB -strict-whitespace < %t.printed.B.txt
 
 // PRINT: struct Struct1 {
 // PRINT-NEXT:   var x: Double
diff --git a/test/IDE/import_as_member_cf.swift b/test/IDE/import_as_member_cf.swift
index ba78f55..e37bfc7 100644
--- a/test/IDE/import_as_member_cf.swift
+++ b/test/IDE/import_as_member_cf.swift
@@ -2,7 +2,7 @@
 
 // REQUIRES: objc_interop
 
-// RUN: FileCheck %s -check-prefix=PRINTC -strict-whitespace < %t.printed.C.txt
+// RUN: %FileCheck %s -check-prefix=PRINTC -strict-whitespace < %t.printed.C.txt
 
 // PRINTC:      extension CCPowerSupply {
 // PRINTC-NEXT:   /*not inherited*/ init(watts watts: Double)
diff --git a/test/IDE/import_as_member_objc.swift b/test/IDE/import_as_member_objc.swift
index b689ce5..c590838 100644
--- a/test/IDE/import_as_member_objc.swift
+++ b/test/IDE/import_as_member_objc.swift
@@ -1,23 +1,6 @@
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -I %t -I %S/Inputs/custom-modules -print-module -source-filename %s -module-to-print=ImportAsMember.Proto -always-argument-labels > %t.printed.Proto.txt
-
-// RUN: FileCheck %s -check-prefix=PRINT-PROTO -strict-whitespace < %t.printed.Proto.txt
-
-// PRINT-PROTO-LABEL: protocol ImportedProtocolBase : NSObjectProtocol {
-// PRINT-PROTO-NEXT:  }
-// PRINT-PROTO-NEXT:  typealias ImportedProtocolBase_t = ImportedProtocolBase
-// PRINT-PROTO-NEXT:  protocol IAMProto : ImportedProtocolBase {
-// PRINT-PROTO-NEXT:  }
-// PRINT-PROTO-NEXT:  typealias IAMProto_t = IAMProto
-// PRINT-PROTO-NEXT:  extension IAMProto {
-// PRINT-PROTO-NEXT:    func mutateSomeState()
-// PRINT-PROTO-NEXT:    func mutateSomeState(withParameter _: Int)
-// PRINT-PROTO-NEXT:    func mutateSomeState(withFirstParameter _: Int)
-// PRINT-PROTO-NEXT:    var someValue: Int32
-// PRINT-PROTO-NEXT:  }
-
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -I %t -I %S/Inputs/custom-modules -print-module -source-filename %s -module-to-print=ImportAsMember.Class -always-argument-labels > %t.printed.Class.txt
 
-// RUN: FileCheck %s -check-prefix=PRINT-CLASS -strict-whitespace < %t.printed.Class.txt
+// RUN: %FileCheck %s -check-prefix=PRINT-CLASS -strict-whitespace < %t.printed.Class.txt
 
 // PRINT-CLASS-LABEL: class SomeClass : NSObject {
 // PRINT-CLASS-NEXT:   init()
@@ -37,32 +20,12 @@
 // REQUIRES: objc_interop
 
 import Foundation
-import ImportAsMember.Proto
 import ImportAsMember.Class
 import IAMError
 
 // Errors
 ErrorStruct.hasPrototype();
 
-// Protocols
-@objc class Foo : NSObject, IAMProto {}
-
-struct Bar : IAMProto {}
-  // expected-error@-1{{non-class type 'Bar' cannot conform to class protocol 'IAMProto'}}
-  // expected-error@-2{{non-class type 'Bar' cannot conform to class protocol 'ImportedProtocolBase'}}
-  // expected-error@-3{{non-class type 'Bar' cannot conform to class protocol 'NSObjectProtocol'}}
-
-@objc class FooErr : NSObject, ErrorProto {}
-
-let foo = Foo()
-foo.mutateSomeState()
-
-let fooErr = FooErr()
-fooErr.mutateSomeInstanceState()
-FooErr.mutateSomeStaticState()
-  // expected-error@-1{{type 'FooErr' has no member 'mutateSomeStaticState'}}
-
-
 // Import into members of an imported, renamed class.
 let someClassOpts: SomeClass.Options = .fuzzyDice
 let someClass = SomeClass(value: 3.14159)
diff --git a/test/IDE/infer_import_as_member.swift b/test/IDE/infer_import_as_member.swift
index d5c2192..f7ad10a 100644
--- a/test/IDE/infer_import_as_member.swift
+++ b/test/IDE/infer_import_as_member.swift
@@ -1,6 +1,6 @@
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/custom-modules/CollisionImportAsMember.h -I %t -I %S/Inputs/custom-modules -print-module -source-filename %s -module-to-print=InferImportAsMember -always-argument-labels -enable-infer-import-as-member > %t.printed.A.txt
 // RUN: %target-swift-frontend -parse -import-objc-header %S/Inputs/custom-modules/CollisionImportAsMember.h -I %t -I %S/Inputs/custom-modules %s -enable-infer-import-as-member -verify
-// RUN: FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.A.txt
+// RUN: %FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.A.txt
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/local_types.swift b/test/IDE/local_types.swift
index 04e9876..62505f0 100644
--- a/test/IDE/local_types.swift
+++ b/test/IDE/local_types.swift
@@ -2,7 +2,7 @@
 
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swiftc_driver -v -emit-module -module-name LocalTypes -o %t/LocalTypes.swiftmodule %s
-// RUN: %target-swift-ide-test -print-local-types -I %t -module-to-print LocalTypes -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -print-local-types -I %t -module-to-print LocalTypes -source-filename %s | %FileCheck %s
 
 public func singleFunc() {
   // CHECK-DAG: VF10LocalTypes10singleFuncFT_T_L_16SingleFuncStruct
diff --git a/test/IDE/merge_local_types.swift b/test/IDE/merge_local_types.swift
index 0c32971..8818faf 100644
--- a/test/IDE/merge_local_types.swift
+++ b/test/IDE/merge_local_types.swift
@@ -5,7 +5,7 @@
 // Create separate modules and merge them together
 // RUN: %target-swiftc_driver -v -emit-module -module-name LocalTypesMerged -o %t/LocalTypesMerged.swiftmodule %s %S/local_types.swift
 
-// RUN: %target-swift-ide-test -print-local-types -I %t -module-to-print LocalTypesMerged -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -print-local-types -I %t -module-to-print LocalTypesMerged -source-filename %s | %FileCheck %s
 
 public func toMerge() {
   // CHECK-DAG: VF16LocalTypesMerged7toMergeFT_T_L_16SingleFuncStruct
diff --git a/test/IDE/module_api_smoketest.swift b/test/IDE/module_api_smoketest.swift
index 68a4659..7282f32 100644
--- a/test/IDE/module_api_smoketest.swift
+++ b/test/IDE/module_api_smoketest.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
-// RUN: %swift-ide-test -generate-module-api-description -- -target %target-triple -module-cache-path %t %s | FileCheck %s
+// RUN: %swift-ide-test -generate-module-api-description -- -target %target-triple -module-cache-path %t %s | %FileCheck %s
 
 public struct Struct1 {}
 
diff --git a/test/IDE/newtype.swift b/test/IDE/newtype.swift
index 5fe379b..5803836 100644
--- a/test/IDE/newtype.swift
+++ b/test/IDE/newtype.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir -p %t
 // RUN: %build-clang-importer-objc-overlays
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk-nosource) -I %t -I %S/Inputs/custom-modules -enable-swift-newtype -print-module -source-filename %s -module-to-print=Newtype > %t.printed.A.txt
-// RUN: FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.A.txt
+// RUN: %FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.A.txt
 // RUN: %target-parse-verify-swift -sdk %clang-importer-sdk -I %S/Inputs/custom-modules -enable-swift-newtype -I %t
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/newtype_objc.swift b/test/IDE/newtype_objc.swift
index a8af960..4c321bc 100644
--- a/test/IDE/newtype_objc.swift
+++ b/test/IDE/newtype_objc.swift
@@ -3,7 +3,7 @@
 // RUN: %build-clang-importer-objc-overlays
 
 // RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk-nosource) -I %t -I %S/Inputs/custom-modules -print-module -source-filename %s -module-to-print=NewtypeObjC -enable-swift-newtype > %t.printed.NewtypeObjC.txt
-// RUN: FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.NewtypeObjC.txt
+// RUN: %FileCheck %s -check-prefix=PRINT -strict-whitespace < %t.printed.NewtypeObjC.txt
 // RUN: %target-parse-verify-swift -sdk %clang-importer-sdk -I %S/Inputs/custom-modules -I %t -enable-swift-newtype %s
 
 // REQUIRES: objc_interop
diff --git a/test/IDE/print_ast_interface.swift b/test/IDE/print_ast_interface.swift
index 6d624bd..fd2d939 100644
--- a/test/IDE/print_ast_interface.swift
+++ b/test/IDE/print_ast_interface.swift
@@ -7,7 +7,7 @@
     case B(String)
 }
 
-// RUN: %target-swift-ide-test -print-ast-typechecked -print-interface -source-filename %s | FileCheck %s -check-prefix=CHECK1
+// RUN: %target-swift-ide-test -print-ast-typechecked -print-interface -source-filename %s | %FileCheck %s -check-prefix=CHECK1
 // CHECK1: {{^}}/// This is my enum.{{$}}
 // CHECK1: {{^}}public enum Foo {{{$}}
 // CHECK1: {{^}}    /// This is really special.{{$}}
diff --git a/test/IDE/print_ast_non_typechecked.swift b/test/IDE/print_ast_non_typechecked.swift
index c770934..90b2d46 100644
--- a/test/IDE/print_ast_non_typechecked.swift
+++ b/test/IDE/print_ast_non_typechecked.swift
@@ -2,5 +2,5 @@
   func foo(s: Int, w
 }
 
-// RUN: %target-swift-ide-test -print-ast-not-typechecked -source-filename %s | FileCheck %s -check-prefix=CHECK1
+// RUN: %target-swift-ide-test -print-ast-not-typechecked -source-filename %s | %FileCheck %s -check-prefix=CHECK1
 // CHECK1: func foo(s: Int)
diff --git a/test/IDE/print_ast_overlay.swift b/test/IDE/print_ast_overlay.swift
index d196451..2a7f27c 100644
--- a/test/IDE/print_ast_overlay.swift
+++ b/test/IDE/print_ast_overlay.swift
@@ -3,16 +3,16 @@
 // RUN: %target-build-swift -emit-module -module-name Foo -o %t -F %S/Inputs/mock-sdk %s
 //
 // RUN: %target-swift-ide-test -print-module -source-filename %s -I %t -F %S/Inputs/mock-sdk -module-to-print=Foo -accessibility-filter-public > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_WITH_OVERLAY -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_NO_INTERNAL -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_WITH_OVERLAY -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_NO_INTERNAL -strict-whitespace < %t.printed.txt
 //
 // RUN: %target-swift-ide-test -print-module -source-filename %s -I %t -F %S/Inputs/mock-sdk -module-to-print=Foo.FooSub > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_WITHOUT_OVERLAY -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_WITHOUT_OVERLAY -strict-whitespace < %t.printed.txt
 
 // XFAIL: linux
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -I %t -F %S/Inputs/mock-sdk -module-to-print=Foo -accessibility-filter-public -annotate-print > %t.annotated.txt
-// RUN: FileCheck %s -check-prefix=PASS_ANNOTATED -strict-whitespace < %t.annotated.txt
+// RUN: %FileCheck %s -check-prefix=PASS_ANNOTATED -strict-whitespace < %t.annotated.txt
 // REQUIRES: executable_test
 
 @_exported import Foo
diff --git a/test/IDE/print_ast_tc_decls.swift b/test/IDE/print_ast_tc_decls.swift
index c596606..bcb9405 100644
--- a/test/IDE/print_ast_tc_decls.swift
+++ b/test/IDE/print_ast_tc_decls.swift
@@ -11,51 +11,51 @@
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -parse -verify %s -F %S/Inputs/mock-sdk -disable-objc-attr-requires-foundation-module
 //
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -skip-deinit=false -print-ast-typechecked -source-filename %s -F %S/Inputs/mock-sdk -function-definitions=false -prefer-type-repr=false -print-implicit-attrs=true -disable-objc-attr-requires-foundation-module > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_PRINT_AST -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_RW_PROP_GET_SET -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_2200 -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_2500 -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_ONE_LINE -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_ONE_LINE_TYPE -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PREFER_TYPE_PRINTING -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_PRINT_AST -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_RW_PROP_GET_SET -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_2200 -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_2500 -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE_TYPE -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PREFER_TYPE_PRINTING -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
 //
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -skip-deinit=false -print-ast-typechecked -source-filename %s -F %S/Inputs/mock-sdk -function-definitions=false -prefer-type-repr=true -print-implicit-attrs=true -disable-objc-attr-requires-foundation-module > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_PRINT_AST -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_RW_PROP_GET_SET -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_2200 -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_2500 -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_ONE_LINE -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_ONE_LINE_TYPEREPR -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PREFER_TYPE_REPR_PRINTING -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_PRINT_AST -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_RW_PROP_GET_SET -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_2200 -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_2500 -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE_TYPEREPR -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PREFER_TYPE_REPR_PRINTING -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
 //
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t -F %S/Inputs/mock-sdk -disable-objc-attr-requires-foundation-module %s
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -skip-deinit=false -print-module -source-filename %s -F %S/Inputs/mock-sdk -module-to-print=print_ast_tc_decls -print-implicit-attrs=true -disable-objc-attr-requires-foundation-module > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_PRINT_MODULE_INTERFACE -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_RW_PROP_NO_GET_SET -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_2200_DESERIALIZED -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_PRINT_MODULE_INTERFACE -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_RW_PROP_NO_GET_SET -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_2200_DESERIALIZED -strict-whitespace < %t.printed.txt
 // FIXME: rdar://15167697
-// FIXME: FileCheck %s -check-prefix=PASS_2500 -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_ONE_LINE -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PREFER_TYPE_REPR_PRINTING -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_EXPLODE_PATTERN -strict-whitespace < %t.printed.txt
+// FIXME: %FileCheck %s -check-prefix=PASS_2500 -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_ONE_LINE -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PREFER_TYPE_REPR_PRINTING -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_EXPLODE_PATTERN -strict-whitespace < %t.printed.txt
 //
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -skip-deinit=false -print-module -source-filename %s -F %S/Inputs/mock-sdk -I %t -module-to-print=print_ast_tc_decls -synthesize-sugar-on-types=true -print-implicit-attrs=true -disable-objc-attr-requires-foundation-module > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_PRINT_MODULE_INTERFACE -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=SYNTHESIZE_SUGAR_ON_TYPES -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_EXPLODE_PATTERN -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_PRINT_MODULE_INTERFACE -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_QUAL_UNQUAL -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=SYNTHESIZE_SUGAR_ON_TYPES -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_EXPLODE_PATTERN -strict-whitespace < %t.printed.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -skip-deinit=false -print-module -source-filename %s -F %S/Inputs/mock-sdk -I %t -module-to-print=print_ast_tc_decls -synthesize-sugar-on-types=true -fully-qualified-types-if-ambiguous=true -print-implicit-attrs=true -disable-objc-attr-requires-foundation-module > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_PRINT_MODULE_INTERFACE -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=PASS_QUAL_IF_AMBIGUOUS -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=SYNTHESIZE_SUGAR_ON_TYPES -strict-whitespace < %t.printed.txt
-// FIXME: FileCheck %s -check-prefix=PASS_EXPLODE_PATTERN -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_PRINT_MODULE_INTERFACE -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=PASS_QUAL_IF_AMBIGUOUS -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=SYNTHESIZE_SUGAR_ON_TYPES -strict-whitespace < %t.printed.txt
+// FIXME: %FileCheck %s -check-prefix=PASS_EXPLODE_PATTERN -strict-whitespace < %t.printed.txt
 
 // FIXME: rdar://problem/19648117 Needs splitting objc parts out
 // XFAIL: linux
@@ -608,7 +608,7 @@
 
   func `func`<`let`: `protocol`, `where`>(
       class: Int, struct: `protocol`, foo: `let`, bar: `where`) where `where` : `protocol` {}
-// PASS_COMMON-NEXT: {{^}}  func `func`<`let` : `protocol`, `where` where `where` : `protocol`>(class: Int, struct: `protocol`, foo: `let`, bar: `where`){{$}}
+// PASS_COMMON-NEXT: {{^}}  func `func`<`let` : {{(d0200_EscapedIdentifiers.)?}}`protocol`, `where` where `where` : {{(d0200_EscapedIdentifiers.)?}}`protocol`>(class: Int, struct: {{(d0200_EscapedIdentifiers.)?}}`protocol`, foo: `let`, bar: `where`){{$}}
 
   var `var`: `struct` = `struct`()
 // PASS_COMMON-NEXT: {{^}}  var `var`: {{(d0200_EscapedIdentifiers.)?}}`struct`{{$}}
diff --git a/test/IDE/print_ast_tc_decls_errors.swift b/test/IDE/print_ast_tc_decls_errors.swift
index 1cac9e8..7fc5e48 100644
--- a/test/IDE/print_ast_tc_decls_errors.swift
+++ b/test/IDE/print_ast_tc_decls_errors.swift
@@ -3,12 +3,12 @@
 // RUN: %target-parse-verify-swift -show-diagnostics-after-fatal %s
 
 // RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -prefer-type-repr=false > %t.printed.txt
-// RUN: FileCheck %s -strict-whitespace < %t.printed.txt
-// RUN: FileCheck -check-prefix=NO-TYPEREPR %s -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck -check-prefix=NO-TYPEREPR %s -strict-whitespace < %t.printed.txt
 
 // RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -prefer-type-repr=true > %t.printed.txt
-// RUN: FileCheck %s -strict-whitespace < %t.printed.txt
-// RUN: FileCheck -check-prefix=TYPEREPR %s -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck -check-prefix=TYPEREPR %s -strict-whitespace < %t.printed.txt
 
 //===---
 //===--- Helper types.
@@ -120,17 +120,17 @@
 // TYREPR: {{^}}enum EnumWithInheritance2 : FooNonExistentProtocol, BarNonExistentProtocol {{{$}}
 
 enum EnumWithInheritance3 : FooClass { case X } // expected-error {{raw type 'FooClass' is not expressible by any literal}}
-// expected-error@-1{{type 'EnumWithInheritance3' does not conform to protocol 'RawRepresentable'}}
+// expected-error@-1{{'EnumWithInheritance3' declares raw type 'FooClass', but does not conform to RawRepresentable and conformance could not be synthesized}}
 // NO-TYREPR: {{^}}enum EnumWithInheritance3 : <<error type>> {{{$}}
 // TYREPR: {{^}}enum EnumWithInheritance3 : FooClass {{{$}}
 
 enum EnumWithInheritance4 : FooClass, FooProtocol { case X } // expected-error {{raw type 'FooClass' is not expressible by any literal}}
-// expected-error@-1{{type 'EnumWithInheritance4' does not conform to protocol 'RawRepresentable'}}
+// expected-error@-1{{'EnumWithInheritance4' declares raw type 'FooClass', but does not conform to RawRepresentable and conformance could not be synthesized}}
 // NO-TYREPR: {{^}}enum EnumWithInheritance4 : <<error type>>, FooProtocol {{{$}}
 // TYREPR: {{^}}enum EnumWithInheritance4 : FooClass, FooProtocol {{{$}}
 
 enum EnumWithInheritance5 : FooClass, BarClass { case X } // expected-error {{raw type 'FooClass' is not expressible by any literal}} expected-error {{multiple enum raw types 'FooClass' and 'BarClass'}}
-// expected-error@-1{{type 'EnumWithInheritance5' does not conform to protocol 'RawRepresentable'}}
+// expected-error@-1{{'EnumWithInheritance5' declares raw type 'FooClass', but does not conform to RawRepresentable and conformance could not be synthesized}}
 // NO-TYREPR: {{^}}enum EnumWithInheritance5 : <<error type>>, <<error type>> {{{$}}
 // TYREPR: {{^}}enum EnumWithInheritance5 : FooClass, BarClass {{{$}}
 
diff --git a/test/IDE/print_ast_tc_function_bodies.swift b/test/IDE/print_ast_tc_function_bodies.swift
index ebcca3a..3b76052 100644
--- a/test/IDE/print_ast_tc_function_bodies.swift
+++ b/test/IDE/print_ast_tc_function_bodies.swift
@@ -2,10 +2,10 @@
 // RUN: %target-parse-verify-swift
 
 // RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -function-definitions=true -prefer-type-repr=false > %t.printed.txt
-// RUN: FileCheck %s -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -strict-whitespace < %t.printed.txt
 
 // RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -function-definitions=true -prefer-type-repr=true > %t.printed.txt
-// RUN: FileCheck %s -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -strict-whitespace < %t.printed.txt
 
 struct FooStruct {
 // CHECK-LABEL: {{^}}struct FooStruct {{{$}}
diff --git a/test/IDE/print_ast_typechecked.swift b/test/IDE/print_ast_typechecked.swift
index dec6e1d..b8bc4c5 100644
--- a/test/IDE/print_ast_typechecked.swift
+++ b/test/IDE/print_ast_typechecked.swift
@@ -7,7 +7,7 @@
   var (InternalTuple1, InternalTuple2) = (10, 20)
 }
 
-// RUN: %target-swift-ide-test -print-ast-typechecked -accessibility-filter-internal -source-filename %s | FileCheck %s -check-prefix=CHECK1
+// RUN: %target-swift-ide-test -print-ast-typechecked -accessibility-filter-internal -source-filename %s | %FileCheck %s -check-prefix=CHECK1
 // CHECK1: {{^}}public class C {{{$}}
 // CHECK1-NOT: private
 // CHECK1: {{^}}  public var PublicVar: Int{{$}}
diff --git a/test/IDE/print_clang_ObjectiveC.swift b/test/IDE/print_clang_ObjectiveC.swift
index 9c7311f..3ec1b73 100644
--- a/test/IDE/print_clang_ObjectiveC.swift
+++ b/test/IDE/print_clang_ObjectiveC.swift
@@ -1,12 +1,12 @@
 // RUN: rm -rf %t && mkdir -p %t
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=ObjectiveC.NSObject -function-definitions=false > %t/ObjectiveC.NSObject.printed.txt
-// RUN: FileCheck -input-file %t/ObjectiveC.NSObject.printed.txt %s
-// RUN: FileCheck -input-file %t/ObjectiveC.NSObject.printed.txt -check-prefix=NEGATIVE -check-prefix=NEGATIVE-WITHOUT-FORWARD-DECLS %s
+// RUN: %FileCheck -input-file %t/ObjectiveC.NSObject.printed.txt %s
+// RUN: %FileCheck -input-file %t/ObjectiveC.NSObject.printed.txt -check-prefix=NEGATIVE -check-prefix=NEGATIVE-WITHOUT-FORWARD-DECLS %s
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=ObjectiveC.NSObject -function-definitions=false -enable-objc-forward-declarations > %t/ObjectiveC.NSObject.forward-decls.txt
-// RUN: FileCheck -input-file %t/ObjectiveC.NSObject.forward-decls.txt -check-prefix=CHECK -check-prefix=CHECK-WITH-FORWARD-DECLS %s
-// RUN: FileCheck -input-file %t/ObjectiveC.NSObject.forward-decls.txt -check-prefix=NEGATIVE %s
+// RUN: %FileCheck -input-file %t/ObjectiveC.NSObject.forward-decls.txt -check-prefix=CHECK -check-prefix=CHECK-WITH-FORWARD-DECLS %s
+// RUN: %FileCheck -input-file %t/ObjectiveC.NSObject.forward-decls.txt -check-prefix=NEGATIVE %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/print_clang_category_ordering.swift b/test/IDE/print_clang_category_ordering.swift
index bf05c86a..5b23d6a 100644
--- a/test/IDE/print_clang_category_ordering.swift
+++ b/test/IDE/print_clang_category_ordering.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -print-module -source-filename %s -I %S/Inputs/category-ordering/ -module-to-print=ProtocolThenProperty | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-PROTO-FIRST
-// RUN: %target-swift-ide-test -print-module -source-filename %s -I %S/Inputs/category-ordering/ -module-to-print=PropertyThenProtocol | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-PROP-FIRST
+// RUN: %target-swift-ide-test -print-module -source-filename %s -I %S/Inputs/category-ordering/ -module-to-print=ProtocolThenProperty | %FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-PROTO-FIRST
+// RUN: %target-swift-ide-test -print-module -source-filename %s -I %S/Inputs/category-ordering/ -module-to-print=PropertyThenProtocol | %FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-PROP-FIRST
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/print_clang_decls.swift b/test/IDE/print_clang_decls.swift
index 475bd7f..7e4a654 100644
--- a/test/IDE/print_clang_decls.swift
+++ b/test/IDE/print_clang_decls.swift
@@ -11,17 +11,17 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/CoreGraphics.swift
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=ctypes -function-definitions=false -prefer-type-repr=true > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=TAG_DECLS_AND_TYPEDEFS -strict-whitespace < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=TAG_DECLS_AND_TYPEDEFS -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE -strict-whitespace < %t.printed.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=Foundation -function-definitions=false -prefer-type-repr=true > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=FOUNDATION -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=FOUNDATION -strict-whitespace < %t.printed.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=ctypes.bits -function-definitions=false -prefer-type-repr=true > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=CTYPESBITS -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=CTYPESBITS -strict-whitespace < %t.printed.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=nullability -function-definitions=false -prefer-type-repr=true > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=CHECK-NULLABILITY -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=CHECK-NULLABILITY -strict-whitespace < %t.printed.txt
 
 // TAG_DECLS_AND_TYPEDEFS: {{^}}struct FooStruct1 {{{$}}
 // TAG_DECLS_AND_TYPEDEFS: {{^}}  var x: Int32{{$}}
diff --git a/test/IDE/print_clang_decls_AppKit.swift b/test/IDE/print_clang_decls_AppKit.swift
index ddcc0af..1167e5d 100644
--- a/test/IDE/print_clang_decls_AppKit.swift
+++ b/test/IDE/print_clang_decls_AppKit.swift
@@ -13,7 +13,7 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/AppKit.swift
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=AppKit -function-definitions=false -prefer-type-repr=true > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=APPKIT -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=APPKIT -strict-whitespace < %t.printed.txt
 
 // APPKIT-LABEL: {{^}}extension NSString {{{$}}
 
diff --git a/test/IDE/print_clang_foundation.swift b/test/IDE/print_clang_foundation.swift
index b6cad71..d95749a 100644
--- a/test/IDE/print_clang_foundation.swift
+++ b/test/IDE/print_clang_foundation.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir -p %t
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=Foundation.NSArray -function-definitions=false > %t/Foundation.NSArray.printed.txt
-// RUN: FileCheck -input-file %t/Foundation.NSArray.printed.txt -check-prefix=CHECK_NSARRAY %s
+// RUN: %FileCheck -input-file %t/Foundation.NSArray.printed.txt -check-prefix=CHECK_NSARRAY %s
 
 // REQUIRES: objc_interop
 
@@ -19,13 +19,13 @@
 // CHECK_NSARRAY:   func setArray(_ otherArray: [Any])
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=Foundation.NSKeyValueCoding -function-definitions=false -print-regular-comments > %t/Foundation.NSKeyValueCoding.printed.txt
-// RUN: FileCheck -input-file %t/Foundation.NSKeyValueCoding.printed.txt -check-prefix=CHECK2 %s
+// RUN: %FileCheck -input-file %t/Foundation.NSKeyValueCoding.printed.txt -check-prefix=CHECK2 %s
 
 // CHECK2: extension NSObject
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=Foundation.NSString -function-definitions=false > %t/Foundation.NSString.printed.txt
-// RUN: FileCheck -input-file %t/Foundation.NSString.printed.txt -check-prefix=CHECK_NSSTRING %s
-// RUN: FileCheck -input-file %t/Foundation.NSString.printed.txt -check-prefix=CHECK_DICTIONARY %s
+// RUN: %FileCheck -input-file %t/Foundation.NSString.printed.txt -check-prefix=CHECK_NSSTRING %s
+// RUN: %FileCheck -input-file %t/Foundation.NSString.printed.txt -check-prefix=CHECK_DICTIONARY %s
 
 // Make sure that we don't qualify 'NSErrorPointer'.
 // CHECK_NSSTRING: init(contentsOfFile path: String, encoding enc: UInt) throws
@@ -33,30 +33,30 @@
 // CHECK_DICTIONARY: func propertyListFromStringsFileFormat() -> [AnyHashable : Any]
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=Foundation -function-definitions=false > %t/Foundation.printed.txt
-// RUN: FileCheck -input-file %t/Foundation.printed.txt -check-prefix=CHECK_DUP %s
+// RUN: %FileCheck -input-file %t/Foundation.printed.txt -check-prefix=CHECK_DUP %s
 
 // CHECK_DUP: import CoreFoundation{{$}}
 // CHECK_DUP-NOT: import CoreFoundation{{$}}
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=Foundation.NSTimeZone -function-definitions=false > %t/Foundation.NSTimeZone.printed.txt
-// RUN:  FileCheck -input-file %t/Foundation.NSTimeZone.printed.txt -check-prefix=CHECK_NSTIMEZONE %s
+// RUN: %FileCheck -input-file %t/Foundation.NSTimeZone.printed.txt -check-prefix=CHECK_NSTIMEZONE %s
 
 // CHECK_NSTIMEZONE: func secondsFromGMT(for aDate: Date) -> Int
 // CHECK_NSTIMEZONE: func abbreviation(for aDate: Date) -> String?
 // CHECK_NSTIMEZONE: var nextDaylightSavingTimeTransition: Date? { get }
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=Foundation.NSCalendar -function-definitions=false > %t/Foundation.NSCalendar.printed.txt
-// RUN:  FileCheck -input-file %t/Foundation.NSCalendar.printed.txt -check-prefix=CHECK_NSCALENDAR %s
+// RUN: %FileCheck -input-file %t/Foundation.NSCalendar.printed.txt -check-prefix=CHECK_NSCALENDAR %s
 
 // CHECK_NSCALENDAR: func date(from comps: DateComponents) -> Date?
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=Foundation.NSDateInterval -function-definitions=false > %t/Foundation.NSDateInterval.printed.txt
-// RUN:  FileCheck -input-file %t/Foundation.NSDateInterval.printed.txt -check-prefix=CHECK_NSDATEINTERVAL %s
+// RUN: %FileCheck -input-file %t/Foundation.NSDateInterval.printed.txt -check-prefix=CHECK_NSDATEINTERVAL %s
 
 // CHECK_NSDATEINTERVAL: func intersection(with dateInterval: DateInterval) -> DateInterval?
 
 // RUN: %target-swift-ide-test -print-module -source-filename %s -module-to-print=Foundation.NSCoder -function-definitions=false > %t/Foundation.NSCoder.printed.txt
-// RUN:  FileCheck -input-file %t/Foundation.NSCoder.printed.txt -check-prefix=CHECK_NSCODER %s
+// RUN: %FileCheck -input-file %t/Foundation.NSCoder.printed.txt -check-prefix=CHECK_NSCODER %s
 
 // CHECK_NSCODER: func failWithError(_ error: Error)
 // CHECK_NSCODER: {{^}}  var error: Error? { get }
diff --git a/test/IDE/print_clang_framework.swift b/test/IDE/print_clang_framework.swift
index fdad7f9..8dc47a9 100644
--- a/test/IDE/print_clang_framework.swift
+++ b/test/IDE/print_clang_framework.swift
@@ -8,7 +8,7 @@
 // RUN: diff -u %S/Inputs/mock-sdk/Foo.printed.txt %t/Foo.printed.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -F %S/Inputs/mock-sdk) -print-interface -print-module -source-filename %s -module-to-print=Foo -function-definitions=false -print-regular-comments > %t/Foo.interface.printed.txt
-// RUN: FileCheck %s -check-prefix=INTERFACE1 < %t/Foo.interface.printed.txt
+// RUN: %FileCheck %s -check-prefix=INTERFACE1 < %t/Foo.interface.printed.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -F %S/Inputs/mock-sdk) -print-module -source-filename %s -module-to-print=Foo -function-definitions=false -prefer-type-repr=true -module-print-submodules > %t/Foo.printed.recursive.txt
 // RUN: diff -u %S/Inputs/mock-sdk/Foo.printed.recursive.txt %t/Foo.printed.recursive.txt
@@ -30,7 +30,7 @@
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=Foundation -function-definitions=false -prefer-type-repr=true > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=FOUNDATION -strict-whitespace < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=FOUNDATION -strict-whitespace < %t.printed.txt
 
 // This test is in general platform-independent, but it happens to check
 // printing of @available attributes for OS X, and those are not printed on
diff --git a/test/IDE/print_clang_framework_with_overlay.swift b/test/IDE/print_clang_framework_with_overlay.swift
index f474b0d..9cab000 100644
--- a/test/IDE/print_clang_framework_with_overlay.swift
+++ b/test/IDE/print_clang_framework_with_overlay.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir -p %t
 
 // RUN: %target-swift-frontend(mock-sdk: -F %S/Inputs/mock-sdk) -I %t -emit-module -o %t/FooOverlay.swiftmodule %S/Inputs/FooOverlay.swift
-// RUN: %target-swift-ide-test(mock-sdk: -F %S/Inputs/mock-sdk) -I %t -print-module -source-filename %s -module-to-print=FooOverlay -function-definitions=false | FileCheck %s
+// RUN: %target-swift-ide-test(mock-sdk: -F %S/Inputs/mock-sdk) -I %t -print-module -source-filename %s -module-to-print=FooOverlay -function-definitions=false | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/print_clang_header_swift_name.swift b/test/IDE/print_clang_header_swift_name.swift
index acff7b3..776464d 100644
--- a/test/IDE/print_clang_header_swift_name.swift
+++ b/test/IDE/print_clang_header_swift_name.swift
@@ -1,7 +1,7 @@
 // RUN: echo '#include "print_clang_header_swift_name.h"' > %t.m
 // RUN: %target-swift-ide-test -source-filename %s -print-header -header-to-print \
 // RUN:     %S/Inputs/print_clang_header_swift_name.h --cc-args %target-cc-options \
-// RUN:     -isysroot %clang-importer-sdk-path -fsyntax-only %t.m -I %S/Inputs | FileCheck %s
+// RUN:     -isysroot %clang-importer-sdk-path -fsyntax-only %t.m -I %S/Inputs | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/print_module_without_deinit.swift b/test/IDE/print_module_without_deinit.swift
index 6586b04..cab4734 100644
--- a/test/IDE/print_module_without_deinit.swift
+++ b/test/IDE/print_module_without_deinit.swift
@@ -1,11 +1,11 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=true -module-to-print=print_module_without_deinit -I %t -source-filename=%s | FileCheck -check-prefix=SKIP1 %s
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=false -module-to-print=print_module_without_deinit -I %t -source-filename=%s | FileCheck -check-prefix=NOSKIP1 %s
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=true -module-to-print=print_module_without_deinit -I %t -source-filename=%s | FileCheck -check-prefix=INIT1 %s
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=true -module-to-print=print_module_without_deinit -I %t -source-filename=%s | FileCheck -check-prefix=INIT2 %s
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=true -module-to-print=print_module_without_deinit -I %t -source-filename=%s | FileCheck -check-prefix=ATTR1 %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=true -module-to-print=print_module_without_deinit -I %t -source-filename=%s | %FileCheck -check-prefix=SKIP1 %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=false -module-to-print=print_module_without_deinit -I %t -source-filename=%s | %FileCheck -check-prefix=NOSKIP1 %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=true -module-to-print=print_module_without_deinit -I %t -source-filename=%s | %FileCheck -check-prefix=INIT1 %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=true -module-to-print=print_module_without_deinit -I %t -source-filename=%s | %FileCheck -check-prefix=INIT2 %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=true -module-to-print=print_module_without_deinit -I %t -source-filename=%s | %FileCheck -check-prefix=ATTR1 %s
 
 // SKIP1: class PropertyOwnership {
 // NOSKIP1: class PropertyOwnership {
diff --git a/test/IDE/print_omit_needless_words.swift b/test/IDE/print_omit_needless_words.swift
index bd75d3b..23c0d7f 100644
--- a/test/IDE/print_omit_needless_words.swift
+++ b/test/IDE/print_omit_needless_words.swift
@@ -12,24 +12,24 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t  %S/../Inputs/clang-importer-sdk/swift-modules-without-ns/AppKit.swift
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=ObjectiveC -function-definitions=false -prefer-type-repr=true  > %t.ObjectiveC.txt
-// RUN: FileCheck %s -check-prefix=CHECK-OBJECTIVEC -strict-whitespace < %t.ObjectiveC.txt
+// RUN: %FileCheck %s -check-prefix=CHECK-OBJECTIVEC -strict-whitespace < %t.ObjectiveC.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=Foundation -function-definitions=false -prefer-type-repr=true  -skip-parameter-names > %t.Foundation.txt
-// RUN: FileCheck %s -check-prefix=CHECK-FOUNDATION -strict-whitespace < %t.Foundation.txt
+// RUN: %FileCheck %s -check-prefix=CHECK-FOUNDATION -strict-whitespace < %t.Foundation.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=AppKit -function-definitions=false -prefer-type-repr=true  -skip-parameter-names > %t.AppKit.txt
-// RUN: FileCheck %s -check-prefix=CHECK-APPKIT -strict-whitespace < %t.AppKit.txt
+// RUN: %FileCheck %s -check-prefix=CHECK-APPKIT -strict-whitespace < %t.AppKit.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t -I %S/../ClangModules/Inputs/custom-modules) -print-module -source-filename %s -module-to-print=CoreCooling -function-definitions=false -prefer-type-repr=true  -skip-parameter-names > %t.CoreCooling.txt
-// RUN: FileCheck %s -check-prefix=CHECK-CORECOOLING -strict-whitespace < %t.CoreCooling.txt
+// RUN: %FileCheck %s -check-prefix=CHECK-CORECOOLING -strict-whitespace < %t.CoreCooling.txt
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t -I %S/Inputs/custom-modules) -print-module -source-filename %s -module-to-print=OmitNeedlessWords -function-definitions=false -prefer-type-repr=true  -skip-parameter-names > %t.OmitNeedlessWords.txt 2> %t.OmitNeedlessWords.diagnostics.txt
-// RUN: FileCheck %s -check-prefix=CHECK-OMIT-NEEDLESS-WORDS -strict-whitespace < %t.OmitNeedlessWords.txt
-// RUN: FileCheck %s -check-prefix=CHECK-OMIT-NEEDLESS-WORDS-DIAGS -strict-whitespace < %t.OmitNeedlessWords.diagnostics.txt
+// RUN: %FileCheck %s -check-prefix=CHECK-OMIT-NEEDLESS-WORDS -strict-whitespace < %t.OmitNeedlessWords.txt
+// RUN: %FileCheck %s -check-prefix=CHECK-OMIT-NEEDLESS-WORDS-DIAGS -strict-whitespace < %t.OmitNeedlessWords.diagnostics.txt
 
 
 // RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=errors -function-definitions=false -prefer-type-repr=true  -skip-parameter-names > %t.errors.txt
-// RUN: FileCheck %s -check-prefix=CHECK-ERRORS -strict-whitespace < %t.errors.txt
+// RUN: %FileCheck %s -check-prefix=CHECK-ERRORS -strict-whitespace < %t.errors.txt
 
 // Note: SEL -> "Selector"
 // CHECK-FOUNDATION: func makeObjectsPerform(_: Selector)
diff --git a/test/IDE/print_stdlib.swift b/test/IDE/print_stdlib.swift
index 41ff055..b864e88 100644
--- a/test/IDE/print_stdlib.swift
+++ b/test/IDE/print_stdlib.swift
@@ -4,18 +4,18 @@
 //
 // RUN: %target-swift-frontend -parse %s
 // RUN: %target-swift-ide-test -print-module -module-to-print=Swift -source-filename %s -print-interface > %t.txt
-// RUN: FileCheck -check-prefix=CHECK-ARGC %s < %t.txt
-// RUN: FileCheck %s < %t.txt
-// RUN: FileCheck -check-prefix=CHECK-SUGAR %s < %t.txt
-// RUN: FileCheck -check-prefix=CHECK-MUTATING-ATTR %s < %t.txt
-// RUN: FileCheck -check-prefix=NO-FIXMES %s < %t.txt
-// RUN: FileCheck -check-prefix=CHECK-ARGC %s < %t.txt
+// RUN: %FileCheck -check-prefix=CHECK-ARGC %s < %t.txt
+// RUN: %FileCheck %s < %t.txt
+// RUN: %FileCheck -check-prefix=CHECK-SUGAR %s < %t.txt
+// RUN: %FileCheck -check-prefix=CHECK-MUTATING-ATTR %s < %t.txt
+// RUN: %FileCheck -check-prefix=NO-FIXMES %s < %t.txt
+// RUN: %FileCheck -check-prefix=CHECK-ARGC %s < %t.txt
 
 // RUN: %target-swift-ide-test -print-module -module-to-print=Swift -source-filename %s -print-interface-doc > %t-doc.txt
-// RUN: FileCheck %s < %t-doc.txt
+// RUN: %FileCheck %s < %t-doc.txt
 
 // RUN: %target-swift-ide-test -print-module -module-to-print=Swift -source-filename %s -print-interface -skip-underscored-stdlib-protocols > %t-prot.txt
-// RUN: FileCheck -check-prefix=CHECK-UNDERSCORED-PROT %s < %t-prot.txt
+// RUN: %FileCheck -check-prefix=CHECK-UNDERSCORED-PROT %s < %t-prot.txt
 // CHECK-UNDERSCORED-PROT: public protocol _DisallowMixedSignArithmetic
 // CHECK-UNDERSCORED-PROT: public protocol _Incrementable
 // CHECK-UNDERSCORED-PROT: public protocol _Integer
@@ -57,7 +57,7 @@
 
 // NO-FIXMES-NOT: FIXME
 // RUN: %target-swift-ide-test -print-module-groups -module-to-print=Swift -source-filename %s -print-interface > %t-group.txt
-// RUN: FileCheck -check-prefix=CHECK-GROUPS1 %s < %t-group.txt
+// RUN: %FileCheck -check-prefix=CHECK-GROUPS1 %s < %t-group.txt
 // CHECK-GROUPS1: Module groups begin:
 // CHECK-GROUPS1-DAG: Pointer
 // CHECK-GROUPS1-DAG: C
diff --git a/test/IDE/print_stdlib_specialized.swift b/test/IDE/print_stdlib_specialized.swift
index 6969a4d..51be541 100644
--- a/test/IDE/print_stdlib_specialized.swift
+++ b/test/IDE/print_stdlib_specialized.swift
@@ -4,23 +4,23 @@
 // REQUIRES: nonexecutable_test
 //
 
-// RUN: %target-swift-ide-test -print-module -module-group "Pointer" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "C" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Protocols" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Optional" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Collection/Lazy Views" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Math" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Math/Floating" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Math/Integers" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Reflection" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Misc" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Collection" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-COLLECTION-GROUP
-// RUN: %target-swift-ide-test -print-module -module-group "Bool" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Assert" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "String" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Collection/Array" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Collection/Type-erased" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
-// RUN: %target-swift-ide-test -print-module -module-group "Collection/HashedCollections" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Pointer" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "C" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Protocols" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Optional" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Collection/Lazy Views" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Math" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Math/Floating" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Math/Integers" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Reflection" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Misc" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Collection" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-COLLECTION-GROUP
+// RUN: %target-swift-ide-test -print-module -module-group "Bool" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Assert" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "String" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Collection/Array" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Collection/Type-erased" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
+// RUN: %target-swift-ide-test -print-module -module-group "Collection/HashedCollections" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | %FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
 
 // CHECK-FREQUENT-WORD: ///
 // CHECK-FREQUENT-WORD-NOT: where Slice<Dictionary<Key, Value>> == Slice<Self>
diff --git a/test/IDE/print_swift_module.swift b/test/IDE/print_swift_module.swift
index 345f528..dc535c9 100644
--- a/test/IDE/print_swift_module.swift
+++ b/test/IDE/print_swift_module.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -emit-module-path %t/print_swift_module.swiftmodule -emit-module-doc -emit-module-doc-path %t/print_swift_module.swiftdoc %s
 // RUN: %target-swift-ide-test -print-module -print-interface -no-empty-line-between-members -module-to-print=print_swift_module -I %t -source-filename=%s > %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK1 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK1 < %t.syn.txt
 
 public protocol P1 {
 	/// foo1 comment from P1
diff --git a/test/IDE/print_synthesized_extensions.swift b/test/IDE/print_synthesized_extensions.swift
index fde83cd..4cb8ab4 100644
--- a/test/IDE/print_synthesized_extensions.swift
+++ b/test/IDE/print_synthesized_extensions.swift
@@ -1,19 +1,19 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -emit-module-path %t/print_synthesized_extensions.swiftmodule -emit-module-doc -emit-module-doc-path %t/print_synthesized_extensions.swiftdoc %s
 // RUN: %target-swift-ide-test -print-module -annotate-print -synthesize-extension -print-interface -no-empty-line-between-members -module-to-print=print_synthesized_extensions -I %t -source-filename=%s > %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK1 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK2 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK3 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK4 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK5 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK6 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK7 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK8 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK9 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK10 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK11 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK12 < %t.syn.txt
-// RUN: FileCheck %s -check-prefix=CHECK13 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK1 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK2 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK3 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK4 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK5 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK6 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK7 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK8 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK9 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK10 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK11 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK12 < %t.syn.txt
+// RUN: %FileCheck %s -check-prefix=CHECK13 < %t.syn.txt
 
 public protocol P1 {
   associatedtype T1
@@ -244,8 +244,8 @@
 // CHECK5:      <decl:Struct>public struct <loc>S10</loc> : <ref:Protocol>P1</ref> {
 // CHECK5-NEXT:   <decl:TypeAlias>public typealias <loc>T1</loc> = <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S9</ref><<ref:Struct>Int</ref>></decl>
 // CHECK5-NEXT: <decl:TypeAlias>public typealias <loc>T2</loc> = <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S9</ref><<ref:Struct>Int</ref>></decl>
-// CHECK5-NEXT: <decl:Func>public func <loc>f1(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S10</ref>.Type.<ref:TypeAlias>T1</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S10</ref>.Type.<ref:TypeAlias>T1</ref></decl>
-// CHECK5-NEXT: <decl:Func>public func <loc>f2(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S10</ref>.Type.<ref:TypeAlias>T2</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S10</ref>.Type.<ref:TypeAlias>T2</ref></decl></decl>
+// CHECK5-NEXT: <decl:Func>public func <loc>f1(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S10</ref>.<ref:TypeAlias>T1</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S10</ref>.<ref:TypeAlias>T1</ref></decl>
+// CHECK5-NEXT: <decl:Func>public func <loc>f2(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S10</ref>.<ref:TypeAlias>T2</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S10</ref>.<ref:TypeAlias>T2</ref></decl></decl>
 // CHECK5-NEXT: <decl:Func>public func <loc>p3Func(<decl:Param>i: <ref:Struct>Int</ref></decl>)</loc> -> <ref:Struct>Int</ref></decl>
 // CHECK5-NEXT: <decl:Func>public func <loc>ef5(<decl:Param>t: <ref:Struct>S9</ref><<ref:Struct>Int</ref>></decl>)</loc></decl>
 // CHECK5-NEXT: <decl:Func>public func <loc>S9IntFunc()</loc></decl>
@@ -264,16 +264,16 @@
 // CHECK8:      <decl:Struct>public struct <loc>S4<<decl:GenericTypeParam>T</decl>></loc> : <ref:Protocol>P1</ref> {
 // CHECK8-NEXT:   <decl:TypeAlias>public typealias <loc>T1</loc> = <ref:Struct>Int</ref></decl>
 // CHECK8-NEXT:   <decl:TypeAlias>public typealias <loc>T2</loc> = <ref:Struct>Int</ref></decl>
-// CHECK8-NEXT:   <decl:Func>public func <loc>f1(<decl:Param>t: <ref:TypeAlias>T1</ref></decl>)</loc> -> <ref:TypeAlias>T1</ref></decl>
-// CHECK8-NEXT:   <decl:Func>public func <loc>f2(<decl:Param>t: <ref:TypeAlias>T2</ref></decl>)</loc> -> <ref:TypeAlias>T2</ref></decl></decl>
+// CHECK8-NEXT:   <decl:Func>public func <loc>f1(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S4</ref>.<ref:TypeAlias>T1</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S4</ref>.<ref:TypeAlias>T1</ref></decl>
+// CHECK8-NEXT:   <decl:Func>public func <loc>f2(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S4</ref>.<ref:TypeAlias>T2</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S4</ref>.<ref:TypeAlias>T2</ref></decl></decl>
 // CHECK8-NEXT:   <decl:Func>public func <loc>p1IntFunc(<decl:Param>i: <ref:Struct>Int</ref></decl>)</loc> -> <ref:Struct>Int</ref></decl>
 // CHECK8-NEXT:   }</synthesized>
 
 // CHECK9:      <decl:Struct>public struct <loc>S6<<decl:GenericTypeParam>T</decl>></loc> : <ref:Protocol>P1</ref> {
 // CHECK9-NEXT:    <decl:TypeAlias>public typealias <loc>T1</loc> = <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S5</ref></decl>
 // CHECK9-NEXT:    <decl:TypeAlias>public typealias <loc>T2</loc> = <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S5</ref></decl>
-// CHECK9-NEXT:    <decl:Func>public func <loc>f1(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S6</ref>.Type.<ref:TypeAlias>T1</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S6</ref>.Type.<ref:TypeAlias>T1</ref></decl>
-// CHECK9-NEXT:    <decl:Func>public func <loc>f2(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S6</ref>.Type.<ref:TypeAlias>T2</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S6</ref>.Type.<ref:TypeAlias>T2</ref></decl></decl>
+// CHECK9-NEXT:    <decl:Func>public func <loc>f1(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S6</ref>.<ref:TypeAlias>T1</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S6</ref>.<ref:TypeAlias>T1</ref></decl>
+// CHECK9-NEXT:    <decl:Func>public func <loc>f2(<decl:Param>t: <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S6</ref>.<ref:TypeAlias>T2</ref></decl>)</loc> -> <ref:module>print_synthesized_extensions</ref>.<ref:Struct>S6</ref>.<ref:TypeAlias>T2</ref></decl></decl>
 // CHECK9-NEXT:    <decl:Extension><decl:Func>public func <loc>f3()</loc></decl></decl>
 // CHECK9-NEXT:    <decl:Extension><decl:Func>public func <loc>fromActualExtension()</loc></decl></decl>
 // CHECK9-NEXT:    <decl:Func>public func <loc>p3Func(<decl:Param>i: <ref:Struct>Int</ref></decl>)</loc> -> <ref:Struct>Int</ref></decl>
diff --git a/test/IDE/print_type_interface.swift b/test/IDE/print_type_interface.swift
index 9a6ab59..8948d58 100644
--- a/test/IDE/print_type_interface.swift
+++ b/test/IDE/print_type_interface.swift
@@ -18,8 +18,8 @@
 	}
 }
 
-// RUN: %target-swift-ide-test -print-type-interface -pos=15:6 -source-filename %s | FileCheck %s -check-prefix=TYPE1
-// RUN: %target-swift-ide-test -print-type-interface -usr=_TtV20print_type_interface1A -module-name print_type_interface -source-filename %s | FileCheck %s -check-prefix=TYPE1
+// RUN: %target-swift-ide-test -print-type-interface -pos=15:6 -source-filename %s | %FileCheck %s -check-prefix=TYPE1
+// RUN: %target-swift-ide-test -print-type-interface -usr=_TtV20print_type_interface1A -module-name print_type_interface -source-filename %s | %FileCheck %s -check-prefix=TYPE1
 // TYPE1:  public struct A {
 // TYPE1:    public func fa()
 // TYPE1:    public func fea1()
@@ -39,10 +39,10 @@
   }
 }
 
-// RUN: %target-swift-ide-test -print-type-interface -pos=37:6 -source-filename %s | FileCheck %s -check-prefix=TYPE2
-// RUN: %target-swift-ide-test -print-type-interface -usr=_TtGC20print_type_interface1DCS_2T1_ -module-name print_type_interface -source-filename %s | FileCheck %s -check-prefix=TYPE2
-// RUN: %target-swift-ide-test -print-type-interface -pos=38:6 -source-filename %s | FileCheck %s -check-prefix=TYPE3
-// RUN: %target-swift-ide-test -print-type-interface -usr=_TtGC20print_type_interface1DSi_ -module-name print_type_interface -source-filename %s | FileCheck %s -check-prefix=TYPE3
+// RUN: %target-swift-ide-test -print-type-interface -pos=37:6 -source-filename %s | %FileCheck %s -check-prefix=TYPE2
+// RUN: %target-swift-ide-test -print-type-interface -usr=_TtGC20print_type_interface1DCS_2T1_ -module-name print_type_interface -source-filename %s | %FileCheck %s -check-prefix=TYPE2
+// RUN: %target-swift-ide-test -print-type-interface -pos=38:6 -source-filename %s | %FileCheck %s -check-prefix=TYPE3
+// RUN: %target-swift-ide-test -print-type-interface -usr=_TtGC20print_type_interface1DSi_ -module-name print_type_interface -source-filename %s | %FileCheck %s -check-prefix=TYPE3
 
 extension D where T : P1 {
   public func conditionalFunc1() {}
@@ -68,7 +68,7 @@
 // TYPE3:   public func unconditionalFunc2(t: Int) -> Int
 // TYPE3: }
 
-// RUN: %target-swift-ide-test -print-type-interface -usr=_TtGSaSi_ -module-name print_type_interface -source-filename %s | FileCheck %s -check-prefix=TYPE4
+// RUN: %target-swift-ide-test -print-type-interface -usr=_TtGSaSi_ -module-name print_type_interface -source-filename %s | %FileCheck %s -check-prefix=TYPE4
 // TYPE4-DAG: public typealias Index = Int
 // TYPE4-DAG: public func min() -> Int?
 // TYPE4-DAG: public mutating func insert<Int>(contentsOf newElements: C, at i: Int)
@@ -77,7 +77,7 @@
 // TYPE4-DAG: public func makeIterator() -> IndexingIterator<Array<Int>>
 // TYPE4-NOT: public func joined
 
-// RUN: %target-swift-ide-test -print-type-interface -usr=_TtGSaSS_ -module-name print_type_interface -source-filename %s | FileCheck %s -check-prefix=TYPE5
+// RUN: %target-swift-ide-test -print-type-interface -usr=_TtGSaSS_ -module-name print_type_interface -source-filename %s | %FileCheck %s -check-prefix=TYPE5
 // TYPE5-DAG: public func prefix(_ maxLength: Int) -> ArraySlice<String>
 // TYPE5-DAG: public func suffix(_ maxLength: Int) -> ArraySlice<String>
 // TYPE5-DAG: public func split(separator: String, maxSplits: Int = default, omittingEmptySubsequences: Bool = default) -> [ArraySlice<String>]
diff --git a/test/IDE/print_types.swift b/test/IDE/print_types.swift
index 8845ef6..a9ad68d 100644
--- a/test/IDE/print_types.swift
+++ b/test/IDE/print_types.swift
@@ -1,8 +1,8 @@
 // This file should not have any syntax or type checker errors.
 // RUN: %target-parse-verify-swift
 
-// RUN: %target-swift-ide-test -print-types -source-filename %s -fully-qualified-types=false | FileCheck %s -strict-whitespace
-// RUN: %target-swift-ide-test -print-types -source-filename %s -fully-qualified-types=true | FileCheck %s -check-prefix=FULL -strict-whitespace
+// RUN: %target-swift-ide-test -print-types -source-filename %s -fully-qualified-types=false | %FileCheck %s -strict-whitespace
+// RUN: %target-swift-ide-test -print-types -source-filename %s -fully-qualified-types=true | %FileCheck %s -check-prefix=FULL -strict-whitespace
 
 typealias MyInt = Int
 // CHECK: TypeAliasDecl '''MyInt''' MyInt.Type{{$}}
diff --git a/test/IDE/print_usrs.swift b/test/IDE/print_usrs.swift
index 61b0d22..207cb55 100644
--- a/test/IDE/print_usrs.swift
+++ b/test/IDE/print_usrs.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify -disable-objc-attr-requires-foundation-module %s
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-usrs -source-filename %s | FileCheck %s -strict-whitespace
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-usrs -source-filename %s | %FileCheck %s -strict-whitespace
 
 import macros
 
diff --git a/test/IDE/print_usrs_invalid.swift b/test/IDE/print_usrs_invalid.swift
index 0ade41d..847a34f 100644
--- a/test/IDE/print_usrs_invalid.swift
+++ b/test/IDE/print_usrs_invalid.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -print-usrs -source-filename %s | FileCheck %s -strict-whitespace
+// RUN: %target-swift-ide-test -print-usrs -source-filename %s | %FileCheck %s -strict-whitespace
 
 // CHECK: [[@LINE+1]]:6 s:O14swift_ide_test11InvalidEnum{{$}}
 enum InvalidEnum {
diff --git a/test/IDE/reconstruct_type_from_mangled_name.swift b/test/IDE/reconstruct_type_from_mangled_name.swift
index e71ef8f..9603ba9 100644
--- a/test/IDE/reconstruct_type_from_mangled_name.swift
+++ b/test/IDE/reconstruct_type_from_mangled_name.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -reconstruct-type -source-filename %s | FileCheck %s -implicit-check-not="FAILURE"
+// RUN: %target-swift-ide-test -reconstruct-type -source-filename %s | %FileCheck %s -implicit-check-not="FAILURE"
 
 struct Mystruct1 {
 // CHECK: decl: struct Mystruct1
diff --git a/test/IDE/reconstruct_type_from_mangled_name_invalid.swift b/test/IDE/reconstruct_type_from_mangled_name_invalid.swift
index 2869250..3df56f7 100644
--- a/test/IDE/reconstruct_type_from_mangled_name_invalid.swift
+++ b/test/IDE/reconstruct_type_from_mangled_name_invalid.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -reconstruct-type -source-filename %s | FileCheck %s -implicit-check-not="FAILURE"
+// RUN: %target-swift-ide-test -reconstruct-type -source-filename %s | %FileCheck %s -implicit-check-not="FAILURE"
 
 struct GS<T> {
 // CHECK: decl: struct GS<T> for 'GS'
diff --git a/test/IDE/sdk_sugar.swift b/test/IDE/sdk_sugar.swift
index fa87b2b..3e746b4 100644
--- a/test/IDE/sdk_sugar.swift
+++ b/test/IDE/sdk_sugar.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %target-swift-ide-test -print-module -module-print-submodules -module-to-print=Foundation -function-definitions=false -source-filename %s > %t/out 2>&1
-// RUN: FileCheck -input-file=%t/out %s
+// RUN: %FileCheck -input-file=%t/out %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IDE/structure.swift b/test/IDE/structure.swift
index 6ca5b22..36e9b86 100644
--- a/test/IDE/structure.swift
+++ b/test/IDE/structure.swift
@@ -1,4 +1,4 @@
-// RUN: %swift-ide-test -structure -source-filename %s | FileCheck %s
+// RUN: %swift-ide-test -structure -source-filename %s | %FileCheck %s
 
 // CHECK: <class>class <name>MyCls</name> : <inherited><elem-typeref>OtherClass</elem-typeref></inherited> {
 // CHECK:   <property>var <name>bar</name> : Int</property>
diff --git a/test/IDE/structure_object_literals.swift b/test/IDE/structure_object_literals.swift
index ebc85e2..23873e4 100644
--- a/test/IDE/structure_object_literals.swift
+++ b/test/IDE/structure_object_literals.swift
@@ -1,4 +1,4 @@
-// RUN: %swift-ide-test -structure -source-filename %s | FileCheck %s
+// RUN: %swift-ide-test -structure -source-filename %s | %FileCheck %s
 
 struct S: _ExpressibleByColorLiteral {
   init(colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) {}
diff --git a/test/IDE/test-input-complete/test_input.swift b/test/IDE/test-input-complete/test_input.swift
index 93c85859..b14afca 100644
--- a/test/IDE/test-input-complete/test_input.swift
+++ b/test/IDE/test-input-complete/test_input.swift
@@ -1,35 +1,35 @@
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/err_type_complete.swift | FileCheck %s -check-prefix=COMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/for_incomplete1.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_complete.swift | FileCheck %s -check-prefix=COMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete1.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete2.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete3.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete4.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete5.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete6.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete7.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete8.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete9.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete10.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete11.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete12.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/nominal_complete.swift | FileCheck %s -check-prefix=COMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/nominal_incomplete.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/nominal_incomplete2.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/nominal_incomplete3.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/switch_incomplete.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/switch_incomplete2.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/switch_incomplete3.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_complete.swift | FileCheck %s -check-prefix=COMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete2.swift | FileCheck %s -check-prefix=COMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete3.swift | FileCheck %s -check-prefix=COMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete4.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete5.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/type_incomplete1.swift | FileCheck %s -check-prefix=COMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/type_incomplete2.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/type_incomplete3.swift | FileCheck %s -check-prefix=INCOMPLETE
-// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/type_incomplete4.swift | FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/err_type_complete.swift | %FileCheck %s -check-prefix=COMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/for_incomplete1.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_complete.swift | %FileCheck %s -check-prefix=COMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete1.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete2.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete3.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete4.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete5.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete6.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete7.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete8.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete9.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete10.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete11.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/func_incomplete12.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/nominal_complete.swift | %FileCheck %s -check-prefix=COMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/nominal_incomplete.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/nominal_incomplete2.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/nominal_incomplete3.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/switch_incomplete.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/switch_incomplete2.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/switch_incomplete3.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_complete.swift | %FileCheck %s -check-prefix=COMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete2.swift | %FileCheck %s -check-prefix=COMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete3.swift | %FileCheck %s -check-prefix=COMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete4.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/toplevel_incomplete5.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/type_incomplete1.swift | %FileCheck %s -check-prefix=COMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/type_incomplete2.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/type_incomplete3.swift | %FileCheck %s -check-prefix=INCOMPLETE
+// RUN: %swift-ide-test -test-input-complete -source-filename %S/Inputs/type_incomplete4.swift | %FileCheck %s -check-prefix=INCOMPLETE
 
 // INCOMPLETE: IS_INCOMPLETE
 // COMPLETE: IS_COMPLETE
diff --git a/test/IRGen/Inputs/abi/Gadget.h b/test/IRGen/Inputs/abi/Gadget.h
index 08b2bc2..7c95cba 100644
--- a/test/IRGen/Inputs/abi/Gadget.h
+++ b/test/IRGen/Inputs/abi/Gadget.h
@@ -41,6 +41,12 @@
 
 @interface Gadget : NSObject
 - (BOOL) negate:(BOOL) b;
+- (_Bool) invert:(_Bool) b;
+
+- (BOOL) negateThrowing:(BOOL) b error:(NSError **) error;
+
+// This one is not imported as a 'throws' function in Swift
+- (_Bool) invertThrowing:(_Bool) b error:(NSError **) error;
 @end
 
 @protocol Pasta
diff --git a/test/IRGen/Inputs/objc_bridged_generic_conformance.h b/test/IRGen/Inputs/objc_bridged_generic_conformance.h
new file mode 100644
index 0000000..125808f
--- /dev/null
+++ b/test/IRGen/Inputs/objc_bridged_generic_conformance.h
@@ -0,0 +1,5 @@
+@import Foundation;
+
+@interface Thingy<T>: NSObject
+
+@end
diff --git a/test/IRGen/UseObjCMethod.swift b/test/IRGen/UseObjCMethod.swift
index b3522b9..0813ed3 100644
--- a/test/IRGen/UseObjCMethod.swift
+++ b/test/IRGen/UseObjCMethod.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 import Foundation
diff --git a/test/IRGen/abi_v7k.swift b/test/IRGen/abi_v7k.swift
index 62bcc53..65e07f0 100644
--- a/test/IRGen/abi_v7k.swift
+++ b/test/IRGen/abi_v7k.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -emit-ir -primary-file %s -module-name test_v7k | FileCheck %s
-// RUN: %target-swift-frontend -S -primary-file %s -module-name test_v7k | FileCheck -check-prefix=V7K %s
+// RUN: %target-swift-frontend -emit-ir -primary-file %s -module-name test_v7k | %FileCheck %s
+// RUN: %target-swift-frontend -S -primary-file %s -module-name test_v7k | %FileCheck -check-prefix=V7K %s
 
 // REQUIRES: CPU=armv7k
 // REQUIRES: OS=watchos
diff --git a/test/IRGen/abitypes.swift b/test/IRGen/abitypes.swift
index 68480ba..bb8411b 100644
--- a/test/IRGen/abitypes.swift
+++ b/test/IRGen/abitypes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -emit-ir | FileCheck -check-prefix=%target-cpu-%target-os %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -emit-ir | %FileCheck -check-prefix=%target-cpu-%target-os %s
 
 // FIXME: rdar://problem/19648117 Needs splitting objc parts out
 // XFAIL: linux
@@ -414,6 +414,48 @@
     return g.negate(b)
   }
 
+  // x86_64-macosx: define hidden i1 @_TFC8abitypes3Foo7negate3fSbSb(i1, %C8abitypes3Foo*) {{.*}} {
+  // x86_64-macosx: [[SEL:%[0-9]+]] = load i8*, i8** @"\01L_selector(invert:)", align 8
+  // x86_64-macosx: [[NEG:%[0-9]+]] = call zeroext i1 bitcast (void ()* @objc_msgSend to i1 (%1*, i8*, i1)*)(%1* [[RECEIVER:%[0-9]+]], i8* [[SEL]], i1 zeroext %0)
+  // x86_64-macosx: ret i1 [[NEG]]
+  // x86_64-macosx: }
+
+  // x86_64-ios: define hidden i1 @_TFC8abitypes3Foo7negate3fSbSb(i1, %C8abitypes3Foo*) {{.*}} {
+  // x86_64-ios: [[SEL:%[0-9]+]] = load i8*, i8** @"\01L_selector(invert:)", align 8
+  // x86_64-ios: [[NEG:%[0-9]+]] = call zeroext i1 bitcast (void ()* @objc_msgSend to i1 (%1*, i8*, i1)*)(%1* [[RECEIVER:%[0-9]+]], i8* [[SEL]], i1 zeroext %0)
+  // x86_64-ios: ret i1 [[NEG]]
+  // x86_64-ios: }
+
+  // i386-ios: define hidden i1 @_TFC8abitypes3Foo7negate3fSbSb(i1, %C8abitypes3Foo*) {{.*}} {
+  // i386-ios: [[SEL:%[0-9]+]] = load i8*, i8** @"\01L_selector(invert:)", align 4
+  // i386-ios: [[NEG:%[0-9]+]] = call zeroext i1 bitcast (void ()* @objc_msgSend to i1 (%1*, i8*, i1)*)(%1* [[RECEIVER:%[0-9]+]], i8* [[SEL]], i1 zeroext %0)
+  // i386-ios: ret i1 [[NEG]]
+  // i386-ios: }
+
+  dynamic func negate3(_ b: Bool) -> Bool {
+    var g = Gadget()
+    return g.invert(b)
+  }
+
+  // x86_64-macosx: define hidden void @_TFC8abitypes3Foo10throwsTestfzSbT_(i1, %C8abitypes3Foo*, %swift.error**) {{.*}} {
+  // x86_64-macosx: [[SEL:%[0-9]+]] = load i8*, i8** @"\01L_selector(negateThrowing:error:)", align 8
+  // x86_64-macosx: call signext i8 bitcast (void ()* @objc_msgSend to i8 (%1*, i8*, i8, %2**)*)(%1* {{%[0-9]+}}, i8* [[SEL]], i8 signext {{%[0-9]+}}, %2** {{%[0-9]+}})
+  // x86_64-macosx: }
+
+  // x86_64-ios: define hidden void @_TFC8abitypes3Foo10throwsTestfzSbT_(i1, %C8abitypes3Foo*, %swift.error**) {{.*}} {
+  // x86_64-ios: [[SEL:%[0-9]+]] = load i8*, i8** @"\01L_selector(negateThrowing:error:)", align 8
+  // x86_64-ios: call zeroext i1 bitcast (void ()* @objc_msgSend to i1 (%1*, i8*, i1, %2**)*)(%1* {{%[0-9]+}}, i8* [[SEL]], i1 zeroext {{%[0-9]+}}, %2** {{%[0-9]+}})
+  // x86_64-ios: }
+
+  // i386-ios: define hidden void @_TFC8abitypes3Foo10throwsTestfzSbT_(i1, %C8abitypes3Foo*, %swift.error**) {{.*}} {
+  // i386-ios: [[SEL:%[0-9]+]] = load i8*, i8** @"\01L_selector(negateThrowing:error:)", align 4
+  // i386-ios: call signext i8 bitcast (void ()* @objc_msgSend to i8 (%1*, i8*, i8, %2**)*)(%1* {{%[0-9]+}}, i8* [[SEL]], i8 signext {{%[0-9]+}}, %2** {{%[0-9]+}})
+  // i386-ios: }
+  dynamic func throwsTest(_ b: Bool) throws {
+    var g = Gadget()
+    try g.negateThrowing(b)
+  }
+
   // x86_64-macosx: define hidden i32* @_TToFC8abitypes3Foo24copyUnsafeMutablePointer{{.*}}(i8*, i8*, i32*) unnamed_addr {{.*}} {
   dynamic func copyUnsafeMutablePointer(_ p: UnsafeMutablePointer<Int32>) -> UnsafeMutablePointer<Int32> {
     return p
diff --git a/test/IRGen/access_control.sil b/test/IRGen/access_control.sil
index 6726ff2..ea7237a 100644
--- a/test/IRGen/access_control.sil
+++ b/test/IRGen/access_control.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/IRGen/alignment.sil b/test/IRGen/alignment.sil
index b0b22c0..34e2760 100644
--- a/test/IRGen/alignment.sil
+++ b/test/IRGen/alignment.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 import Swift
 
diff --git a/test/IRGen/alloc.sil b/test/IRGen/alloc.sil
index 93cb407..de460ac 100644
--- a/test/IRGen/alloc.sil
+++ b/test/IRGen/alloc.sil
@@ -1,9 +1,9 @@
-// RUN: %swift -target x86_64-apple-macosx10.9 -module-name main %s -emit-ir -o - | FileCheck %s
-// RUN: %swift -target i386-apple-ios7.0 %s -module-name main -emit-ir -o - | FileCheck %s
-// RUN: %swift -target x86_64-apple-ios7.0 %s -module-name main -emit-ir -o - | FileCheck %s
-// RUN: %swift -target armv7-apple-ios7.0 %s -module-name main -emit-ir -o - | FileCheck %s
-// RUN: %swift -target arm64-apple-ios7.0 %s -module-name main -emit-ir -o - | FileCheck %s
-// RUN: %swift -target x86_64-unknown-linux-gnu %s -disable-objc-interop -module-name main -emit-ir -o - | FileCheck %s
+// RUN: %swift -target x86_64-apple-macosx10.9 -module-name main %s -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target i386-apple-ios7.0 %s -module-name main -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target x86_64-apple-ios7.0 %s -module-name main -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target armv7-apple-ios7.0 %s -module-name main -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target arm64-apple-ios7.0 %s -module-name main -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target x86_64-unknown-linux-gnu %s -disable-objc-interop -module-name main -emit-ir -o - | %FileCheck %s
 
 // REQUIRES: X86
 // REQUIRES: ARM
diff --git a/test/IRGen/argument_attrs.sil b/test/IRGen/argument_attrs.sil
index e8755fb..d4a1276 100644
--- a/test/IRGen/argument_attrs.sil
+++ b/test/IRGen/argument_attrs.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 import Builtin
 
diff --git a/test/IRGen/array_value_witnesses.sil b/test/IRGen/array_value_witnesses.sil
index 06bcf66..111125b 100644
--- a/test/IRGen/array_value_witnesses.sil
+++ b/test/IRGen/array_value_witnesses.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 
 import Swift
diff --git a/test/IRGen/asan-attributes.swift b/test/IRGen/asan-attributes.swift
index dfb9286..5eb9a4b 100644
--- a/test/IRGen/asan-attributes.swift
+++ b/test/IRGen/asan-attributes.swift
@@ -1,6 +1,6 @@
 // This test verifies that we add the function attributes used by ASan.
 
-// RUN: %target-swift-frontend -emit-ir -sanitize=address %s | FileCheck %s -check-prefix=ASAN
+// RUN: %target-swift-frontend -emit-ir -sanitize=address %s | %FileCheck %s -check-prefix=ASAN
 
 // XFAIL: linux
 
diff --git a/test/IRGen/asmname.swift b/test/IRGen/asmname.swift
index d7649d3..dcc73e5 100644
--- a/test/IRGen/asmname.swift
+++ b/test/IRGen/asmname.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/assert_conf_default.sil b/test/IRGen/assert_conf_default.sil
index fa50c53..32a440c 100644
--- a/test/IRGen/assert_conf_default.sil
+++ b/test/IRGen/assert_conf_default.sil
@@ -1,7 +1,7 @@
-// RUN: %target-swift-frontend -assert-config DisableReplacement -emit-ir %s   | FileCheck %s --check-prefix=DISABLED
-// RUN: %target-swift-frontend -assert-config Release -emit-ir %s   | FileCheck %s --check-prefix=RELEASE
-// RUN: %target-swift-frontend -assert-config Debug -emit-ir %s   | FileCheck %s --check-prefix=DEBUG
-// RUN: %target-swift-frontend -assert-config Unchecked -emit-ir %s   | FileCheck %s --check-prefix=UNCHECKED
+// RUN: %target-swift-frontend -assert-config DisableReplacement -emit-ir %s   | %FileCheck %s --check-prefix=DISABLED
+// RUN: %target-swift-frontend -assert-config Release -emit-ir %s   | %FileCheck %s --check-prefix=RELEASE
+// RUN: %target-swift-frontend -assert-config Debug -emit-ir %s   | %FileCheck %s --check-prefix=DEBUG
+// RUN: %target-swift-frontend -assert-config Unchecked -emit-ir %s   | %FileCheck %s --check-prefix=UNCHECKED
 
 import Builtin
 
diff --git a/test/IRGen/associated_type_witness.swift b/test/IRGen/associated_type_witness.swift
index 9e1d06c..b99574d 100644
--- a/test/IRGen/associated_type_witness.swift
+++ b/test/IRGen/associated_type_witness.swift
@@ -1,6 +1,6 @@
 // RUN: %target-swift-frontend -primary-file %s -emit-ir > %t.ll
-// RUN: FileCheck %s -check-prefix=GLOBAL < %t.ll
-// RUN: FileCheck %s < %t.ll
+// RUN: %FileCheck %s -check-prefix=GLOBAL < %t.ll
+// RUN: %FileCheck %s < %t.ll
 // REQUIRES: CPU=x86_64
 
 protocol P {}
diff --git a/test/IRGen/associated_types.swift b/test/IRGen/associated_types.swift
index bb01e69..a14b801 100644
--- a/test/IRGen/associated_types.swift
+++ b/test/IRGen/associated_types.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -primary-file %s | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/autolink-coff-force-link.swift b/test/IRGen/autolink-coff-force-link.swift
index 6e5c824..a885512 100644
--- a/test/IRGen/autolink-coff-force-link.swift
+++ b/test/IRGen/autolink-coff-force-link.swift
@@ -1,9 +1,9 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 
-// RUN: %swift -target i686--windows-msvc -parse-as-library -parse-stdlib -module-name autolink -module-link-name autolink -autolink-force-load -emit-ir -o - %s | FileCheck %s
-// RUN: %swift -target i686--windows-itanium -parse-as-library -parse-stdlib -module-name autolink -module-link-name autolink -autolink-force-load -S -o - %s | FileCheck %s -check-prefix CHECK-ASM-GNU
-// RUN: %swift -target i686--windows-msvc -parse-as-library -parse-stdlib -module-name autolink -module-link-name autolink -autolink-force-load -S -o - %s | FileCheck %s -check-prefix CHECK-ASM-MSC
+// RUN: %swift -target i686--windows-msvc -parse-as-library -parse-stdlib -module-name autolink -module-link-name autolink -autolink-force-load -emit-ir -o - %s | %FileCheck %s
+// RUN: %swift -target i686--windows-itanium -parse-as-library -parse-stdlib -module-name autolink -module-link-name autolink -autolink-force-load -S -o - %s | %FileCheck %s -check-prefix CHECK-ASM-GNU
+// RUN: %swift -target i686--windows-msvc -parse-as-library -parse-stdlib -module-name autolink -module-link-name autolink -autolink-force-load -S -o - %s | %FileCheck %s -check-prefix CHECK-ASM-MSC
 
 // CHECK: @"_swift_FORCE_LOAD_$_autolink" = common dllexport global i1 false
 // CHECK-ASM-GNU: .ascii  " -export:__swift_FORCE_LOAD_$_autolink,data"
diff --git a/test/IRGen/autolink-coff.swift b/test/IRGen/autolink-coff.swift
index cf57eff..ded2e97 100644
--- a/test/IRGen/autolink-coff.swift
+++ b/test/IRGen/autolink-coff.swift
@@ -2,16 +2,16 @@
 // RUN: mkdir -p %t
 
 // RUN: %swift -target thumbv7--windows-gnu -parse-as-library -parse-stdlib -emit-module-path %t/module.swiftmodule -module-name module -module-link-name module %s
-// RUN: %swift -target thumbv7--windows-gnu -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | FileCheck %s -check-prefix CHECK-GNU-IR
-// RUN: %swift -target thumbv7--windows-gnu -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -S -o - %s | FileCheck %s -check-prefix CHECK-GNU-ASM
+// RUN: %swift -target thumbv7--windows-gnu -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | %FileCheck %s -check-prefix CHECK-GNU-IR
+// RUN: %swift -target thumbv7--windows-gnu -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -S -o - %s | %FileCheck %s -check-prefix CHECK-GNU-ASM
 
 // RUN: %swift -target thumbv7--windows-itanium -parse-as-library -parse-stdlib -emit-module-path %t/module.swiftmodule -module-name module -module-link-name module %s
-// RUN: %swift -target thumbv7--windows-itanium -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | FileCheck %s -check-prefix CHECK-MSVC-IR
-// RUN: %swift -target thumbv7--windows-itanium -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -S -o - %s | FileCheck %s -check-prefix CHECK-MSVC-ASM
+// RUN: %swift -target thumbv7--windows-itanium -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | %FileCheck %s -check-prefix CHECK-MSVC-IR
+// RUN: %swift -target thumbv7--windows-itanium -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -S -o - %s | %FileCheck %s -check-prefix CHECK-MSVC-ASM
 
 // RUN: %swift -target thumbv7--windows-msvc -parse-as-library -parse-stdlib -emit-module-path %t/module.swiftmodule -module-name module -module-link-name module %s
-// RUN: %swift -target thumbv7--windows-msvc -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | FileCheck %s -check-prefix CHECK-MSVC-IR
-// RUN: %swift -target thumbv7--windows-msvc -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -S -o - %s | FileCheck %s -check-prefix CHECK-MSVC-ASM
+// RUN: %swift -target thumbv7--windows-msvc -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | %FileCheck %s -check-prefix CHECK-MSVC-IR
+// RUN: %swift -target thumbv7--windows-msvc -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -S -o - %s | %FileCheck %s -check-prefix CHECK-MSVC-ASM
 
 // REQUIRES: CODEGENERATOR=ARM
 
diff --git a/test/IRGen/autolink-psei.swift b/test/IRGen/autolink-psei.swift
index 2fb6699..392b15c 100644
--- a/test/IRGen/autolink-psei.swift
+++ b/test/IRGen/autolink-psei.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %swift -target x86_64-scei-ps4 -parse-as-library -parse-stdlib -emit-module-path %t/module.swiftmodule -module-name module -module-link-name module %s
-// RUN: %swift -target x86_64-scei-ps4 -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | FileCheck %s -check-prefix CHECK-IR
+// RUN: %swift -target x86_64-scei-ps4 -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | %FileCheck %s -check-prefix CHECK-IR
 
 #if MAIN_MODULE
 import module
diff --git a/test/IRGen/autolink_elf.swift b/test/IRGen/autolink_elf.swift
index 32d0ba7..573bdfa 100644
--- a/test/IRGen/autolink_elf.swift
+++ b/test/IRGen/autolink_elf.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %swift -target x86_64-unknown-linux-gnu -emit-module -parse-stdlib -o %t -module-name Empty -module-link-name swiftEmpty %S/../Inputs/empty.swift
-// RUN: %swift -target x86_64-unknown-linux-gnu %s -I %t -parse-stdlib -disable-objc-interop -module-name main -emit-ir -o - | FileCheck %s
+// RUN: %swift -target x86_64-unknown-linux-gnu %s -I %t -parse-stdlib -disable-objc-interop -module-name main -emit-ir -o - | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=X86
 
diff --git a/test/IRGen/autorelease.sil b/test/IRGen/autorelease.sil
index 9e3e901..1ce783c 100644
--- a/test/IRGen/autorelease.sil
+++ b/test/IRGen/autorelease.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | FileCheck -check-prefix=%target-cpu %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | %FileCheck -check-prefix=%target-cpu %s
 // REQUIRES: objc_interop
 
 // rdar://16565958
diff --git a/test/IRGen/autorelease_optimized_aarch64.sil b/test/IRGen/autorelease_optimized_aarch64.sil
index 1348613..e6e3d1e 100644
--- a/test/IRGen/autorelease_optimized_aarch64.sil
+++ b/test/IRGen/autorelease_optimized_aarch64.sil
@@ -1,4 +1,4 @@
-// RUN: %swift -gnone -O -target arm64-apple-ios7 -emit-assembly %s -o - | FileCheck %s
+// RUN: %swift -gnone -O -target arm64-apple-ios7 -emit-assembly %s -o - | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=AArch64
 
diff --git a/test/IRGen/autorelease_optimized_armv7.sil b/test/IRGen/autorelease_optimized_armv7.sil
index 070b4f8..4bd8766 100644
--- a/test/IRGen/autorelease_optimized_armv7.sil
+++ b/test/IRGen/autorelease_optimized_armv7.sil
@@ -1,4 +1,4 @@
-// RUN: %swift -gnone -O -target armv7-apple-ios7 -emit-assembly %s -o - | FileCheck %s
+// RUN: %swift -gnone -O -target armv7-apple-ios7 -emit-assembly %s -o - | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=ARM
 
diff --git a/test/IRGen/autorelease_optimized_x86_64.sil b/test/IRGen/autorelease_optimized_x86_64.sil
index e689038..39142c6 100644
--- a/test/IRGen/autorelease_optimized_x86_64.sil
+++ b/test/IRGen/autorelease_optimized_x86_64.sil
@@ -1,4 +1,4 @@
-// RUN: %swift -gnone -O -target x86_64-apple-macosx10.9 -emit-assembly %s -o - | FileCheck %s
+// RUN: %swift -gnone -O -target x86_64-apple-macosx10.9 -emit-assembly %s -o - | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=X86
 
diff --git a/test/IRGen/bitcast.sil b/test/IRGen/bitcast.sil
index 7ed2c29..a715971 100644
--- a/test/IRGen/bitcast.sil
+++ b/test/IRGen/bitcast.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir| FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir| %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/bitcast_different_size.sil b/test/IRGen/bitcast_different_size.sil
index 5ea95d6..e244110 100644
--- a/test/IRGen/bitcast_different_size.sil
+++ b/test/IRGen/bitcast_different_size.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s -verify | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s -verify | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/boxed_existential.sil b/test/IRGen/boxed_existential.sil
index 4eb90d6..bd38512 100644
--- a/test/IRGen/boxed_existential.sil
+++ b/test/IRGen/boxed_existential.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-runtime
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-runtime
 
 import Swift
 
diff --git a/test/IRGen/bridge_object_arm64.sil b/test/IRGen/bridge_object_arm64.sil
index fd1f76c..ed3e051 100644
--- a/test/IRGen/bridge_object_arm64.sil
+++ b/test/IRGen/bridge_object_arm64.sil
@@ -1,4 +1,4 @@
-// RUN: %swift -module-name bridge_object -emit-ir -target arm64-apple-ios8.0 %s | FileCheck %s
+// RUN: %swift -module-name bridge_object -emit-ir -target arm64-apple-ios8.0 %s | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=AArch64
 
diff --git a/test/IRGen/bridge_object_armv7.sil b/test/IRGen/bridge_object_armv7.sil
index 7bf06ba..654fe1c5 100644
--- a/test/IRGen/bridge_object_armv7.sil
+++ b/test/IRGen/bridge_object_armv7.sil
@@ -1,4 +1,4 @@
-// RUN: %swift -module-name bridge_object -emit-ir -target armv7-apple-ios8.0 %s | FileCheck %s
+// RUN: %swift -module-name bridge_object -emit-ir -target armv7-apple-ios8.0 %s | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=ARM
 
diff --git a/test/IRGen/bridge_object_x86_64.sil b/test/IRGen/bridge_object_x86_64.sil
index 070fc87..7890abf 100644
--- a/test/IRGen/bridge_object_x86_64.sil
+++ b/test/IRGen/bridge_object_x86_64.sil
@@ -1,4 +1,4 @@
-// RUN: %swift -module-name bridge_object -emit-ir -target x86_64-apple-macosx10.9 %s | FileCheck %s
+// RUN: %swift -module-name bridge_object -emit-ir -target x86_64-apple-macosx10.9 %s | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=X86
 
diff --git a/test/IRGen/builtin_math.swift b/test/IRGen/builtin_math.swift
index 254c2ee..7e32c0e 100644
--- a/test/IRGen/builtin_math.swift
+++ b/test/IRGen/builtin_math.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // XFAIL: linux
 
diff --git a/test/IRGen/builtin_word.sil b/test/IRGen/builtin_word.sil
index 7516adc..542078e 100644
--- a/test/IRGen/builtin_word.sil
+++ b/test/IRGen/builtin_word.sil
@@ -1,5 +1,5 @@
-// RUN: %swift -target x86_64-apple-macosx10.9 %s -gnone -emit-ir -o - | FileCheck %s -check-prefix=INTEL
-// RUN: %swift -target armv7-apple-ios7 %s -gnone -emit-ir -o - | FileCheck %s -check-prefix=ARM32
+// RUN: %swift -target x86_64-apple-macosx10.9 %s -gnone -emit-ir -o - | %FileCheck %s -check-prefix=INTEL
+// RUN: %swift -target armv7-apple-ios7 %s -gnone -emit-ir -o - | %FileCheck %s -check-prefix=ARM32
 
 // REQUIRES: ARM
 
diff --git a/test/IRGen/builtins.swift b/test/IRGen/builtins.swift
index 7862df0..8ad6a76 100644
--- a/test/IRGen/builtins.swift
+++ b/test/IRGen/builtins.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -primary-file %s -emit-ir -o - -disable-objc-attr-requires-foundation-module | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-swift-frontend -parse-stdlib -primary-file %s -emit-ir -o - -disable-objc-attr-requires-foundation-module | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 // REQUIRES: executable_test
 
 // REQUIRES: CPU=x86_64
diff --git a/test/IRGen/c_function_pointer.sil b/test/IRGen/c_function_pointer.sil
index 492cfc0..01b910e 100644
--- a/test/IRGen/c_function_pointer.sil
+++ b/test/IRGen/c_function_pointer.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 import Swift
 
diff --git a/test/IRGen/c_functions.swift b/test/IRGen/c_functions.swift
index 91eebf6..749d548 100644
--- a/test/IRGen/c_functions.swift
+++ b/test/IRGen/c_functions.swift
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t && mkdir -p %t
-// RUN: %target-swift-frontend -import-objc-header %S/Inputs/c_functions.h -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -import-objc-header %S/Inputs/c_functions.h -primary-file %s -emit-ir | %FileCheck %s
 
 // This is deliberately not a SIL test so that we can test SILGen too.
 
diff --git a/test/IRGen/c_globals.swift b/test/IRGen/c_globals.swift
index 7ad63818..2586e84 100644
--- a/test/IRGen/c_globals.swift
+++ b/test/IRGen/c_globals.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -emit-ir | %FileCheck %s
 
 import c_layout
 
diff --git a/test/IRGen/c_layout.sil b/test/IRGen/c_layout.sil
index 297d861..50b808f 100644
--- a/test/IRGen/c_layout.sil
+++ b/test/IRGen/c_layout.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/Inputs/abi %s -emit-ir | FileCheck %s --check-prefix=CHECK-%target-cpu
+// RUN: %target-swift-frontend -I %S/Inputs/abi %s -emit-ir | %FileCheck %s --check-prefix=CHECK-%target-cpu
 
 sil_stage canonical
 import c_layout
diff --git a/test/IRGen/casts.sil b/test/IRGen/casts.sil
index 6635fd5..54e403b 100644
--- a/test/IRGen/casts.sil
+++ b/test/IRGen/casts.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-disable-pass="External Defs To Decls" %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-disable-pass="External Defs To Decls" %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 // XFAIL: linux
diff --git a/test/IRGen/cf.sil b/test/IRGen/cf.sil
index 9492ee8..845d7de 100644
--- a/test/IRGen/cf.sil
+++ b/test/IRGen/cf.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs %s -emit-ir -import-cf-types | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
+// RUN: %target-swift-frontend -sdk %S/Inputs %s -emit-ir -import-cf-types | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
 
 // REQUIRES: CPU=i386_or_x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/cf_members.sil b/test/IRGen/cf_members.sil
index da37ce12..7c47867 100644
--- a/test/IRGen/cf_members.sil
+++ b/test/IRGen/cf_members.sil
@@ -10,7 +10,6 @@
 sil @IAMStruct1CreateSimple : $@convention(c) () -> Struct1
 sil @IAMStruct1Rotate : $@convention(c) (@in Struct1, Double) -> Struct1
 sil @IAMStruct1SetAltitude : $@convention(c) (@inout Struct1, Double) -> ()
-sil @mutateSomeState : $@convention(c) <τ_0_0 where τ_0_0 : IAMProto> (τ_0_0) -> ()
 
 sil @invoke_methods : $@convention(thin) (Double) -> () {
 entry(%z : $Double):
@@ -25,14 +24,3 @@
   dealloc_stack %c : $*Struct1
   return undef : $()
 }
-
-// CHECK-LABEL: define void @invoke_protocol_methods(%objc_object*)
-sil @invoke_protocol_methods : $@convention(thin) (IAMProto) -> () {
-entry(%z : $IAMProto):
-  %a = open_existential_ref %z : $IAMProto to $@opened("01234567-89AB-CDEF-0123-000000000000") IAMProto
-  %b = function_ref @mutateSomeState : $@convention(c) <τ_0_0 where τ_0_0 : IAMProto> (τ_0_0) -> ()
-  // CHECK: [[CAST:%.*]] = bitcast %objc_object* %0 to i8*
-  // CHECK: call void @mutateSomeState(i8* [[CAST]])
-  apply %b<@opened("01234567-89AB-CDEF-0123-000000000000") IAMProto>(%a) : $@convention(c) <τ_0_0 where τ_0_0 : IAMProto> (τ_0_0) -> ()
-  return undef : $()
-}
diff --git a/test/IRGen/clang_inline.swift b/test/IRGen/clang_inline.swift
index 4d6f262..4f614fc 100644
--- a/test/IRGen/clang_inline.swift
+++ b/test/IRGen/clang_inline.swift
@@ -1,11 +1,11 @@
 // RUN: rm -rf %t && mkdir -p %t
-// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s -emit-ir | %FileCheck %s
 
 // RUN: mkdir -p %t/Empty.framework/Modules/Empty.swiftmodule
 // RUN: %target-swift-frontend -emit-module-path %t/Empty.framework/Modules/Empty.swiftmodule/%target-swiftmodule-name %S/../Inputs/empty.swift -module-name Empty
 // RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s -F %t -DIMPORT_EMPTY -emit-ir > %t.ll
-// RUN: FileCheck %s < %t.ll
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t.ll
+// RUN: %FileCheck %s < %t.ll
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t.ll
 
 // REQUIRES: CPU=i386_or_x86_64
 // XFAIL: linux
diff --git a/test/IRGen/clang_inline_reverse.swift b/test/IRGen/clang_inline_reverse.swift
index a9f4896..1a743ac 100644
--- a/test/IRGen/clang_inline_reverse.swift
+++ b/test/IRGen/clang_inline_reverse.swift
@@ -1,6 +1,6 @@
 // Same test as clang_inline.swift, but with the order swapped.
 
-// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s -emit-ir -module-name clang_inline | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s -emit-ir -module-name clang_inline | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 // XFAIL: linux
diff --git a/test/IRGen/class.sil b/test/IRGen/class.sil
index 702c6dd..8d58f06 100644
--- a/test/IRGen/class.sil
+++ b/test/IRGen/class.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/class_bounded_generics.swift b/test/IRGen/class_bounded_generics.swift
index 5d0bb29..e69d004 100644
--- a/test/IRGen/class_bounded_generics.swift
+++ b/test/IRGen/class_bounded_generics.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir -primary-file %s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -primary-file %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // XFAIL: linux
diff --git a/test/IRGen/class_constraint.sil b/test/IRGen/class_constraint.sil
index 04c7b07..89a50a6 100644
--- a/test/IRGen/class_constraint.sil
+++ b/test/IRGen/class_constraint.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -primary-file %s | %FileCheck %s
 
 protocol P {}
 class A : P {}
diff --git a/test/IRGen/class_isa_pointers.sil b/test/IRGen/class_isa_pointers.sil
index 42b7e03..91f757a 100644
--- a/test/IRGen/class_isa_pointers.sil
+++ b/test/IRGen/class_isa_pointers.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/class_isa_pointers_armv7k_watchos.sil b/test/IRGen/class_isa_pointers_armv7k_watchos.sil
index 60f3c6a..47bd4c4 100644
--- a/test/IRGen/class_isa_pointers_armv7k_watchos.sil
+++ b/test/IRGen/class_isa_pointers_armv7k_watchos.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=armv7k, OS=watchos
 // REQUIRES: objc_interop
diff --git a/test/IRGen/class_resilience.swift b/test/IRGen/class_resilience.swift
index 4e0e838..c917193 100644
--- a/test/IRGen/class_resilience.swift
+++ b/test/IRGen/class_resilience.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 // RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience -O %s
 
 // CHECK: %swift.type = type { [[INT:i32|i64]] }
diff --git a/test/IRGen/class_resilience_objc.swift b/test/IRGen/class_resilience_objc.swift
index e25f9e6..7ed403e 100644
--- a/test/IRGen/class_resilience_objc.swift
+++ b/test/IRGen/class_resilience_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-source-import -emit-ir -o - -primary-file %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-source-import -emit-ir -o - -primary-file %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/class_stack_alloc.sil b/test/IRGen/class_stack_alloc.sil
index 29b5720..6c0611c 100644
--- a/test/IRGen/class_stack_alloc.sil
+++ b/test/IRGen/class_stack_alloc.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -stack-promotion-limit 48 -Onone -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -stack-promotion-limit 48 -Onone -emit-ir %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/IRGen/class_with_stub_initializers.swift b/test/IRGen/class_with_stub_initializers.swift
index 76903f8..3a6c078 100644
--- a/test/IRGen/class_with_stub_initializers.swift
+++ b/test/IRGen/class_with_stub_initializers.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/closure.swift b/test/IRGen/closure.swift
index 8ea5b8c..daec9f9 100644
--- a/test/IRGen/closure.swift
+++ b/test/IRGen/closure.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/concrete_inherits_generic_base.swift b/test/IRGen/concrete_inherits_generic_base.swift
index 062002c..97c26f4 100644
--- a/test/IRGen/concrete_inherits_generic_base.swift
+++ b/test/IRGen/concrete_inherits_generic_base.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -module-name foo -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -module-name foo -emit-ir %s | %FileCheck %s
 
 // CHECK: %swift.type = type { [[INT:i32|i64]] }
 
diff --git a/test/IRGen/condfail.sil b/test/IRGen/condfail.sil
index 0214477..8f1fb83 100644
--- a/test/IRGen/condfail.sil
+++ b/test/IRGen/condfail.sil
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -primary-file %s -O -g -S  | FileCheck %s --check-prefix CHECK --check-prefix CHECK-%target-cpu --check-prefix CHECK-OPT-%target-os
-// RUN: %target-swift-frontend -primary-file %s -g -S  | FileCheck %s --check-prefix CHECK --check-prefix CHECK-%target-cpu --check-prefix CHECK-NOOPT-%target-os
+// RUN: %target-swift-frontend -primary-file %s -O -g -S  | %FileCheck %s --check-prefix CHECK --check-prefix CHECK-%target-cpu --check-prefix CHECK-OPT-%target-os
+// RUN: %target-swift-frontend -primary-file %s -g -S  | %FileCheck %s --check-prefix CHECK --check-prefix CHECK-%target-cpu --check-prefix CHECK-NOOPT-%target-os
 
 import Builtin
 import Swift
diff --git a/test/IRGen/coverage.swift b/test/IRGen/coverage.swift
index 9bcd6bd..4e5d40d 100644
--- a/test/IRGen/coverage.swift
+++ b/test/IRGen/coverage.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend %s -profile-generate -profile-coverage-mapping -emit-sil -o - | FileCheck %s --check-prefix=SIL
-// RUN: %target-swift-frontend %s -profile-generate -profile-coverage-mapping -emit-ir -o - | FileCheck %s --check-prefix=IR
+// RUN: %target-swift-frontend %s -profile-generate -profile-coverage-mapping -emit-sil -o - | %FileCheck %s --check-prefix=SIL
+// RUN: %target-swift-frontend %s -profile-generate -profile-coverage-mapping -emit-ir -o - | %FileCheck %s --check-prefix=IR
 
 // SIL-DAG: sil hidden @_TF8coverage2f1FT_T_
 // SIL-DAG: string_literal utf8 "{{.*}}coverage.swift:{{.*}}_TF8coverage2f1FT_T_"
diff --git a/test/IRGen/coverage_with_asan.swift b/test/IRGen/coverage_with_asan.swift
index 25f9ada..63803d7 100644
--- a/test/IRGen/coverage_with_asan.swift
+++ b/test/IRGen/coverage_with_asan.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -profile-generate -profile-coverage-mapping -sanitize=address -emit-ir -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -profile-generate -profile-coverage-mapping -sanitize=address -emit-ir -o - | %FileCheck %s
 // REQUIRES: OS=macosx
 
 // CHECK: main
diff --git a/test/IRGen/deallocate.swift b/test/IRGen/deallocate.swift
index 89018d5..c11c064 100644
--- a/test/IRGen/deallocate.swift
+++ b/test/IRGen/deallocate.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/decls.swift b/test/IRGen/decls.swift
index 72d1813..3595604 100644
--- a/test/IRGen/decls.swift
+++ b/test/IRGen/decls.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // Check that we emit all local decls, not just the first one.
 func test1() {
diff --git a/test/IRGen/dependent-library.swift b/test/IRGen/dependent-library.swift
index e9dc804..4c27b5e 100644
--- a/test/IRGen/dependent-library.swift
+++ b/test/IRGen/dependent-library.swift
@@ -1,4 +1,4 @@
-// RUN: %swift -target i686-unknown-windows-msvc -emit-ir -parse-as-library -parse-stdlib -module-name dependent -autolink-library oldnames -autolink-library msvcrt %s -o - | FileCheck %s
+// RUN: %swift -target i686-unknown-windows-msvc -emit-ir -parse-as-library -parse-stdlib -module-name dependent -autolink-library oldnames -autolink-library msvcrt %s -o - | %FileCheck %s
 
 // CHECK: !{i32 6, !"Linker Options", ![[options:[0-9]+]]}
 // CHECK: ![[options]] = !{![[oldnames:[0-9]+]], ![[msvcrtd:[0-9]+]]}
diff --git a/test/IRGen/dependent_reabstraction.swift b/test/IRGen/dependent_reabstraction.swift
index 0c13673..4091d96 100644
--- a/test/IRGen/dependent_reabstraction.swift
+++ b/test/IRGen/dependent_reabstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/IRGen/dllexport.swift b/test/IRGen/dllexport.swift
index 5955ef8..f9c616d 100644
--- a/test/IRGen/dllexport.swift
+++ b/test/IRGen/dllexport.swift
@@ -1,5 +1,5 @@
-// RUN: %swift -target thumbv7--windows-itanium -emit-ir -parse-as-library -parse-stdlib -module-name dllexport %s -o - | FileCheck %s -check-prefix CHECK -check-prefix CHECK-NO-OPT
-// RUN: %swift -target thumbv7--windows-itanium -O -emit-ir -parse-as-library -parse-stdlib -module-name dllexport %s -o - | FileCheck %s -check-prefix CHECK -check-prefix CHECK-OPT
+// RUN: %swift -target thumbv7--windows-itanium -emit-ir -parse-as-library -parse-stdlib -module-name dllexport %s -o - | %FileCheck %s -check-prefix CHECK -check-prefix CHECK-NO-OPT
+// RUN: %swift -target thumbv7--windows-itanium -O -emit-ir -parse-as-library -parse-stdlib -module-name dllexport %s -o - | %FileCheck %s -check-prefix CHECK -check-prefix CHECK-OPT
 
 // REQUIRES: CODEGENERATOR=ARM
 
diff --git a/test/IRGen/dllimport.swift b/test/IRGen/dllimport.swift
index da11785..b9d39bc 100644
--- a/test/IRGen/dllimport.swift
+++ b/test/IRGen/dllimport.swift
@@ -1,5 +1,5 @@
-// RUN: %swift -target thumbv7--windows-itanium -emit-ir -parse-as-library -parse-stdlib -module-name dllimport %s -o - -enable-source-import -I %S | FileCheck %s -check-prefix CHECK -check-prefix CHECK-NO-OPT
-// RUN: %swift -target thumbv7--windows-itanium -O -emit-ir -parse-as-library -parse-stdlib -module-name dllimport %s -o - -enable-source-import -I %S | FileCheck %s -check-prefix CHECK -check-prefix CHECK-OPT
+// RUN: %swift -target thumbv7--windows-itanium -emit-ir -parse-as-library -parse-stdlib -module-name dllimport %s -o - -enable-source-import -I %S | %FileCheck %s -check-prefix CHECK -check-prefix CHECK-NO-OPT
+// RUN: %swift -target thumbv7--windows-itanium -O -emit-ir -parse-as-library -parse-stdlib -module-name dllimport %s -o - -enable-source-import -I %S | %FileCheck %s -check-prefix CHECK -check-prefix CHECK-OPT
 
 // REQUIRES: CODEGENERATOR=ARM
 
diff --git a/test/IRGen/dynamic_cast.sil b/test/IRGen/dynamic_cast.sil
index cbbed04..f0147f6 100644
--- a/test/IRGen/dynamic_cast.sil
+++ b/test/IRGen/dynamic_cast.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/dynamic_init.sil b/test/IRGen/dynamic_init.sil
index 9e1bb55..c2aff16 100644
--- a/test/IRGen/dynamic_init.sil
+++ b/test/IRGen/dynamic_init.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/dynamic_lookup.sil b/test/IRGen/dynamic_lookup.sil
index a962f9c..2714a5d 100644
--- a/test/IRGen/dynamic_lookup.sil
+++ b/test/IRGen/dynamic_lookup.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/dynamic_self.sil b/test/IRGen/dynamic_self.sil
index ac16699..7b436b0 100644
--- a/test/IRGen/dynamic_self.sil
+++ b/test/IRGen/dynamic_self.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/dynamic_self_metadata.swift b/test/IRGen/dynamic_self_metadata.swift
index dd7873e..6217426 100644
--- a/test/IRGen/dynamic_self_metadata.swift
+++ b/test/IRGen/dynamic_self_metadata.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -parse-as-library | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -parse-as-library | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/empty_array.sil b/test/IRGen/empty_array.sil
index 4d2716d..e6fb643 100644
--- a/test/IRGen/empty_array.sil
+++ b/test/IRGen/empty_array.sil
@@ -1,9 +1,9 @@
-// RUN: %swift -target x86_64-apple-macosx10.9 -module-name main %s -emit-ir -o - | FileCheck -check-prefix=CHECK-64 %s
-// RUN: %swift -target i386-apple-ios7.1 %s -module-name main -emit-ir -o - | FileCheck -check-prefix=CHECK-32 %s
-// RUN: %swift -target x86_64-apple-ios7.1 %s -module-name main -emit-ir -o - | FileCheck -check-prefix=CHECK-64 %s
-// RUN: %swift -target armv7-apple-ios7.1 %s -module-name main -emit-ir -o - | FileCheck -check-prefix=CHECK-32 %s
-// RUN: %swift -target arm64-apple-ios7.1 %s -module-name main -emit-ir -o - | FileCheck -check-prefix=CHECK-64 %s
-// RUN: %swift -target x86_64-unknown-linux-gnu -disable-objc-interop %s -module-name main -emit-ir -o - | FileCheck -check-prefix=CHECK-64 %s
+// RUN: %swift -target x86_64-apple-macosx10.9 -module-name main %s -emit-ir -o - | %FileCheck -check-prefix=CHECK-64 %s
+// RUN: %swift -target i386-apple-ios7.1 %s -module-name main -emit-ir -o - | %FileCheck -check-prefix=CHECK-32 %s
+// RUN: %swift -target x86_64-apple-ios7.1 %s -module-name main -emit-ir -o - | %FileCheck -check-prefix=CHECK-64 %s
+// RUN: %swift -target armv7-apple-ios7.1 %s -module-name main -emit-ir -o - | %FileCheck -check-prefix=CHECK-32 %s
+// RUN: %swift -target arm64-apple-ios7.1 %s -module-name main -emit-ir -o - | %FileCheck -check-prefix=CHECK-64 %s
+// RUN: %swift -target x86_64-unknown-linux-gnu -disable-objc-interop %s -module-name main -emit-ir -o - | %FileCheck -check-prefix=CHECK-64 %s
 
 // REQUIRES: X86
 // REQUIRES: ARM
diff --git a/test/IRGen/enum.sil b/test/IRGen/enum.sil
index 61597eb..8bd5819 100644
--- a/test/IRGen/enum.sil
+++ b/test/IRGen/enum.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -gnone -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-runtime-%target-ptrsize
+// RUN: %target-swift-frontend %s -gnone -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-runtime-%target-ptrsize
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/enum_32_bit.sil b/test/IRGen/enum_32_bit.sil
index d3af2b9..89b1057 100644
--- a/test/IRGen/enum_32_bit.sil
+++ b/test/IRGen/enum_32_bit.sil
@@ -1,5 +1,5 @@
-// RUN: %swift -target i386-apple-ios7 %s -gnone -emit-ir | FileCheck %s
-// RUN: %swift -target armv7-apple-ios7 %s -gnone -emit-ir | FileCheck %s
+// RUN: %swift -target i386-apple-ios7 %s -gnone -emit-ir | %FileCheck %s
+// RUN: %swift -target armv7-apple-ios7 %s -gnone -emit-ir | %FileCheck %s
 
 // REQUIRES: X86
 // REQUIRES: ARM
diff --git a/test/IRGen/enum_derived.swift b/test/IRGen/enum_derived.swift
index 40c2219..ee4fa63 100644
--- a/test/IRGen/enum_derived.swift
+++ b/test/IRGen/enum_derived.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -module-name def_enum -o %t %S/Inputs/def_enum.swift
-// RUN: %target-swift-frontend -I %t -O -primary-file %s -emit-ir | FileCheck -check-prefix=CHECK -check-prefix=CHECK-NORMAL %s
-// RUN: %target-swift-frontend -I %t -O -primary-file %s -enable-testing -emit-ir | FileCheck -check-prefix=CHECK -check-prefix=CHECK-TESTABLE %s
+// RUN: %target-swift-frontend -I %t -O -primary-file %s -emit-ir | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-NORMAL %s
+// RUN: %target-swift-frontend -I %t -O -primary-file %s -enable-testing -emit-ir | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-TESTABLE %s
 
 import def_enum
 
@@ -47,5 +47,3 @@
   case Up
   case Down
 }
-
-extension Phantom : RawRepresentable {}
diff --git a/test/IRGen/enum_dynamic_multi_payload.sil b/test/IRGen/enum_dynamic_multi_payload.sil
index ebbc0f4..8b0242d 100644
--- a/test/IRGen/enum_dynamic_multi_payload.sil
+++ b/test/IRGen/enum_dynamic_multi_payload.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -gnone -emit-ir -I %S/Inputs | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend %s -gnone -emit-ir -I %S/Inputs | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 import Builtin
 
diff --git a/test/IRGen/enum_function.sil b/test/IRGen/enum_function.sil
index ee40e48..f3857ec 100644
--- a/test/IRGen/enum_function.sil
+++ b/test/IRGen/enum_function.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -gnone -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend -primary-file %s -gnone -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/enum_resilience.swift b/test/IRGen/enum_resilience.swift
index 2e51f61..ce70ef3 100644
--- a/test/IRGen/enum_resilience.swift
+++ b/test/IRGen/enum_resilience.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | FileCheck %s
+// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | %FileCheck %s
 // RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience -O %s
 
 import resilient_enum
diff --git a/test/IRGen/enum_spare_bits.sil b/test/IRGen/enum_spare_bits.sil
index 03c9fd5..18a2a5b 100644
--- a/test/IRGen/enum_spare_bits.sil
+++ b/test/IRGen/enum_spare_bits.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
 
 // REQUIRES: CPU=i386_or_x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/enum_switch_singleton_enum_in_optional.sil b/test/IRGen/enum_switch_singleton_enum_in_optional.sil
index ed87254..e45eea4 100644
--- a/test/IRGen/enum_switch_singleton_enum_in_optional.sil
+++ b/test/IRGen/enum_switch_singleton_enum_in_optional.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 sil_stage canonical
 
 enum Optional<T> { case some(T), none }
diff --git a/test/IRGen/enum_value_semantics.sil b/test/IRGen/enum_value_semantics.sil
index 70c6c7a..86241dc 100644
--- a/test/IRGen/enum_value_semantics.sil
+++ b/test/IRGen/enum_value_semantics.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -gnone -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend %s -gnone -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/enum_value_semantics_special_cases.sil b/test/IRGen/enum_value_semantics_special_cases.sil
index 9646942..b90e6f8 100644
--- a/test/IRGen/enum_value_semantics_special_cases.sil
+++ b/test/IRGen/enum_value_semantics_special_cases.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/enum_value_semantics_special_cases_objc.sil b/test/IRGen/enum_value_semantics_special_cases_objc.sil
index 014e60c..500cdbb 100644
--- a/test/IRGen/enum_value_semantics_special_cases_objc.sil
+++ b/test/IRGen/enum_value_semantics_special_cases_objc.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/errors.sil b/test/IRGen/errors.sil
index 1f18bc7..607c283 100644
--- a/test/IRGen/errors.sil
+++ b/test/IRGen/errors.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 // REQUIRES: executable_test
 
 sil_stage canonical
diff --git a/test/IRGen/errors_optimized.sil b/test/IRGen/errors_optimized.sil
index 3030e7c..3a7868c 100644
--- a/test/IRGen/errors_optimized.sil
+++ b/test/IRGen/errors_optimized.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -O -emit-ir | FileCheck %s 
+// RUN: %target-swift-frontend -primary-file %s -O -emit-ir | %FileCheck %s 
 
 sil_stage canonical
 
diff --git a/test/IRGen/exactcast.sil b/test/IRGen/exactcast.sil
index c320205..7e90b8d 100644
--- a/test/IRGen/exactcast.sil
+++ b/test/IRGen/exactcast.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/existential_metatypes.sil b/test/IRGen/existential_metatypes.sil
index 7dd20ef..23ee266 100644
--- a/test/IRGen/existential_metatypes.sil
+++ b/test/IRGen/existential_metatypes.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir -o - -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -o - -primary-file %s | %FileCheck %s
 // REQUIRES: CPU=x86_64
 
 sil_stage canonical
diff --git a/test/IRGen/existentials.sil b/test/IRGen/existentials.sil
index a0e25de..dcb90cc 100644
--- a/test/IRGen/existentials.sil
+++ b/test/IRGen/existentials.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -disable-objc-interop | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -disable-objc-interop | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/existentials_objc.sil b/test/IRGen/existentials_objc.sil
index e7d7ba3..0491749 100644
--- a/test/IRGen/existentials_objc.sil
+++ b/test/IRGen/existentials_objc.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %t %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %t %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/expressions.swift b/test/IRGen/expressions.swift
index 4497998..9acc7ac 100644
--- a/test/IRGen/expressions.swift
+++ b/test/IRGen/expressions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -parse-stdlib -disable-access-control | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -parse-stdlib -disable-access-control | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/field_type_vectors.sil b/test/IRGen/field_type_vectors.sil
index 666385d..dcc30eb 100644
--- a/test/IRGen/field_type_vectors.sil
+++ b/test/IRGen/field_type_vectors.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/fixed_size_buffer_peepholes.sil b/test/IRGen/fixed_size_buffer_peepholes.sil
index 5ba5daf..9755bd1 100644
--- a/test/IRGen/fixed_size_buffer_peepholes.sil
+++ b/test/IRGen/fixed_size_buffer_peepholes.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 import Builtin
 
diff --git a/test/IRGen/fixlifetime.sil b/test/IRGen/fixlifetime.sil
index a1e5490..5e9d89d 100644
--- a/test/IRGen/fixlifetime.sil
+++ b/test/IRGen/fixlifetime.sil
@@ -1,6 +1,6 @@
-// RUN: %target-swift-frontend -parse-sil -emit-ir -disable-llvm-optzns -O %s | FileCheck --check-prefix=CHECK-%target-runtime %s
-// RUN: %target-swift-frontend -parse-sil -emit-ir -disable-llvm-optzns -Ounchecked %s | FileCheck --check-prefix=CHECK-%target-runtime %s
-// RUN: %target-swift-frontend -parse-sil -emit-ir -disable-llvm-optzns -Onone %s | FileCheck --check-prefix=ONONE %s
+// RUN: %target-swift-frontend -parse-sil -emit-ir -disable-llvm-optzns -O %s | %FileCheck --check-prefix=CHECK-%target-runtime %s
+// RUN: %target-swift-frontend -parse-sil -emit-ir -disable-llvm-optzns -Ounchecked %s | %FileCheck --check-prefix=CHECK-%target-runtime %s
+// RUN: %target-swift-frontend -parse-sil -emit-ir -disable-llvm-optzns -Onone %s | %FileCheck --check-prefix=ONONE %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/foreign_class_extension.swift b/test/IRGen/foreign_class_extension.swift
index 8506778..851edf6 100644
--- a/test/IRGen/foreign_class_extension.swift
+++ b/test/IRGen/foreign_class_extension.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/foreign_types.sil b/test/IRGen/foreign_types.sil
index e0c7c51..f29a740 100644
--- a/test/IRGen/foreign_types.sil
+++ b/test/IRGen/foreign_types.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/Inputs/abi %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -I %S/Inputs/abi %s -emit-ir | %FileCheck %s
 
 sil_stage canonical
 import c_layout
diff --git a/test/IRGen/fulfillment.sil b/test/IRGen/fulfillment.sil
index 66b5129..bc37934 100644
--- a/test/IRGen/fulfillment.sil
+++ b/test/IRGen/fulfillment.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/function-target-features.swift b/test/IRGen/function-target-features.swift
index bcd9f64..c862dab 100644
--- a/test/IRGen/function-target-features.swift
+++ b/test/IRGen/function-target-features.swift
@@ -1,12 +1,12 @@
 // This test verifies that we produce target-cpu and target-features attributes
 // on functions.
 
-// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc +avx | FileCheck %s -check-prefix=AVX-FEATURE
-// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc +avx512f -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc +avx512er | FileCheck %s -check-prefix=TWO-AVX
-// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-cpu -Xcc -Xclang -Xcc corei7 | FileCheck %s -check-prefix=CORE-CPU
-// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-cpu -Xcc -Xclang -Xcc corei7 -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc +avx | FileCheck %s -check-prefix=CORE-CPU-AND-FEATURES
-// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-cpu -Xcc -Xclang -Xcc x86-64 | FileCheck %s -check-prefix=X86-64-CPU
-// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-cpu -Xcc -Xclang -Xcc corei7-avx -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc -avx | FileCheck %s -check-prefix=AVX-MINUS-FEATURE
+// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc +avx | %FileCheck %s -check-prefix=AVX-FEATURE
+// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc +avx512f -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc +avx512er | %FileCheck %s -check-prefix=TWO-AVX
+// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-cpu -Xcc -Xclang -Xcc corei7 | %FileCheck %s -check-prefix=CORE-CPU
+// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-cpu -Xcc -Xclang -Xcc corei7 -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc +avx | %FileCheck %s -check-prefix=CORE-CPU-AND-FEATURES
+// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-cpu -Xcc -Xclang -Xcc x86-64 | %FileCheck %s -check-prefix=X86-64-CPU
+// RUN: %target-swift-frontend -emit-ir -o - %s -Xcc -Xclang -Xcc -target-cpu -Xcc -Xclang -Xcc corei7-avx -Xcc -Xclang -Xcc -target-feature -Xcc -Xclang -Xcc -avx | %FileCheck %s -check-prefix=AVX-MINUS-FEATURE
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/function_metadata.swift b/test/IRGen/function_metadata.swift
index 988d168..f022081 100644
--- a/test/IRGen/function_metadata.swift
+++ b/test/IRGen/function_metadata.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -primary-file %s | %FileCheck %s
 
 func arch<F>(_ f: F) {}
 
diff --git a/test/IRGen/function_param_convention.sil b/test/IRGen/function_param_convention.sil
index 01c6d32..d873f6b 100644
--- a/test/IRGen/function_param_convention.sil
+++ b/test/IRGen/function_param_convention.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s -module-name Test | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s -module-name Test | %FileCheck %s
 
 import Builtin
 
diff --git a/test/IRGen/function_types.sil b/test/IRGen/function_types.sil
index 309937a..f4e452f 100644
--- a/test/IRGen/function_types.sil
+++ b/test/IRGen/function_types.sil
@@ -1,9 +1,9 @@
-// RUN: %swift -target x86_64-apple-macosx10.9 -module-name function_types %s -emit-ir -o - | FileCheck %s
-// RUN: %swift -target i386-apple-ios7.1 %s -module-name function_types -emit-ir -o - | FileCheck %s
-// RUN: %swift -target x86_64-apple-ios7.1 %s -module-name function_types -emit-ir -o - | FileCheck %s
-// RUN: %swift -target armv7-apple-ios7.1 %s -module-name function_types -emit-ir -o - | FileCheck %s
-// RUN: %swift -target arm64-apple-ios7.1 %s -module-name function_types -emit-ir -o - | FileCheck %s
-// RUN: %swift -target x86_64-unknown-linux-gnu -disable-objc-interop %s -module-name function_types -emit-ir -o - | FileCheck %s
+// RUN: %swift -target x86_64-apple-macosx10.9 -module-name function_types %s -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target i386-apple-ios7.1 %s -module-name function_types -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target x86_64-apple-ios7.1 %s -module-name function_types -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target armv7-apple-ios7.1 %s -module-name function_types -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target arm64-apple-ios7.1 %s -module-name function_types -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target x86_64-unknown-linux-gnu -disable-objc-interop %s -module-name function_types -emit-ir -o - | %FileCheck %s
 
 // REQUIRES: X86
 // REQUIRES: ARM
diff --git a/test/IRGen/generic_casts.swift b/test/IRGen/generic_casts.swift
index c4b1353..9e62baa 100644
--- a/test/IRGen/generic_casts.swift
+++ b/test/IRGen/generic_casts.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/generic_class_anyobject.swift b/test/IRGen/generic_class_anyobject.swift
index 8ab9387..5035a82 100644
--- a/test/IRGen/generic_class_anyobject.swift
+++ b/test/IRGen/generic_class_anyobject.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/generic_classes.sil b/test/IRGen/generic_classes.sil
index 1a7a0ea..24a5ee3 100644
--- a/test/IRGen/generic_classes.sil
+++ b/test/IRGen/generic_classes.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/generic_classes_objc.sil b/test/IRGen/generic_classes_objc.sil
index 4e4e990..a8aca5c 100644
--- a/test/IRGen/generic_classes_objc.sil
+++ b/test/IRGen/generic_classes_objc.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/generic_metatypes.swift b/test/IRGen/generic_metatypes.swift
index 82cc764..a9f704f 100644
--- a/test/IRGen/generic_metatypes.swift
+++ b/test/IRGen/generic_metatypes.swift
@@ -1,15 +1,15 @@
-// RUN: %swift -target x86_64-apple-macosx10.9 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
-// RUN: %swift -target i386-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
-// RUN: %swift -target x86_64-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
-// RUN: %swift -target i386-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
-// RUN: %swift -target x86_64-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
-// RUN: %swift -target i386-apple-watchos2.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
-// RUN: %swift -target armv7-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
-// RUN: %swift -target arm64-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
-// RUN: %swift -target armv7-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
-// RUN: %swift -target arm64-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
-// RUN: %swift -target armv7k-apple-watchos2.0 -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
-// RUN: %swift -target x86_64-unknown-linux-gnu -disable-objc-interop -emit-ir -parse-stdlib -primary-file %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
+// RUN: %swift -target x86_64-apple-macosx10.9 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
+// RUN: %swift -target i386-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
+// RUN: %swift -target x86_64-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
+// RUN: %swift -target i386-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
+// RUN: %swift -target x86_64-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
+// RUN: %swift -target i386-apple-watchos2.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
+// RUN: %swift -target armv7-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
+// RUN: %swift -target arm64-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
+// RUN: %swift -target armv7-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
+// RUN: %swift -target arm64-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
+// RUN: %swift -target armv7k-apple-watchos2.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
+// RUN: %swift -target x86_64-unknown-linux-gnu -disable-objc-interop -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
 
 // REQUIRES: X86
 
diff --git a/test/IRGen/generic_structs.sil b/test/IRGen/generic_structs.sil
index 22a599d..0038731 100644
--- a/test/IRGen/generic_structs.sil
+++ b/test/IRGen/generic_structs.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/generic_ternary.swift b/test/IRGen/generic_ternary.swift
index df5e1b4..48c0ad8 100644
--- a/test/IRGen/generic_ternary.swift
+++ b/test/IRGen/generic_ternary.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/generic_tuples.swift b/test/IRGen/generic_tuples.swift
index e75ba0d..f86f37f 100644
--- a/test/IRGen/generic_tuples.swift
+++ b/test/IRGen/generic_tuples.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -primary-file %s | %FileCheck %s
 
 // Make sure that optimization passes don't choke on storage types for generic tuples
 // RUN: %target-swift-frontend -emit-ir -O %s
diff --git a/test/IRGen/generic_types.swift b/test/IRGen/generic_types.swift
index 49136aa..e1b8af8 100644
--- a/test/IRGen/generic_types.swift
+++ b/test/IRGen/generic_types.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/global_resilience.sil b/test/IRGen/global_resilience.sil
index b98ce37..fdbc117 100644
--- a/test/IRGen/global_resilience.sil
+++ b/test/IRGen/global_resilience.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | FileCheck %s
+// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | %FileCheck %s
 // RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience -O %s
 
 // CHECK: %swift.type = type { [[INT:i32|i64]] }
diff --git a/test/IRGen/globals.swift b/test/IRGen/globals.swift
index 6d657c0..5f9ac83 100644
--- a/test/IRGen/globals.swift
+++ b/test/IRGen/globals.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/indexing.sil b/test/IRGen/indexing.sil
index f5a9d1f..7727414 100644
--- a/test/IRGen/indexing.sil
+++ b/test/IRGen/indexing.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/indirect_argument.sil b/test/IRGen/indirect_argument.sil
index 398957d..8cc2f39 100644
--- a/test/IRGen/indirect_argument.sil
+++ b/test/IRGen/indirect_argument.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck -check-prefix=CHECK -check-prefix=CHECK-%target-ptrsize %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-%target-ptrsize %s
 import Swift
 import Builtin
 
diff --git a/test/IRGen/indirect_enum.sil b/test/IRGen/indirect_enum.sil
index 0bf6e99..c6a7fff 100644
--- a/test/IRGen/indirect_enum.sil
+++ b/test/IRGen/indirect_enum.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 import Swift
 
diff --git a/test/IRGen/indirect_return.swift b/test/IRGen/indirect_return.swift
index 4378fec..b39eee5 100644
--- a/test/IRGen/indirect_return.swift
+++ b/test/IRGen/indirect_return.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/infinite_archetype.swift b/test/IRGen/infinite_archetype.swift
index a378252..0e8dd63 100644
--- a/test/IRGen/infinite_archetype.swift
+++ b/test/IRGen/infinite_archetype.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/int_to_fp.sil b/test/IRGen/int_to_fp.sil
index 5f7bd76..af53795 100644
--- a/test/IRGen/int_to_fp.sil
+++ b/test/IRGen/int_to_fp.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // Test if llvm can generate code for it
 // RUN: %target-swift-frontend -c %s
diff --git a/test/IRGen/ivar_destroyer.sil b/test/IRGen/ivar_destroyer.sil
index 9360ce8..9f4a6a0 100644
--- a/test/IRGen/ivar_destroyer.sil
+++ b/test/IRGen/ivar_destroyer.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/lazy_globals.swift b/test/IRGen/lazy_globals.swift
index fcada67..7b92980 100644
--- a/test/IRGen/lazy_globals.swift
+++ b/test/IRGen/lazy_globals.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-ir -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-ir -primary-file %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/lazy_multi_file.swift b/test/IRGen/lazy_multi_file.swift
index 9c24322..6cc1850 100644
--- a/test/IRGen/lazy_multi_file.swift
+++ b/test/IRGen/lazy_multi_file.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s %S/Inputs/lazy_multi_file_helper.swift -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s %S/Inputs/lazy_multi_file_helper.swift -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/lifetime.sil b/test/IRGen/lifetime.sil
index 3f42a78..bc95819 100644
--- a/test/IRGen/lifetime.sil
+++ b/test/IRGen/lifetime.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -gnone -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -gnone -emit-ir %s | %FileCheck %s
 
 // CHECK: [[OPAQUE:%swift.opaque]] = type opaque
 // CHECK: [[TYPE:%swift.type]] = type
diff --git a/test/IRGen/linker_options_objc.swift b/test/IRGen/linker_options_objc.swift
index f41357b..acb1dae 100644
--- a/test/IRGen/linker_options_objc.swift
+++ b/test/IRGen/linker_options_objc.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swiftc_driver -emit-module -o %t -module-name Empty -module-link-name swiftEmpty %S/../Inputs/empty.swift
-// RUN: %target-swiftc_driver %s -I %t -emit-ir | FileCheck %s
+// RUN: %target-swiftc_driver %s -I %t -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/literals.sil b/test/IRGen/literals.sil
index 8e2410c..9f0c935 100644
--- a/test/IRGen/literals.sil
+++ b/test/IRGen/literals.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/local_types.swift b/test/IRGen/local_types.swift
index 363263b..53f85ff 100644
--- a/test/IRGen/local_types.swift
+++ b/test/IRGen/local_types.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-swift-frontend -emit-module %S/Inputs/local_types_helper.swift -o %t
 // RUN: %target-swift-frontend -emit-ir -parse-as-library %s -I %t > %t.ll
-// RUN: FileCheck %s < %t.ll
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t.ll
+// RUN: %FileCheck %s < %t.ll
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t.ll
 
 // XFAIL: linux
 
diff --git a/test/IRGen/mangle-anonclosure.swift b/test/IRGen/mangle-anonclosure.swift
index c0902da..0a5b1f0 100644
--- a/test/IRGen/mangle-anonclosure.swift
+++ b/test/IRGen/mangle-anonclosure.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s -o - | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s -o - | %FileCheck %s
 
 func someValidPointer<T>() -> UnsafeMutablePointer<T> { fatalError() }
 
diff --git a/test/IRGen/meta_meta_type.swift b/test/IRGen/meta_meta_type.swift
index b434a0f..a5ae333 100644
--- a/test/IRGen/meta_meta_type.swift
+++ b/test/IRGen/meta_meta_type.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck -check-prefix=CHECKIR %s
+// RUN: %target-run %t/a.out | %FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck -check-prefix=CHECKIR %s
 // REQUIRES: executable_test
 
 protocol Proto {
diff --git a/test/IRGen/metadata_dominance.swift b/test/IRGen/metadata_dominance.swift
index 96846a0..234409c 100644
--- a/test/IRGen/metadata_dominance.swift
+++ b/test/IRGen/metadata_dominance.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -emit-ir -primary-file %s | FileCheck %s
-// RUN: %target-swift-frontend -O -emit-ir -primary-file %s | FileCheck %s --check-prefix=CHECK-OPT
+// RUN: %target-swift-frontend -emit-ir -primary-file %s | %FileCheck %s
+// RUN: %target-swift-frontend -O -emit-ir -primary-file %s | %FileCheck %s --check-prefix=CHECK-OPT
 
 func use_metadata<F>(_ f: F) {}
 
diff --git a/test/IRGen/metatype.sil b/test/IRGen/metatype.sil
index 01bcc5a..afef2c3 100644
--- a/test/IRGen/metatype.sil
+++ b/test/IRGen/metatype.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %t -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %t -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/metatype_casts.sil b/test/IRGen/metatype_casts.sil
index 75ed4d2..f18797c 100644
--- a/test/IRGen/metatype_casts.sil
+++ b/test/IRGen/metatype_casts.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 // XFAIL: linux
diff --git a/test/IRGen/method_linkage.swift b/test/IRGen/method_linkage.swift
index 39054dd..33de988 100644
--- a/test/IRGen/method_linkage.swift
+++ b/test/IRGen/method_linkage.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // Test if all methods which go into a vtable have at least the visibility of its class.
 // Reason: Derived classes from "outside" still have to put the less visible base members
diff --git a/test/IRGen/module_hash.swift b/test/IRGen/module_hash.swift
index 63a3551..9dc6825 100644
--- a/test/IRGen/module_hash.swift
+++ b/test/IRGen/module_hash.swift
@@ -60,7 +60,7 @@
 // CHECK-DAG: simple.o: MD5=[[SIMPLE2_MD5:[0-9a-f]+]]
 // CHECK-DAG: simple.o: prev MD5=[[SIMPLE_MD5]] recompiling
 
-// RUN: FileCheck %s < %t/log
+// RUN: %FileCheck %s < %t/log
 
 // REQUIRES: asserts
 
diff --git a/test/IRGen/multithread_module.swift b/test/IRGen/multithread_module.swift
index ac075c6..bb78b60 100644
--- a/test/IRGen/multithread_module.swift
+++ b/test/IRGen/multithread_module.swift
@@ -1,12 +1,12 @@
 // RUN: rm -rf %t && mkdir -p %t
 
 // RUN: %target-swift-frontend %S/Inputs/multithread_module/main.swift -emit-ir -o %t/main.ll %s -o %t/mt_module.ll -num-threads 2 -O -g -module-name test
-// RUN: FileCheck --check-prefix=CHECK-MAINLL %s <%t/main.ll
-// RUN: FileCheck --check-prefix=CHECK-MODULELL %s <%t/mt_module.ll
+// RUN: %FileCheck --check-prefix=CHECK-MAINLL %s <%t/main.ll
+// RUN: %FileCheck --check-prefix=CHECK-MODULELL %s <%t/mt_module.ll
 
 // RUN: %target-swift-frontend -c %S/Inputs/multithread_module/main.swift -o %t/main.o %s -o %t/mt_module.o -num-threads 2 -O -g -module-name test
 // RUN: %target-build-swift %t/main.o %t/mt_module.o -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 
diff --git a/test/IRGen/nested_types.sil b/test/IRGen/nested_types.sil
index 1c92b19..c34c3e36 100644
--- a/test/IRGen/nested_types.sil
+++ b/test/IRGen/nested_types.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/IRGen/newtype.swift b/test/IRGen/newtype.swift
index a6d2446..f7ded64 100644
--- a/test/IRGen/newtype.swift
+++ b/test/IRGen/newtype.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t -I %S/../IDE/Inputs/custom-modules) %s -emit-ir -enable-swift-newtype | FileCheck %s
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t -I %S/../IDE/Inputs/custom-modules) %s -emit-ir -enable-swift-newtype -O | FileCheck %s -check-prefix=OPT
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t -I %S/../IDE/Inputs/custom-modules) %s -emit-ir -enable-swift-newtype | %FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t -I %S/../IDE/Inputs/custom-modules) %s -emit-ir -enable-swift-newtype -O | %FileCheck %s -check-prefix=OPT
 import CoreFoundation
 import Foundation
 import Newtype
@@ -130,3 +130,31 @@
 public func anchor() -> Bool {
   return false
 }
+
+class ObjCTest {
+  // CHECK-LABEL: define hidden %0* @_TToFC7newtype8ObjCTest19optionalPassThroughfGSqVSC11ErrorDomain_GSqS1__
+  // CHECK: [[CASTED:%.+]] = ptrtoint %0* %2 to i{{32|64}}
+  // CHECK: [[RESULT:%.+]] = call i{{32|64}} @_TFC7newtype8ObjCTest19optionalPassThroughfGSqVSC11ErrorDomain_GSqS1__(i{{32|64}} [[CASTED]], %C7newtype8ObjCTest* {{%.+}})
+  // CHECK: [[OPAQUE_RESULT:%.+]] = inttoptr i{{32|64}} [[RESULT]] to %0*
+  // CHECK: ret %0* [[OPAQUE_RESULT]]
+  // CHECK: {{^}$}}
+
+  // OPT-LABEL: define hidden %0* @_TToFC7newtype8ObjCTest19optionalPassThroughfGSqVSC11ErrorDomain_GSqS1__
+  // OPT: ret %0* %2
+  // OPT: {{^}$}}
+  @objc func optionalPassThrough(_ ed: ErrorDomain?) -> ErrorDomain? {
+    return ed
+  }
+
+  // CHECK-LABEL: define hidden i32 @_TToFC7newtype8ObjCTest18integerPassThroughfVSC5MyIntS1_
+  // CHECK: [[RESULT:%.+]] = call i32 @_TFC7newtype8ObjCTest18integerPassThroughfVSC5MyIntS1_(i32 %2, %C7newtype8ObjCTest* {{%.+}})
+  // CHECK: ret i32 [[RESULT]]
+  // CHECK: {{^}$}}
+
+  // OPT-LABEL: define hidden i32 @_TToFC7newtype8ObjCTest18integerPassThroughfVSC5MyIntS1_
+  // OPT: ret i32 %2
+  // OPT: {{^}$}}
+  @objc func integerPassThrough(_ num: MyInt) -> MyInt {
+    return num
+  }
+}
\ No newline at end of file
diff --git a/test/IRGen/noinline.swift b/test/IRGen/noinline.swift
index 47280e5..cd17fdb 100644
--- a/test/IRGen/noinline.swift
+++ b/test/IRGen/noinline.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -O -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -O -emit-ir | %FileCheck %s
 
 public var x = 0
 
diff --git a/test/IRGen/nominal-type-section.swift b/test/IRGen/nominal-type-section.swift
index 37815c9..ee573f6 100644
--- a/test/IRGen/nominal-type-section.swift
+++ b/test/IRGen/nominal-type-section.swift
@@ -1,6 +1,6 @@
-// RUN: %swift -target x86_64-apple-macosx10.10 -emit-ir -parse-stdlib -primary-file %s -module-name main -o - | FileCheck %s -check-prefix CHECK-MACHO
-// RUN: %swift -target x86_64-unknown-linux-gnu -emit-ir -parse-stdlib -primary-file %s -module-name main -o - | FileCheck %s -check-prefix CHECK-ELF
-// RUN: %swift -target x86_64-unknown-windows-itanium -emit-ir -parse-stdlib -primary-file %s -module-name main -o - | FileCheck %s -check-prefix CHECK-COFF
+// RUN: %swift -target x86_64-apple-macosx10.10 -emit-ir -parse-stdlib -primary-file %s -module-name main -o - | %FileCheck %s -check-prefix CHECK-MACHO
+// RUN: %swift -target x86_64-unknown-linux-gnu -emit-ir -parse-stdlib -primary-file %s -module-name main -o - | %FileCheck %s -check-prefix CHECK-ELF
+// RUN: %swift -target x86_64-unknown-windows-itanium -emit-ir -parse-stdlib -primary-file %s -module-name main -o - | %FileCheck %s -check-prefix CHECK-COFF
 
 // CHECK-MACHO: @_TMnV4main1s = constant {{.*}}, section "__TEXT,__const"
 // CHECK-ELF: @_TMnV4main1s = {{.*}}constant {{.*}}, section ".rodata"
diff --git a/test/IRGen/nonatomic_reference_counting.sil b/test/IRGen/nonatomic_reference_counting.sil
index f208c3c..160cb25 100644
--- a/test/IRGen/nonatomic_reference_counting.sil
+++ b/test/IRGen/nonatomic_reference_counting.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -disable-sil-perf-optzns -O -Xllvm -swiftmergefunc-threshold=0 -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -disable-sil-perf-optzns -O -Xllvm -swiftmergefunc-threshold=0 -emit-ir %s | %FileCheck %s
 
 // Check that IRGen lowers non-atomic reference counting instructions to
 // proper runtime calls.
diff --git a/test/IRGen/nondominant.sil b/test/IRGen/nondominant.sil
index 18b82bb..1530485 100644
--- a/test/IRGen/nondominant.sil
+++ b/test/IRGen/nondominant.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/objc.swift b/test/IRGen/objc.swift
index 3e8d055..4883bbd 100644
--- a/test/IRGen/objc.swift
+++ b/test/IRGen/objc.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_attr_NSManaged.sil b/test/IRGen/objc_attr_NSManaged.sil
index c51e704..ed4a7b8 100644
--- a/test/IRGen/objc_attr_NSManaged.sil
+++ b/test/IRGen/objc_attr_NSManaged.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_block.sil b/test/IRGen/objc_block.sil
index a0fe906..1e5dd8f 100644
--- a/test/IRGen/objc_block.sil
+++ b/test/IRGen/objc_block.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_block_storage.sil b/test/IRGen/objc_block_storage.sil
index dbd1f69..c62f116 100644
--- a/test/IRGen/objc_block_storage.sil
+++ b/test/IRGen/objc_block_storage.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -gnone -sdk %S/Inputs %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -gnone -sdk %S/Inputs %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_bridge.swift b/test/IRGen/objc_bridge.swift
index 721f5f1..25851bd 100644
--- a/test/IRGen/objc_bridge.swift
+++ b/test/IRGen/objc_bridge.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -primary-file %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_bridged_generic_conformance.swift b/test/IRGen/objc_bridged_generic_conformance.swift
new file mode 100644
index 0000000..ead4a71
--- /dev/null
+++ b/test/IRGen/objc_bridged_generic_conformance.swift
@@ -0,0 +1,14 @@
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir %s -import-objc-header %S/Inputs/objc_bridged_generic_conformance.h | %FileCheck %s
+// REQUIRES: objc_interop
+
+// CHECK-NOT: _TMnCSo
+
+// CHECK: @"\01l_protocol_conformances" = {{.*}} @"got.OBJC_CLASS_$_Thingy"
+
+// CHECK-NOT: _TMnCSo
+
+protocol P { func test() }
+
+extension Thingy: P {
+  func test() {}
+}
diff --git a/test/IRGen/objc_casts.sil b/test/IRGen/objc_casts.sil
index aecad64..ac6d21e 100644
--- a/test/IRGen/objc_casts.sil
+++ b/test/IRGen/objc_casts.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_class_empty_fields.swift b/test/IRGen/objc_class_empty_fields.swift
index cddbb7d..3e163c3 100644
--- a/test/IRGen/objc_class_empty_fields.swift
+++ b/test/IRGen/objc_class_empty_fields.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_class_export.swift b/test/IRGen/objc_class_export.swift
index 46a1407..8195859 100644
--- a/test/IRGen/objc_class_export.swift
+++ b/test/IRGen/objc_class_export.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %t -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %t -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_class_property.swift b/test/IRGen/objc_class_property.swift
index 3c6fa65..4708f71 100644
--- a/test/IRGen/objc_class_property.swift
+++ b/test/IRGen/objc_class_property.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_dealloc.sil b/test/IRGen/objc_dealloc.sil
index e2fe978..23e374a 100644
--- a/test/IRGen/objc_dealloc.sil
+++ b/test/IRGen/objc_dealloc.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_enum_multi_file.swift b/test/IRGen/objc_enum_multi_file.swift
index 7c02477..29b0e23 100644
--- a/test/IRGen/objc_enum_multi_file.swift
+++ b/test/IRGen/objc_enum_multi_file.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t && mkdir %t
-// RUN: %target-swift-frontend -module-name main -primary-file %s %S/Inputs/objc_enum_multi_file_helper.swift -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -module-name main -primary-file %s %S/Inputs/objc_enum_multi_file_helper.swift -emit-ir | %FileCheck %s
 
 // RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module -emit-module %S/Inputs/objc_enum_multi_file_helper.swift -o %t
-// RUN: %target-swift-frontend -module-name main -primary-file %s -I %t -DIMPORT -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -module-name main -primary-file %s -I %t -DIMPORT -emit-ir | %FileCheck %s
 
 #if IMPORT
 import objc_enum_multi_file_helper
diff --git a/test/IRGen/objc_errors.sil b/test/IRGen/objc_errors.sil
index 051eb4a..e98d1de 100644
--- a/test/IRGen/objc_errors.sil
+++ b/test/IRGen/objc_errors.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_extensions.swift b/test/IRGen/objc_extensions.swift
index 760427b..7f36594 100644
--- a/test/IRGen/objc_extensions.swift
+++ b/test/IRGen/objc_extensions.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -disable-objc-attr-requires-foundation-module -emit-module %S/Inputs/objc_extension_base.swift -o %t
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_factory_method.sil b/test/IRGen/objc_factory_method.sil
index 766c515..289fa33 100644
--- a/test/IRGen/objc_factory_method.sil
+++ b/test/IRGen/objc_factory_method.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_generic_class_convention.sil b/test/IRGen/objc_generic_class_convention.sil
index 6873eba..6abb329 100644
--- a/test/IRGen/objc_generic_class_convention.sil
+++ b/test/IRGen/objc_generic_class_convention.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_generic_class_debug_info.swift b/test/IRGen/objc_generic_class_debug_info.swift
new file mode 100644
index 0000000..c37036e
--- /dev/null
+++ b/test/IRGen/objc_generic_class_debug_info.swift
@@ -0,0 +1,13 @@
+
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir -g -verify
+
+// REQUIRES: objc_interop
+
+import Swift
+import Foundation
+import objc_generics
+
+extension GenericClass {
+  func method() {}
+  class func classMethod() {}
+}
diff --git a/test/IRGen/objc_generic_class_metadata.sil b/test/IRGen/objc_generic_class_metadata.sil
index ef52b77..61f2ab7 100644
--- a/test/IRGen/objc_generic_class_metadata.sil
+++ b/test/IRGen/objc_generic_class_metadata.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
@@ -71,6 +71,11 @@
   unreachable
 }
 
+sil @_TToFC27objc_generic_class_metadata8SubclasscfT7optionsGSqGVs10DictionaryVSC13GenericOptionP____GSQS0__ : $@convention(objc_method) (@owned Subclass, @owned NSDictionary) -> @owned Subclass {
+entry(%0: $Subclass, %1: $NSDictionary):
+  unreachable
+}
+
 // CHECK-LABEL: define linkonce_odr hidden %swift.type* @_TMaCSo12GenericClass()
 // CHECK:         [[T0:%.*]] = load %objc_class*, %objc_class** @"OBJC_CLASS_REF_$_GenericClass",
 // CHECK:         call %objc_class* @rt_swift_getInitializedObjCClass(%objc_class* [[T0]])
diff --git a/test/IRGen/objc_globals.swift b/test/IRGen/objc_globals.swift
index 6d26e1f..89aa369 100644
--- a/test/IRGen/objc_globals.swift
+++ b/test/IRGen/objc_globals.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -whole-module-optimization -emit-ir %s | FileCheck %s
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -whole-module-optimization -emit-ir %s | %FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi %s -emit-ir | %FileCheck %s
 //
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_implicit_with.sil b/test/IRGen/objc_implicit_with.sil
index bbe5074..3c60f39 100644
--- a/test/IRGen/objc_implicit_with.sil
+++ b/test/IRGen/objc_implicit_with.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_int_encoding.sil b/test/IRGen/objc_int_encoding.sil
index 4ac19ee..51eebbc 100644
--- a/test/IRGen/objc_int_encoding.sil
+++ b/test/IRGen/objc_int_encoding.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 
 // CHECK: [[SELECTOR:@.*]] = private global {{.*}} c"fooWithX:\00"
diff --git a/test/IRGen/objc_local.swift b/test/IRGen/objc_local.swift
index 779adb6..c1cc6ad 100644
--- a/test/IRGen/objc_local.swift
+++ b/test/IRGen/objc_local.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_methods.swift b/test/IRGen/objc_methods.swift
index 2912fbb..4e6c3c2 100644
--- a/test/IRGen/objc_methods.swift
+++ b/test/IRGen/objc_methods.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-os %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-os %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_ns_enum.swift b/test/IRGen/objc_ns_enum.swift
index eeefe6c..dd5bf3a5 100644
--- a/test/IRGen/objc_ns_enum.swift
+++ b/test/IRGen/objc_ns_enum.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_pointers.swift b/test/IRGen/objc_pointers.swift
index 766a0fd..759b9a8 100644
--- a/test/IRGen/objc_pointers.swift
+++ b/test/IRGen/objc_pointers.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_properties.swift b/test/IRGen/objc_properties.swift
index bf6d025..98cb6e4 100644
--- a/test/IRGen/objc_properties.swift
+++ b/test/IRGen/objc_properties.swift
@@ -1,7 +1,7 @@
 // This file is also used by objc_properties_ios.swift.
 
-// RUN: %swift -target x86_64-apple-macosx10.11 %s -disable-target-os-checking -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck -check-prefix=CHECK -check-prefix=CHECK-NEW %s
-// RUN: %swift -target x86_64-apple-macosx10.10 %s -disable-target-os-checking -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck -check-prefix=CHECK -check-prefix=CHECK-OLD %s
+// RUN: %swift -target x86_64-apple-macosx10.11 %s -disable-target-os-checking -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-NEW %s
+// RUN: %swift -target x86_64-apple-macosx10.10 %s -disable-target-os-checking -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-OLD %s
 
 // REQUIRES: OS=macosx
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_properties_imported.swift b/test/IRGen/objc_properties_imported.swift
index 8639b06..7210c64 100644
--- a/test/IRGen/objc_properties_imported.swift
+++ b/test/IRGen/objc_properties_imported.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-source-import -emit-ir -o - -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-source-import -emit-ir -o - -primary-file %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_properties_ios.swift b/test/IRGen/objc_properties_ios.swift
index eb626e7..33fa41e 100644
--- a/test/IRGen/objc_properties_ios.swift
+++ b/test/IRGen/objc_properties_ios.swift
@@ -1,5 +1,5 @@
-// RUN: %swift -target x86_64-apple-ios9 %S/objc_properties.swift -disable-target-os-checking -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck -check-prefix=CHECK -check-prefix=CHECK-NEW %S/objc_properties.swift
-// RUN: %swift -target x86_64-apple-ios8 %S/objc_properties.swift -disable-target-os-checking -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck -check-prefix=CHECK -check-prefix=CHECK-OLD %S/objc_properties.swift
+// RUN: %swift -target x86_64-apple-ios9 %S/objc_properties.swift -disable-target-os-checking -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-NEW %S/objc_properties.swift
+// RUN: %swift -target x86_64-apple-ios8 %S/objc_properties.swift -disable-target-os-checking -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-OLD %S/objc_properties.swift
 
 // REQUIRES: OS=ios
 // REQUIRES: CPU=x86_64
diff --git a/test/IRGen/objc_properties_jit.swift b/test/IRGen/objc_properties_jit.swift
index b48eaff..d7bb2b3 100644
--- a/test/IRGen/objc_properties_jit.swift
+++ b/test/IRGen/objc_properties_jit.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir -disable-objc-attr-requires-foundation-module -use-jit | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-ir -disable-objc-attr-requires-foundation-module -use-jit | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_property_attrs.swift b/test/IRGen/objc_property_attrs.swift
index c0cd10b..4ef182c 100644
--- a/test/IRGen/objc_property_attrs.swift
+++ b/test/IRGen/objc_property_attrs.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_protocol_conversion.sil b/test/IRGen/objc_protocol_conversion.sil
index 3c7866f..b286ddc 100644
--- a/test/IRGen/objc_protocol_conversion.sil
+++ b/test/IRGen/objc_protocol_conversion.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %t %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %t %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
@@ -29,7 +29,8 @@
 // CHECK-LABEL: define{{( protected)?}} %swift.type* @protocol_metatype()
 sil @protocol_metatype : $@convention(thin) () -> @thick Protocol.Type {
 entry:
-  // CHECK: call %swift.type* @swift_getForeignTypeMetadata
+  // CHECK: call %objc_class* @objc_lookUpClass
+  // CHECK: call %swift.type* @swift_getObjCClassMetadata
   %t = metatype $@thick Protocol.Type
   return %t : $@thick Protocol.Type
 }
diff --git a/test/IRGen/objc_protocol_extended_method_types.swift b/test/IRGen/objc_protocol_extended_method_types.swift
index d656fda..e69879a 100644
--- a/test/IRGen/objc_protocol_extended_method_types.swift
+++ b/test/IRGen/objc_protocol_extended_method_types.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_protocol_multi_file.swift b/test/IRGen/objc_protocol_multi_file.swift
index 6427239..12cf9de 100644
--- a/test/IRGen/objc_protocol_multi_file.swift
+++ b/test/IRGen/objc_protocol_multi_file.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s %S/Inputs/objc_protocol_multi_file_helper.swift -g -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s %S/Inputs/objc_protocol_multi_file_helper.swift -g -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_protocols.swift b/test/IRGen/objc_protocols.swift
index 58de2e0..32c1e07 100644
--- a/test/IRGen/objc_protocols.swift
+++ b/test/IRGen/objc_protocols.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-module -o %t %S/Inputs/objc_protocols_Bas.swift
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_protocols_jit.swift b/test/IRGen/objc_protocols_jit.swift
index 36c1105..440d79c 100644
--- a/test/IRGen/objc_protocols_jit.swift
+++ b/test/IRGen/objc_protocols_jit.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/objc_protocols_Bas.swift
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %t -primary-file %s -use-jit -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %t -primary-file %s -use-jit -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_remapped_inits.swift b/test/IRGen/objc_remapped_inits.swift
index 487d8b1..437255c 100644
--- a/test/IRGen/objc_remapped_inits.swift
+++ b/test/IRGen/objc_remapped_inits.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // FIXME: This test could use %clang-importer-sdk, but the compiler crashes.
 
diff --git a/test/IRGen/objc_runtime_visible.sil b/test/IRGen/objc_runtime_visible.sil
index 1b0c118..f3541d6 100644
--- a/test/IRGen/objc_runtime_visible.sil
+++ b/test/IRGen/objc_runtime_visible.sil
@@ -1,6 +1,6 @@
 // REQUIRES: objc_interop
 
-// RUN: %target-swift-frontend -I %S/../Inputs/custom-modules %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -I %S/../Inputs/custom-modules %s -emit-ir | %FileCheck %s
 
 sil_stage raw
 
@@ -20,3 +20,17 @@
   // CHECK-NEXT:  ret %objc_class*
   return %0 : $@objc_metatype A.Type
 }
+
+// CHECK: define void @deallocA(%CSo1A*) #0 {
+sil @deallocA : $@convention(thin) (@owned A) -> () {
+bb0(%0 : $A):
+  %1 = metatype $@thick A.Type
+
+  // CHECK: call %objc_object* @object_dispose
+  dealloc_partial_ref %0 : $A, %1 : $@thick A.Type
+
+  %2 = tuple ()
+
+  // CHECK-NEXT: ret
+  return %2 : $()
+}
diff --git a/test/IRGen/objc_selector.sil b/test/IRGen/objc_selector.sil
index 34214e4..e283be3 100644
--- a/test/IRGen/objc_selector.sil
+++ b/test/IRGen/objc_selector.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_simd.sil b/test/IRGen/objc_simd.sil
index 676d2f7..c39894b 100644
--- a/test/IRGen/objc_simd.sil
+++ b/test/IRGen/objc_simd.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir %s | FileCheck %s --check-prefix=%target-cpu
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir %s | %FileCheck %s --check-prefix=%target-cpu
 
 import Swift
 import simd
diff --git a/test/IRGen/objc_structs.swift b/test/IRGen/objc_structs.swift
index a854801..483aec3 100644
--- a/test/IRGen/objc_structs.swift
+++ b/test/IRGen/objc_structs.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_subclass.swift b/test/IRGen/objc_subclass.swift
index 8ee05d6..3426307 100644
--- a/test/IRGen/objc_subclass.swift
+++ b/test/IRGen/objc_subclass.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/objc_subscripts.swift b/test/IRGen/objc_subscripts.swift
index e27dcde..0bbacb9 100644
--- a/test/IRGen/objc_subscripts.swift
+++ b/test/IRGen/objc_subscripts.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_super.swift b/test/IRGen/objc_super.swift
index b77d522..935b0a8 100644
--- a/test/IRGen/objc_super.swift
+++ b/test/IRGen/objc_super.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/objc_type_encoding.swift b/test/IRGen/objc_type_encoding.swift
index b52730a..68503c4 100644
--- a/test/IRGen/objc_type_encoding.swift
+++ b/test/IRGen/objc_type_encoding.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s -check-prefix=CHECK-%target-os
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s -check-prefix=CHECK-%target-os
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/optional_metatype.sil b/test/IRGen/optional_metatype.sil
index 89abbf6..f26e520 100644
--- a/test/IRGen/optional_metatype.sil
+++ b/test/IRGen/optional_metatype.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %t -emit-ir %s | FileCheck %s --check-prefix=%target-cpu
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %t -emit-ir %s | %FileCheck %s --check-prefix=%target-cpu
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/ordering_aarch64.sil b/test/IRGen/ordering_aarch64.sil
index 47972b0..53eb531 100644
--- a/test/IRGen/ordering_aarch64.sil
+++ b/test/IRGen/ordering_aarch64.sil
@@ -1,4 +1,4 @@
-// RUN: %swift -target arm64-apple-ios7.1 %s -module-name main -emit-ir -o - | FileCheck %s
+// RUN: %swift -target arm64-apple-ios7.1 %s -module-name main -emit-ir -o - | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=AArch64
 
diff --git a/test/IRGen/ordering_arm.sil b/test/IRGen/ordering_arm.sil
index 9822af1..f24570b 100644
--- a/test/IRGen/ordering_arm.sil
+++ b/test/IRGen/ordering_arm.sil
@@ -1,4 +1,4 @@
-// RUN: %swift -target armv7-apple-ios7.1 %s -module-name main -emit-ir -o - | FileCheck %s
+// RUN: %swift -target armv7-apple-ios7.1 %s -module-name main -emit-ir -o - | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=ARM
 
diff --git a/test/IRGen/ordering_x86.sil b/test/IRGen/ordering_x86.sil
index 33419e5..fd57c48 100644
--- a/test/IRGen/ordering_x86.sil
+++ b/test/IRGen/ordering_x86.sil
@@ -1,7 +1,7 @@
-// RUN: %swift -target x86_64-apple-macosx10.9 -module-name main %s -emit-ir -o - | FileCheck %s
-// RUN: %swift -target i386-apple-ios7.1 %s -module-name main -emit-ir -o - | FileCheck %s
-// RUN: %swift -target x86_64-apple-ios7.1 %s -module-name main -emit-ir -o - | FileCheck %s
-// RUN: %swift -target x86_64-unknown-linux-gnu -disable-objc-interop %s -module-name main -emit-ir -o - | FileCheck %s
+// RUN: %swift -target x86_64-apple-macosx10.9 -module-name main %s -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target i386-apple-ios7.1 %s -module-name main -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target x86_64-apple-ios7.1 %s -module-name main -emit-ir -o - | %FileCheck %s
+// RUN: %swift -target x86_64-unknown-linux-gnu -disable-objc-interop %s -module-name main -emit-ir -o - | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=X86
 
diff --git a/test/IRGen/osx-targets.swift b/test/IRGen/osx-targets.swift
index 7c96218..11f4ec5 100644
--- a/test/IRGen/osx-targets.swift
+++ b/test/IRGen/osx-targets.swift
@@ -1,6 +1,6 @@
-// RUN: %swift %s -emit-ir | FileCheck %s
-// RUN: %swift -target x86_64-apple-macosx10.12 %s -emit-ir | FileCheck -check-prefix=CHECK-SPECIFIC %s
-// RUN: %swift -target x86_64-apple-darwin16 %s -emit-ir | FileCheck -check-prefix=CHECK-SPECIFIC %s
+// RUN: %swift %s -emit-ir | %FileCheck %s
+// RUN: %swift -target x86_64-apple-macosx10.12 %s -emit-ir | %FileCheck -check-prefix=CHECK-SPECIFIC %s
+// RUN: %swift -target x86_64-apple-darwin16 %s -emit-ir | %FileCheck -check-prefix=CHECK-SPECIFIC %s
 
 // REQUIRES: OS=macosx
 
diff --git a/test/IRGen/partial_apply.sil b/test/IRGen/partial_apply.sil
index 971c96f..a78698c 100644
--- a/test/IRGen/partial_apply.sil
+++ b/test/IRGen/partial_apply.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/partial_apply_forwarder.sil b/test/IRGen/partial_apply_forwarder.sil
index 9060489..1090f49 100644
--- a/test/IRGen/partial_apply_forwarder.sil
+++ b/test/IRGen/partial_apply_forwarder.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 sil_stage canonical
 
 public protocol P {}
diff --git a/test/IRGen/partial_apply_generic.swift b/test/IRGen/partial_apply_generic.swift
index ac9b09d..ebe388e 100644
--- a/test/IRGen/partial_apply_generic.swift
+++ b/test/IRGen/partial_apply_generic.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/pic.swift b/test/IRGen/pic.swift
index 9140ff5..4fe4487 100644
--- a/test/IRGen/pic.swift
+++ b/test/IRGen/pic.swift
@@ -1,7 +1,7 @@
 // <rdar://problem/15358345> Check that we always use PIC relocations on all
 // platforms.
 
-// RUN: %target-swift-frontend %s -module-name main -S -o - | FileCheck -check-prefix=%target-cpu %s
+// RUN: %target-swift-frontend %s -module-name main -S -o - | %FileCheck -check-prefix=%target-cpu %s
 
 // XFAIL: linux
 
diff --git a/test/IRGen/playground.swift b/test/IRGen/playground.swift
index 19a4f1d..8666ac8 100644
--- a/test/IRGen/playground.swift
+++ b/test/IRGen/playground.swift
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t
-// RUN: %target-swift-frontend -use-jit -playground -parse-stdlib %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -use-jit -playground -parse-stdlib %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: OS=macosx
 // REQUIRES: CPU=x86_64
diff --git a/test/IRGen/protocol_conformance_records.swift b/test/IRGen/protocol_conformance_records.swift
index 43e14bc..eccf7af 100644
--- a/test/IRGen/protocol_conformance_records.swift
+++ b/test/IRGen/protocol_conformance_records.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -enable-resilience -enable-source-import -I %S/../Inputs | FileCheck %s
-// RUN: %target-swift-frontend %s -emit-ir -num-threads 8 -enable-resilience -enable-source-import -I %S/../Inputs | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -enable-resilience -enable-source-import -I %S/../Inputs | %FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir -num-threads 8 -enable-resilience -enable-source-import -I %S/../Inputs | %FileCheck %s
 
 import resilient_struct
 
diff --git a/test/IRGen/protocol_conformance_records_objc.swift b/test/IRGen/protocol_conformance_records_objc.swift
index f649468..5603be2 100644
--- a/test/IRGen/protocol_conformance_records_objc.swift
+++ b/test/IRGen/protocol_conformance_records_objc.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-module -o %t %S/Inputs/objc_protocols_Bas.swift
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck %s
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir -num-threads 8 | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir -num-threads 8 | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/protocol_extensions.sil b/test/IRGen/protocol_extensions.sil
index 45b1edc..c57f326 100644
--- a/test/IRGen/protocol_extensions.sil
+++ b/test/IRGen/protocol_extensions.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/protocol_extensions_constrain.swift b/test/IRGen/protocol_extensions_constrain.swift
index d5ff564..e96e437 100644
--- a/test/IRGen/protocol_extensions_constrain.swift
+++ b/test/IRGen/protocol_extensions_constrain.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // rdar://20532214 -- Wrong code for witness method lookup lets executable crash
 
diff --git a/test/IRGen/protocol_metadata.swift b/test/IRGen/protocol_metadata.swift
index 9a939bf..ff4a7d9 100644
--- a/test/IRGen/protocol_metadata.swift
+++ b/test/IRGen/protocol_metadata.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/protocol_resilience.sil b/test/IRGen/protocol_resilience.sil
index b39a822..a5a7781 100644
--- a/test/IRGen/protocol_resilience.sil
+++ b/test/IRGen/protocol_resilience.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | FileCheck %s
+// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | %FileCheck %s
 // RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience -O %s
 
 sil_stage canonical
diff --git a/test/IRGen/rdar15304329.swift b/test/IRGen/rdar15304329.swift
index 807f761..601edd6 100644
--- a/test/IRGen/rdar15304329.swift
+++ b/test/IRGen/rdar15304329.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-irgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/IRGen/readonly.sil b/test/IRGen/readonly.sil
index 66540d1..b96647e 100644
--- a/test/IRGen/readonly.sil
+++ b/test/IRGen/readonly.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 //sil_stage canonical
 
 import Builtin
diff --git a/test/IRGen/reflection_metadata.swift b/test/IRGen/reflection_metadata.swift
index 214749e..1decf78 100644
--- a/test/IRGen/reflection_metadata.swift
+++ b/test/IRGen/reflection_metadata.swift
@@ -1,6 +1,6 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
-// RUN: %target-swift-frontend -disable-reflection-names -emit-ir %s | FileCheck %s --check-prefix=STRIP_REFLECTION_NAMES
-// RUN: %target-swift-frontend -disable-reflection-metadata -emit-ir %s | FileCheck %s --check-prefix=STRIP_REFLECTION_METADATA
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
+// RUN: %target-swift-frontend -disable-reflection-names -emit-ir %s | %FileCheck %s --check-prefix=STRIP_REFLECTION_NAMES
+// RUN: %target-swift-frontend -disable-reflection-metadata -emit-ir %s | %FileCheck %s --check-prefix=STRIP_REFLECTION_METADATA
 
 // STRIP_REFLECTION_NAMES_DAG: {{.*}}swift3_reflect
 // STRIP_REFLECTION_NAMES_DAG: {{.*}}swift3_fieldmd
diff --git a/test/IRGen/runtime_calling_conventions.swift b/test/IRGen/runtime_calling_conventions.swift
index ddb7b12..07f511e 100644
--- a/test/IRGen/runtime_calling_conventions.swift
+++ b/test/IRGen/runtime_calling_conventions.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-ir %s | FileCheck %s
-// RUN: %target-swift-frontend -parse-as-library -O -emit-ir %s | FileCheck --check-prefix=OPT-CHECK %s
+// RUN: %target-swift-frontend -parse-as-library -emit-ir %s | %FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -O -emit-ir %s | %FileCheck --check-prefix=OPT-CHECK %s
 
 // Test that runtime functions are invoked using the new calling convention.
 // Test that wrappers are used to invoked them.
diff --git a/test/IRGen/same_type_constraints.swift b/test/IRGen/same_type_constraints.swift
index fc17ae1..61bb861 100644
--- a/test/IRGen/same_type_constraints.swift
+++ b/test/IRGen/same_type_constraints.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir -primary-file %s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -primary-file %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // <rdar://problem/21665983> IRGen crash with protocol extension involving same-type constraint to X<T>
 public struct DefaultFoo<T> {
@@ -22,3 +22,23 @@
 public class C2<T: Equatable, U: P where T == U.Foo>: C1<T> {}
 
 // CHECK: define{{( protected)?}} void @_TFC21same_type_constraints2C1D
+
+public protocol MyHashable {}
+public protocol DataType : MyHashable {}
+
+public protocol E {
+  associatedtype Data: DataType
+}
+
+struct Dict<V : MyHashable, K> {}
+struct Val {}
+
+public class GenericKlazz<T: DataType, R: E> : E where R.Data == T
+{
+  public typealias Data = T
+
+  var d: Dict<T, Val>
+  init() {
+     d = Dict()
+  }
+}
diff --git a/test/IRGen/sanitize_coverage.swift b/test/IRGen/sanitize_coverage.swift
index 766b1c3..da38a3f 100644
--- a/test/IRGen/sanitize_coverage.swift
+++ b/test/IRGen/sanitize_coverage.swift
@@ -1,11 +1,11 @@
 // XFAIL: linux
-// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=func %s | FileCheck %s -check-prefix=SANCOV
-// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=bb %s | FileCheck %s -check-prefix=SANCOV
-// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge %s | FileCheck %s -check-prefix=SANCOV
-// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,trace-cmp %s | FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_TRACE_CMP
-// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,trace-bb %s | FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_TRACE_BB
-// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,indirect-calls %s | FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_INDIRECT_CALLS
-// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,8bit-counters %s | FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_8BIT_COUNTERS
+// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=func %s | %FileCheck %s -check-prefix=SANCOV
+// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=bb %s | %FileCheck %s -check-prefix=SANCOV
+// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge %s | %FileCheck %s -check-prefix=SANCOV
+// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,trace-cmp %s | %FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_TRACE_CMP
+// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,trace-bb %s | %FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_TRACE_BB
+// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,indirect-calls %s | %FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_INDIRECT_CALLS
+// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,8bit-counters %s | %FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_8BIT_COUNTERS
 
 import Darwin
 
diff --git a/test/IRGen/select_enum.sil b/test/IRGen/select_enum.sil
index aab1c02..c3225fe 100644
--- a/test/IRGen/select_enum.sil
+++ b/test/IRGen/select_enum.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -gnone -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -gnone -emit-ir %s | %FileCheck %s
 
 import Builtin
 
diff --git a/test/IRGen/select_enum_optimized.swift b/test/IRGen/select_enum_optimized.swift
index c2dbdeb..7ecf77b 100644
--- a/test/IRGen/select_enum_optimized.swift
+++ b/test/IRGen/select_enum_optimized.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -O -disable-llvm-optzns -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -O -disable-llvm-optzns -emit-ir | %FileCheck %s
 
 enum NoPayload {
   case E0
diff --git a/test/IRGen/select_enum_single_payload.sil b/test/IRGen/select_enum_single_payload.sil
index 29a4e12..8ec45bf 100644
--- a/test/IRGen/select_enum_single_payload.sil
+++ b/test/IRGen/select_enum_single_payload.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 sil_stage canonical
 
 import Builtin
diff --git a/test/IRGen/sil_generic_witness_methods.swift b/test/IRGen/sil_generic_witness_methods.swift
index e1befcb..60a545f 100644
--- a/test/IRGen/sil_generic_witness_methods.swift
+++ b/test/IRGen/sil_generic_witness_methods.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/sil_generic_witness_methods_objc.swift b/test/IRGen/sil_generic_witness_methods_objc.swift
index e5bba74..0656e08 100644
--- a/test/IRGen/sil_generic_witness_methods_objc.swift
+++ b/test/IRGen/sil_generic_witness_methods_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/sil_linkage.sil b/test/IRGen/sil_linkage.sil
index 64f3b28..87bdf9c 100644
--- a/test/IRGen/sil_linkage.sil
+++ b/test/IRGen/sil_linkage.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-disable-pass="External Defs To Decls" -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-disable-pass="External Defs To Decls" -emit-ir %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/IRGen/sil_witness_methods.sil b/test/IRGen/sil_witness_methods.sil
index bd35163..8a7e2c2 100644
--- a/test/IRGen/sil_witness_methods.sil
+++ b/test/IRGen/sil_witness_methods.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/sil_witness_tables.swift b/test/IRGen/sil_witness_tables.swift
index 8d73f72..099fa16 100644
--- a/test/IRGen/sil_witness_tables.swift
+++ b/test/IRGen/sil_witness_tables.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/sil_witness_tables_external_conformance.swift
-// RUN: %target-swift-frontend -I %t -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -I %t -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/sil_witness_tables_external_witnesstable.swift b/test/IRGen/sil_witness_tables_external_witnesstable.swift
index 136f8c0..b29ba84 100644
--- a/test/IRGen/sil_witness_tables_external_witnesstable.swift
+++ b/test/IRGen/sil_witness_tables_external_witnesstable.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module %S/Inputs/sil_witness_tables_external_input.swift -o %t/Swift.swiftmodule -parse-stdlib -parse-as-library -module-name Swift -sil-serialize-all -module-link-name swiftCore
-// RUN: %target-swift-frontend -I %t -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -I %t -primary-file %s -emit-ir | %FileCheck %s
 
 import Swift
 
diff --git a/test/IRGen/sil_witness_tables_inherited_conformance.swift b/test/IRGen/sil_witness_tables_inherited_conformance.swift
index d8b69dd..acf28a4 100644
--- a/test/IRGen/sil_witness_tables_inherited_conformance.swift
+++ b/test/IRGen/sil_witness_tables_inherited_conformance.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // rdar://problem/20628295
 
diff --git a/test/IRGen/special_protocols.sil b/test/IRGen/special_protocols.sil
index 8d73104..ce31cb3 100644
--- a/test/IRGen/special_protocols.sil
+++ b/test/IRGen/special_protocols.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir -parse-stdlib -module-name Swift | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend %s -emit-ir -parse-stdlib -module-name Swift | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 public protocol AnyObject: class {}
 // CHECK-LABEL: @_TMps9AnyObject = {{(protected )?}}constant %swift.protocol {
diff --git a/test/IRGen/static_initializer.sil b/test/IRGen/static_initializer.sil
index d71d3c2..b3acd0b 100644
--- a/test/IRGen/static_initializer.sil
+++ b/test/IRGen/static_initializer.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/struct_layout.sil b/test/IRGen/struct_layout.sil
index 1accf68..a08ca69 100644
--- a/test/IRGen/struct_layout.sil
+++ b/test/IRGen/struct_layout.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -module-name main -emit-ir -o - | FileCheck -check-prefix=%target-ptrsize %s
+// RUN: %target-swift-frontend %s -module-name main -emit-ir -o - | %FileCheck -check-prefix=%target-ptrsize %s
 
 import Builtin
 import Swift
diff --git a/test/IRGen/struct_resilience.swift b/test/IRGen/struct_resilience.swift
index 656d3ad..43f2aed 100644
--- a/test/IRGen/struct_resilience.swift
+++ b/test/IRGen/struct_resilience.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | FileCheck %s
+// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience %s | %FileCheck %s
 // RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-ir -enable-resilience -O %s
 
 import resilient_struct
diff --git a/test/IRGen/subclass.swift b/test/IRGen/subclass.swift
index 10a080a..c8911dd 100644
--- a/test/IRGen/subclass.swift
+++ b/test/IRGen/subclass.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // REQUIRES: objc_interop
diff --git a/test/IRGen/super.sil b/test/IRGen/super.sil
index f7d9966..66080f1 100644
--- a/test/IRGen/super.sil
+++ b/test/IRGen/super.sil
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -enable-resilience -I %t -module-name resilient_struct -o %t %S/../Inputs/resilient_struct.swift
 // RUN: %target-swift-frontend -emit-module -enable-resilience -I %t -module-name resilient_class -o %t %S/../Inputs/resilient_class.swift
-// RUN: %target-swift-frontend -enable-resilience -parse-sil -parse-as-library -emit-ir -I %t %s | FileCheck %s
+// RUN: %target-swift-frontend -enable-resilience -parse-sil -parse-as-library -emit-ir -I %t %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/IRGen/swift3-metadata-coff.swift b/test/IRGen/swift3-metadata-coff.swift
index dc76a4c..e39c04c 100644
--- a/test/IRGen/swift3-metadata-coff.swift
+++ b/test/IRGen/swift3-metadata-coff.swift
@@ -1,4 +1,4 @@
-// RUN: %swift -target thumbv7--windows-itanium -parse-stdlib -parse-as-library -module-name Swift -O -emit-ir %s -o - | FileCheck %s
+// RUN: %swift -target thumbv7--windows-itanium -parse-stdlib -parse-as-library -module-name Swift -O -emit-ir %s -o - | %FileCheck %s
 
 // REQUIRES: CODEGENERATOR=ARM
 
@@ -19,8 +19,10 @@
   public typealias T = Optional<S>
 }
 
+var gg = S()
+
 public func f(s : S) -> (() -> ()) {
-  return { _ = s }
+  return { gg = s }
 }
 
 // CHECK-DAG: @"\01l__swift3_capture_descriptor" = private constant {{.*}}, section ".sw3cptr"
diff --git a/test/IRGen/swift_native_objc_runtime_base.sil b/test/IRGen/swift_native_objc_runtime_base.sil
index aadc59c..798b7b6 100644
--- a/test/IRGen/swift_native_objc_runtime_base.sil
+++ b/test/IRGen/swift_native_objc_runtime_base.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 // REQUIRES: objc_interop
 
 // CHECK-LABEL: @_TMmC30swift_native_objc_runtime_base1C = hidden global %objc_class {
diff --git a/test/IRGen/tsan-attributes.swift b/test/IRGen/tsan-attributes.swift
index 20e934d..2a22807 100644
--- a/test/IRGen/tsan-attributes.swift
+++ b/test/IRGen/tsan-attributes.swift
@@ -1,6 +1,6 @@
 // This test verifies that we add the function attributes used by TSan.
 
-// RUN: %target-swift-frontend -emit-ir -sanitize=thread %s | FileCheck %s -check-prefix=TSAN
+// RUN: %target-swift-frontend -emit-ir -sanitize=thread %s | %FileCheck %s -check-prefix=TSAN
 
 // TSan is currently only supported on 64 bit mac and simulators.
 // (We do not test the simulators here.)
diff --git a/test/IRGen/type_layout.swift b/test/IRGen/type_layout.swift
index 586900c..363ea15 100644
--- a/test/IRGen/type_layout.swift
+++ b/test/IRGen/type_layout.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 class C {}
 
diff --git a/test/IRGen/type_layout_objc.swift b/test/IRGen/type_layout_objc.swift
index c45540e..e4c0285 100644
--- a/test/IRGen/type_layout_objc.swift
+++ b/test/IRGen/type_layout_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 
 import Foundation
diff --git a/test/IRGen/type_layout_reference_storage.swift b/test/IRGen/type_layout_reference_storage.swift
index 2a1a6f1..3396e14 100644
--- a/test/IRGen/type_layout_reference_storage.swift
+++ b/test/IRGen/type_layout_reference_storage.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK
 
 class C {}
 protocol P: class {}
diff --git a/test/IRGen/type_layout_reference_storage_objc.swift b/test/IRGen/type_layout_reference_storage_objc.swift
index 5104107..23a6ad6 100644
--- a/test/IRGen/type_layout_reference_storage_objc.swift
+++ b/test/IRGen/type_layout_reference_storage_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir %s | %FileCheck %s
 // REQUIRES: objc_interop
 
 import Foundation
diff --git a/test/IRGen/typed_boxes.sil b/test/IRGen/typed_boxes.sil
index a7abe34..ae7c860 100644
--- a/test/IRGen/typed_boxes.sil
+++ b/test/IRGen/typed_boxes.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 sil_stage canonical
 
 import Builtin
diff --git a/test/IRGen/typemetadata.sil b/test/IRGen/typemetadata.sil
index 5435a0c..fcdcbd6 100644
--- a/test/IRGen/typemetadata.sil
+++ b/test/IRGen/typemetadata.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // XFAIL: linux
diff --git a/test/IRGen/unconditional_checked_cast.sil b/test/IRGen/unconditional_checked_cast.sil
index 9eb37f8..33cd62e 100644
--- a/test/IRGen/unconditional_checked_cast.sil
+++ b/test/IRGen/unconditional_checked_cast.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/undef.sil b/test/IRGen/undef.sil
index f105eba..359f030 100644
--- a/test/IRGen/undef.sil
+++ b/test/IRGen/undef.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/unowned.sil b/test/IRGen/unowned.sil
index 9c6eb34..05af7d1 100644
--- a/test/IRGen/unowned.sil
+++ b/test/IRGen/unowned.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -disable-objc-interop -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -disable-objc-interop -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/unowned_objc.sil b/test/IRGen/unowned_objc.sil
index 97dc095..f6d646b 100644
--- a/test/IRGen/unowned_objc.sil
+++ b/test/IRGen/unowned_objc.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // XFAIL: linux
diff --git a/test/IRGen/unused.sil b/test/IRGen/unused.sil
index e72a75c..24ceafa 100644
--- a/test/IRGen/unused.sil
+++ b/test/IRGen/unused.sil
@@ -1,6 +1,6 @@
 // RUN: %target-swift-frontend -primary-file %s -emit-ir > %t
-// RUN: FileCheck %s --check-prefix=CHECK-%target-object-format --check-prefix=CHECK < %t
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t
+// RUN: %FileCheck %s --check-prefix=CHECK-%target-object-format --check-prefix=CHECK < %t
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/upcast.sil b/test/IRGen/upcast.sil
index 3b85b47..e292a1d 100644
--- a/test/IRGen/upcast.sil
+++ b/test/IRGen/upcast.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // Make sure that we are able to lower upcast addresses.
 
diff --git a/test/IRGen/value_buffers.sil b/test/IRGen/value_buffers.sil
index 36df17b..1bb90a1 100644
--- a/test/IRGen/value_buffers.sil
+++ b/test/IRGen/value_buffers.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/vector_reduction.swift b/test/IRGen/vector_reduction.swift
index 49b0484..0da5b4e 100644
--- a/test/IRGen/vector_reduction.swift
+++ b/test/IRGen/vector_reduction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Ounchecked %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -Ounchecked %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/vtable.sil b/test/IRGen/vtable.sil
index bf085f9..4fd9545 100644
--- a/test/IRGen/vtable.sil
+++ b/test/IRGen/vtable.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 // REQUIRES: executable_test
 
 // REQUIRES: CPU=x86_64
diff --git a/test/IRGen/vtable_multi_file.swift b/test/IRGen/vtable_multi_file.swift
index 18b7c2b..7602664 100644
--- a/test/IRGen/vtable_multi_file.swift
+++ b/test/IRGen/vtable_multi_file.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s %S/Inputs/vtable_multi_file_helper.swift -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s %S/Inputs/vtable_multi_file_helper.swift -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/weak.sil b/test/IRGen/weak.sil
index 7a6de6c..08e0e9b 100644
--- a/test/IRGen/weak.sil
+++ b/test/IRGen/weak.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 // XFAIL: linux
diff --git a/test/IRGen/weak_class_protocol.sil b/test/IRGen/weak_class_protocol.sil
index df1aabf..be1fcca 100644
--- a/test/IRGen/weak_class_protocol.sil
+++ b/test/IRGen/weak_class_protocol.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/weak_import.swift b/test/IRGen/weak_import.swift
index a347c87..edff1dc 100644
--- a/test/IRGen/weak_import.swift
+++ b/test/IRGen/weak_import.swift
@@ -4,8 +4,8 @@
 // Specify explicit target triples for the deployment target to test weak
 // linking for a symbol introduced in OS X 10.51.
 //
-// RUN: %target-swift-frontend(mock-sdk: -target x86_64-apple-macosx10.50 -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck -check-prefix=CHECK-10_50 %s
-// RUN: %target-swift-frontend(mock-sdk: -target x86_64-apple-macosx10.51 -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | FileCheck -check-prefix=CHECK-10_51 %s
+// RUN: %target-swift-frontend(mock-sdk: -target x86_64-apple-macosx10.50 -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck -check-prefix=CHECK-10_50 %s
+// RUN: %target-swift-frontend(mock-sdk: -target x86_64-apple-macosx10.51 -sdk %S/Inputs -I %t) -primary-file %s -emit-ir | %FileCheck -check-prefix=CHECK-10_51 %s
 
 // REQUIRES: OS=macosx
 // REQUIRES: objc_interop
diff --git a/test/IRGen/weak_value_witnesses.sil b/test/IRGen/weak_value_witnesses.sil
index ed32ce8..f0ea58a 100644
--- a/test/IRGen/weak_value_witnesses.sil
+++ b/test/IRGen/weak_value_witnesses.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
 
 // REQUIRES: CPU=x86_64
 
diff --git a/test/IRGen/witness_method.sil b/test/IRGen/witness_method.sil
index bc8dddd..bc7a26b 100644
--- a/test/IRGen/witness_method.sil
+++ b/test/IRGen/witness_method.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-ir | FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
+// RUN: %target-swift-frontend %s -emit-ir | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
 
 // REQUIRES: CPU=i386_or_x86_64
 
diff --git a/test/IRGen/witness_method_phi.sil b/test/IRGen/witness_method_phi.sil
index 5d926e5..9db61eb 100644
--- a/test/IRGen/witness_method_phi.sil
+++ b/test/IRGen/witness_method_phi.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/IRGen/witness_table_multifile.swift b/test/IRGen/witness_table_multifile.swift
index 832e10d..9108945 100644
--- a/test/IRGen/witness_table_multifile.swift
+++ b/test/IRGen/witness_table_multifile.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s %S/Inputs/witness_table_multifile_2.swift -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s %S/Inputs/witness_table_multifile_2.swift -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // CHECK: [[P_WITNESS_TABLE:%[A-Za-z0-9_]+]] = type { [{{24|12}} x i8], %swift.type*, i8** }
 
diff --git a/test/IRGen/witness_table_objc_associated_type.swift b/test/IRGen/witness_table_objc_associated_type.swift
index 32c0875..d6a741f 100644
--- a/test/IRGen/witness_table_objc_associated_type.swift
+++ b/test/IRGen/witness_table_objc_associated_type.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 protocol A {}
 
diff --git a/test/IRGen/zombies.swift b/test/IRGen/zombies.swift
index aaaf778..3373aed 100644
--- a/test/IRGen/zombies.swift
+++ b/test/IRGen/zombies.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -O -emit-ir | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -O -emit-ir | %FileCheck %s
 
 // rdar://24121475
 //   Ideally, these wouldn't be in the v-table at all; but as long as they
diff --git a/test/Inputs/ObjCBridging/Appliances.h b/test/Inputs/ObjCBridging/Appliances.h
index 2ed2832..61e6033 100644
--- a/test/Inputs/ObjCBridging/Appliances.h
+++ b/test/Inputs/ObjCBridging/Appliances.h
@@ -17,3 +17,7 @@
 @interface APPManufacturerInfo <DataType> : NSObject
 @property (nonatomic,nonnull,readonly) DataType value;
 @end
+
+@interface APPBroken : NSObject
+@property (nonatomic,nonnull,readonly) id thing;
+@end
diff --git a/test/Inputs/ObjCBridging/Appliances.m b/test/Inputs/ObjCBridging/Appliances.m
index 6c2fe4d..aea5482 100644
--- a/test/Inputs/ObjCBridging/Appliances.m
+++ b/test/Inputs/ObjCBridging/Appliances.m
@@ -26,3 +26,11 @@
 
 @implementation APPManufacturerInfo
 @end
+
+@implementation APPBroken
+
+- (id _Nonnull)thing {
+  return (id _Nonnull)nil;
+}
+
+@end
diff --git a/test/Inputs/clang-importer-sdk/usr/include/objc_generics.h b/test/Inputs/clang-importer-sdk/usr/include/objc_generics.h
index 672bcdc..fe1cef5 100644
--- a/test/Inputs/clang-importer-sdk/usr/include/objc_generics.h
+++ b/test/Inputs/clang-importer-sdk/usr/include/objc_generics.h
@@ -1,8 +1,18 @@
 #import <Foundation.h>
 
+#define _CF_TYPED_ENUM __attribute__((swift_wrapper(enum)))
+#define NS_STRING_ENUM _CF_TYPED_ENUM
+#define NS_SWIFT_NAME(Name) __attribute__((swift_name(#Name)))
+
+typedef NSString * GenericOption NS_STRING_ENUM;
+
+GenericOption const GenericOptionMultithreaded NS_SWIFT_NAME(multithreaded);
+
+
 @interface GenericClass<T> : NSObject
 - (id)initWithThing:(T)thing;
 - (id)initWithArrayOfThings:(NSArray<T> *__nonnull)things;
+- (id)initWithOptions:(nullable NSDictionary<GenericOption, id> *)options;
 - (void)dealloc;
 - (__nullable T)thing;
 - (int)count;
@@ -76,3 +86,5 @@
 - (void)doThing:(__nonnull T<Pettable>)thing;
 @end
 
+typedef id <Fungible> FungibleObject;
+
diff --git a/test/Interpreter/Inputs/ObjCClasses/ObjCClasses.h b/test/Interpreter/Inputs/ObjCClasses/ObjCClasses.h
index 2ae8506..dfee11d 100644
--- a/test/Interpreter/Inputs/ObjCClasses/ObjCClasses.h
+++ b/test/Interpreter/Inputs/ObjCClasses/ObjCClasses.h
@@ -98,6 +98,11 @@
 + (unsigned) count;
 @end
 
+@interface TestingBool : NSObject
+- (void) shouldBeTrueObjCBool: (BOOL)value;
+- (void) shouldBeTrueCBool: (_Bool)value;
+@end
+
 NS_ASSUME_NONNULL_END
 
 #endif
diff --git a/test/Interpreter/Inputs/ObjCClasses/ObjCClasses.m b/test/Interpreter/Inputs/ObjCClasses/ObjCClasses.m
index 88166a4..a2f714a 100644
--- a/test/Interpreter/Inputs/ObjCClasses/ObjCClasses.m
+++ b/test/Interpreter/Inputs/ObjCClasses/ObjCClasses.m
@@ -1,6 +1,7 @@
 #import "ObjCClasses.h"
 #import <Foundation/NSError.h>
 #include <stdio.h>
+#include <assert.h>
 
 @implementation HasHiddenIvars
 @synthesize x;
@@ -151,3 +152,15 @@
 }
 
 @end
+
+@implementation TestingBool
+
+- (void) shouldBeTrueObjCBool: (BOOL)value {
+  assert(value);
+}
+
+- (void) shouldBeTrueCBool: (_Bool)value {
+  assert(value);
+}
+
+@end
diff --git a/test/Interpreter/RosettaCode.swift b/test/Interpreter/RosettaCode.swift
index 8c37874..d62bc1b 100644
--- a/test/Interpreter/RosettaCode.swift
+++ b/test/Interpreter/RosettaCode.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // From http://rosettacode.org/wiki/Factorial
diff --git a/test/Interpreter/SDK/AnyObject_native_interop.swift b/test/Interpreter/SDK/AnyObject_native_interop.swift
index 36e6afd..88e3157 100644
--- a/test/Interpreter/SDK/AnyObject_native_interop.swift
+++ b/test/Interpreter/SDK/AnyObject_native_interop.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/CALayer.swift b/test/Interpreter/SDK/CALayer.swift
index 60360cc..de92786 100644
--- a/test/Interpreter/SDK/CALayer.swift
+++ b/test/Interpreter/SDK/CALayer.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 // <rdar://problem/17014037>
 // REQUIRES: OS=macosx
diff --git a/test/Interpreter/SDK/CGImportAsMember.swift b/test/Interpreter/SDK/CGImportAsMember.swift
index 51f5313..e829d6e 100644
--- a/test/Interpreter/SDK/CGImportAsMember.swift
+++ b/test/Interpreter/SDK/CGImportAsMember.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: OS=macosx
 
diff --git a/test/Interpreter/SDK/Cocoa_enums.swift b/test/Interpreter/SDK/Cocoa_enums.swift
index 0256ad1..3f376a6 100644
--- a/test/Interpreter/SDK/Cocoa_enums.swift
+++ b/test/Interpreter/SDK/Cocoa_enums.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/Cocoa_repl.swift b/test/Interpreter/SDK/Cocoa_repl.swift
index 9a0f7b1..de34645 100644
--- a/test/Interpreter/SDK/Cocoa_repl.swift
+++ b/test/Interpreter/SDK/Cocoa_repl.swift
@@ -1,4 +1,4 @@
-// RUN: %target-repl-run-simple-swift | FileCheck %s
+// RUN: %target-repl-run-simple-swift | %FileCheck %s
 
 // REQUIRES: objc_interop
 // REQUIRES: swift_repl
diff --git a/test/Interpreter/SDK/CoreFoundation_casting.swift b/test/Interpreter/SDK/CoreFoundation_casting.swift
index 6c07150..41bb74d 100644
--- a/test/Interpreter/SDK/CoreFoundation_casting.swift
+++ b/test/Interpreter/SDK/CoreFoundation_casting.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/CoreImage_without_Foundation.swift b/test/Interpreter/SDK/CoreImage_without_Foundation.swift
index e83ce1f..48e07e0 100644
--- a/test/Interpreter/SDK/CoreImage_without_Foundation.swift
+++ b/test/Interpreter/SDK/CoreImage_without_Foundation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/Foundation_CFString.swift b/test/Interpreter/SDK/Foundation_CFString.swift
index 563b768..e1485f8 100644
--- a/test/Interpreter/SDK/Foundation_CFString.swift
+++ b/test/Interpreter/SDK/Foundation_CFString.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/Foundation_NSExpression.swift b/test/Interpreter/SDK/Foundation_NSExpression.swift
index b06730f..7ecf9d5 100644
--- a/test/Interpreter/SDK/Foundation_NSExpression.swift
+++ b/test/Interpreter/SDK/Foundation_NSExpression.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 // rdar://16726530
 
diff --git a/test/Interpreter/SDK/Foundation_NSLocalizedString.swift b/test/Interpreter/SDK/Foundation_NSLocalizedString.swift
index a6681b2..4e4df80 100644
--- a/test/Interpreter/SDK/Foundation_NSLocalizedString.swift
+++ b/test/Interpreter/SDK/Foundation_NSLocalizedString.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/Foundation_NSLog.swift b/test/Interpreter/SDK/Foundation_NSLog.swift
index d95de40..7be29e5 100644
--- a/test/Interpreter/SDK/Foundation_NSLog.swift
+++ b/test/Interpreter/SDK/Foundation_NSLog.swift
@@ -5,7 +5,7 @@
 
 // RUN: %target-build-swift %s %t/NSLogIsWorking.o -import-objc-header %t/NSLogIsWorking.h -o %t/main
 // RUN: %target-run %t/main 2>%t/output.txt
-// RUN: (FileCheck %s < %t/output.txt) || (not FileCheck -check-prefix=CHECK-WORKING %s < %t/output.txt)
+// RUN: %FileCheck %s < %t/output.txt
 
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
@@ -13,7 +13,6 @@
 import Foundation
 
 // CHECK: working
-// CHECK-WORKING: working
 testNSLog()
 
 // CHECK: 1 is the loneliest number that you'll ever do
diff --git a/test/Interpreter/SDK/Foundation_NSPredicate.swift b/test/Interpreter/SDK/Foundation_NSPredicate.swift
index 0910a91..4cbea64 100644
--- a/test/Interpreter/SDK/Foundation_NSPredicate.swift
+++ b/test/Interpreter/SDK/Foundation_NSPredicate.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 // rdar://16726530
 
diff --git a/test/Interpreter/SDK/Foundation_NSRect.swift b/test/Interpreter/SDK/Foundation_NSRect.swift
index 5913dd8..fbea20b 100644
--- a/test/Interpreter/SDK/Foundation_NSRect.swift
+++ b/test/Interpreter/SDK/Foundation_NSRect.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // iOS doesn't have NSRect. iOS and OS X CGRect is tested elsewhere.
diff --git a/test/Interpreter/SDK/Foundation_NSString.swift b/test/Interpreter/SDK/Foundation_NSString.swift
index 2f48f2b..1522f3a 100644
--- a/test/Interpreter/SDK/Foundation_NSString.swift
+++ b/test/Interpreter/SDK/Foundation_NSString.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/Foundation_bridge.swift b/test/Interpreter/SDK/Foundation_bridge.swift
index 4653347..199bb98 100644
--- a/test/Interpreter/SDK/Foundation_bridge.swift
+++ b/test/Interpreter/SDK/Foundation_bridge.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir %t
 // RUN: %target-build-swift %s -import-objc-header %S/Inputs/Foundation_bridge.h -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/GLKit.swift b/test/Interpreter/SDK/GLKit.swift
index 356c053..6147b2f 100644
--- a/test/Interpreter/SDK/GLKit.swift
+++ b/test/Interpreter/SDK/GLKit.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // NOTE: Clang used to miscompile GLKit functions on i386. rdar://problem/19184403
diff --git a/test/Interpreter/SDK/GLKit_jit.swift b/test/Interpreter/SDK/GLKit_jit.swift
index 0e04dab..7144c84 100644
--- a/test/Interpreter/SDK/GLKit_jit.swift
+++ b/test/Interpreter/SDK/GLKit_jit.swift
@@ -1,6 +1,6 @@
 // Test GLKit.swift in JIT mode.
 // -module-name is necessary because of rdar://problem/14483032
-// RUN: %target-jit-run -module-name=main %S/GLKit.swift | FileCheck %S/GLKit.swift
+// RUN: %target-jit-run -module-name=main %S/GLKit.swift | %FileCheck %S/GLKit.swift
 
 // REQUIRES: objc_interop
 // REQUIRES: swift_interpreter
diff --git a/test/Interpreter/SDK/KVO.swift b/test/Interpreter/SDK/KVO.swift
index 37eabbe..ea3500b 100644
--- a/test/Interpreter/SDK/KVO.swift
+++ b/test/Interpreter/SDK/KVO.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/NSDecimal.swift b/test/Interpreter/SDK/NSDecimal.swift
index aa58698..f14530c 100644
--- a/test/Interpreter/SDK/NSDecimal.swift
+++ b/test/Interpreter/SDK/NSDecimal.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/OS_objects.swift b/test/Interpreter/SDK/OS_objects.swift
index 902a2b5..cf4af93 100644
--- a/test/Interpreter/SDK/OS_objects.swift
+++ b/test/Interpreter/SDK/OS_objects.swift
@@ -3,7 +3,7 @@
 //
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift %t/main.swift -I %S/Inputs/custom-modules/ -o %t/OS_objects -Xfrontend -disable-access-control
-// RUN: %target-run %t/OS_objects 2>&1 | FileCheck %s
+// RUN: %target-run %t/OS_objects 2>&1 | %FileCheck %s
 
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
diff --git a/test/Interpreter/SDK/Quartz_without_Foundation.swift b/test/Interpreter/SDK/Quartz_without_Foundation.swift
index 42c49e2..446ae40 100644
--- a/test/Interpreter/SDK/Quartz_without_Foundation.swift
+++ b/test/Interpreter/SDK/Quartz_without_Foundation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: OS=macosx
 
diff --git a/test/Interpreter/SDK/Reflection_KVO.swift b/test/Interpreter/SDK/Reflection_KVO.swift
index ff775e7..78e93dc 100644
--- a/test/Interpreter/SDK/Reflection_KVO.swift
+++ b/test/Interpreter/SDK/Reflection_KVO.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/UIActionSheetHack.swift b/test/Interpreter/SDK/UIActionSheetHack.swift
index 8b52aa8..442ff55 100644
--- a/test/Interpreter/SDK/UIActionSheetHack.swift
+++ b/test/Interpreter/SDK/UIActionSheetHack.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: OS=ios
 
diff --git a/test/Interpreter/SDK/UIApplicationMain.swift b/test/Interpreter/SDK/UIApplicationMain.swift
index ffd0c61..64ff6e7 100644
--- a/test/Interpreter/SDK/UIApplicationMain.swift
+++ b/test/Interpreter/SDK/UIApplicationMain.swift
@@ -3,7 +3,7 @@
 
 // We aren't yet able to run tests that require a UI context, so just try
 // building with the real SDK for now.
-// DISABLED: %target-run %t/main | FileCheck %s
+// DISABLED: %target-run %t/main | %FileCheck %s
 
 // REQUIRES: OS=ios
 
diff --git a/test/Interpreter/SDK/archiving_generic_swift_class.swift b/test/Interpreter/SDK/archiving_generic_swift_class.swift
index 2d071fb..8d6c24c 100644
--- a/test/Interpreter/SDK/archiving_generic_swift_class.swift
+++ b/test/Interpreter/SDK/archiving_generic_swift_class.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
 // UNSUPPORTED: OS=tvos
diff --git a/test/Interpreter/SDK/autorelease.swift b/test/Interpreter/SDK/autorelease.swift
index 9ded228..b85f676 100644
--- a/test/Interpreter/SDK/autorelease.swift
+++ b/test/Interpreter/SDK/autorelease.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift foo | FileCheck %s
+// RUN: %target-run-simple-swift foo | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/block_calls.swift b/test/Interpreter/SDK/block_calls.swift
index f3d3dc3..161c56a 100644
--- a/test/Interpreter/SDK/block_calls.swift
+++ b/test/Interpreter/SDK/block_calls.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/c_pointers.swift b/test/Interpreter/SDK/c_pointers.swift
index 3e577b3..186f798 100644
--- a/test/Interpreter/SDK/c_pointers.swift
+++ b/test/Interpreter/SDK/c_pointers.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-build-swift %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
@@ -127,7 +127,7 @@
 //
 
 var unsorted = [3, 14, 15, 9, 2, 6, 5]
-qsort(&unsorted, unsorted.count, MemoryLayout._ofInstance(unsorted[0]).size) { a, b in
+qsort(&unsorted, unsorted.count, MemoryLayout.size(ofValue: unsorted[0])) { a, b in
   return Int32(a!.load(as: Int.self) - b!.load(as: Int.self))
 }
 // CHECK-NEXT: [2, 3, 5, 6, 9, 14, 15]
diff --git a/test/Interpreter/SDK/class_as_object.swift b/test/Interpreter/SDK/class_as_object.swift
index f55775d..7acaab1 100644
--- a/test/Interpreter/SDK/class_as_object.swift
+++ b/test/Interpreter/SDK/class_as_object.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir %t
 // RUN: %target-build-swift %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/dictionary_pattern_matching.swift b/test/Interpreter/SDK/dictionary_pattern_matching.swift
index 91d03e0..8380fcf 100644
--- a/test/Interpreter/SDK/dictionary_pattern_matching.swift
+++ b/test/Interpreter/SDK/dictionary_pattern_matching.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/equatable_hashable.swift b/test/Interpreter/SDK/equatable_hashable.swift
index 498949d..e33e3d8 100644
--- a/test/Interpreter/SDK/equatable_hashable.swift
+++ b/test/Interpreter/SDK/equatable_hashable.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/glob.swift b/test/Interpreter/SDK/glob.swift
index 846fd05..71ac575 100644
--- a/test/Interpreter/SDK/glob.swift
+++ b/test/Interpreter/SDK/glob.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/header_static.swift b/test/Interpreter/SDK/header_static.swift
index d80f532..78f9c55 100644
--- a/test/Interpreter/SDK/header_static.swift
+++ b/test/Interpreter/SDK/header_static.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/interpret_with_options.swift b/test/Interpreter/SDK/interpret_with_options.swift
index fdbff58..39b524b 100644
--- a/test/Interpreter/SDK/interpret_with_options.swift
+++ b/test/Interpreter/SDK/interpret_with_options.swift
@@ -1,8 +1,8 @@
-// RUN: %swift_driver -sdk %sdk %s | FileCheck -check-prefix=WITHOUT-LIB %s
-// RUN: %swift_driver -sdk %sdk -L %S/Inputs/ -lTestLoad %s | FileCheck -check-prefix=WITH-LIB %s
-// RUN: %swift_driver -sdk %sdk -L %S/Inputs/ -llibTestLoad.dylib %s | FileCheck -check-prefix=WITH-LIB %s
-// RUN: %swift_driver -sdk %sdk -l%S/Inputs/libTestLoad.dylib %s | FileCheck -check-prefix=WITH-LIB %s
-// RUN: cd %S && %swift_driver -sdk %sdk -lInputs/libTestLoad.dylib %s | FileCheck -check-prefix=WITH-LIB %s
+// RUN: %swift_driver -sdk %sdk %s | %FileCheck -check-prefix=WITHOUT-LIB %s
+// RUN: %swift_driver -sdk %sdk -L %S/Inputs/ -lTestLoad %s | %FileCheck -check-prefix=WITH-LIB %s
+// RUN: %swift_driver -sdk %sdk -L %S/Inputs/ -llibTestLoad.dylib %s | %FileCheck -check-prefix=WITH-LIB %s
+// RUN: %swift_driver -sdk %sdk -l%S/Inputs/libTestLoad.dylib %s | %FileCheck -check-prefix=WITH-LIB %s
+// RUN: cd %S && %swift_driver -sdk %sdk -lInputs/libTestLoad.dylib %s | %FileCheck -check-prefix=WITH-LIB %s
 // REQUIRES: OS=macosx
 
 import ObjectiveC
diff --git a/test/Interpreter/SDK/libc.swift b/test/Interpreter/SDK/libc.swift
index 506918c..2325fc0 100644
--- a/test/Interpreter/SDK/libc.swift
+++ b/test/Interpreter/SDK/libc.swift
@@ -2,7 +2,7 @@
 // Do not edit the line above.
 
 // RUN: rm -rf %t  &&  mkdir -p %t
-// RUN: %target-run-simple-swift %s %t | FileCheck %s
+// RUN: %target-run-simple-swift %s %t | %FileCheck %s
 // rdar://26960623
 // REQUIRES: disabled
 // REQUIRES: executable_test
diff --git a/test/Interpreter/SDK/mapkit_header_static.swift b/test/Interpreter/SDK/mapkit_header_static.swift
index e5667db..48a3189 100644
--- a/test/Interpreter/SDK/mapkit_header_static.swift
+++ b/test/Interpreter/SDK/mapkit_header_static.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/missing_imports_repl.swift b/test/Interpreter/SDK/missing_imports_repl.swift
index 944f289..9e22dfb 100644
--- a/test/Interpreter/SDK/missing_imports_repl.swift
+++ b/test/Interpreter/SDK/missing_imports_repl.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: touch %t/Corrupted_Module.swiftmodule
-// RUN: not %target-repl-run-simple-swift -I %t 2> %t/stderr.txt | FileCheck %s
-// RUN: FileCheck -check-prefix CHECK-ERROR %s < %t/stderr.txt
+// RUN: not %target-repl-run-simple-swift -I %t 2> %t/stderr.txt | %FileCheck %s
+// RUN: %FileCheck -check-prefix CHECK-ERROR %s < %t/stderr.txt
 
 // REQUIRES: objc_interop
 // REQUIRES: swift_repl
diff --git a/test/Interpreter/SDK/multi-file-imported-enum.swift b/test/Interpreter/SDK/multi-file-imported-enum.swift
index 02407d6..aefa17f 100644
--- a/test/Interpreter/SDK/multi-file-imported-enum.swift
+++ b/test/Interpreter/SDK/multi-file-imported-enum.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-build-swift -module-name test -whole-module-optimization %s %S/Inputs/multi-file-imported-enum/main.swift -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 // XFAIL: linux
diff --git a/test/Interpreter/SDK/objc_block_generic.swift b/test/Interpreter/SDK/objc_block_generic.swift
index aac1075..5f967ee 100644
--- a/test/Interpreter/SDK/objc_block_generic.swift
+++ b/test/Interpreter/SDK/objc_block_generic.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_bridge.swift b/test/Interpreter/SDK/objc_bridge.swift
index 2513321..342333d 100644
--- a/test/Interpreter/SDK/objc_bridge.swift
+++ b/test/Interpreter/SDK/objc_bridge.swift
@@ -9,7 +9,7 @@
 // RUN: %target-build-swift -c -parse-as-library -I %S/../../Inputs/ObjCBridging %S/../../Inputs/ObjCBridging/Appliances.swift -module-name Appliances -o %t/AppliancesSwift.o
 
 // RUN: %target-build-swift -I %t -I %S/../../Inputs/ObjCBridging %s %t/AppliancesSwift.o %t/AppliancesObjC.o -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
@@ -47,5 +47,12 @@
   print("Fridge has temperature \(f2.temperature)")
 }
 
+// Check improper nullability auditing of `id` interfaces. `nil` should come
+// through as a nonnull `Any` without crashing.
+autoreleasepool {
+  let broken = APPBroken()
+  let thing = broken.thing
+}
+
 // CHECK: DONE
 print("DONE")
diff --git a/test/Interpreter/SDK/objc_bridge_cast.swift b/test/Interpreter/SDK/objc_bridge_cast.swift
index de30f54..5eb1e0c 100644
--- a/test/Interpreter/SDK/objc_bridge_cast.swift
+++ b/test/Interpreter/SDK/objc_bridge_cast.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_cast.swift b/test/Interpreter/SDK/objc_cast.swift
index 3ee96f3..2786902 100644
--- a/test/Interpreter/SDK/objc_cast.swift
+++ b/test/Interpreter/SDK/objc_cast.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // rdar://problem/27616753
diff --git a/test/Interpreter/SDK/objc_currying.swift b/test/Interpreter/SDK/objc_currying.swift
index ca502e3..6c8cb5e 100644
--- a/test/Interpreter/SDK/objc_currying.swift
+++ b/test/Interpreter/SDK/objc_currying.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_dealloc.swift b/test/Interpreter/SDK/objc_dealloc.swift
index 1193f5f..9e30d17 100644
--- a/test/Interpreter/SDK/objc_dealloc.swift
+++ b/test/Interpreter/SDK/objc_dealloc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_dynamic_lookup.swift b/test/Interpreter/SDK/objc_dynamic_lookup.swift
index 72ee148..2d74305 100644
--- a/test/Interpreter/SDK/objc_dynamic_lookup.swift
+++ b/test/Interpreter/SDK/objc_dynamic_lookup.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_extensions.swift b/test/Interpreter/SDK/objc_extensions.swift
index f528fb6..4088e33 100644
--- a/test/Interpreter/SDK/objc_extensions.swift
+++ b/test/Interpreter/SDK/objc_extensions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_factory_method.swift b/test/Interpreter/SDK/objc_factory_method.swift
index 9405b93..6a8db76 100644
--- a/test/Interpreter/SDK/objc_factory_method.swift
+++ b/test/Interpreter/SDK/objc_factory_method.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir %t
 // RUN: %target-build-swift -module-name FactoryTest %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: OS=macosx
 
diff --git a/test/Interpreter/SDK/objc_fast_enumeration.swift b/test/Interpreter/SDK/objc_fast_enumeration.swift
index fba5d7d..72a1668 100644
--- a/test/Interpreter/SDK/objc_fast_enumeration.swift
+++ b/test/Interpreter/SDK/objc_fast_enumeration.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_inner_pointer.swift b/test/Interpreter/SDK/objc_inner_pointer.swift
index 288a74e..44f893b 100644
--- a/test/Interpreter/SDK/objc_inner_pointer.swift
+++ b/test/Interpreter/SDK/objc_inner_pointer.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_keypath.swift b/test/Interpreter/SDK/objc_keypath.swift
index bd7b0d2..5a7c6d7 100644
--- a/test/Interpreter/SDK/objc_keypath.swift
+++ b/test/Interpreter/SDK/objc_keypath.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_mangling.swift b/test/Interpreter/SDK/objc_mangling.swift
index 331e6eb..3a44060 100644
--- a/test/Interpreter/SDK/objc_mangling.swift
+++ b/test/Interpreter/SDK/objc_mangling.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir %t
 // RUN: %target-build-swift -module-name MangleTest %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_nil.swift b/test/Interpreter/SDK/objc_nil.swift
index 1a3f5dd..a2d9027 100644
--- a/test/Interpreter/SDK/objc_nil.swift
+++ b/test/Interpreter/SDK/objc_nil.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_nsstring_bridge.swift b/test/Interpreter/SDK/objc_nsstring_bridge.swift
index ec4c4b8..3fa0be9 100644
--- a/test/Interpreter/SDK/objc_nsstring_bridge.swift
+++ b/test/Interpreter/SDK/objc_nsstring_bridge.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_protocol_lookup.swift b/test/Interpreter/SDK/objc_protocol_lookup.swift
index 1668464..ff76a2e 100644
--- a/test/Interpreter/SDK/objc_protocol_lookup.swift
+++ b/test/Interpreter/SDK/objc_protocol_lookup.swift
@@ -1,5 +1,5 @@
 // Check JIT mode
-// RUN: %target-jit-run %s | FileCheck %s
+// RUN: %target-jit-run %s | %FileCheck %s
 
 // REQUIRES: swift_interpreter
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_protocol_lookup_jit.swift b/test/Interpreter/SDK/objc_protocol_lookup_jit.swift
index ce7418f..ef07162 100644
--- a/test/Interpreter/SDK/objc_protocol_lookup_jit.swift
+++ b/test/Interpreter/SDK/objc_protocol_lookup_jit.swift
@@ -1,5 +1,5 @@
 // Test objc_protocol_lookup.swift in JIT mode.
-// RUN: %target-jit-run %S/objc_protocol_lookup.swift | FileCheck %S/objc_protocol_lookup.swift
+// RUN: %target-jit-run %S/objc_protocol_lookup.swift | %FileCheck %S/objc_protocol_lookup.swift
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
 
diff --git a/test/Interpreter/SDK/objc_subclass.swift b/test/Interpreter/SDK/objc_subclass.swift
index b739165..4aa7aed 100644
--- a/test/Interpreter/SDK/objc_subclass.swift
+++ b/test/Interpreter/SDK/objc_subclass.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift foo | FileCheck %s
+// RUN: %target-run-simple-swift foo | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_switch.swift b/test/Interpreter/SDK/objc_switch.swift
index 55426e9..6e6be8a 100644
--- a/test/Interpreter/SDK/objc_switch.swift
+++ b/test/Interpreter/SDK/objc_switch.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_unowned.swift b/test/Interpreter/SDK/objc_unowned.swift
index ca4d9f5..fc75dc0 100644
--- a/test/Interpreter/SDK/objc_unowned.swift
+++ b/test/Interpreter/SDK/objc_unowned.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/objc_witness_to_swift_protocol.swift b/test/Interpreter/SDK/objc_witness_to_swift_protocol.swift
index c23025f..bf677bb 100644
--- a/test/Interpreter/SDK/objc_witness_to_swift_protocol.swift
+++ b/test/Interpreter/SDK/objc_witness_to_swift_protocol.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/protocol_lookup_foreign.swift b/test/Interpreter/SDK/protocol_lookup_foreign.swift
index 66ab529..df51586 100644
--- a/test/Interpreter/SDK/protocol_lookup_foreign.swift
+++ b/test/Interpreter/SDK/protocol_lookup_foreign.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/SDK/weak_objc_interop.swift b/test/Interpreter/SDK/weak_objc_interop.swift
index 026b79d..f2598ab 100644
--- a/test/Interpreter/SDK/weak_objc_interop.swift
+++ b/test/Interpreter/SDK/weak_objc_interop.swift
@@ -4,7 +4,7 @@
 // RUN: cp %s %t/main.swift
 // RUN: %target-clang -fobjc-arc %S/Inputs/ObjCWeak/ObjCWeak.m -c -o %t/ObjCWeak.o
 // RUN: %target-build-swift %t/main.swift -I %S/Inputs/ObjCWeak/ -Xlinker %t/ObjCWeak.o -o %t/weak_objc_interop -Xfrontend -disable-access-control
-// RUN: %target-run %t/weak_objc_interop 2>&1 | FileCheck %s
+// RUN: %target-run %t/weak_objc_interop 2>&1 | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/algorithms.swift b/test/Interpreter/algorithms.swift
index 54a40ac..90d96a3 100644
--- a/test/Interpreter/algorithms.swift
+++ b/test/Interpreter/algorithms.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 func fib() {
diff --git a/test/Interpreter/archetype_casts.swift b/test/Interpreter/archetype_casts.swift
index 289f453..213ad67 100644
--- a/test/Interpreter/archetype_casts.swift
+++ b/test/Interpreter/archetype_casts.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 class C {
diff --git a/test/Interpreter/array_of_optional.swift b/test/Interpreter/array_of_optional.swift
index db3740b..1860c61 100644
--- a/test/Interpreter/array_of_optional.swift
+++ b/test/Interpreter/array_of_optional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // <rdar://problem/15609900>
diff --git a/test/Interpreter/arrays.swift b/test/Interpreter/arrays.swift
index ff94adb..b3a60b8 100644
--- a/test/Interpreter/arrays.swift
+++ b/test/Interpreter/arrays.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // Create a new array
diff --git a/test/Interpreter/availability_weak_linking.swift b/test/Interpreter/availability_weak_linking.swift
index 7115b2e..35a7cd8 100644
--- a/test/Interpreter/availability_weak_linking.swift
+++ b/test/Interpreter/availability_weak_linking.swift
@@ -12,8 +12,8 @@
 // at run time.
 // RUN: mv %t/FakeUnavailableObjCFramework.framework %t/FakeUnavailableObjCFramework-MovedAside.framework
 
-// RUN: %target-run %t/UseWeaklinkedUnavailableObjCFramework | FileCheck %s
-// RUN: %target-run %t/UseWeaklinkedUnavailableObjCFramework.opt | FileCheck %s
+// RUN: %target-run %t/UseWeaklinkedUnavailableObjCFramework | %FileCheck %s
+// RUN: %target-run %t/UseWeaklinkedUnavailableObjCFramework.opt | %FileCheck %s
 
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
diff --git a/test/Interpreter/binary_operator_perf.swift b/test/Interpreter/binary_operator_perf.swift
index 7b868c4..ad2bb04 100644
--- a/test/Interpreter/binary_operator_perf.swift
+++ b/test/Interpreter/binary_operator_perf.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 var test1 =
diff --git a/test/Interpreter/bitvector.swift b/test/Interpreter/bitvector.swift
index 700ec43..82d3033 100644
--- a/test/Interpreter/bitvector.swift
+++ b/test/Interpreter/bitvector.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/test/Interpreter/bool_as_generic.swift b/test/Interpreter/bool_as_generic.swift
index 5febd58..f5b55da 100644
--- a/test/Interpreter/bool_as_generic.swift
+++ b/test/Interpreter/bool_as_generic.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 // <rdar://problem/13986638> Missing Bool metadata when Bool is used as a generic
 // parameter or existential value
diff --git a/test/Interpreter/break_continue.swift b/test/Interpreter/break_continue.swift
index 534b8a6..8b8be0f 100644
--- a/test/Interpreter/break_continue.swift
+++ b/test/Interpreter/break_continue.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 func test4() {
diff --git a/test/Interpreter/builtin.swift b/test/Interpreter/builtin.swift
index 1fc35c4..514b30c 100644
--- a/test/Interpreter/builtin.swift
+++ b/test/Interpreter/builtin.swift
@@ -1,6 +1,6 @@
 // RUN: mkdir -p %t
 // RUN: %target-build-swift %s -parse-stdlib -Xfrontend -disable-access-control -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/test/Interpreter/builtin_bridge_object.swift b/test/Interpreter/builtin_bridge_object.swift
index a993b02..6f4adee 100644
--- a/test/Interpreter/builtin_bridge_object.swift
+++ b/test/Interpreter/builtin_bridge_object.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir -p %t
 // RUN: %target-build-swift -parse-stdlib %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 // FIXME: rdar://problem/19648117 Needs splitting objc parts out
diff --git a/test/Interpreter/capture_inout.swift b/test/Interpreter/capture_inout.swift
index 60d69e8..1b9d54d 100644
--- a/test/Interpreter/capture_inout.swift
+++ b/test/Interpreter/capture_inout.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 func foo(_ x: inout Int) {
diff --git a/test/Interpreter/capture_top_level.swift b/test/Interpreter/capture_top_level.swift
index d6fc518..732491c 100644
--- a/test/Interpreter/capture_top_level.swift
+++ b/test/Interpreter/capture_top_level.swift
@@ -1,10 +1,10 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 
 // RUN: %target-build-swift -DVAR %s -o %t-var
-// RUN: %target-run %t-var | FileCheck %s
+// RUN: %target-run %t-var | %FileCheck %s
 
 // RUN: %target-build-swift -DVAR_UPDATE %s -o %t-var
-// RUN: %target-run %t-var | FileCheck %s
+// RUN: %target-run %t-var | %FileCheck %s
 
 // REQUIRES: executable_test
 
diff --git a/test/Interpreter/capture_unowned.swift b/test/Interpreter/capture_unowned.swift
index 275b5ad..d0607a2 100644
--- a/test/Interpreter/capture_unowned.swift
+++ b/test/Interpreter/capture_unowned.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 class C {
diff --git a/test/Interpreter/classes.swift b/test/Interpreter/classes.swift
index c7042c6..81c8636 100644
--- a/test/Interpreter/classes.swift
+++ b/test/Interpreter/classes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 class Interval {
diff --git a/test/Interpreter/closures.swift b/test/Interpreter/closures.swift
index d408604..33d5eb6 100644
--- a/test/Interpreter/closures.swift
+++ b/test/Interpreter/closures.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 func localFunc(_ x: Int) -> Int {
diff --git a/test/Interpreter/collection_casts.swift b/test/Interpreter/collection_casts.swift
index 3600f57..c8a3fc5 100644
--- a/test/Interpreter/collection_casts.swift
+++ b/test/Interpreter/collection_casts.swift
@@ -1,9 +1,9 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
-// RUN: %target-build-swift %s -Xfrontend -enable-experimental-collection-casts -o %t/main
-// RUN: %target-build-swift %s -Xfrontend -enable-experimental-collection-casts -o %t/main-optimized
-// RUN: %target-run %t/main | FileCheck %s
-// RUN: %target-run %t/main-optimized | FileCheck %s
+// RUN: %target-build-swift %s -o %t/main
+// RUN: %target-build-swift %s -o %t/main-optimized
+// RUN: %target-run %t/main | %FileCheck %s
+// RUN: %target-run %t/main-optimized | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol Preening {
diff --git a/test/Interpreter/constructor.swift b/test/Interpreter/constructor.swift
index 24d4155..bb05e0c 100644
--- a/test/Interpreter/constructor.swift
+++ b/test/Interpreter/constructor.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 class A {
diff --git a/test/Interpreter/conversions.swift b/test/Interpreter/conversions.swift
index fa5afcc..2fb757b 100644
--- a/test/Interpreter/conversions.swift
+++ b/test/Interpreter/conversions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 class B {     func foo() { print("foo") } }
diff --git a/test/Interpreter/currying_generics.swift b/test/Interpreter/currying_generics.swift
index 4e35503..4a162d6 100644
--- a/test/Interpreter/currying_generics.swift
+++ b/test/Interpreter/currying_generics.swift
@@ -1,11 +1,11 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
-func curry<T, U, V>(_ f: @escaping (T, U) -> V) -> @escaping (T) -> @escaping (U) -> V {
+func curry<T, U, V>(_ f: @escaping (T, U) -> V) -> (T) -> (U) -> V {
   return { x in { y in f(x, y) } }
 }
 
-func curry<T1, T2, T3, T4>(_ f: @escaping (T1, T2, T3) -> T4) -> @escaping (T1) -> @escaping (T2) -> @escaping (T3) -> T4 {
+func curry<T1, T2, T3, T4>(_ f: @escaping (T1, T2, T3) -> T4) -> (T1) -> (T2) -> (T3) -> T4 {
   return { x in { y in { z in f(x, y, z) } } }
 }
 
@@ -91,7 +91,7 @@
 
 // rdar://problem/18988428
 
-func clamp<T: Comparable>(_ minValue: T, _ maxValue: T) -> @escaping (_ n: T) -> T {
+func clamp<T: Comparable>(_ minValue: T, _ maxValue: T) -> (T) -> T {
     return { n in max(minValue, min(n, maxValue)) }
 }
 
@@ -109,8 +109,8 @@
 	return { b in (a,b) }
 }
 
-infix operator <+> { }
-func <+><T,U,V> (lhs: T?, rhs: @escaping (T) -> @escaping (U) -> V) -> @escaping (U) -> V? {
+infix operator <+>
+func <+><T,U,V> (lhs: T?, rhs: @escaping (T) -> (U) -> V) -> (U) -> V? {
 	if let x = lhs {
 		return { y in .some(rhs(x)(y)) }
 	} else {
@@ -130,11 +130,11 @@
 struct Identity<A> { let value: A }
 struct Const<A, B> { let value: A }
 
-func fmap<A, B>(_ f: @escaping (A) -> B) -> @escaping (Identity<A>) -> Identity<B> {
+func fmap<A, B>(_ f: @escaping (A) -> B) -> (Identity<A>) -> Identity<B> {
 	return { identity in Identity(value: f(identity.value)) }
 }
 
-func fmap<A, B>(_ f: @escaping (A) -> B) -> @escaping (Const<A, B>) -> Const<A, B> {
+func fmap<A, B>(_ f: @escaping (A) -> B) -> (Const<A, B>) -> Const<A, B> {
 	return { const in const }
 }
 
@@ -160,44 +160,38 @@
 }
 
 
-func view<S, A>(_ lens: @escaping (@escaping (A) -> Const<A, S>) -> @escaping (S) -> @escaping (@escaping (@escaping (A) -> S) -> @escaping (Const<A, S>) -> Const<A, S>) -> Const<A, S>) -> @escaping (S) -> A {
+func view<S, A>(_ lens: @escaping (@escaping (A) -> Const<A, S>) -> (S) -> (@escaping (@escaping (A) -> S) -> (Const<A, S>) -> Const<A, S>) -> Const<A, S>) -> (S) -> A {
 	return { s in getConst(lens(_Const)(s)(fmap)) }
 }
 
-func over<S, A>(_ lens: @escaping (@escaping (A) -> Identity<A>) -> @escaping (S) -> @escaping (@escaping (@escaping (A) -> S) -> @escaping (Identity<A>) -> Identity<S>) -> Identity<S>) -> @escaping (@escaping (A) -> A) -> @escaping (S) -> S {
+func over<S, A>(_ lens: @escaping (@escaping (A) -> Identity<A>) -> (S) -> (@escaping (@escaping (A) -> S) -> (Identity<A>) -> Identity<S>) -> Identity<S>) -> (@escaping (A) -> A) -> (S) -> S {
 	return { f in { s in runIdentity(lens({ _Identity(f($0)) })(s)(fmap)) } }
 }
 
-func set<S, A>(_ lens: @escaping (@escaping (A) -> Identity<A>) -> @escaping (S) -> @escaping (@escaping (@escaping (A) -> S) -> @escaping (Identity<A>) -> Identity<S>) -> Identity<S>) -> @escaping (A) -> @escaping (S) -> S {
+func set<S, A>(_ lens: @escaping (@escaping (A) -> Identity<A>) -> (S) -> (@escaping (@escaping (A) -> S) -> (Identity<A>) -> Identity<S>) -> Identity<S>) -> (A) -> (S) -> S {
 	return { x in { y in over(lens)(const(x))(y) } }
 }
 
-func _1<A, B, C, D>(_ f: @escaping (A) -> C) -> @escaping (A, B) -> @escaping (@escaping (@escaping (A) -> (A, B)) -> @escaping (C) -> D) -> D {
+func _1<A, B, C, D>(_ f: @escaping (A) -> C) -> (A, B) -> (@escaping (@escaping (A) -> (A, B)) -> (C) -> D) -> D {
 	return { (x, y) in { fmap in fmap({ ($0, y) })(f(x)) } }
 }
 
-func _2<A, B, C, D>(_ f: @escaping (B) -> C) -> @escaping (A, B) -> @escaping (@escaping (@escaping (B) -> (A, B)) -> @escaping (C) -> D) -> D {
+func _2<A, B, C, D>(_ f: @escaping (B) -> C) -> (A, B) -> (@escaping (@escaping (B) -> (A, B)) -> (C) -> D) -> D {
     return { (x, y) in { fmap in fmap({ (x, $0) })(f(y)) } }
 }
 
 
-public func >>> <T, U, V> (f: @escaping (T) -> U, g: @escaping (U) -> V) -> @escaping (T) -> V {
+public func >>> <T, U, V> (f: @escaping (T) -> U, g: @escaping (U) -> V) -> (T) -> V {
 	return { g(f($0)) }
 }
 
-public func <<< <T, U, V> (f: @escaping (U) -> V, g: @escaping (T) -> U) -> @escaping (T) -> V {
+public func <<< <T, U, V> (f: @escaping (U) -> V, g: @escaping (T) -> U) -> (T) -> V {
 	return { f(g($0)) }
 }
 
 
-infix operator >>> {
-	associativity right
-	precedence 170
-}
-infix operator <<< {
-	associativity right
-	precedence 170
-}
+infix operator >>>
+infix operator <<<
 
 let pt1 = view(_1)((1, 2))
 print(pt1) // CHECK-NEXT: 1
diff --git a/test/Interpreter/currying_protocols.swift b/test/Interpreter/currying_protocols.swift
index 0ad9b01..88f3ae4 100644
--- a/test/Interpreter/currying_protocols.swift
+++ b/test/Interpreter/currying_protocols.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 enum Medal {
diff --git a/test/Interpreter/defer.swift b/test/Interpreter/defer.swift
index cd0c311..5e75a93 100644
--- a/test/Interpreter/defer.swift
+++ b/test/Interpreter/defer.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 do {
diff --git a/test/Interpreter/destructors.swift b/test/Interpreter/destructors.swift
index b3c1974..818d3c2 100644
--- a/test/Interpreter/destructors.swift
+++ b/test/Interpreter/destructors.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 class C {
diff --git a/test/Interpreter/dynamic_lookup.swift b/test/Interpreter/dynamic_lookup.swift
index 3b748f6..e907930 100644
--- a/test/Interpreter/dynamic_lookup.swift
+++ b/test/Interpreter/dynamic_lookup.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/dynamic_self.swift b/test/Interpreter/dynamic_self.swift
index 2748597..da52607 100644
--- a/test/Interpreter/dynamic_self.swift
+++ b/test/Interpreter/dynamic_self.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // Test IR generation via execution for Self.
diff --git a/test/Interpreter/enum.swift b/test/Interpreter/enum.swift
index adac8ae..fb72a04 100644
--- a/test/Interpreter/enum.swift
+++ b/test/Interpreter/enum.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir %t
 // RUN: %target-build-swift %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 enum Singleton {
@@ -440,7 +440,7 @@
   }
 }
 func test_optional_generic_tuple<T>(_ a: OptionalTuple<T>) -> T {
-  print("optional pair is same size as pair: \(MemoryLayout._ofInstance(a).size == MemoryLayout<T>.size*2)")
+  print("optional pair is same size as pair: \(MemoryLayout.size(ofValue: a) == MemoryLayout<T>.size*2)")
   return a.value!.0
 }
 print("Int result: \(test_optional_generic_tuple(OptionalTuple<Int>((5, 6))))")
diff --git a/test/Interpreter/enum_runtime_alignment.swift b/test/Interpreter/enum_runtime_alignment.swift
index 7d4123e..5602952 100644
--- a/test/Interpreter/enum_runtime_alignment.swift
+++ b/test/Interpreter/enum_runtime_alignment.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 
 // REQUIRES: executable_test
 
diff --git a/test/Interpreter/formal_access.swift b/test/Interpreter/formal_access.swift
index 30420eb..e101cf8 100644
--- a/test/Interpreter/formal_access.swift
+++ b/test/Interpreter/formal_access.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 class C: CustomStringConvertible {
diff --git a/test/Interpreter/fractal.swift b/test/Interpreter/fractal.swift
index 9434af2..25ec37c 100644
--- a/test/Interpreter/fractal.swift
+++ b/test/Interpreter/fractal.swift
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t  &&  mkdir %t
-// RUN: %target-jit-run %s -I %S -enable-source-import | FileCheck %s
+// RUN: %target-jit-run %s -I %S -enable-source-import | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: swift_interpreter
diff --git a/test/Interpreter/function_metatypes.swift b/test/Interpreter/function_metatypes.swift
index fe3efed..87da207 100644
--- a/test/Interpreter/function_metatypes.swift
+++ b/test/Interpreter/function_metatypes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol ProtocolHasInOut {
diff --git a/test/Interpreter/functions.swift b/test/Interpreter/functions.swift
index b7bc6f6..891948b 100644
--- a/test/Interpreter/functions.swift
+++ b/test/Interpreter/functions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 func double(_ x: Int) -> Int {
diff --git a/test/Interpreter/generic_casts.swift b/test/Interpreter/generic_casts.swift
index 24e56e3..0705141 100644
--- a/test/Interpreter/generic_casts.swift
+++ b/test/Interpreter/generic_casts.swift
@@ -1,6 +1,6 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // RUN: %target-build-swift -O %s -o %t/a.out.optimized
-// RUN: %target-run %t/a.out.optimized | FileCheck %s
+// RUN: %target-run %t/a.out.optimized | %FileCheck %s
 // REQUIRES: executable_test
 
 // FIXME: rdar://problem/19648117 Needs splitting objc parts out
@@ -158,8 +158,15 @@
 // Bridging
 print(allToAll(0, AnyObject.self)) // CHECK-NEXT: true
 
+// This will get bridged using _SwiftValue.
 struct NotBridged { var x: Int }
-print(allToAll(NotBridged(x: 0), AnyObject.self)) // CHECK-NEXT: false
+print(allToAll(NotBridged(x: 0), AnyObject.self)) // CHECK-NEXT: true
+print(allToAll(NotBridged(x: 0), NSCopying.self)) // CHECK-NEXT: true
+
+// These casts fail (intentionally) even though _SwiftValue does
+// technically conform to these protocols through NSObject.
+print(allToAll(NotBridged(x: 0), CustomStringConvertible.self)) // CHECK-NEXT: false
+print(allToAll(NotBridged(x: 0), (AnyObject & CustomStringConvertible).self)) // CHECK-NEXT: false
 
 //
 // rdar://problem/19482567
diff --git a/test/Interpreter/generic_class.swift b/test/Interpreter/generic_class.swift
index 27d2163..b493f04 100644
--- a/test/Interpreter/generic_class.swift
+++ b/test/Interpreter/generic_class.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir %t
 // RUN: %target-build-swift %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol MyPrintable {
diff --git a/test/Interpreter/generic_class_empty_field.swift b/test/Interpreter/generic_class_empty_field.swift
new file mode 100644
index 0000000..da980ed
--- /dev/null
+++ b/test/Interpreter/generic_class_empty_field.swift
@@ -0,0 +1,47 @@
+// RUN: rm -rf %t  &&  mkdir %t
+// RUN: %target-build-swift %s -o %t/a.out
+// RUN: %target-run %t/a.out | %FileCheck %s
+// REQUIRES: executable_test
+
+class Outer {
+  class Foo {
+    var zim = Bar()
+    var bas = Outer()
+  }
+  class Boo {
+    var bas = Outer()
+    var zim = Bar()
+  }
+
+  required init() {}
+}
+
+protocol Initable { init() }
+extension Outer: Initable {}
+
+class GFoo<T: Initable> {
+  var zim = Bar()
+  var bas = T()
+}
+class GBoo<T: Initable> {
+  var bas = T()
+  var zim = Bar()
+}
+class GFos<T: Initable> {
+  var bar = T()
+  var zim = Bar()
+  var bas = T()
+}
+
+struct Bar { }
+
+do {
+  let a = Outer.Foo()
+  let b = Outer.Boo()
+  let c = GFoo<Outer>()
+  let d = GBoo<Outer>()
+  let e = GFos<Outer>()
+}
+
+// CHECK: Job's finished
+print("Job's finished")
diff --git a/test/Interpreter/generic_implicit_closure.swift b/test/Interpreter/generic_implicit_closure.swift
index e332954..8f47b5a 100644
--- a/test/Interpreter/generic_implicit_closure.swift
+++ b/test/Interpreter/generic_implicit_closure.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol MyBoolean {
diff --git a/test/Interpreter/generic_objc_subclass.swift b/test/Interpreter/generic_objc_subclass.swift
index 8f164f4..d3cc6bd 100644
--- a/test/Interpreter/generic_objc_subclass.swift
+++ b/test/Interpreter/generic_objc_subclass.swift
@@ -3,7 +3,7 @@
 //
 // RUN: %target-clang -fobjc-arc %S/Inputs/ObjCClasses/ObjCClasses.m -c -o %t/ObjCClasses.o
 // RUN: %target-build-swift -I %S/Inputs/ObjCClasses/ -Xlinker %t/ObjCClasses.o %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/generic_ref_counts.swift b/test/Interpreter/generic_ref_counts.swift
index f2abef2..ca88d4f 100644
--- a/test/Interpreter/generic_ref_counts.swift
+++ b/test/Interpreter/generic_ref_counts.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/test/Interpreter/generic_struct.swift b/test/Interpreter/generic_struct.swift
index 163dfb2..2c132f7 100644
--- a/test/Interpreter/generic_struct.swift
+++ b/test/Interpreter/generic_struct.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir %t
 // RUN: %target-build-swift %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol MyPrintable {
diff --git a/test/Interpreter/generic_tuple.swift b/test/Interpreter/generic_tuple.swift
index 2794c5b..fdaba04 100644
--- a/test/Interpreter/generic_tuple.swift
+++ b/test/Interpreter/generic_tuple.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // <rdar://problem/13995785> We were using the wrong type metadata pointer for the empty
diff --git a/test/Interpreter/generics.swift b/test/Interpreter/generics.swift
index 1585a82..7e4fd7f 100644
--- a/test/Interpreter/generics.swift
+++ b/test/Interpreter/generics.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 struct BigStruct { var a,b,c,d,e,f,g,h:Int }
diff --git a/test/Interpreter/hello_func.swift b/test/Interpreter/hello_func.swift
index 110d89f..b311ca6 100644
--- a/test/Interpreter/hello_func.swift
+++ b/test/Interpreter/hello_func.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // CHECK: Nice shoes
diff --git a/test/Interpreter/hello_toplevel.swift b/test/Interpreter/hello_toplevel.swift
index 820549c..48e332c 100644
--- a/test/Interpreter/hello_toplevel.swift
+++ b/test/Interpreter/hello_toplevel.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // CHECK: Hey I just met you and this is crazy
diff --git a/test/Interpreter/if_expr.swift b/test/Interpreter/if_expr.swift
index 1a0dcfa..a419c85 100644
--- a/test/Interpreter/if_expr.swift
+++ b/test/Interpreter/if_expr.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // CHECK: 1
diff --git a/test/Interpreter/import.swift b/test/Interpreter/import.swift
index f449015..3f9c9ae 100644
--- a/test/Interpreter/import.swift
+++ b/test/Interpreter/import.swift
@@ -1,4 +1,4 @@
-// RUN: %swift -interpret -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %swift -interpret -I %S/Inputs -enable-source-import %s | %FileCheck %s
 // REQUIRES: swift_interpreter
 // FIXME: This test uses IRGen with -enable-source-import; it may fail with -g.
 
diff --git a/test/Interpreter/import_as_member.swift b/test/Interpreter/import_as_member.swift
index 61d32e9..7918522 100644
--- a/test/Interpreter/import_as_member.swift
+++ b/test/Interpreter/import_as_member.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir -p %t
 // RUN: %clang -isysroot %sdk %S/Inputs/ImportAsMember/IAMVec.c -c -o %t/IAMVec.o
 // RUN: %target-build-swift -I %S/Inputs/ImportAsMember/ -Xlinker %t/IAMVec.o %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 
 // REQUIRES: swift_interpreter
 // REQUIRES: OS=macosx
diff --git a/test/Interpreter/initializers.swift b/test/Interpreter/initializers.swift
index be54ba0..36bcb37 100644
--- a/test/Interpreter/initializers.swift
+++ b/test/Interpreter/initializers.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // Test initialization and initializer inheritance.
diff --git a/test/Interpreter/interpolation.swift b/test/Interpreter/interpolation.swift
index 88742d6..e6f8f7b 100644
--- a/test/Interpreter/interpolation.swift
+++ b/test/Interpreter/interpolation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // FIXME: rdar://16168414 big int interpolation isn't working on 32-bit
diff --git a/test/Interpreter/interpret_load_framework.swift b/test/Interpreter/interpret_load_framework.swift
index c3c4470..d0df187 100644
--- a/test/Interpreter/interpret_load_framework.swift
+++ b/test/Interpreter/interpret_load_framework.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: cp -R %S/Inputs/VerySmallObjCFramework.framework %t
 // RUN: %clang -dynamiclib %S/Inputs/VerySmallObjCFramework.m -fmodules -F %t -o %t/VerySmallObjCFramework.framework/VerySmallObjCFramework
-// RUN: %swift_driver -F %t %s | FileCheck %s
+// RUN: %swift_driver -F %t %s | %FileCheck %s
 
 // REQUIRES: objc_interop 
 // REQUIRES: swift_interpreter
diff --git a/test/Interpreter/layout_reabstraction.swift b/test/Interpreter/layout_reabstraction.swift
index 1772a0a..98a472d 100644
--- a/test/Interpreter/layout_reabstraction.swift
+++ b/test/Interpreter/layout_reabstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 struct S {}
diff --git a/test/Interpreter/mandelbrot.swift b/test/Interpreter/mandelbrot.swift
index 3f38b53..bd89e79 100644
--- a/test/Interpreter/mandelbrot.swift
+++ b/test/Interpreter/mandelbrot.swift
@@ -1,4 +1,4 @@
-// RUN: %target-jit-run -I %S -enable-source-import %s | FileCheck %s
+// RUN: %target-jit-run -I %S -enable-source-import %s | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: swift_interpreter
 
diff --git a/test/Interpreter/nested_generics.swift b/test/Interpreter/nested_generics.swift
index 3af5558..8156f33 100644
--- a/test/Interpreter/nested_generics.swift
+++ b/test/Interpreter/nested_generics.swift
@@ -1,6 +1,6 @@
 // RUN: mkdir -p %t
 // RUN: %target-build-swift %s -Xfrontend -enable-experimental-nested-generic-types -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol MyPrintable {
diff --git a/test/Interpreter/objc_bool.swift b/test/Interpreter/objc_bool.swift
new file mode 100644
index 0000000..7c36372
--- /dev/null
+++ b/test/Interpreter/objc_bool.swift
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+//
+// RUN: %target-clang -fobjc-arc %S/Inputs/ObjCClasses/ObjCClasses.m -c -o %t/ObjCClasses.o
+// RUN: %target-build-swift -I %S/Inputs/ObjCClasses/ -Xlinker %t/ObjCClasses.o %s -o %t/a.out
+// RUN: %target-run %t/a.out
+
+// REQUIRES: executable_test
+// REQUIRES: objc_interop
+
+import ObjCClasses
+import Foundation
+
+TestingBool().shouldBeTrueObjCBool(true)
+TestingBool().shouldBeTrueCBool(true)
diff --git a/test/Interpreter/objc_runtime_visible.swift b/test/Interpreter/objc_runtime_visible.swift
index 82701c9..9f11c31 100644
--- a/test/Interpreter/objc_runtime_visible.swift
+++ b/test/Interpreter/objc_runtime_visible.swift
@@ -2,7 +2,7 @@
 
 // RUN: %clang %target-cc-options -isysroot %sdk -fobjc-arc %S/Inputs/objc_runtime_visible.m -fmodules -nodefaultlibs -lc -dynamiclib -o %t/libobjc_runtime_visible.dylib -install_name @executable_path/libobjc_runtime_visible.dylib
 // RUN: codesign -f -s - %t/libobjc_runtime_visible.dylib
-// RUN: nm -g %t/libobjc_runtime_visible.dylib | FileCheck %s
+// RUN: nm -g %t/libobjc_runtime_visible.dylib | %FileCheck %s
 // RUN: %target-build-swift -import-objc-header %S/Inputs/objc_runtime_visible.h %t/libobjc_runtime_visible.dylib %s -o %t/main
 // RUN: %target-run %t/main %t/libobjc_runtime_visible.dylib
 
diff --git a/test/Interpreter/object.swift b/test/Interpreter/object.swift
index f514f67..ad7d3a8 100644
--- a/test/Interpreter/object.swift
+++ b/test/Interpreter/object.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 func test() {
diff --git a/test/Interpreter/optional.swift b/test/Interpreter/optional.swift
index f24d41e..ed3be1e 100644
--- a/test/Interpreter/optional.swift
+++ b/test/Interpreter/optional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 class A {
diff --git a/test/Interpreter/optional_lvalues.swift b/test/Interpreter/optional_lvalues.swift
index 61b0871..49b8956 100644
--- a/test/Interpreter/optional_lvalues.swift
+++ b/test/Interpreter/optional_lvalues.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 var x: Int! = 0
diff --git a/test/Interpreter/pinning.swift b/test/Interpreter/pinning.swift
index a2ff275..44fff0a 100644
--- a/test/Interpreter/pinning.swift
+++ b/test/Interpreter/pinning.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir -p %t
 // RUN: %target-build-swift -parse-stdlib %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/test/Interpreter/process_arguments.swift b/test/Interpreter/process_arguments.swift
index 65e8b68..5be6855 100644
--- a/test/Interpreter/process_arguments.swift
+++ b/test/Interpreter/process_arguments.swift
@@ -1,7 +1,7 @@
-// RUN: %swift -interpret %s | FileCheck %s -check-prefix=CHECK-NONE
-// RUN: %swift -interpret %s -Onone -g | FileCheck %s -check-prefix=CHECK-NONE
-// RUN: %swift -interpret %s -Onone -g -- | FileCheck %s -check-prefix=CHECK-NONE
-// RUN: %swift -interpret %s -Onone -g -- a b c | FileCheck %s -check-prefix=CHECK-THREE
+// RUN: %swift -interpret %s | %FileCheck %s -check-prefix=CHECK-NONE
+// RUN: %swift -interpret %s -Onone -g | %FileCheck %s -check-prefix=CHECK-NONE
+// RUN: %swift -interpret %s -Onone -g -- | %FileCheck %s -check-prefix=CHECK-NONE
+// RUN: %swift -interpret %s -Onone -g -- a b c | %FileCheck %s -check-prefix=CHECK-THREE
 
 // REQUIRES: swift_interpreter
 
diff --git a/test/Interpreter/properties.swift b/test/Interpreter/properties.swift
index d6b6a60..7b9ef29 100644
--- a/test/Interpreter/properties.swift
+++ b/test/Interpreter/properties.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 var foo: Int {
diff --git a/test/Interpreter/protocol_extensions.swift b/test/Interpreter/protocol_extensions.swift
index b02cbd4..c21a17c 100644
--- a/test/Interpreter/protocol_extensions.swift
+++ b/test/Interpreter/protocol_extensions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // Extend a protocol with a property.
diff --git a/test/Interpreter/protocol_initializers.swift b/test/Interpreter/protocol_initializers.swift
new file mode 100644
index 0000000..3e84888
--- /dev/null
+++ b/test/Interpreter/protocol_initializers.swift
@@ -0,0 +1,89 @@
+// RUN: %target-run-simple-swift
+// REQUIRES: executable_test
+
+import StdlibUnittest
+
+var ProtocolInitTestSuite = TestSuite("ProtocolInit")
+
+func mustFail<T>(f: () -> T?) {
+  if f() != nil {
+    preconditionFailure("Didn't fail")
+  }
+}
+
+protocol TriviallyConstructible {
+  init(inner: LifetimeTracked)
+}
+
+enum E : Error { case X }
+
+extension TriviallyConstructible {
+  init(middle x: LifetimeTracked) {
+    self.init(inner: x)
+  }
+
+  init?(failingMiddle x: LifetimeTracked, shouldFail: Bool) {
+    if (shouldFail) {
+      return nil
+    }
+    self.init(inner: x)
+  }
+
+  init(throwingMiddle x: LifetimeTracked, shouldThrow: Bool) throws {
+    if (shouldThrow) {
+      throw E.X
+    }
+    self.init(inner: x)
+  }
+}
+
+class TrivialClass : TriviallyConstructible {
+
+  convenience init(outer x: LifetimeTracked) {
+    self.init(middle: x)
+  }
+
+  convenience init?(failingOuter x: LifetimeTracked, shouldFail: Bool) {
+    self.init(failingMiddle: x, shouldFail: shouldFail)
+  }
+
+  convenience init(throwingOuter x: LifetimeTracked, shouldThrow: Bool) throws {
+    try self.init(throwingMiddle: x, shouldThrow: shouldThrow)
+  }
+
+  required init(inner tracker: LifetimeTracked) {
+    self.tracker = tracker
+  }
+
+  let tracker: LifetimeTracked
+}
+
+ProtocolInitTestSuite.test("ProtocolInit_Trivial") {
+  _ = TrivialClass(outer: LifetimeTracked(0))
+}
+
+ProtocolInitTestSuite.test("ProtocolInit_Failable") {
+  do {
+    let result = TrivialClass(failingOuter: LifetimeTracked(1), shouldFail: false)
+    assert(result != nil)
+  }
+  do {
+    let result = TrivialClass(failingOuter: LifetimeTracked(2), shouldFail: true)
+    assert(result == nil)
+  }
+}
+
+ProtocolInitTestSuite.test("ProtocolInit_Throwing") {
+  do {
+    let result = try TrivialClass(throwingOuter: LifetimeTracked(4), shouldThrow: false)
+  } catch {
+    preconditionFailure("Expected no error")
+  }
+
+  do {
+    let result = try TrivialClass(throwingOuter: LifetimeTracked(5), shouldThrow: true)
+    preconditionFailure("Expected error")
+  } catch {}
+}
+
+runAllTests()
diff --git a/test/Interpreter/protocol_lookup.swift b/test/Interpreter/protocol_lookup.swift
index 2aaed02..29042b1 100644
--- a/test/Interpreter/protocol_lookup.swift
+++ b/test/Interpreter/protocol_lookup.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-run-simple-swift | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 // REQUIRES: executable_test
 
 // Note: JIT mode is checked in Interpreter/protocol_lookup_jit.swift.
diff --git a/test/Interpreter/protocol_lookup_jit.swift b/test/Interpreter/protocol_lookup_jit.swift
index 33f63ea..365a706 100644
--- a/test/Interpreter/protocol_lookup_jit.swift
+++ b/test/Interpreter/protocol_lookup_jit.swift
@@ -1,5 +1,5 @@
 // Test protocol_lookup.swift in JIT mode.
-// RUN: %swift -interpret %S/protocol_lookup.swift | FileCheck %S/protocol_lookup.swift --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %swift -interpret %S/protocol_lookup.swift | %FileCheck %S/protocol_lookup.swift --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 // REQUIRES: executable_test
 
 // REQUIRES: swift_interpreter
diff --git a/test/Interpreter/protocols.swift b/test/Interpreter/protocols.swift
index 8dbc8ef..5719ea2 100644
--- a/test/Interpreter/protocols.swift
+++ b/test/Interpreter/protocols.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol RollCallable {
diff --git a/test/Interpreter/rdar15674812.swift b/test/Interpreter/rdar15674812.swift
index c31b72b..f397496 100644
--- a/test/Interpreter/rdar15674812.swift
+++ b/test/Interpreter/rdar15674812.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 class HeapBuf<Element> {}
diff --git a/test/Interpreter/recursive_generics.swift b/test/Interpreter/recursive_generics.swift
index 266f1a6..ef321fb 100644
--- a/test/Interpreter/recursive_generics.swift
+++ b/test/Interpreter/recursive_generics.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // rdar://18067671
diff --git a/test/Interpreter/repl.swift b/test/Interpreter/repl.swift
index 49dce6c..996b865 100644
--- a/test/Interpreter/repl.swift
+++ b/test/Interpreter/repl.swift
@@ -1,4 +1,4 @@
-// RUN: %target-repl-run-simple-swift | FileCheck %s
+// RUN: %target-repl-run-simple-swift | %FileCheck %s
 
 // REQUIRES: swift_repl
 
diff --git a/test/Interpreter/repl_13695499.swift b/test/Interpreter/repl_13695499.swift
index d128f22..69e9b63 100644
--- a/test/Interpreter/repl_13695499.swift
+++ b/test/Interpreter/repl_13695499.swift
@@ -1,4 +1,4 @@
-// RUN: %target-repl-run-simple-swift | FileCheck %s
+// RUN: %target-repl-run-simple-swift | %FileCheck %s
 
 // REQUIRES: swift_repl
 
diff --git a/test/Interpreter/repl_17597453.swift b/test/Interpreter/repl_17597453.swift
index b20b42b..0ff3ec0 100644
--- a/test/Interpreter/repl_17597453.swift
+++ b/test/Interpreter/repl_17597453.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: cp -R %S/Inputs/VerySmallObjCFramework.framework %t
 // RUN: %clang -dynamiclib %S/Inputs/VerySmallObjCFramework.m -fmodules -F %t -o %t/VerySmallObjCFramework.framework/VerySmallObjCFramework
-// RUN: %target-repl-run-simple-swift -F %t | FileCheck %s
+// RUN: %target-repl-run-simple-swift -F %t | %FileCheck %s
 
 // REQUIRES: swift_repl
 // REQUIRES: objc_interop 
diff --git a/test/Interpreter/repl_autolinking.swift b/test/Interpreter/repl_autolinking.swift
index 5fc27b3..0702b8d 100644
--- a/test/Interpreter/repl_autolinking.swift
+++ b/test/Interpreter/repl_autolinking.swift
@@ -4,7 +4,7 @@
 // RUN: sed -n -e '/REPL_START$/,/REPL_END$/ p' %s > %t/repl.swift
 // RUN: %target-swiftc_driver -emit-library %t/a.swift -I %t -L %t -emit-module-path %t/ModuleA.swiftmodule -autolink-force-load -module-link-name ModuleA -module-name ModuleA -o %t/libModuleA.dylib
 // RUN: %target-swiftc_driver -emit-library %t/b.swift -I %t -L %t -emit-module-path %t/ModuleB.swiftmodule -autolink-force-load -module-link-name ModuleB -module-name ModuleB -o %t/libModuleB.dylib
-// RUN: %swift -repl -I %t -L %t < %t/repl.swift 2>&1 | FileCheck %s
+// RUN: %swift -repl -I %t -L %t < %t/repl.swift 2>&1 | %FileCheck %s
 
 // REQUIRES: swift_repl
 // UNSUPPORTED: OS=linux-gnu
diff --git a/test/Interpreter/repl_conformance_lookup.swift b/test/Interpreter/repl_conformance_lookup.swift
index 25290a7f..a3192d5 100644
--- a/test/Interpreter/repl_conformance_lookup.swift
+++ b/test/Interpreter/repl_conformance_lookup.swift
@@ -1,4 +1,4 @@
-// RUN: %target-repl-run-simple-swift | FileCheck %s
+// RUN: %target-repl-run-simple-swift | %FileCheck %s
 
 // REQUIRES: swift_repl
 
diff --git a/test/Interpreter/repl_diagnostics.swift b/test/Interpreter/repl_diagnostics.swift
index 102e2fe..a996ae3 100644
--- a/test/Interpreter/repl_diagnostics.swift
+++ b/test/Interpreter/repl_diagnostics.swift
@@ -1,4 +1,4 @@
-// RUN: %target-repl-run-simple-swift | FileCheck %s
+// RUN: %target-repl-run-simple-swift | %FileCheck %s
 
 // REQUIRES: swift_repl
 
diff --git a/test/Interpreter/repl_hashbang.swift b/test/Interpreter/repl_hashbang.swift
index 863d43f..c937511 100644
--- a/test/Interpreter/repl_hashbang.swift
+++ b/test/Interpreter/repl_hashbang.swift
@@ -1,7 +1,7 @@
 #!/usr/bin/swift
 class Foo {}
 // Check that we diagnose and skip the hashbang in the REPL.
-// RUN: %target-repl-run-simple-swift | FileCheck %s
+// RUN: %target-repl-run-simple-swift | %FileCheck %s
 
 // REQUIRES: swift_repl
 
diff --git a/test/Interpreter/return_from_main.swift b/test/Interpreter/return_from_main.swift
index 27330c4..09d6b08 100644
--- a/test/Interpreter/return_from_main.swift
+++ b/test/Interpreter/return_from_main.swift
@@ -1,5 +1,5 @@
 // This test specifically exercises the interpreter's top-level error handler.
-// RUN: not --crash %target-jit-run %s 2>&1 | FileCheck %s
+// RUN: not --crash %target-jit-run %s 2>&1 | %FileCheck %s
 // REQUIRES: swift_interpreter
 
 // rdar://20809122
diff --git a/test/Interpreter/selector_arguments.swift b/test/Interpreter/selector_arguments.swift
index f0edfac..d544279 100644
--- a/test/Interpreter/selector_arguments.swift
+++ b/test/Interpreter/selector_arguments.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 func divide(_ a: Int, byDividend b: Int) -> Int { return a / b }
diff --git a/test/Interpreter/shebang-direct.swift b/test/Interpreter/shebang-direct.swift
index 44f0c05..cec0bb2 100644
--- a/test/Interpreter/shebang-direct.swift
+++ b/test/Interpreter/shebang-direct.swift
@@ -2,8 +2,8 @@
 // RUN: cat %S/shebang-env.swift >> %t.shebang.swift
 // RUN: chmod u+x %t.shebang.swift
 
-// RUN: %t.shebang.swift | FileCheck -check-prefix=NONE %S/shebang-env.swift
-// RUN: %t.shebang.swift a b c | FileCheck -check-prefix=THREE-ARGS %S/shebang-env.swift
+// RUN: %t.shebang.swift | %FileCheck -check-prefix=NONE %S/shebang-env.swift
+// RUN: %t.shebang.swift a b c | %FileCheck -check-prefix=THREE-ARGS %S/shebang-env.swift
 
 // REQUIRES: swift_interpreter
 // UNSUPPORTED: linux
diff --git a/test/Interpreter/shebang-env.swift b/test/Interpreter/shebang-env.swift
index f170431..62f32af 100644
--- a/test/Interpreter/shebang-env.swift
+++ b/test/Interpreter/shebang-env.swift
@@ -4,8 +4,8 @@
 // RUN: cat %s >> %t.shebang.swift
 // RUN: chmod u+x %t.shebang.swift
 
-// RUN: env PATH=$(dirname %swift_driver_plain) %t.shebang.swift | FileCheck -check-prefix=NONE %s
-// RUN: env PATH=$(dirname %swift_driver_plain) %t.shebang.swift a b c | FileCheck -check-prefix=THREE-ARGS %s
+// RUN: env PATH=$(dirname %swift_driver_plain) %t.shebang.swift | %FileCheck -check-prefix=NONE %s
+// RUN: env PATH=$(dirname %swift_driver_plain) %t.shebang.swift a b c | %FileCheck -check-prefix=THREE-ARGS %s
 
 // REQUIRES: swift_interpreter
 
diff --git a/test/Interpreter/simple.swift b/test/Interpreter/simple.swift
index cff5a8f..8faeba7 100644
--- a/test/Interpreter/simple.swift
+++ b/test/Interpreter/simple.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // CHECK: 123ABCD
diff --git a/test/Interpreter/slices.swift b/test/Interpreter/slices.swift
index fb0bc6c..ce97ff5 100644
--- a/test/Interpreter/slices.swift
+++ b/test/Interpreter/slices.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol Showable {
diff --git a/test/Interpreter/statements.swift b/test/Interpreter/statements.swift
index e97cb48..30d3437 100644
--- a/test/Interpreter/statements.swift
+++ b/test/Interpreter/statements.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // Foreach loops
diff --git a/test/Interpreter/static_objc_var.swift b/test/Interpreter/static_objc_var.swift
index ea53bdf..f51f5a2 100644
--- a/test/Interpreter/static_objc_var.swift
+++ b/test/Interpreter/static_objc_var.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: objc_interop
diff --git a/test/Interpreter/structs.swift b/test/Interpreter/structs.swift
index b5734d7..8dd8e31 100644
--- a/test/Interpreter/structs.swift
+++ b/test/Interpreter/structs.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 struct Interval {
diff --git a/test/Interpreter/super_constructor.swift b/test/Interpreter/super_constructor.swift
index c2fd2ff..fe83bef 100644
--- a/test/Interpreter/super_constructor.swift
+++ b/test/Interpreter/super_constructor.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 struct S {
diff --git a/test/Interpreter/testability.swift b/test/Interpreter/testability.swift
index 90608fb..24841d0 100644
--- a/test/Interpreter/testability.swift
+++ b/test/Interpreter/testability.swift
@@ -2,7 +2,7 @@
 // RUN: %target-build-swift -emit-library -c %S/Inputs/testability_helper.swift -enable-testing -force-single-frontend-invocation -o %t/testability_helper.o -emit-module
 
 // RUN: %target-build-swift %s -I %t -Xlinker %t/testability_helper.o -o %t/main
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 @testable import testability_helper
diff --git a/test/Interpreter/tuples.swift b/test/Interpreter/tuples.swift
index b53bee4..a325276 100644
--- a/test/Interpreter/tuples.swift
+++ b/test/Interpreter/tuples.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 typealias Interval = (lo: Int, hi: Int)
diff --git a/test/Interpreter/typeof.swift b/test/Interpreter/typeof.swift
index 678517d..72f8acb 100644
--- a/test/Interpreter/typeof.swift
+++ b/test/Interpreter/typeof.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol Fooable { static func foo() }
diff --git a/test/Interpreter/varargs.swift b/test/Interpreter/varargs.swift
index b50e580..faf2746 100644
--- a/test/Interpreter/varargs.swift
+++ b/test/Interpreter/varargs.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // XFAIL: linux
diff --git a/test/Interpreter/weak.swift b/test/Interpreter/weak.swift
index 6cfffaa..c10883e 100644
--- a/test/Interpreter/weak.swift
+++ b/test/Interpreter/weak.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 protocol Protocol : class {
diff --git a/test/Interpreter/weak_objc.swift b/test/Interpreter/weak_objc.swift
index bcf38bd..54cfeda 100644
--- a/test/Interpreter/weak_objc.swift
+++ b/test/Interpreter/weak_objc.swift
@@ -1,5 +1,5 @@
 // RUN: %target-build-swift %s -Xfrontend -disable-objc-attr-requires-foundation-module -o %t-main
-// RUN: %target-run %t-main | FileCheck %s
+// RUN: %target-run %t-main | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
 
diff --git a/test/Interpreter/wildcard_dispatch_on_catch.swift b/test/Interpreter/wildcard_dispatch_on_catch.swift
index b72e906..5555d2a 100644
--- a/test/Interpreter/wildcard_dispatch_on_catch.swift
+++ b/test/Interpreter/wildcard_dispatch_on_catch.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t  &&  mkdir %t
 // RUN: %target-build-swift %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 enum testError: Error {
diff --git a/test/Interpreter/writeback.swift b/test/Interpreter/writeback.swift
index fe779ac..1a93db5 100644
--- a/test/Interpreter/writeback.swift
+++ b/test/Interpreter/writeback.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 struct Foo {
diff --git a/test/LLVMPasses/allocation-deletion.ll b/test/LLVMPasses/allocation-deletion.ll
index ab11212..344b4cd 100644
--- a/test/LLVMPasses/allocation-deletion.ll
+++ b/test/LLVMPasses/allocation-deletion.ll
@@ -1,4 +1,4 @@
-; RUN: %swift-llvm-opt -swift-llvm-arc-optimize %s | FileCheck %s
+; RUN: %swift-llvm-opt -swift-llvm-arc-optimize %s | %FileCheck %s
 
 target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-macosx10.9"
@@ -81,4 +81,19 @@
 ; CHECK-NEXT: ret void
 
 
+; external_dtor_alloc_eliminate -  Make sure we can not eliminate the allocation
+; because we know nothing about the type of the allocation.
+@external_dtor_metadata = external global %swift.heapmetadata, align 8
+define void @external_dtor_alloc_eliminate() nounwind {
+entry:
+  %0 = tail call noalias %swift.refcounted* @swift_allocObject(%swift.heapmetadata* nonnull @external_dtor_metadata, i64 24, i64 8) nounwind
+  tail call void @swift_release(%swift.refcounted* %0) nounwind
+  ret void
+}
+
+; CHECK: @external_dtor_alloc_eliminate
+; CHECK-NEXT: entry:
+; CHECK-NEXT: swift_allocObject
+; CHECK-NEXT: swift_release
+; CHECK-NEXT: ret void
 
diff --git a/test/LLVMPasses/basic.ll b/test/LLVMPasses/basic.ll
index 31b7b7d..7946dbb 100644
--- a/test/LLVMPasses/basic.ll
+++ b/test/LLVMPasses/basic.ll
@@ -1,4 +1,4 @@
-; RUN: %swift-llvm-opt -swift-llvm-arc-optimize %s | FileCheck %s
+; RUN: %swift-llvm-opt -swift-llvm-arc-optimize %s | %FileCheck %s
 
 target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-macosx10.9"
diff --git a/test/LLVMPasses/contract.ll b/test/LLVMPasses/contract.ll
index 27bbc24..b3220ba 100644
--- a/test/LLVMPasses/contract.ll
+++ b/test/LLVMPasses/contract.ll
@@ -1,4 +1,4 @@
-; RUN: %swift-llvm-opt -swift-arc-contract %s | FileCheck %s
+; RUN: %swift-llvm-opt -swift-arc-contract %s | %FileCheck %s
 
 target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-macosx10.9"
diff --git a/test/LLVMPasses/llvm-aa.ll b/test/LLVMPasses/llvm-aa.ll
index cf90373..e8944ae 100644
--- a/test/LLVMPasses/llvm-aa.ll
+++ b/test/LLVMPasses/llvm-aa.ll
@@ -1,4 +1,4 @@
-; RUN: %swift-llvm-opt -swift-aa -gvn %s | FileCheck %s
+; RUN: %swift-llvm-opt -swift-aa -gvn %s | %FileCheck %s
 
 target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-macosx10.9"
diff --git a/test/LLVMPasses/merge_func.ll b/test/LLVMPasses/merge_func.ll
index 708911e..37b4948 100644
--- a/test/LLVMPasses/merge_func.ll
+++ b/test/LLVMPasses/merge_func.ll
@@ -1,4 +1,4 @@
-; RUN: %swift-llvm-opt -swift-merge-functions -swiftmergefunc-threshold=4 %s | FileCheck %s
+; RUN: %swift-llvm-opt -swift-merge-functions -swiftmergefunc-threshold=4 %s | %FileCheck %s
 
 @g1 = external global i32
 @g2 = external global i32
diff --git a/test/LLVMPasses/stack_promotion.ll b/test/LLVMPasses/stack_promotion.ll
index 28f1552..62d489b 100644
--- a/test/LLVMPasses/stack_promotion.ll
+++ b/test/LLVMPasses/stack_promotion.ll
@@ -1,4 +1,4 @@
-; RUN: %swift-llvm-opt -swift-stack-promotion -stack-promotion-limit=100 %s | FileCheck %s
+; RUN: %swift-llvm-opt -swift-stack-promotion -stack-promotion-limit=100 %s | %FileCheck %s
 
 target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-macosx10.9"
diff --git a/test/Misc/fatal_error.swift b/test/Misc/fatal_error.swift
index e16d136..24af056 100644
--- a/test/Misc/fatal_error.swift
+++ b/test/Misc/fatal_error.swift
@@ -1,5 +1,5 @@
-// RUN: not %target-swift-frontend -parse %s -sdk "" 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=NO-MODULE %s
-// RUN: not %target-swift-frontend -parse %s -resource-dir / 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=NO-STDLIB %s
+// RUN: not %target-swift-frontend -parse %s -sdk "" 2>&1 | %FileCheck -check-prefix=CHECK -check-prefix=NO-MODULE %s
+// RUN: not %target-swift-frontend -parse %s -resource-dir / 2>&1 | %FileCheck -check-prefix=CHECK -check-prefix=NO-STDLIB %s
 
 // NO-MODULE: error: no such module 'NonExistent'
 
diff --git a/test/Misc/opt-debug-forbid-typecheck-prefix.swift b/test/Misc/opt-debug-forbid-typecheck-prefix.swift
index 0afc2b9..f1c6e49 100644
--- a/test/Misc/opt-debug-forbid-typecheck-prefix.swift
+++ b/test/Misc/opt-debug-forbid-typecheck-prefix.swift
@@ -1,21 +1,21 @@
 // This makes sure -debug-forbid-typecheck-prefix works as expected.
 
 // RUN: not %target-swift-frontend -parse %s -D TRY1 -debug-forbid-typecheck-prefix FORBID_ 2> %t.txt
-// RUN: FileCheck -check-prefix=CHECK1 -input-file %t.txt %s
+// RUN: %FileCheck -check-prefix=CHECK1 -input-file %t.txt %s
 #if TRY1
 // CHECK1: LLVM ERROR: forbidden typecheck occurred: FORBID_global
 var FORBID_global = 0
 #endif
 
 // RUN: not %target-swift-frontend -parse %s -D TRY2 -debug-forbid-typecheck-prefix FORBID_ 2> %t.txt
-// RUN: FileCheck -check-prefix=CHECK2 -input-file %t.txt %s
+// RUN: %FileCheck -check-prefix=CHECK2 -input-file %t.txt %s
 #if TRY2
 // CHECK2: LLVM ERROR: forbidden typecheck occurred: FORBID_class
 class FORBID_class {}
 #endif
 
 // RUN: not %target-swift-frontend -parse %s -D TRY3 -debug-forbid-typecheck-prefix FORBID_ 2> %t.txt
-// RUN: FileCheck -check-prefix=CHECK3 -input-file %t.txt %s
+// RUN: %FileCheck -check-prefix=CHECK3 -input-file %t.txt %s
 #if TRY3
 class C {
   // CHECK3: LLVM ERROR: forbidden typecheck occurred: FORBID_member
@@ -24,7 +24,7 @@
 #endif
 
 // RUN: not %target-swift-frontend -parse %s -D TRY4 -debug-forbid-typecheck-prefix FORBID_ 2> %t.txt
-// RUN: FileCheck -check-prefix=CHECK4 -input-file %t.txt %s
+// RUN: %FileCheck -check-prefix=CHECK4 -input-file %t.txt %s
 #if TRY4
 class C {
   // CHECK4: LLVM ERROR: forbidden typecheck occurred: FORBID_memberFunc
@@ -33,14 +33,14 @@
 #endif
 
 // RUN: not %target-swift-frontend -parse %s -D TRY5 -debug-forbid-typecheck-prefix FORBID_ 2> %t.txt
-// RUN: FileCheck -check-prefix=CHECK5 -input-file %t.txt %s
+// RUN: %FileCheck -check-prefix=CHECK5 -input-file %t.txt %s
 #if TRY5
 // CHECK5: LLVM ERROR: forbidden typecheck occurred: FORBID_func
 func FORBID_func() {}
 #endif
 
 // RUN: not %target-swift-frontend -parse %s -D TRY6 -debug-forbid-typecheck-prefix FORBID_ 2> %t.txt
-// RUN: FileCheck -check-prefix=CHECK6 -input-file %t.txt %s
+// RUN: %FileCheck -check-prefix=CHECK6 -input-file %t.txt %s
 #if TRY6
 // CHECK6: LLVM ERROR: forbidden typecheck occurred: FORBID_local
 func globalFunc() {
@@ -49,14 +49,14 @@
 #endif
 
 // RUN: not %target-swift-frontend -parse %s -D TRY7 -debug-forbid-typecheck-prefix FORBID_ 2> %t.txt
-// RUN: FileCheck -check-prefix=CHECK7 -input-file %t.txt %s
+// RUN: %FileCheck -check-prefix=CHECK7 -input-file %t.txt %s
 #if TRY7
 // CHECK7: LLVM ERROR: forbidden typecheck occurred: FORBID_ref
 var global = FORBID_ref
 #endif
 
 // RUN: not %target-swift-frontend -parse %s -D TRY8 -debug-forbid-typecheck-prefix FORBID_ 2> %t.txt
-// RUN: FileCheck -check-prefix=CHECK8 -input-file %t.txt %s
+// RUN: %FileCheck -check-prefix=CHECK8 -input-file %t.txt %s
 #if TRY8
 class C {
   // CHECK8: LLVM ERROR: forbidden typecheck occurred: FORBID_ref
diff --git a/test/Misc/serialized-diagnostics.swift b/test/Misc/serialized-diagnostics.swift
index b1bd613..9145efd 100644
--- a/test/Misc/serialized-diagnostics.swift
+++ b/test/Misc/serialized-diagnostics.swift
@@ -3,12 +3,12 @@
 // Test swift executable
 // RUN: %target-swift-frontend -parse -serialize-diagnostics-path %t.dia %s -verify
 // RUN: c-index-test -read-diagnostics %t.dia > %t.deserialized_diagnostics.txt 2>&1
-// RUN: FileCheck --input-file=%t.deserialized_diagnostics.txt %s
+// RUN: %FileCheck --input-file=%t.deserialized_diagnostics.txt %s
 
 // Test swift_driver integrated frontend
 // RUN: %target-swift-frontend -parse -serialize-diagnostics -serialize-diagnostics-path %t.integrated_frontend.dia %s -verify
 // RUN: c-index-test -read-diagnostics %t.integrated_frontend.dia > %t.integrated_frontend.deserialized_diagnostics.txt 2>&1
-// RUN: FileCheck --input-file=%t.integrated_frontend.deserialized_diagnostics.txt %s
+// RUN: %FileCheck --input-file=%t.integrated_frontend.deserialized_diagnostics.txt %s
 
 var x = 1 x = 2   // expected-error {{consecutive statements on a line must be separated by ';'}} {{10-10=;}}
 var z : Int       // expected-note {{previously declared here}}
diff --git a/test/Misc/target-cpu.swift b/test/Misc/target-cpu.swift
index 124eb6b..6addecf 100644
--- a/test/Misc/target-cpu.swift
+++ b/test/Misc/target-cpu.swift
@@ -1,39 +1,39 @@
-// RUN: not %swift -parse -target arm64-apple-ios7 -Xcc -### %s 2>&1 | FileCheck -check-prefix=TARGETCPU1 %s
+// RUN: not %swift -parse -target arm64-apple-ios7 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=TARGETCPU1 %s
 // TARGETCPU1: "-target-cpu" "cyclone"
 
-// RUN: not %swift -parse -target arm64-apple-tvos9 -Xcc -### %s 2>&1 | FileCheck -check-prefix=APPLETVTARGETCPU1 %s
+// RUN: not %swift -parse -target arm64-apple-tvos9 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=APPLETVTARGETCPU1 %s
 // APPLETVTARGETCPU1: "-target-cpu" "cyclone"
 
-// RUN: not %swift -parse -target armv7s-apple-tvos9 -Xcc -### %s 2>&1 | FileCheck -check-prefix=APPLETVTARGETCPU2 %s
+// RUN: not %swift -parse -target armv7s-apple-tvos9 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=APPLETVTARGETCPU2 %s
 // APPLETVTARGETCPU2: "-target-cpu" "swift"
 
-// RUN: not %swift -parse -target armv7-apple-tvos9 -Xcc -### %s 2>&1 | FileCheck -check-prefix=APPLETVTARGETCPU3 %s
+// RUN: not %swift -parse -target armv7-apple-tvos9 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=APPLETVTARGETCPU3 %s
 // APPLETVTARGETCPU3: "-target-cpu" "cortex-a8"
 
-// RUN: not %swift -parse -target armv7k-apple-watchos2 -Xcc -### %s 2>&1 | FileCheck -check-prefix=WATCHTARGETCPU1 %s
+// RUN: not %swift -parse -target armv7k-apple-watchos2 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=WATCHTARGETCPU1 %s
 // WATCHTARGETCPU1: "-target-cpu" "cortex-a7"
 
-// RUN: not %swift -parse -target arm64-apple-watchos2 -Xcc -### %s 2>&1 | FileCheck -check-prefix=WATCHTARGETCPU2 %s
+// RUN: not %swift -parse -target arm64-apple-watchos2 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=WATCHTARGETCPU2 %s
 // WATCHTARGETCPU2: "-target-cpu" "cyclone"
 
-// RUN: not %swift -parse -target armv7s-apple-ios7 -Xcc -### %s 2>&1 | FileCheck -check-prefix=TARGETCPU2 %s
+// RUN: not %swift -parse -target armv7s-apple-ios7 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=TARGETCPU2 %s
 // TARGETCPU2: "-target-cpu" "swift"
 
-// RUN: not %swift -parse -target armv7-apple-ios7 -Xcc -### %s 2>&1 | FileCheck -check-prefix=TARGETCPU3 %s
+// RUN: not %swift -parse -target armv7-apple-ios7 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=TARGETCPU3 %s
 // TARGETCPU3: "-target-cpu" "cortex-a8"
 
-// RUN: not %swift -parse -target i386-apple-ios7 -Xcc -### %s 2>&1 | FileCheck -check-prefix=SIMULATOR_CPU %s
+// RUN: not %swift -parse -target i386-apple-ios7 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=SIMULATOR_CPU %s
 // SIMULATOR_CPU: "-target-cpu" "yonah"
 
-// RUN: not %swift -parse -target i386-apple-watchos2 -Xcc -### %s 2>&1 | FileCheck -check-prefix=WATCHSIMULATOR_CPU %s
+// RUN: not %swift -parse -target i386-apple-watchos2 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=WATCHSIMULATOR_CPU %s
 // WATCHSIMULATOR_CPU: "-target-cpu" "yonah"
 
-// RUN: not %swift -parse -target x86_64-apple-ios7 -Xcc -### %s 2>&1 | FileCheck -check-prefix=SIMULATOR64_CPU %s
+// RUN: not %swift -parse -target x86_64-apple-ios7 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=SIMULATOR64_CPU %s
 // SIMULATOR64_CPU: "-target-cpu" "core2"
 
-// RUN: not %swift -parse -target x86_64-apple-tvos9 -Xcc -### %s 2>&1 | FileCheck -check-prefix=APPLETVSIMULATOR64_CPU %s
+// RUN: not %swift -parse -target x86_64-apple-tvos9 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=APPLETVSIMULATOR64_CPU %s
 // APPLETVSIMULATOR64_CPU: "-target-cpu" "core2"
 
-// RUN: not %swift -parse -target x86_64-apple-watchos2 -Xcc -### %s 2>&1 | FileCheck -check-prefix=WATCHSIMULATOR64_CPU %s
+// RUN: not %swift -parse -target x86_64-apple-watchos2 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=WATCHSIMULATOR64_CPU %s
 // WATCHSIMULATOR64_CPU: "-target-cpu" "core2"
 
diff --git a/test/Misc/tbi.swift b/test/Misc/tbi.swift
index df3a20f..6eae244 100644
--- a/test/Misc/tbi.swift
+++ b/test/Misc/tbi.swift
@@ -1,10 +1,10 @@
 // RUN: %target-build-swift -target arm64-apple-ios8.0 -target-cpu cyclone \
 // RUN:   -O -S %s -parse-as-library -parse-stdlib | \
-// RUN:   FileCheck --check-prefix=TBI %s
+// RUN:   %FileCheck --check-prefix=TBI %s
 
 // RUN: %target-build-swift -target arm64-apple-ios7.0 -target-cpu cyclone \
 // RUN:     -O -S %s -parse-as-library -parse-stdlib | \
-// RUN:   FileCheck --check-prefix=NO_TBI %s
+// RUN:   %FileCheck --check-prefix=NO_TBI %s
 
 // REQUIRES: CPU=arm64, OS=ios
 
diff --git a/test/NameBinding/Inputs/HasPrivateAccess1.swift b/test/NameBinding/Inputs/HasPrivateAccess1.swift
index c8ebd00..21dd0da 100644
--- a/test/NameBinding/Inputs/HasPrivateAccess1.swift
+++ b/test/NameBinding/Inputs/HasPrivateAccess1.swift
@@ -3,3 +3,10 @@
 public struct MyStruct {
   private static func method() -> Int? { return nil }
 }
+
+// Note: These are deliberately 'internal' here and 'private' in the other file.
+// They're testing that we don't filter out non-discriminated decls in lookup.
+internal func process(_ x: Int) -> Int { return x }
+extension MyStruct {
+  internal static func process(_ x: Int) -> Int { return x }
+}
diff --git a/test/NameBinding/Inputs/HasPrivateAccess2.swift b/test/NameBinding/Inputs/HasPrivateAccess2.swift
index 1c79bd1..ce143d2 100644
--- a/test/NameBinding/Inputs/HasPrivateAccess2.swift
+++ b/test/NameBinding/Inputs/HasPrivateAccess2.swift
@@ -3,3 +3,10 @@
 extension MyStruct {
   private static func method() -> String? { return nil }
 }
+
+// Note: These are deliberately 'private' here and 'internal' in the other file.
+// They're testing that we don't filter out non-discriminated decls in lookup.
+private func process(_ x: String) -> String { return x }
+extension MyStruct {
+  private static func process(_ x: String) -> String { return x }
+}
diff --git a/test/NameBinding/accessibility.swift b/test/NameBinding/accessibility.swift
index fbba954..16bf293 100644
--- a/test/NameBinding/accessibility.swift
+++ b/test/NameBinding/accessibility.swift
@@ -7,7 +7,7 @@
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/has_accessibility.swift -D DEFINE_VAR_FOR_SCOPED_IMPORT -enable-testing
 // RUN: %target-swift-frontend -parse -primary-file %t/main.swift %S/Inputs/accessibility_other.swift -module-name accessibility -I %t -sdk "" -enable-access-control -verify
 // RUN: %target-swift-frontend -parse -primary-file %t/main.swift %S/Inputs/accessibility_other.swift -module-name accessibility -I %t -sdk "" -disable-access-control -D ACCESS_DISABLED
-// RUN: not %target-swift-frontend -parse -primary-file %t/main.swift %S/Inputs/accessibility_other.swift -module-name accessibility -I %t -sdk "" -D TESTABLE 2>&1 | FileCheck -check-prefix=TESTABLE %s
+// RUN: not %target-swift-frontend -parse -primary-file %t/main.swift %S/Inputs/accessibility_other.swift -module-name accessibility -I %t -sdk "" -D TESTABLE 2>&1 | %FileCheck -check-prefix=TESTABLE %s
 
 #if TESTABLE
 @testable import has_accessibility
@@ -53,6 +53,15 @@
 Foo.c() // expected-error {{'c' is inaccessible due to 'private' protection level}}
 
 _ = Foo() // expected-error {{'Foo' initializer is inaccessible due to 'internal' protection level}}
+
+// <rdar://problem/27982012> QoI: Poor diagnostic for inaccessible initializer
+struct rdar27982012 {
+  var x: Int
+  private init(_ x: Int) { self.x = x }
+}
+
+_ = { rdar27982012($0.0) }((1, 2)) // expected-error {{type of expression is ambiguous without more context}}
+
 // TESTABLE-NOT: :[[@LINE-1]]:{{[^:]+}}:
 _ = PrivateInit() // expected-error {{'PrivateInit' initializer is inaccessible due to 'private' protection level}}
 // TESTABLE: :[[@LINE-1]]:{{[^:]+}}: error: 'PrivateInit' initializer is inaccessible due to 'private' protection level
@@ -96,9 +105,10 @@
 }
 
 extension OriginallyEmpty : MethodProto {}
-extension HiddenMethod : MethodProto {} // expected-error {{type 'HiddenMethod' does not conform to protocol 'MethodProto'}}
 // TESTABLE-NOT: :[[@LINE-1]]:{{[^:]+}}:
 #if !ACCESS_DISABLED
+extension HiddenMethod : MethodProto {} // expected-error {{type 'HiddenMethod' does not conform to protocol 'MethodProto'}}
+
 extension Foo : MethodProto {} // expected-error {{type 'Foo' does not conform to protocol 'MethodProto'}}
 #endif
 
@@ -108,9 +118,10 @@
 }
 
 extension OriginallyEmpty {}
+#if !ACCESS_DISABLED
 extension HiddenType : TypeProto {} // expected-error {{type 'HiddenType' does not conform to protocol 'TypeProto'}}
 // TESTABLE-NOT: :[[@LINE-1]]:{{[^:]+}}:
-#if !ACCESS_DISABLED
+
 extension Foo : TypeProto {} // expected-error {{type 'Foo' does not conform to protocol 'TypeProto'}}
 #endif
 
diff --git a/test/NameBinding/debug-client-discriminator.swift b/test/NameBinding/debug-client-discriminator.swift
index b4f6f93..f5203f3 100644
--- a/test/NameBinding/debug-client-discriminator.swift
+++ b/test/NameBinding/debug-client-discriminator.swift
@@ -1,9 +1,9 @@
 // RUN: rm -rf %t && mkdir -p %t
 
 // RUN: %target-swift-frontend -emit-module -o %t -module-name HasPrivateAccess %S/Inputs/HasPrivateAccess1.swift %S/Inputs/HasPrivateAccess2.swift
-// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -I %t -sdk "" -disable-access-control 2>&1 | FileCheck -check-prefix=CHECK-ERROR %s
-// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -I %t -sdk "" -disable-access-control -explode-pattern-binding-decls -debug-client-discriminator _5AB3F657DD2A7E5E793501C5FA480C3D | FileCheck -check-prefix=CHECK-INT %s
-// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -I %t -sdk "" -disable-access-control -explode-pattern-binding-decls -debug-client-discriminator _0D6EC78101B0986747C7103C2739A767 | FileCheck -check-prefix=CHECK-STRING %s
+// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -I %t -sdk "" -disable-access-control 2>&1 | %FileCheck -check-prefix=CHECK-ERROR %s
+// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -I %t -sdk "" -disable-access-control -explode-pattern-binding-decls -debug-client-discriminator _5AB3F657DD2A7E5E793501C5FA480C3D | %FileCheck -check-prefix=CHECK-INT %s
+// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -I %t -sdk "" -disable-access-control -explode-pattern-binding-decls -debug-client-discriminator _0D6EC78101B0986747C7103C2739A767 | %FileCheck -check-prefix=CHECK-STRING %s
 
 import HasPrivateAccess
 
@@ -21,3 +21,23 @@
 // CHECK-INT: let result: Int?
 // CHECK-STRING: let result: String?
 let result = HasPrivateAccess.MyStruct.method()
+
+// CHECK-ERROR: let processedInt: Int
+// CHECK-INT: let processedInt: Int
+// CHECK-STRING: let processedInt: Int
+let processedInt = process(1)
+
+// CHECK-ERROR: let processedIntQualified: Int
+// CHECK-INT: let processedIntQualified: Int
+// CHECK-STRING: let processedIntQualified: Int
+let processedIntQualified = MyStruct.process(1)
+
+// CHECK-ERROR: let processedString: String
+// CHECK-INT: let processedString: String
+// CHECK-STRING: let processedString: String
+let processedString = process("abc")
+
+// CHECK-ERROR: let processedStringQualified: String
+// CHECK-INT: let processedStringQualified: String
+// CHECK-STRING: let processedStringQualified: String
+let processedStringQualified = MyStruct.process("abc")
diff --git a/test/NameBinding/import-command-line.swift b/test/NameBinding/import-command-line.swift
index dd3097a..c4a8cf9 100644
--- a/test/NameBinding/import-command-line.swift
+++ b/test/NameBinding/import-command-line.swift
@@ -1,10 +1,10 @@
 // RUN: %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -verify
 // RUN: %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -import-module abcde
 
-// RUN: not %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -import-module 3333 2>&1 | FileCheck -check-prefix=NON-IDENT %s
+// RUN: not %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -import-module 3333 2>&1 | %FileCheck -check-prefix=NON-IDENT %s
 // NON-IDENT: error: module name "3333" is not a valid identifier
 
-// RUN: not %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -import-module NON_EXISTENT 2>&1 | FileCheck -check-prefix=NON-EXISTENT %s
+// RUN: not %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -import-module NON_EXISTENT 2>&1 | %FileCheck -check-prefix=NON-EXISTENT %s
 // NON-EXISTENT: error: no such module 'NON_EXISTENT'
 
 var a: A? // expected-error {{use of undeclared type 'A'}}
diff --git a/test/NameBinding/import-multiple-command-line.swift b/test/NameBinding/import-multiple-command-line.swift
index 1155857..86b860b 100644
--- a/test/NameBinding/import-multiple-command-line.swift
+++ b/test/NameBinding/import-multiple-command-line.swift
@@ -1,7 +1,7 @@
 // RUN: %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -verify
 // RUN: %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -import-module abcde -import-module aeiou
 
-// RUN: not %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -import-module abcde -import-module aeiou -import-module 3333 2>&1 | FileCheck -check-prefix=NON-IDENT %s
+// RUN: not %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -import-module abcde -import-module aeiou -import-module 3333 2>&1 | %FileCheck -check-prefix=NON-IDENT %s
 
 // NON-IDENT: error: module name "3333" is not a valid identifier
 
diff --git a/test/NameBinding/import-resolution-overload.swift b/test/NameBinding/import-resolution-overload.swift
index 47c09ba..1de86ae 100644
--- a/test/NameBinding/import-resolution-overload.swift
+++ b/test/NameBinding/import-resolution-overload.swift
@@ -6,7 +6,7 @@
 // RUN: %target-swift-frontend -parse %s -I %t -sdk "" -verify
 
 // RUN: not %target-swift-frontend -dump-ast %s -I %t -sdk "" > %t.astdump 2>&1
-// RUN: FileCheck %s < %t.astdump
+// RUN: %FileCheck %s < %t.astdump
 
 import overload_intFunctions
 import overload_boolFunctions
diff --git a/test/NameBinding/import-resolution.swift b/test/NameBinding/import-resolution.swift
index aff9ee9..fa5c42b 100644
--- a/test/NameBinding/import-resolution.swift
+++ b/test/NameBinding/import-resolution.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir -p %t
 
 // RUN: %target-swift-frontend -parse %s -enable-source-import -I %S/Inputs -sdk "" -verify -show-diagnostics-after-fatal
-// RUN: not %target-swift-frontend -parse %s -I %S/Inputs -sdk "" -show-diagnostics-after-fatal 2>&1 | FileCheck %s -check-prefix=CHECK-NO-SOURCE-IMPORT
+// RUN: not %target-swift-frontend -parse %s -I %S/Inputs -sdk "" -show-diagnostics-after-fatal 2>&1 | %FileCheck %s -check-prefix=CHECK-NO-SOURCE-IMPORT
 
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/abcde.swift
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/aeiou.swift
@@ -10,7 +10,7 @@
 // RUN: %target-swift-frontend -emit-module -o %t -I %t %S/Inputs/letters.swift
 // RUN: %target-swift-frontend -parse %s -I %t -sdk "" -verify -show-diagnostics-after-fatal
 
-// RUN: %target-swift-ide-test -source-filename %s -print-module-imports -module-to-print=letters -I %t | FileCheck %s -check-prefix=CHECK-IMPORTS
+// RUN: %target-swift-ide-test -source-filename %s -print-module-imports -module-to-print=letters -I %t | %FileCheck %s -check-prefix=CHECK-IMPORTS
 
 // CHECK-NO-SOURCE-IMPORT: no such module 'letters'
 // CHECK-NO-SOURCE-IMPORT: no such module 'abcde'
diff --git a/test/NameBinding/import-specific-decl.swift b/test/NameBinding/import-specific-decl.swift
index 6911919..6a11f98 100644
--- a/test/NameBinding/import-specific-decl.swift
+++ b/test/NameBinding/import-specific-decl.swift
@@ -4,7 +4,7 @@
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/abcde.swift
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/aeiou.swift
 // RUN: %target-swift-frontend -parse %s -I %t -sdk "" -verify
-// RUN: not %target-swift-frontend -parse %s -I %t -sdk "" 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -parse %s -I %t -sdk "" 2>&1 | %FileCheck %s
 
 import struct aeiou.U
 import struct aeiou.E
diff --git a/test/NameBinding/import-specific-fixits.swift b/test/NameBinding/import-specific-fixits.swift
index ede774a..a8a4f65 100644
--- a/test/NameBinding/import-specific-fixits.swift
+++ b/test/NameBinding/import-specific-fixits.swift
@@ -8,7 +8,7 @@
 // RUN: echo "public var x = Int()" | %target-swift-frontend -module-name FooBar -emit-module -o %t -
 // RUN: %target-swift-frontend -parse -I %t -serialize-diagnostics-path %t.dia %s -verify
 // RUN: c-index-test -read-diagnostics %t.dia > %t.deserialized_diagnostics.txt 2>&1
-// RUN: FileCheck --input-file=%t.deserialized_diagnostics.txt %s
+// RUN: %FileCheck --input-file=%t.deserialized_diagnostics.txt %s
 
 import typealias Swift.Int
 import struct Swift.Int
diff --git a/test/NameBinding/reference-dependencies-dynamic-lookup.swift b/test/NameBinding/reference-dependencies-dynamic-lookup.swift
index 47ccaa9..6042037 100644
--- a/test/NameBinding/reference-dependencies-dynamic-lookup.swift
+++ b/test/NameBinding/reference-dependencies-dynamic-lookup.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -primary-file %t/main.swift -emit-reference-dependencies-path - > %t.swiftdeps
-// RUN: FileCheck %s < %t.swiftdeps
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t.swiftdeps
+// RUN: %FileCheck %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t.swiftdeps
 
 // REQUIRES: objc_interop
 
diff --git a/test/NameBinding/reference-dependencies-members.swift b/test/NameBinding/reference-dependencies-members.swift
index 95c0514..7b386eb 100644
--- a/test/NameBinding/reference-dependencies-members.swift
+++ b/test/NameBinding/reference-dependencies-members.swift
@@ -2,14 +2,14 @@
 // RUN: cp %s %t/main.swift
 // RUN: %target-swift-frontend -parse -primary-file %t/main.swift %S/Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - > %t.swiftdeps
 
-// RUN: FileCheck -check-prefix=PROVIDES-NOMINAL %s < %t.swiftdeps
-// RUN: FileCheck -check-prefix=PROVIDES-NOMINAL-NEGATIVE %s < %t.swiftdeps
-// RUN: FileCheck -check-prefix=PROVIDES-MEMBER %s < %t.swiftdeps
-// RUN: FileCheck -check-prefix=PROVIDES-MEMBER-NEGATIVE %s < %t.swiftdeps
-// RUN: FileCheck -check-prefix=DEPENDS-NOMINAL %s < %t.swiftdeps
-// RUN: FileCheck -check-prefix=DEPENDS-NOMINAL-NEGATIVE %s < %t.swiftdeps
-// RUN: FileCheck -check-prefix=DEPENDS-MEMBER %s < %t.swiftdeps
-// RUN: FileCheck -check-prefix=DEPENDS-MEMBER-NEGATIVE %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=PROVIDES-NOMINAL %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=PROVIDES-NOMINAL-NEGATIVE %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=PROVIDES-MEMBER %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=PROVIDES-MEMBER-NEGATIVE %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=DEPENDS-NOMINAL %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=DEPENDS-NOMINAL-NEGATIVE %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=DEPENDS-MEMBER %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=DEPENDS-MEMBER-NEGATIVE %s < %t.swiftdeps
 
 
 // PROVIDES-NOMINAL-LABEL: {{^provides-nominal:$}}
diff --git a/test/NameBinding/reference-dependencies.swift b/test/NameBinding/reference-dependencies.swift
index b8435a2..5a27740 100644
--- a/test/NameBinding/reference-dependencies.swift
+++ b/test/NameBinding/reference-dependencies.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-swift-frontend -parse -primary-file %t/main.swift %S/Inputs/reference-dependencies-helper.swift -emit-reference-dependencies-path - > %t.swiftdeps
-// RUN: FileCheck %s < %t.swiftdeps
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t.swiftdeps
+// RUN: %FileCheck %s < %t.swiftdeps
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t.swiftdeps
 
 // CHECK-LABEL: {{^provides-top-level:$}}
 // CHECK-NEXT: "IntWrapper"
diff --git a/test/Parse/ConditionalCompilation/decl_parse_errors.swift b/test/Parse/ConditionalCompilation/decl_parse_errors.swift
index 6ca6ee8..241353d 100644
--- a/test/Parse/ConditionalCompilation/decl_parse_errors.swift
+++ b/test/Parse/ConditionalCompilation/decl_parse_errors.swift
@@ -1,5 +1,32 @@
 // RUN: %target-parse-verify-swift
 
+public
+#if FOO // expected-error {{expected declaration}}
+var val1: Int = 0
+#else
+var val1: UInt = 1
+#endif
+
+struct S2 { // expected-note {{in declaration of 'S2'}}
+  @available(*, deprecated)
+#if FOO // expected-error {{expected declaration}}
+  func fn1() {}
+#endif
+}
+
+// expected-error@+2 {{expected declaration}}
+private
+#sourceLocation(file: "test.swift", line: 1)
+var val2: Int = 0
+#sourceLocation()
+
+// expected-error@+3 {{expected declaration}}
+// expected-error@+2 {{#line directive was renamed to #sourceLocation}}
+lazy
+#line 12 "test.swift"
+var val3: Int = 0;
+#line
+
 class C { // expected-note 3 {{in declaration of 'C'}}
 
 #if os(iOS)
diff --git a/test/Parse/EOF/block-comment-missing-newline.swift b/test/Parse/EOF/block-comment-missing-newline.swift
index e6a7531..4547532 100644
--- a/test/Parse/EOF/block-comment-missing-newline.swift
+++ b/test/Parse/EOF/block-comment-missing-newline.swift
@@ -1,4 +1,4 @@
 // RUN: %target-parse-verify-swift
 
 // This file does not end in a trailing newline; this is deliberate!
-/* unterminated block comment expected-note{{comment started here}} expected-error{{unterminated '/*' comment}}{{126-126=*/}}
+/* unterminated block comment expected-note{{comment started here}} expected-error{{unterminated '/*' comment}}{{126-126=*/}}
\ No newline at end of file
diff --git a/test/Parse/EOF/unterminated-string-literal-missing-newline.swift b/test/Parse/EOF/unterminated-string-literal-missing-newline.swift
index f1354dd..8a40f90 100644
--- a/test/Parse/EOF/unterminated-string-literal-missing-newline.swift
+++ b/test/Parse/EOF/unterminated-string-literal-missing-newline.swift
@@ -4,4 +4,4 @@
 
 // This file does not end in a trailing newline; this is deliberate, don't fix it!
 
-/* expected-error {{unterminated string literal}} */ "
+/* expected-error {{unterminated string literal}} */ "
\ No newline at end of file
diff --git a/test/Parse/deprecated_where.swift b/test/Parse/deprecated_where.swift
index 6c793e0..d57e091 100644
--- a/test/Parse/deprecated_where.swift
+++ b/test/Parse/deprecated_where.swift
@@ -64,3 +64,16 @@
 // 1,2,3
 struct S123<T: Hashable where T: Comparable> where T: Equatable {} // expected-warning {{'where' clause next to generic parameters is deprecated and will be removed in the future version of Swift}} {{24-44=}} {{46-51=where T: Comparable,}}
 
+
+protocol ProtoA {}
+protocol ProtoB {}
+protocol ProtoC {}
+protocol ProtoD {}
+func testCombinedConstraints<T: ProtoA & ProtoB where T: ProtoC>(x: T) {} // expected-warning {{'where' clause next to generic parameters is deprecated and will be removed in the future version of Swift}} {{48-64=}} {{71-71= where T: ProtoC}}
+func testCombinedConstraints<T: ProtoA & ProtoB where T: ProtoC>(x: T) where T: ProtoD {} // expected-warning {{'where' clause next to generic parameters is deprecated and will be removed in the future version of Swift}} {{48-64=}} {{72-77=where T: ProtoC,}}
+
+func testCombinedConstraintsOld<T: protocol<ProtoA, ProtoB> where T: ProtoC>(x: T) {} // expected-warning {{'where' clause next to generic parameters is deprecated and will be removed in the future version of Swift}} {{60-76=}} {{83-83= where T: ProtoC}}
+// expected-warning@-1 {{'protocol<...>' composition syntax is deprecated}}
+func testCombinedConstraintsOld<T: protocol<ProtoA, ProtoB> where T: ProtoC>(x: T) where T: ProtoD {} // expected-warning {{'where' clause next to generic parameters is deprecated and will be removed in the future version of Swift}} {{60-76=}} {{84-89=where T: ProtoC,}}
+// expected-warning@-1 {{'protocol<...>' composition syntax is deprecated}}
+
diff --git a/test/Parse/diagnose_initializer_as_typed_pattern.swift b/test/Parse/diagnose_initializer_as_typed_pattern.swift
new file mode 100644
index 0000000..52d8c96
--- /dev/null
+++ b/test/Parse/diagnose_initializer_as_typed_pattern.swift
@@ -0,0 +1,35 @@
+// RUN: %target-parse-verify-swift
+
+// https://bugs.swift.org/browse/SR-1461
+
+class X {}
+func foo() {}
+
+let a:[X]()  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{6-7= = }}
+let b: [X]()  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{6-7= =}}
+let c :[X]()  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{7-8== }}
+let d : [X]()  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{7-8==}}
+
+let e: X(), ee: Int  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{6-7= =}}
+
+var _1 = 1, _2 = 2
+
+// paren follows the type, but it's part of a separate (valid) expression
+let ff: X
+(_1, _2) = (_2, _1)
+let fff: X
+ (_1, _2) = (_2, _1)
+
+let g: X(x)  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{6-7= =}}
+let h: X(x, y)  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{6-7= =}}
+let i: X() { foo() }  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{6-7= =}}
+let j: X(x) { foo() }  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{6-7= =}}
+let k: X(x, y) { foo() }  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{6-7= =}}
+
+func nonTopLevel() {
+  let a:[X]()   // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{8-9= = }}
+  let i: X() { foo() }  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{8-9= =}}
+  let j: X(x) { foo() }  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{8-9= =}}
+  let k: X(x, y) { foo() }  // expected-error{{unexpected initializer in pattern; did you mean to use '='?}} {{8-9= =}}
+  _ = (a, i, j, k)
+}
diff --git a/test/Parse/diagnostic_points_to_first_bad_token.swift b/test/Parse/diagnostic_points_to_first_bad_token.swift
index 3d478c1..f26e9db 100644
--- a/test/Parse/diagnostic_points_to_first_bad_token.swift
+++ b/test/Parse/diagnostic_points_to_first_bad_token.swift
@@ -1,4 +1,4 @@
-// RUN: not %target-swift-frontend -parse %s 2>&1 | FileCheck -strict-whitespace %s
+// RUN: not %target-swift-frontend -parse %s 2>&1 | %FileCheck -strict-whitespace %s
 
 // Test the diagnostic option 'PointsToFirstBadToken'.
 
diff --git a/test/Parse/enum.swift b/test/Parse/enum.swift
index 1e1fe53..78a00b1 100644
--- a/test/Parse/enum.swift
+++ b/test/Parse/enum.swift
@@ -128,7 +128,7 @@
 } // expected-error {{expected identifier after comma in enum 'case' declaration}}
 
 enum RawTypeEmpty : Int {} // expected-error {{an enum with no cases cannot declare a raw type}}
-// expected-error@-1{{type 'RawTypeEmpty' does not conform to protocol 'RawRepresentable'}}
+// expected-error@-1{{'RawTypeEmpty' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
 
 enum Raw : Int {
   case Ankeny, Burnside
@@ -144,7 +144,7 @@
 }
 
 enum ExpressibleByRawTypeNotLiteral : Array<Int> { // expected-error {{raw type 'Array<Int>' is not expressible by any literal}}
-  // expected-error@-1{{type 'ExpressibleByRawTypeNotLiteral' does not conform to protocol 'RawRepresentable'}}
+  // expected-error@-1{{'ExpressibleByRawTypeNotLiteral' declares raw type 'Array<Int>', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case Ladd, Elliott, Sixteenth, Harrison
 }
 
@@ -167,7 +167,7 @@
 struct ExpressibleByFloatLiteralOnly : ExpressibleByFloatLiteral {
     init(floatLiteral: Double) {}
 }
-enum ExpressibleByRawTypeNotIntegerLiteral : ExpressibleByFloatLiteralOnly { // expected-error {{RawRepresentable 'init' cannot be synthesized because raw type 'ExpressibleByFloatLiteralOnly' is not Equatable}}
+enum ExpressibleByRawTypeNotIntegerLiteral : ExpressibleByFloatLiteralOnly { // expected-error {{'ExpressibleByRawTypeNotIntegerLiteral' declares raw type 'ExpressibleByFloatLiteralOnly', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-error {{RawRepresentable 'init' cannot be synthesized because raw type 'ExpressibleByFloatLiteralOnly' is not Equatable}}
   case Everett // expected-error {{enum cases require explicit raw values when the raw type is not expressible by integer or string literal}}
   case Flanders
 }
@@ -181,23 +181,23 @@
   case AutoIncAcrossZero = -1, Zero, One
 }
 
-enum RawTypeWithUnicodeScalarValues : UnicodeScalar {
+enum RawTypeWithUnicodeScalarValues : UnicodeScalar { // expected-error {{'RawTypeWithUnicodeScalarValues' declares raw type 'UnicodeScalar', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case Kearney = "K"
   case Lovejoy // expected-error {{enum cases require explicit raw values when the raw type is not expressible by integer or string literal}}
   case Marshall = "M"
 }
 
-enum RawTypeWithCharacterValues : Character {
+enum RawTypeWithCharacterValues : Character { // expected-error {{'RawTypeWithCharacterValues' declares raw type 'Character', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case First = "い"
   case Second // expected-error {{enum cases require explicit raw values when the raw type is not expressible by integer or string literal}}
   case Third = "は"
 }
 
-enum RawTypeWithCharacterValues_Error1 : Character {
+enum RawTypeWithCharacterValues_Error1 : Character { // expected-error {{'RawTypeWithCharacterValues_Error1' declares raw type 'Character', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case First = "abc" // expected-error {{cannot convert value of type 'String' to raw type 'Character'}}
 }
 
-enum RawTypeWithFloatValues : Float {
+enum RawTypeWithFloatValues : Float { // expected-error {{'RawTypeWithFloatValues' declares raw type 'Float', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case Northrup = 1.5
   case Overton // expected-error {{enum case must declare a raw value when the preceding raw value is not an integer}}
   case Pettygrove = 2.25
@@ -308,12 +308,12 @@
   case Yeon = 100 + 20 + 3 // expected-error {{raw value for enum case must be a literal}}
 }
 
-enum RawTypeWithPayload : Int { // expected-note {{declared raw type 'Int' here}} expected-note {{declared raw type 'Int' here}}
+enum RawTypeWithPayload : Int { // expected-error {{'RawTypeWithPayload' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{declared raw type 'Int' here}} expected-note {{declared raw type 'Int' here}}
   case Powell(Int) // expected-error {{enum with raw type cannot have cases with arguments}}
   case Terwilliger(Int) = 17 // expected-error {{enum with raw type cannot have cases with arguments}}
 }
 
-enum RawTypeMismatch : Int {
+enum RawTypeMismatch : Int { // expected-error {{'RawTypeMismatch' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case Barbur = "foo" // expected-error {{}}
 }
 
@@ -333,12 +333,12 @@
   case Foo(Int) // expected-error {{duplicate definition of enum element}}
 }
 
-enum DuplicateMembers4 : Int {
+enum DuplicateMembers4 : Int { // expected-error {{'DuplicateMembers4' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case Foo = 1 // expected-note {{previous definition of 'Foo' is here}}
   case Foo = 2 // expected-error {{duplicate definition of enum element}}
 }
 
-enum DuplicateMembers5 : Int {
+enum DuplicateMembers5 : Int { // expected-error {{'DuplicateMembers5' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case Foo = 1 // expected-note {{previous definition of 'Foo' is here}}
   case Foo = 1 + 1 // expected-error {{duplicate definition of enum element}} expected-error {{raw value for enum case must be a literal}}
 }
@@ -349,7 +349,7 @@
   case Foo // expected-error {{duplicate definition of enum element}}
 }
 
-enum DuplicateMembers7 : String {
+enum DuplicateMembers7 : String { // expected-error {{'DuplicateMembers7' declares raw type 'String', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case Foo // expected-note {{previous definition of 'Foo' is here}}
   case Foo = "Bar" // expected-error {{duplicate definition of enum element}}
 }
@@ -401,7 +401,7 @@
   case B = 0 // expected-error {{raw value for enum case is not unique}}
 }
 
-enum ManyLiteralB : ManyLiteralable {
+enum ManyLiteralB : ManyLiteralable { // expected-error {{'ManyLiteralB' declares raw type 'ManyLiteralable', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case A = "abc"
   case B // expected-error {{enum case must declare a raw value when the preceding raw value is not an integer}}
 }
@@ -430,7 +430,7 @@
   case A, B
 }
 
-enum foo : String {
+enum foo : String { // expected-error {{'foo' declares raw type 'String', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case bar = nil // expected-error {{cannot convert nil to raw type 'String'}}
 }
 
diff --git a/test/Parse/if_expr.swift b/test/Parse/if_expr.swift
index 76fed60..aa20ad4 100644
--- a/test/Parse/if_expr.swift
+++ b/test/Parse/if_expr.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -dump-ast %s 2>&1 | FileCheck %s
+// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s
 
 // CHECK: (func_decl "r13756261(_:_:)"
 func r13756261(_ x: Bool, _ y: Int) -> Int {
diff --git a/test/Parse/objc_enum.swift b/test/Parse/objc_enum.swift
index 5031f32..0d1f1e7 100644
--- a/test/Parse/objc_enum.swift
+++ b/test/Parse/objc_enum.swift
@@ -16,8 +16,7 @@
   case Zim, Zang, Zung
 }
 
-@objc enum NonIntegerRawType: Float { // expected-error{{'@objc' enum raw type 'Float' is not an integer type}}
-  // expected-error@-1{{type 'NonIntegerRawType' does not conform to protocol 'RawRepresentable'}}
+@objc enum NonIntegerRawType: Float { // expected-error{{'@objc' enum raw type 'Float' is not an integer type}} expected-error {{'NonIntegerRawType' declares raw type 'Float', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case Zim = 1.0, Zang = 1.5, Zung = 2.0
 }
 
@@ -31,7 +30,7 @@
 }
 
 // <rdar://problem/23681566> @objc enums with payloads rejected with no source location info
-@objc enum r23681566 : Int {  // expected-note {{declared raw type 'Int' here}}
+@objc enum r23681566 : Int {  // expected-error {{'r23681566' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{declared raw type 'Int' here}}
   case Foo(progress: Int)     // expected-error {{enum with raw type cannot have cases with arguments}}
 }
 
diff --git a/test/Parse/operator_decl.swift b/test/Parse/operator_decl.swift
index df11d66..0d37e9e 100644
--- a/test/Parse/operator_decl.swift
+++ b/test/Parse/operator_decl.swift
@@ -1,8 +1,12 @@
 // RUN: %target-parse-verify-swift
 
-prefix operator +++ {} // expected-warning {{operator should no longer be declared with body}}
-postfix operator +++ {} // expected-warning {{operator should no longer be declared with body}}
-infix operator +++ {} // expected-warning {{operator should no longer be declared with body}}
+prefix operator +++ {} // expected-warning {{operator should no longer be declared with body}} {{20-23=}}
+postfix operator +++ {} // expected-warning {{operator should no longer be declared with body}} {{21-24=}}
+infix operator +++ {} // expected-warning {{operator should no longer be declared with body}} {{19-22=}}
+infix operator +++* { // expected-warning {{operator should no longer be declared with body; use a precedence group instead}} {{none}}
+  associativity right
+}
+infix operator +++** : A { } // expected-warning {{operator should no longer be declared with body}} {{25-29=}}
 
 prefix operator // expected-error {{expected operator name in operator declaration}}
 
diff --git a/test/Parse/recovery.swift b/test/Parse/recovery.swift
index 79e3318..107469e 100644
--- a/test/Parse/recovery.swift
+++ b/test/Parse/recovery.swift
@@ -603,7 +603,7 @@
 
 
 // <rdar://problem/21369926> Malformed Swift Enums crash playground service
-enum Rank: Int {
+enum Rank: Int {  // expected-error {{'Rank' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
   case Ace = 1
   case Two = 2.1  // expected-error {{cannot convert value of type 'Double' to raw type 'Int'}}
 }
diff --git a/test/PlaygroundTransform/array.swift b/test/PlaygroundTransform/array.swift
index 345a8d4..152852f 100644
--- a/test/PlaygroundTransform/array.swift
+++ b/test/PlaygroundTransform/array.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 var foo = [true, false]
diff --git a/test/PlaygroundTransform/array_did_set.swift b/test/PlaygroundTransform/array_did_set.swift
index dc46e8a..e32da8f 100644
--- a/test/PlaygroundTransform/array_did_set.swift
+++ b/test/PlaygroundTransform/array_did_set.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 struct S {
     var a : [Int] = [] {
diff --git a/test/PlaygroundTransform/array_in_struct.swift b/test/PlaygroundTransform/array_in_struct.swift
index bc8c63d..a1d6e70 100644
--- a/test/PlaygroundTransform/array_in_struct.swift
+++ b/test/PlaygroundTransform/array_in_struct.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 // FIXME: We need to instrument mutations of objects that are accessed in
diff --git a/test/PlaygroundTransform/bare_value.swift b/test/PlaygroundTransform/bare_value.swift
index 6fee164..3c0f281 100644
--- a/test/PlaygroundTransform/bare_value.swift
+++ b/test/PlaygroundTransform/bare_value.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 1
diff --git a/test/PlaygroundTransform/control-flow.swift b/test/PlaygroundTransform/control-flow.swift
index e7eaa24..8c35d73 100644
--- a/test/PlaygroundTransform/control-flow.swift
+++ b/test/PlaygroundTransform/control-flow.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 var a = true
diff --git a/test/PlaygroundTransform/declarations.swift b/test/PlaygroundTransform/declarations.swift
index e6da660..376123a 100644
--- a/test/PlaygroundTransform/declarations.swift
+++ b/test/PlaygroundTransform/declarations.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 var a = 2
diff --git a/test/PlaygroundTransform/declarations_error.swift b/test/PlaygroundTransform/declarations_error.swift
index ef91418..a1cc15a 100644
--- a/test/PlaygroundTransform/declarations_error.swift
+++ b/test/PlaygroundTransform/declarations_error.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: cp %s %t/main.swift
-// RUN: not %target-swift-frontend -parse -playground %t/main.swift 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -parse -playground %t/main.swift 2>&1 | %FileCheck %s
 
 // CHECK: error: no such module
 import Nonexistent_Module
diff --git a/test/PlaygroundTransform/disable_transform_only.swift b/test/PlaygroundTransform/disable_transform_only.swift
index b6723f3..15f035b 100644
--- a/test/PlaygroundTransform/disable_transform_only.swift
+++ b/test/PlaygroundTransform/disable_transform_only.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -disable-playground-transform -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s -allow-empty
+// RUN: %target-run %t/main | %FileCheck %s -allow-empty
 // REQUIRES: executable_test
 
 var a = 2
diff --git a/test/PlaygroundTransform/do-catch.swift b/test/PlaygroundTransform/do-catch.swift
index cf3096f..8f5c710 100644
--- a/test/PlaygroundTransform/do-catch.swift
+++ b/test/PlaygroundTransform/do-catch.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 func doSomething() throws -> Int { return 5 }
diff --git a/test/PlaygroundTransform/do.swift b/test/PlaygroundTransform/do.swift
index ffd389a..ad3051f 100644
--- a/test/PlaygroundTransform/do.swift
+++ b/test/PlaygroundTransform/do.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 do {
   1
diff --git a/test/PlaygroundTransform/empty-tuple.swift b/test/PlaygroundTransform/empty-tuple.swift
new file mode 100644
index 0000000..9a8a72c
--- /dev/null
+++ b/test/PlaygroundTransform/empty-tuple.swift
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t && mkdir %t
+// RUN: cp %s %t/main.swift
+// RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
+// RUN: %target-run %t/main | %FileCheck %s
+// REQUIRES: executable_test
+func foo() { }
+foo()
+1+2
+// CHECK: {{.*}} $builtin_log[='3']
diff --git a/test/PlaygroundTransform/high_performance.swift b/test/PlaygroundTransform/high_performance.swift
index 261b411..788a1a7 100644
--- a/test/PlaygroundTransform/high_performance.swift
+++ b/test/PlaygroundTransform/high_performance.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -playground-high-performance -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 var a = true
diff --git a/test/PlaygroundTransform/init.swift b/test/PlaygroundTransform/init.swift
index 8804e5e..856f2fe 100644
--- a/test/PlaygroundTransform/init.swift
+++ b/test/PlaygroundTransform/init.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 class B {
diff --git a/test/PlaygroundTransform/mutation.swift b/test/PlaygroundTransform/mutation.swift
index 5e6c7a1..d2ba28c 100644
--- a/test/PlaygroundTransform/mutation.swift
+++ b/test/PlaygroundTransform/mutation.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 class A {
diff --git a/test/PlaygroundTransform/placeholder.swift b/test/PlaygroundTransform/placeholder.swift
index c6ac771..fb33211 100644
--- a/test/PlaygroundTransform/placeholder.swift
+++ b/test/PlaygroundTransform/placeholder.swift
@@ -2,8 +2,8 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -disable-playground-transform -o %t/main %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
-// RUN: ! %target-run %t/main --crash 2>&1 | FileCheck -check-prefix=CRASH-CHECK %s
+// RUN: %target-run %t/main | %FileCheck %s
+// RUN: ! %target-run %t/main --crash 2>&1 | %FileCheck -check-prefix=CRASH-CHECK %s
 // REQUIRES: executable_test
 
 // NOTE: "!" is used above instead of "not --crash" because simctl's exit
diff --git a/test/PlaygroundTransform/plus_equals.swift b/test/PlaygroundTransform/plus_equals.swift
new file mode 100644
index 0000000..20410f5
--- /dev/null
+++ b/test/PlaygroundTransform/plus_equals.swift
@@ -0,0 +1,13 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: cp %s %t/main.swift
+// RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
+// RUN: %target-run %t/main | %FileCheck %s
+// REQUIRES: executable_test
+
+var a = "a"
+var b = "b" 
+a += b 
+// CHECK: [{{.*}}] $builtin_log[a='a']
+// CHECK-NEXT: [{{.*}}] $builtin_log[b='b']
+// CHECK-NEXT: [{{.*}}] $builtin_log[a='ab']
diff --git a/test/PlaygroundTransform/print.swift b/test/PlaygroundTransform/print.swift
index fc394a1..165f7ae 100644
--- a/test/PlaygroundTransform/print.swift
+++ b/test/PlaygroundTransform/print.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: cp %s %t/main.swift
 // RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift
-// RUN: %target-run %t/main | FileCheck %s
+// RUN: %target-run %t/main | %FileCheck %s
 // REQUIRES: executable_test
 
 var str : String = ""
diff --git a/test/PrintAsObjC/Inputs/custom-modules/module.map b/test/PrintAsObjC/Inputs/custom-modules/module.map
index b64e1c5..f406749 100644
--- a/test/PrintAsObjC/Inputs/custom-modules/module.map
+++ b/test/PrintAsObjC/Inputs/custom-modules/module.map
@@ -23,3 +23,7 @@
   header "override.h"
   export *
 }
+
+module OtherModule {
+  // Deliberately empty. Used by depends-on-swift-framework.swift.
+}
diff --git a/test/PrintAsObjC/Inputs/depends-on-swift-framework-helper.swift b/test/PrintAsObjC/Inputs/depends-on-swift-framework-helper.swift
new file mode 100644
index 0000000..765ef9c
--- /dev/null
+++ b/test/PrintAsObjC/Inputs/depends-on-swift-framework-helper.swift
@@ -0,0 +1,3 @@
+import objc_generics
+
+public typealias AliasForFungible = Fungible
diff --git a/test/PrintAsObjC/accessibility.swift b/test/PrintAsObjC/accessibility.swift
index 740999e..5f34e4c 100644
--- a/test/PrintAsObjC/accessibility.swift
+++ b/test/PrintAsObjC/accessibility.swift
@@ -1,22 +1,22 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -parse-as-library %s -parse -emit-objc-header-path %t/accessibility.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-PUBLIC %s < %t/accessibility.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=CHECK-PUBLIC %s < %t/accessibility.h
 // RUN: %check-in-clang %t/accessibility.h
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -parse -emit-objc-header-path %t/accessibility-internal.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-INTERNAL %s < %t/accessibility-internal.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=CHECK-INTERNAL %s < %t/accessibility-internal.h
 // RUN: %check-in-clang %t/accessibility-internal.h
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %s -parse -import-objc-header %S/../Inputs/empty.h -emit-objc-header-path %t/accessibility-imported-header.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-INTERNAL %s < %t/accessibility-imported-header.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=CHECK-INTERNAL %s < %t/accessibility-imported-header.h
 // RUN: %check-in-clang %t/accessibility-imported-header.h
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %s -parse -DMAIN -emit-objc-header-path %t/accessibility-main.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-INTERNAL %s < %t/accessibility-main.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=CHECK-INTERNAL %s < %t/accessibility-main.h
 // RUN: %check-in-clang %t/accessibility-main.h
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %s -parse -application-extension -emit-objc-header-path %t/accessibility-appext.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-INTERNAL %s < %t/accessibility-appext.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=CHECK-INTERNAL %s < %t/accessibility-appext.h
 // RUN: %check-in-clang %t/accessibility-appext.h
 
 // REQUIRES: objc_interop
diff --git a/test/PrintAsObjC/any_as_id.swift b/test/PrintAsObjC/any_as_id.swift
index 42f9078..80dce60 100644
--- a/test/PrintAsObjC/any_as_id.swift
+++ b/test/PrintAsObjC/any_as_id.swift
@@ -10,10 +10,10 @@
 // RUN:  %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t  %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
 // FIXME: END -enable-source-import hackaround
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -enable-id-as-any -emit-module -o %t %s
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -enable-id-as-any -parse-as-library %t/any_as_id.swiftmodule -parse -emit-objc-header-path %t/any_as_id.h
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -parse-as-library %t/any_as_id.swiftmodule -parse -emit-objc-header-path %t/any_as_id.h
 
-// RUN: FileCheck %s < %t/any_as_id.h
+// RUN: %FileCheck %s < %t/any_as_id.h
 
 // RUN: %check-in-clang %t/any_as_id.h
 
diff --git a/test/PrintAsObjC/arc-conventions.swift b/test/PrintAsObjC/arc-conventions.swift
index 3085a23..f32474e 100644
--- a/test/PrintAsObjC/arc-conventions.swift
+++ b/test/PrintAsObjC/arc-conventions.swift
@@ -3,11 +3,11 @@
 
 // RUN: %target-clang -c -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -fobjc-arc -fmodules %S/Inputs/arc-conventions.m -o %t/main.o -I %t
 // RUN: %target-build-swift %t/swift.o %t/main.o -o %t/main
-// RUN: %target-run %t/main | FileCheck %S/Inputs/arc-conventions.m
+// RUN: %target-run %t/main | %FileCheck %S/Inputs/arc-conventions.m
 
 // RUN: %target-clang -c -Weverything -Werror -Wno-unused-macros -Wno-incomplete-module -fno-objc-arc -fmodules %S/Inputs/arc-conventions.m -o %t/main.o -I %t
 // RUN: %target-build-swift %t/swift.o %t/main.o -o %t/main
-// RUN: %target-run %t/main | FileCheck %S/Inputs/arc-conventions.m
+// RUN: %target-run %t/main | %FileCheck %S/Inputs/arc-conventions.m
 
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
diff --git a/test/PrintAsObjC/blocks.swift b/test/PrintAsObjC/blocks.swift
index aaef5b4..2908786 100644
--- a/test/PrintAsObjC/blocks.swift
+++ b/test/PrintAsObjC/blocks.swift
@@ -4,7 +4,7 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/blocks.swiftmodule -parse -emit-objc-header-path %t/blocks.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/blocks.h
+// RUN: %FileCheck %s < %t/blocks.h
 // RUN: %check-in-clang %t/blocks.h
 
 // REQUIRES: objc_interop
diff --git a/test/PrintAsObjC/cdecl.swift b/test/PrintAsObjC/cdecl.swift
index 6d50a44..41dcf83 100644
--- a/test/PrintAsObjC/cdecl.swift
+++ b/test/PrintAsObjC/cdecl.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-source-import -emit-module -emit-module-doc -o %t %s -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/cdecl.swiftmodule -parse -emit-objc-header-path %t/cdecl.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/cdecl.h
+// RUN: %FileCheck %s < %t/cdecl.h
 // RUN: %check-in-clang %t/cdecl.h
 // RUN: %check-in-clang -fno-modules -Qunused-arguments %t/cdecl.h -include Foundation.h -include ctypes.h -include CoreFoundation.h
 
diff --git a/test/PrintAsObjC/circularity-errors.swift b/test/PrintAsObjC/circularity-errors.swift
index 5774663..1bc4d7b 100644
--- a/test/PrintAsObjC/circularity-errors.swift
+++ b/test/PrintAsObjC/circularity-errors.swift
@@ -13,7 +13,7 @@
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/circularity.h -emit-module -o %t %s
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/circularity.h -parse-as-library %t/circularity-errors.swiftmodule -parse -emit-objc-header-path %t/circularity-errors.h
 
-// RUN: FileCheck %s < %t/circularity-errors.h
+// RUN: %FileCheck %s < %t/circularity-errors.h
 // RUN: not %check-in-clang %t/circularity-errors.h
 
 import Foundation
diff --git a/test/PrintAsObjC/circularity.swift b/test/PrintAsObjC/circularity.swift
index 2e08e36..5f07991 100644
--- a/test/PrintAsObjC/circularity.swift
+++ b/test/PrintAsObjC/circularity.swift
@@ -13,7 +13,7 @@
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/circularity.h -emit-module -o %t %s
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/circularity.h -parse-as-library %t/circularity.swiftmodule -parse -emit-objc-header-path %t/circularity.h
 
-// RUN: FileCheck %s < %t/circularity.h
+// RUN: %FileCheck %s < %t/circularity.h
 
 // RUN: %check-in-clang %t/circularity.h
 // RUN: %check-in-clang -fno-modules -Qunused-arguments %t/circularity.h
diff --git a/test/PrintAsObjC/classes.swift b/test/PrintAsObjC/classes.swift
index bee800e..a0228f3 100644
--- a/test/PrintAsObjC/classes.swift
+++ b/test/PrintAsObjC/classes.swift
@@ -15,8 +15,8 @@
 
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %s -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -parse-as-library %t/classes.swiftmodule -parse -emit-objc-header-path %t/classes.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/classes.h
-// RUN: FileCheck --check-prefix=NEGATIVE %s < %t/classes.h
+// RUN: %FileCheck %s < %t/classes.h
+// RUN: %FileCheck --check-prefix=NEGATIVE %s < %t/classes.h
 // RUN: %check-in-clang %t/classes.h
 // RUN: not %check-in-clang -fno-modules -Qunused-arguments %t/classes.h
 // RUN: %check-in-clang -fno-modules -Qunused-arguments %t/classes.h -include Foundation.h -include CoreFoundation.h -include objc_generics.h
@@ -328,6 +328,18 @@
 // CHECK-NEXT: @end
 @objc protocol MyProtocol : NSObjectProtocol {}
 
+// CHECK-LABEL: @protocol MyProtocolMetaOnly;
+// CHECK-LABEL: @interface MyProtocolMetaCheck
+// CHECK-NEXT: - (void)test:(Class <MyProtocolMetaOnly> _Nullable)x;
+// CHECK-NEXT: init
+// CHECK-NEXT: @end
+@objc class MyProtocolMetaCheck {
+  func test(_ x: MyProtocolMetaOnly.Type?) {}
+}
+// CHECK-LABEL: @protocol MyProtocolMetaOnly
+// CHECK-NEXT: @end
+@objc protocol MyProtocolMetaOnly {}
+
 // CHECK-LABEL: @interface Nested
 // CHECK-NEXT: init
 // CHECK-NEXT: @end
@@ -699,6 +711,10 @@
   @objc func takeAndReturnGenericClass(_ x: GenericClass<NSString>?) -> GenericClass<AnyObject> { fatalError("") }
   // CHECK: - (FungibleContainer<id <Fungible>> * _Null_unspecified)takeAndReturnFungibleContainer:(FungibleContainer<Spoon *> * _Nonnull)x;
   @objc func takeAndReturnFungibleContainer(_ x: FungibleContainer<Spoon>) -> FungibleContainer<Fungible>! { fatalError("") }
+
+  typealias Dipper = Spoon
+  // CHECK: - (FungibleContainer<FungibleObject> * _Nonnull)fungibleContainerWithAliases:(FungibleContainer<Spoon *> * _Nullable)x;
+  @objc func fungibleContainerWithAliases(_ x: FungibleContainer<Dipper>?) -> FungibleContainer<FungibleObject> { fatalError("") }
 }
 // CHECK: @end
 
diff --git a/test/PrintAsObjC/depends-on-swift-framework.swift b/test/PrintAsObjC/depends-on-swift-framework.swift
new file mode 100644
index 0000000..434f1d3
--- /dev/null
+++ b/test/PrintAsObjC/depends-on-swift-framework.swift
@@ -0,0 +1,31 @@
+// RUN: rm -rf %t && mkdir %t
+
+// FIXME: BEGIN -enable-source-import hackaround
+// RUN:  %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/ObjectiveC.swift
+// RUN:  %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t  %S/../Inputs/clang-importer-sdk/swift-modules/CoreGraphics.swift
+// RUN:  %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t  %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
+// FIXME: END -enable-source-import hackaround
+
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/Inputs/depends-on-swift-framework-helper.swift -module-name OtherModule
+
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/../Inputs/empty.h -emit-module -o %t %s -module-name main
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/../Inputs/empty.h -parse-as-library %t/main.swiftmodule -parse -emit-objc-header-path %t/main.h
+
+// RUN: %FileCheck %s < %t/main.h
+
+// RUN: %check-in-clang -I %S/Inputs/custom-modules %t/main.h
+// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/main.h -include objc_generics.h
+
+// REQUIRES: objc_interop
+
+import Foundation
+import objc_generics
+import OtherModule
+
+// CHECK-LABEL: @interface Test
+public class Test: NSObject {
+  // CHECK: - (void)testSimpleTypealias:(id <Fungible> _Nonnull)_;
+  func testSimpleTypealias(_: AliasForFungible) {}
+  // CHECK: - (void)testGenericTypealias:(FungibleContainer<id <Fungible>> * _Nonnull)_;
+  func testGenericTypealias(_: FungibleContainer<AliasForFungible>) {}
+} // CHECK: @end
diff --git a/test/PrintAsObjC/empty.swift b/test/PrintAsObjC/empty.swift
index d14f908..e22224d 100644
--- a/test/PrintAsObjC/empty.swift
+++ b/test/PrintAsObjC/empty.swift
@@ -1,10 +1,10 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -parse -emit-objc-header-path %t/empty.h
-// RUN: FileCheck %s < %t/empty.h
+// RUN: %FileCheck %s < %t/empty.h
 // RUN: %check-in-clang -std=c99 %t/empty.h
 // RUN: %check-in-clang -std=c99 -fno-modules -Qunused-arguments %t/empty.h
-// RUN: not %check-in-clang -I %S/Inputs/clang-headers %t/empty.h 2>&1 | FileCheck %s --check-prefix=CUSTOM-OBJC-PROLOGUE
+// RUN: not %check-in-clang -I %S/Inputs/clang-headers %t/empty.h 2>&1 | %FileCheck %s --check-prefix=CUSTOM-OBJC-PROLOGUE
 
 // Make sure we can handle two bridging headers. rdar://problem/22702104
 // RUN: %check-in-clang -include %t/empty.h -std=c99 -fno-modules -Qunused-arguments %t/empty.h
diff --git a/test/PrintAsObjC/enums.swift b/test/PrintAsObjC/enums.swift
index cd532c6..63a3e94 100644
--- a/test/PrintAsObjC/enums.swift
+++ b/test/PrintAsObjC/enums.swift
@@ -2,8 +2,8 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-source-import -emit-module -emit-module-doc -o %t %s -import-objc-header %S/Inputs/enums.h -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/enums.swiftmodule -parse -emit-objc-header-path %t/enums.h -import-objc-header %S/Inputs/enums.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/enums.h
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t/enums.h
+// RUN: %FileCheck %s < %t/enums.h
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/enums.h
 // RUN: %check-in-clang %t/enums.h
 // RUN: %check-in-clang -fno-modules -Qunused-arguments %t/enums.h -include Foundation.h -include ctypes.h -include CoreFoundation.h
 
diff --git a/test/PrintAsObjC/error-delegate.swift b/test/PrintAsObjC/error-delegate.swift
index 36f47ea..1e03b6c 100644
--- a/test/PrintAsObjC/error-delegate.swift
+++ b/test/PrintAsObjC/error-delegate.swift
@@ -13,7 +13,7 @@
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/error-delegate.h -emit-module -o %t %s
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/error-delegate.h -parse-as-library %t/error-delegate.swiftmodule -parse -emit-objc-header-path %t/error-delegate.h
 
-// RUN: FileCheck %s < %t/error-delegate.h
+// RUN: %FileCheck %s < %t/error-delegate.h
 // RUN: %check-in-clang %t/error-delegate.h
 
 import Foundation
diff --git a/test/PrintAsObjC/extensions.swift b/test/PrintAsObjC/extensions.swift
index 7adb84d..2fde403 100644
--- a/test/PrintAsObjC/extensions.swift
+++ b/test/PrintAsObjC/extensions.swift
@@ -4,14 +4,15 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/extensions.swiftmodule -parse -emit-objc-header-path %t/extensions.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/extensions.h
-// RUN: FileCheck --check-prefix=NEGATIVE %s < %t/extensions.h
+// RUN: %FileCheck %s < %t/extensions.h
+// RUN: %FileCheck --check-prefix=NEGATIVE %s < %t/extensions.h
 // RUN: %check-in-clang %t/extensions.h
 
 // REQUIRES: objc_interop
 
 import Foundation
 import AppKit
+import objc_generics
 
 // CHECK-NOT: AppKit
 
@@ -83,6 +84,13 @@
   func anyOldMethod() {}
 }
 
+// CHECK-LABEL: @interface GenericClass (SWIFT_EXTENSION(extensions))
+// CHECK-NEXT: - (void)bar;
+// CHECK-NEXT: @end
+extension GenericClass {
+  func bar() {}
+}
+
 // NEGATIVE-NOT: NotObjC
 class NotObjC {}
 extension NotObjC {}
diff --git a/test/PrintAsObjC/generic-ancestry.swift b/test/PrintAsObjC/generic-ancestry.swift
index 862c269..a84ec93 100644
--- a/test/PrintAsObjC/generic-ancestry.swift
+++ b/test/PrintAsObjC/generic-ancestry.swift
@@ -4,8 +4,8 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s -module-name generic -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/generic.swiftmodule -parse -emit-objc-header-path %t/generic.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/generic.h
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t/generic.h
+// RUN: %FileCheck %s < %t/generic.h
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/generic.h
 // RUN: %check-in-clang %t/generic.h
 
 // REQUIRES: objc_interop
diff --git a/test/PrintAsObjC/imports.swift b/test/PrintAsObjC/imports.swift
index 2c8e5cd..ff2037d 100644
--- a/test/PrintAsObjC/imports.swift
+++ b/test/PrintAsObjC/imports.swift
@@ -4,8 +4,8 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules/ -emit-module -o %t %s -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules/ -parse-as-library %t/imports.swiftmodule -parse -emit-objc-header-path %t/imports.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/imports.h
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t/imports.h
+// RUN: %FileCheck %s < %t/imports.h
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/imports.h
 // RUN: %check-in-clang %t/imports.h -I %S/Inputs/custom-modules/
 
 // REQUIRES: objc_interop
diff --git a/test/PrintAsObjC/local-types.swift b/test/PrintAsObjC/local-types.swift
index ca2729b..77bb5e5 100644
--- a/test/PrintAsObjC/local-types.swift
+++ b/test/PrintAsObjC/local-types.swift
@@ -4,7 +4,7 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s -module-name local -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/local.swiftmodule -parse -emit-objc-header-path %t/local.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/local.h
+// RUN: %FileCheck %s < %t/local.h
 // RUN: %check-in-clang %t/local.h
 
 // REQUIRES: objc_interop
diff --git a/test/PrintAsObjC/mixed-framework-fwd.swift b/test/PrintAsObjC/mixed-framework-fwd.swift
index 91b232b..d2b148e 100644
--- a/test/PrintAsObjC/mixed-framework-fwd.swift
+++ b/test/PrintAsObjC/mixed-framework-fwd.swift
@@ -1,18 +1,18 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -F %S/Inputs/ -module-name Mixed -import-underlying-module %s -parse -emit-objc-header-path %t/mixed.h
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=NO-IMPORT %s < %t/mixed.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=NO-IMPORT %s < %t/mixed.h
 // RUN: %check-in-clang -F %S/Inputs/ %t/mixed.h
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -module-name Mixed -import-objc-header %S/Inputs/Mixed.framework/Headers/Mixed.h %s -parse -emit-objc-header-path %t/mixed-header.h
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=NO-IMPORT %s < %t/mixed-header.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=NO-IMPORT %s < %t/mixed-header.h
 // RUN: %check-in-clang -include %S/Inputs/Mixed.framework/Headers/Mixed.h %t/mixed-header.h
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -F %S/Inputs/ -module-name Mixed -import-underlying-module %s -parse -emit-objc-header-path %t/mixed-proto.h -DREQUIRE
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=FRAMEWORK %s < %t/mixed-proto.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=FRAMEWORK %s < %t/mixed-proto.h
 // RUN: %check-in-clang -F %S/Inputs/ %t/mixed-proto.h
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -module-name Mixed -import-objc-header %S/Inputs/Mixed.framework/Headers/Mixed.h %s -parse -emit-objc-header-path %t/mixed-header-proto.h -DREQUIRE
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=HEADER %s < %t/mixed-header-proto.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=HEADER %s < %t/mixed-header-proto.h
 // RUN: %check-in-clang -include %S/Inputs/Mixed.framework/Headers/Mixed.h %t/mixed-header-proto.h
 
 // REQUIRES: objc_interop
diff --git a/test/PrintAsObjC/mixed-framework.swift b/test/PrintAsObjC/mixed-framework.swift
index a79d695..712c3f9 100644
--- a/test/PrintAsObjC/mixed-framework.swift
+++ b/test/PrintAsObjC/mixed-framework.swift
@@ -1,10 +1,10 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -F %S/Inputs/ -module-name Mixed -import-underlying-module -parse-as-library %s -parse -emit-objc-header-path %t/mixed.h
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=FRAMEWORK %s < %t/mixed.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=FRAMEWORK %s < %t/mixed.h
 // RUN: %check-in-clang -F %S/Inputs/ %t/mixed.h
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -module-name Mixed -import-objc-header %S/Inputs/Mixed.framework/Headers/Mixed.h %s -parse -emit-objc-header-path %t/mixed-header.h
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=HEADER %s < %t/mixed-header.h
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=HEADER %s < %t/mixed-header.h
 // RUN: %check-in-clang -include %S/Inputs/Mixed.framework/Headers/Mixed.h %t/mixed-header.h
 
 // REQUIRES: objc_interop
diff --git a/test/PrintAsObjC/newtype.swift b/test/PrintAsObjC/newtype.swift
index f7dbd75..5bc7a25 100644
--- a/test/PrintAsObjC/newtype.swift
+++ b/test/PrintAsObjC/newtype.swift
@@ -13,7 +13,7 @@
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/newtype.h -enable-swift-newtype -emit-module -o %t %s
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/newtype.h -enable-swift-newtype -parse-as-library %t/newtype.swiftmodule -parse -emit-objc-header-path %t/newtype.h
 
-// RUN: FileCheck %s < %t/newtype.h
+// RUN: %FileCheck %s < %t/newtype.h
 
 // RUN: %check-in-clang %t/newtype.h
 // RUN: %check-in-clang -fno-modules -Qunused-arguments %t/newtype.h
@@ -28,6 +28,8 @@
   func takesNewtypeArray(_ a: [EnumLikeStringWrapper]) {}
   // CHECK: - (void)takesNewtypeDictionary:(NSDictionary<EnumLikeStringWrapper, EnumLikeStringWrapper> * _Nonnull)a;
   func takesNewtypeDictionary(_ a: [EnumLikeStringWrapper: EnumLikeStringWrapper]) {}
+  // CHECK: - (void)takesNewtypeOptional:(EnumLikeStringWrapper _Nullable)a;
+  func takesNewtypeOptional(_ a: EnumLikeStringWrapper?) {}
 }
 // CHECK: @end
 
@@ -39,6 +41,8 @@
   func takesNewtypeArray(_ a: [StructLikeStringWrapper]) {}
   // CHECK: - (void)takesNewtypeDictionary:(NSDictionary<StructLikeStringWrapper, StructLikeStringWrapper> * _Nonnull)a;
   func takesNewtypeDictionary(_ a: [StructLikeStringWrapper: StructLikeStringWrapper]) {}
+  // CHECK: - (void)takesNewtypeOptional:(StructLikeStringWrapper _Nullable)a;
+  func takesNewtypeOptional(_ a: StructLikeStringWrapper?) {}
 }
 // CHECK: @end
 
diff --git a/test/PrintAsObjC/override.swift b/test/PrintAsObjC/override.swift
index 77ab1ad..c8cb900 100644
--- a/test/PrintAsObjC/override.swift
+++ b/test/PrintAsObjC/override.swift
@@ -9,9 +9,9 @@
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -I %S/Inputs/custom-modules -o %t %s
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -parse-as-library %t/override.swiftmodule -parse -emit-objc-header-path %t/override.h
-// RUN: FileCheck %s < %t/override.h
+// RUN: %FileCheck %s < %t/override.h
 // RUN: %check-in-clang %t/override.h -I %S/Inputs/custom-modules -Wno-super-class-method-mismatch -Wno-overriding-method-mismatch
-// RUN: not %check-in-clang %t/override.h -Wno-super-class-method-mismatch -I %S/Inputs/custom-modules 2>&1 | FileCheck -check-prefix=CLANG %s
+// RUN: not %check-in-clang %t/override.h -Wno-super-class-method-mismatch -I %S/Inputs/custom-modules 2>&1 | %FileCheck -check-prefix=CLANG %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/PrintAsObjC/pragma-clang.swift b/test/PrintAsObjC/pragma-clang.swift
index 14e887e..c639a2d 100644
--- a/test/PrintAsObjC/pragma-clang.swift
+++ b/test/PrintAsObjC/pragma-clang.swift
@@ -9,7 +9,7 @@
 
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) %s -import-objc-header %S/Inputs/bridging-header.h -parse -emit-objc-header-path %t/pragma-clang.h
 // RUN: %check-in-clang -fsyntax-only -Werror %t/pragma-clang.h
-// RUN: FileCheck %s < %t/pragma-clang.h
+// RUN: %FileCheck %s < %t/pragma-clang.h
 
 // REQUIRES: objc_interop
 
diff --git a/test/PrintAsObjC/protocols.swift b/test/PrintAsObjC/protocols.swift
index 8c637c1..f6c256d 100644
--- a/test/PrintAsObjC/protocols.swift
+++ b/test/PrintAsObjC/protocols.swift
@@ -11,8 +11,8 @@
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -I %t -emit-module -o %t %s -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -I %t -parse-as-library %t/protocols.swiftmodule -parse -emit-objc-header-path %t/protocols.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/protocols.h
-// RUN: FileCheck --check-prefix=NEGATIVE %s < %t/protocols.h
+// RUN: %FileCheck %s < %t/protocols.h
+// RUN: %FileCheck --check-prefix=NEGATIVE %s < %t/protocols.h
 // RUN: %check-in-clang %t/protocols.h
 
 // REQUIRES: objc_interop
diff --git a/test/PrintAsObjC/simd.swift b/test/PrintAsObjC/simd.swift
index fc92b51..07ab341 100644
--- a/test/PrintAsObjC/simd.swift
+++ b/test/PrintAsObjC/simd.swift
@@ -10,7 +10,7 @@
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -emit-module-doc -o %t -module-name simd_test %s
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -parse-as-library %t/simd_test.swiftmodule -parse -emit-objc-header-path %t/simd.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
-// RUN: FileCheck %s < %t/simd.h
+// RUN: %FileCheck %s < %t/simd.h
 // RUN: %check-in-clang %t/simd.h
 // RUN: %check-in-clang -fno-modules -Qunused-arguments %t/simd.h -include Foundation.h
 
diff --git a/test/PrintAsObjC/swift_name.m b/test/PrintAsObjC/swift_name.m
index a34cbae..fd2999a 100644
--- a/test/PrintAsObjC/swift_name.m
+++ b/test/PrintAsObjC/swift_name.m
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %S/../Inputs/empty.swift -parse -emit-objc-header-path %t/empty.h
-// RUN: %clang -E -fobjc-arc -fmodules -isysroot %clang-importer-sdk-path -I %t %s | FileCheck %s
+// RUN: %clang -E -fobjc-arc -fmodules -isysroot %clang-importer-sdk-path -I %t %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/PrintAsObjC/swift_name.swift b/test/PrintAsObjC/swift_name.swift
index 459f0fb..86d29cd 100644
--- a/test/PrintAsObjC/swift_name.swift
+++ b/test/PrintAsObjC/swift_name.swift
@@ -13,7 +13,7 @@
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/swift_name.h -emit-module -o %t %s
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/swift_name.h -parse-as-library %t/swift_name.swiftmodule -parse -emit-objc-header-path %t/swift_name.h
 
-// RUN: FileCheck %s < %t/swift_name.h
+// RUN: %FileCheck %s < %t/swift_name.h
 // RUN: %check-in-clang %t/swift_name.h
 
 import Foundation
diff --git a/test/Prototypes/GenericDispatch.swift b/test/Prototypes/GenericDispatch.swift
index 96b6c7a..cfd6d5f 100644
--- a/test/Prototypes/GenericDispatch.swift
+++ b/test/Prototypes/GenericDispatch.swift
@@ -15,7 +15,7 @@
 //  prototype to which we can refer when building the standard library.
 //
 //===----------------------------------------------------------------------===//
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // CHECK: testing...
diff --git a/test/Prototypes/TextFormatting.swift b/test/Prototypes/TextFormatting.swift
index 0df1cf3..bbca1c6 100644
--- a/test/Prototypes/TextFormatting.swift
+++ b/test/Prototypes/TextFormatting.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // Text Formatting Prototype
diff --git a/test/Reflection/Inputs/GenericTypes.swift b/test/Reflection/Inputs/GenericTypes.swift
index 7df3235..78a49f5 100644
--- a/test/Reflection/Inputs/GenericTypes.swift
+++ b/test/Reflection/Inputs/GenericTypes.swift
@@ -9,7 +9,7 @@
   public let tuple: Tuple
   public let dependentMember: T
 
-  public init(aClass: C1<T>, aStruct: S1<T>, anEnum: E1<T>, function: Function, tuple: Tuple, dependentMember: T) {
+  public init(aClass: C1<T>, aStruct: S1<T>, anEnum: E1<T>, function: @escaping Function, tuple: Tuple, dependentMember: T) {
     self.aClass = aClass
     self.aStruct = aStruct
     self.anEnum = anEnum
@@ -29,7 +29,7 @@
   public let tuple: Tuple
   public let primaryArchetype: T
   public let dependentMember1: T.Inner
-  public init(aClass: C1<T>, aStruct: S1<T>, anEnum: E1<T>, function: Function, tuple: Tuple, primaryArchetype: T, dependentMember1: T.Inner) {
+  public init(aClass: C1<T>, aStruct: S1<T>, anEnum: E1<T>, function: @escaping Function, tuple: Tuple, primaryArchetype: T, dependentMember1: T.Inner) {
     self.aClass = aClass
     self.aStruct = aStruct
     self.anEnum = anEnum
@@ -51,7 +51,7 @@
   public let primaryArchetype: T
   public let dependentMember1: T.Outer
   public let dependentMember2: T.Outer.Inner
-  public init(aClass: C3<T>, aStruct: S3<T>, anEnum: E3<T>, function: Function, tuple: Tuple, primaryArchetype: T, dependentMember1: T.Outer, dependentMember2: T.Outer.Inner) {
+  public init(aClass: C3<T>, aStruct: S3<T>, anEnum: E3<T>, function: @escaping Function, tuple: Tuple, primaryArchetype: T, dependentMember1: T.Outer, dependentMember2: T.Outer.Inner) {
     self.aClass = aClass
     self.aStruct = aStruct
     self.anEnum = anEnum
@@ -99,7 +99,7 @@
   public let primaryArchetype: T
   public let dependentMember1: T.Outer
   public let dependentMember2: T.Outer.Inner
-  public init(aClass: C3<T>, aStruct: Box<S3<T>>, anEnum: Box<E3<T>>, function: Function, tuple: Tuple, primaryArchetype: T, dependentMember1: T.Outer, dependentMember2: T.Outer.Inner) {
+  public init(aClass: C3<T>, aStruct: Box<S3<T>>, anEnum: Box<E3<T>>, function: @escaping Function, tuple: Tuple, primaryArchetype: T, dependentMember1: T.Outer, dependentMember2: T.Outer.Inner) {
     self.aClass = aClass
     self.aStruct = aStruct
     self.anEnum = anEnum
diff --git a/test/Reflection/box_descriptors.sil b/test/Reflection/box_descriptors.sil
index 7689111..b9f01e1 100644
--- a/test/Reflection/box_descriptors.sil
+++ b/test/Reflection/box_descriptors.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift %s -emit-module -emit-library -module-name capture_descriptors -o %t/capture_descriptors.%target-dylib-extension
-// RUN: %target-swift-reflection-dump -binary-filename %t/capture_descriptors.%target-dylib-extension | FileCheck %s
+// RUN: %target-swift-reflection-dump -binary-filename %t/capture_descriptors.%target-dylib-extension | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/Reflection/capture_descriptors.sil b/test/Reflection/capture_descriptors.sil
index e0a4b08..7d35485 100644
--- a/test/Reflection/capture_descriptors.sil
+++ b/test/Reflection/capture_descriptors.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift %s -emit-module -emit-library -module-name capture_descriptors -o %t/capture_descriptors.%target-dylib-extension
-// RUN: %target-swift-reflection-dump -binary-filename %t/capture_descriptors.%target-dylib-extension | FileCheck %s
+// RUN: %target-swift-reflection-dump -binary-filename %t/capture_descriptors.%target-dylib-extension | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/Reflection/typeref_decoding.swift b/test/Reflection/typeref_decoding.swift
index 8ebe0f8..0f49048 100644
--- a/test/Reflection/typeref_decoding.swift
+++ b/test/Reflection/typeref_decoding.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift -parse-as-library -emit-module -emit-library -module-name TypesToReflect -o %t/libTypesToReflect.%target-dylib-extension
-// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension | FileCheck %s
+// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension | %FileCheck %s
 
 // CHECK: FIELDS:
 // CHECK: =======
diff --git a/test/Reflection/typeref_decoding_imported.swift b/test/Reflection/typeref_decoding_imported.swift
index 2850bbc..2ccce7a 100644
--- a/test/Reflection/typeref_decoding_imported.swift
+++ b/test/Reflection/typeref_decoding_imported.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift %S/Inputs/ImportedTypes.swift -parse-as-library -emit-module -emit-library -module-name TypesToReflect -o %t/libTypesToReflect.%target-dylib-extension -I %S/Inputs
-// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension | FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-cpu
+// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension | %FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-cpu
 
 // CHECK-32: FIELDS:
 // CHECK-32: =======
diff --git a/test/Reflection/typeref_decoding_objc.swift b/test/Reflection/typeref_decoding_objc.swift
index 0bd724f..75a958d 100644
--- a/test/Reflection/typeref_decoding_objc.swift
+++ b/test/Reflection/typeref_decoding_objc.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift %S/Inputs/ObjectiveCTypes.swift -parse-as-library -emit-module -emit-library -module-name TypesToReflect -o %t/libTypesToReflect.%target-dylib-extension
-// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension | FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK
+// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension | %FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK
 // REQUIRES: objc_interop
 
 // CHECK: FIELDS:
diff --git a/test/Reflection/typeref_lowering.swift b/test/Reflection/typeref_lowering.swift
index 5d7a4a2..c2d721c 100644
--- a/test/Reflection/typeref_lowering.swift
+++ b/test/Reflection/typeref_lowering.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift %S/Inputs/TypeLowering.swift -parse-as-library -emit-module -emit-library -module-name TypeLowering -o %t/libTypesToReflect.%target-dylib-extension
-// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension -binary-filename %platform-module-dir/libswiftCore.%target-dylib-extension -dump-type-lowering < %s | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension -binary-filename %platform-module-dir/libswiftCore.%target-dylib-extension -dump-type-lowering < %s | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 
 V12TypeLowering11BasicStruct
 // CHECK-64:      (struct TypeLowering.BasicStruct)
diff --git a/test/Reflection/typeref_lowering_imported.swift b/test/Reflection/typeref_lowering_imported.swift
index e6e8430..27a9805 100644
--- a/test/Reflection/typeref_lowering_imported.swift
+++ b/test/Reflection/typeref_lowering_imported.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift %S/Inputs/ImportedTypes.swift -parse-as-library -emit-module -emit-library -module-name TypeLowering -I %S/Inputs -o %t/libTypesToReflect
-// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect -binary-filename %platform-module-dir/libswiftCore.dylib -dump-type-lowering < %s | FileCheck %s
+// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect -binary-filename %platform-module-dir/libswiftCore.dylib -dump-type-lowering < %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 // REQUIRES: CPU=x86_64
diff --git a/test/Reflection/typeref_lowering_missing.swift b/test/Reflection/typeref_lowering_missing.swift
new file mode 100644
index 0000000..a87f63a
--- /dev/null
+++ b/test/Reflection/typeref_lowering_missing.swift
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: %target-build-swift %S/Inputs/ConcreteTypes.swift -parse-as-library -emit-module -emit-library -module-name TypeLowering -Xfrontend -disable-reflection-metadata -o %t/libTypesToReflect
+// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect -binary-filename %platform-module-dir/libswiftCore.dylib -dump-type-lowering < %s | %FileCheck %s
+
+// REQUIRES: objc_interop
+// REQUIRES: CPU=x86_64
+
+V12TypeLowering11BasicStruct
+// CHECK: (struct TypeLowering.BasicStruct)
+// CHECK: Invalid lowering
+
+GSqV12TypeLowering11BasicStruct_
+// CHECK: (bound_generic_enum Swift.Optional
+// CHECK:   (struct TypeLowering.BasicStruct))
+// CHECK: Invalid lowering
diff --git a/test/Reflection/typeref_lowering_objc.swift b/test/Reflection/typeref_lowering_objc.swift
index 36f0fd4..fe1b2c8 100644
--- a/test/Reflection/typeref_lowering_objc.swift
+++ b/test/Reflection/typeref_lowering_objc.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift %S/Inputs/TypeLoweringObjectiveC.swift -parse-as-library -emit-module -emit-library -module-name TypeLowering -o %t/libTypesToReflect
-// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect -binary-filename %platform-module-dir/libswiftCore.dylib -dump-type-lowering < %s | FileCheck %s
+// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect -binary-filename %platform-module-dir/libswiftCore.dylib -dump-type-lowering < %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 // REQUIRES: CPU=x86_64
diff --git a/test/RemoteAST/foreign_types.swift b/test/RemoteAST/foreign_types.swift
index 7ee8135..358cf0a 100644
--- a/test/RemoteAST/foreign_types.swift
+++ b/test/RemoteAST/foreign_types.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-remoteast-test -sdk %S/../IRGen/Inputs %s | FileCheck %s
+// RUN: %target-swift-remoteast-test -sdk %S/../IRGen/Inputs %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/RemoteAST/member_offsets.swift b/test/RemoteAST/member_offsets.swift
index 77eafca..3b05669 100644
--- a/test/RemoteAST/member_offsets.swift
+++ b/test/RemoteAST/member_offsets.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-remoteast-test %s | FileCheck %s
+// RUN: %target-swift-remoteast-test %s | %FileCheck %s
 
 // REQUIRES: PTRSIZE=64
 
diff --git a/test/RemoteAST/nominal_types.swift b/test/RemoteAST/nominal_types.swift
index 83de314..5bf7ed3 100644
--- a/test/RemoteAST/nominal_types.swift
+++ b/test/RemoteAST/nominal_types.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-remoteast-test %s | FileCheck %s
+// RUN: %target-swift-remoteast-test %s | %FileCheck %s
 
 @_silgen_name("printMetadataType")
 func printType(_: Any.Type)
diff --git a/test/RemoteAST/objc_classes.swift b/test/RemoteAST/objc_classes.swift
index 32b1ee6..0a3ce42 100644
--- a/test/RemoteAST/objc_classes.swift
+++ b/test/RemoteAST/objc_classes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-remoteast-test-with-sdk %s | FileCheck %s
+// RUN: %target-swift-remoteast-test-with-sdk %s | %FileCheck %s
 
 // REQUIRES: swift_interpreter
 // REQUIRES: objc_interop
diff --git a/test/RemoteAST/structural_types.swift b/test/RemoteAST/structural_types.swift
index 03670f1..980eb89 100644
--- a/test/RemoteAST/structural_types.swift
+++ b/test/RemoteAST/structural_types.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-remoteast-test %s | FileCheck %s
+// RUN: %target-swift-remoteast-test %s | %FileCheck %s
 
 @_silgen_name("printMetadataType")
 func printType(_: Any.Type)
diff --git a/test/Runtime/weak-reference-racetests-dispatch.swift b/test/Runtime/weak-reference-racetests-dispatch.swift
index fea724b..70dc142 100644
--- a/test/Runtime/weak-reference-racetests-dispatch.swift
+++ b/test/Runtime/weak-reference-racetests-dispatch.swift
@@ -1,9 +1,6 @@
 // RUN: %target-run-simple-swift
 // REQUIRES: executable_test
 
-// Disabled because of a crash with a debug stdlib - rdar://problem/27226313
-// REQUIRES: optimized_stdlib
-
 // REQUIRES: objc_interop
 
 import StdlibUnittest
diff --git a/test/SIL/Parser/apply_with_conformance.sil b/test/SIL/Parser/apply_with_conformance.sil
index 02a0391..2354073 100644
--- a/test/SIL/Parser/apply_with_conformance.sil
+++ b/test/SIL/Parser/apply_with_conformance.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
 // radar://16375832
 sil_stage raw
 
diff --git a/test/SIL/Parser/apply_with_substitution.sil b/test/SIL/Parser/apply_with_substitution.sil
index 8a05075..6cf6f3e 100644
--- a/test/SIL/Parser/apply_with_substitution.sil
+++ b/test/SIL/Parser/apply_with_substitution.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 // rdar://14443287
 sil_stage raw
diff --git a/test/SIL/Parser/attributes.sil b/test/SIL/Parser/attributes.sil
index c3aad2f..6db8bc3 100644
--- a/test/SIL/Parser/attributes.sil
+++ b/test/SIL/Parser/attributes.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s | FileCheck %s
+// RUN: %target-sil-opt %s | %FileCheck %s
 
 // CHECK-LABEL: sil [_semantics "123"] [_semantics "456"] @foo : $@convention(thin) () -> () {
 sil [_semantics "123"] [_semantics "456"] @foo : $@convention(thin) () -> () {
diff --git a/test/SIL/Parser/available.sil b/test/SIL/Parser/available.sil
index eae5733..35e16e6 100644
--- a/test/SIL/Parser/available.sil
+++ b/test/SIL/Parser/available.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s | FileCheck %s
+// RUN: %target-sil-opt %s | %FileCheck %s
 
 @available(*,unavailable,message: "it has been renamed")
 public struct mmConstUnsafePointer<T> {
diff --git a/test/SIL/Parser/basic.sil b/test/SIL/Parser/basic.sil
index a258ea2..64e859e 100644
--- a/test/SIL/Parser/basic.sil
+++ b/test/SIL/Parser/basic.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 sil_stage raw // CHECK: sil_stage raw
 
diff --git a/test/SIL/Parser/basic_objc.sil b/test/SIL/Parser/basic_objc.sil
index f8b274f..232707e 100644
--- a/test/SIL/Parser/basic_objc.sil
+++ b/test/SIL/Parser/basic_objc.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SIL/Parser/bound_generic.sil b/test/SIL/Parser/bound_generic.sil
index 0734003..ce0cb73 100644
--- a/test/SIL/Parser/bound_generic.sil
+++ b/test/SIL/Parser/bound_generic.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 // rdar://14443287
 sil_stage raw
diff --git a/test/SIL/Parser/coverage_maps.sil b/test/SIL/Parser/coverage_maps.sil
index 24787ce..3ab203e 100644
--- a/test/SIL/Parser/coverage_maps.sil
+++ b/test/SIL/Parser/coverage_maps.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -module-name=coverage_maps | %target-sil-opt -verify -module-name=coverage_maps | FileCheck %s
+// RUN: %target-sil-opt %s -module-name=coverage_maps | %target-sil-opt -verify -module-name=coverage_maps | %FileCheck %s
 
 sil @someFunction : $@convention(thin) () -> () {
 bb0:
diff --git a/test/SIL/Parser/default_witness_tables.sil b/test/SIL/Parser/default_witness_tables.sil
index 0313340..cfe23f6 100644
--- a/test/SIL/Parser/default_witness_tables.sil
+++ b/test/SIL/Parser/default_witness_tables.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt %s -module-name=witness_tables -enable-resilience | %target-sil-opt -module-name=witness_tables -enable-resilience | FileCheck %s
-// RUN: %target-sil-opt %s -module-name=witness_tables -enable-resilience -O | FileCheck %s
+// RUN: %target-sil-opt %s -module-name=witness_tables -enable-resilience | %target-sil-opt -module-name=witness_tables -enable-resilience | %FileCheck %s
+// RUN: %target-sil-opt %s -module-name=witness_tables -enable-resilience -O | %FileCheck %s
 
 sil_stage raw
 
diff --git a/test/SIL/Parser/enum_in_class.sil b/test/SIL/Parser/enum_in_class.sil
index 6ab43e5..0d2dfab 100644
--- a/test/SIL/Parser/enum_in_class.sil
+++ b/test/SIL/Parser/enum_in_class.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 // rdar://16764223
 
diff --git a/test/SIL/Parser/final.swift b/test/SIL/Parser/final.swift
index 06198fe..03bc3fe 100644
--- a/test/SIL/Parser/final.swift
+++ b/test/SIL/Parser/final.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 // CHECK: final class Rect
 // CHECK: @sil_stored final var orgx: Double
diff --git a/test/SIL/Parser/generic_signature_with_depth.swift b/test/SIL/Parser/generic_signature_with_depth.swift
index 5909cf2..e6635ae 100644
--- a/test/SIL/Parser/generic_signature_with_depth.swift
+++ b/test/SIL/Parser/generic_signature_with_depth.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | %target-sil-opt | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %target-sil-opt | %FileCheck %s
 
 protocol mmGeneratorType {
   associatedtype Element
diff --git a/test/SIL/Parser/generics.sil b/test/SIL/Parser/generics.sil
index b1d5bc6..014248c 100644
--- a/test/SIL/Parser/generics.sil
+++ b/test/SIL/Parser/generics.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 sil_stage raw
 import Builtin
diff --git a/test/SIL/Parser/global_init_attribute.sil b/test/SIL/Parser/global_init_attribute.sil
index dc44034..3f7bdb2 100644
--- a/test/SIL/Parser/global_init_attribute.sil
+++ b/test/SIL/Parser/global_init_attribute.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-silgen | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SIL/Parser/nonatomic_reference_counting.sil b/test/SIL/Parser/nonatomic_reference_counting.sil
index 975884c..5204ae1 100644
--- a/test/SIL/Parser/nonatomic_reference_counting.sil
+++ b/test/SIL/Parser/nonatomic_reference_counting.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 // Check that all reference counting instructions can take the [nonatomic]
 // attribute. SIL parser should be able to parse this attribute and
diff --git a/test/SIL/Parser/overloaded_member.sil b/test/SIL/Parser/overloaded_member.sil
index a7ae975..de9e800 100644
--- a/test/SIL/Parser/overloaded_member.sil
+++ b/test/SIL/Parser/overloaded_member.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // rdar://15763213
 // Make sure that we can parse SILDeclRef to an overloaded member.
diff --git a/test/SIL/Parser/polymorphic_function.sil b/test/SIL/Parser/polymorphic_function.sil
index 07117fe..0b7c111 100644
--- a/test/SIL/Parser/polymorphic_function.sil
+++ b/test/SIL/Parser/polymorphic_function.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s | FileCheck %s
+// RUN: %target-sil-opt %s | %FileCheck %s
 
 import Swift
 
diff --git a/test/SIL/Parser/protocol_getter.sil b/test/SIL/Parser/protocol_getter.sil
index 8041918..69e77f4 100644
--- a/test/SIL/Parser/protocol_getter.sil
+++ b/test/SIL/Parser/protocol_getter.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 // Verify that SILParser correctly handles witness_method on a getter.
 import Swift
diff --git a/test/SIL/Parser/self.sil b/test/SIL/Parser/self.sil
index d1860511..017cf27 100644
--- a/test/SIL/Parser/self.sil
+++ b/test/SIL/Parser/self.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -parse-stdlib -module-name Swift -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -parse-stdlib -module-name Swift -emit-silgen | %FileCheck %s
 
 enum Optional<T> {
   case none
@@ -14,7 +14,7 @@
 
 sil_vtable SelfTest {}
 
-sil @test_stuff : $@convention(thin) (@owned SelfTest) -> () {
+sil @test_stuff : $@convention(method) (@owned SelfTest) -> () {
 bb0(%0 : $SelfTest):
   // CHECK: metatype $@thick @dynamic_self SelfTest
   %2 = metatype $@thick @dynamic_self SelfTest.Type
diff --git a/test/SIL/Parser/self_substitution.sil b/test/SIL/Parser/self_substitution.sil
index b1945c3..461e48b 100644
--- a/test/SIL/Parser/self_substitution.sil
+++ b/test/SIL/Parser/self_substitution.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s | FileCheck %s
+// RUN: %target-sil-opt %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SIL/Parser/sil_scope.sil b/test/SIL/Parser/sil_scope.sil
index ccfbe46..5af3110 100644
--- a/test/SIL/Parser/sil_scope.sil
+++ b/test/SIL/Parser/sil_scope.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s | FileCheck %s
+// RUN: %target-sil-opt %s | %FileCheck %s
 
 // CHECK: sil_scope 1 { loc "foo.sil":12:34 parent @foo : $@convention(thin) () -> () }
           sil_scope 1 { loc "foo.sil":12:34 parent @foo : $@convention(thin) () -> () }
diff --git a/test/SIL/Parser/sil_scope_inline_fn.sil b/test/SIL/Parser/sil_scope_inline_fn.sil
index aa3e50f..b00da92 100644
--- a/test/SIL/Parser/sil_scope_inline_fn.sil
+++ b/test/SIL/Parser/sil_scope_inline_fn.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -O %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -O %s | %FileCheck %s
 
 sil_scope 1 { loc "foo.sil":3:4 parent @foo : $@convention(thin) () -> () }
 sil_scope 2 { loc "foo.sil":3:4 parent 1 }
diff --git a/test/SIL/Parser/sillocation.sil b/test/SIL/Parser/sillocation.sil
index 30a9f58..71d6a37 100644
--- a/test/SIL/Parser/sillocation.sil
+++ b/test/SIL/Parser/sillocation.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s | FileCheck %s
+// RUN: %target-sil-opt %s | %FileCheck %s
 
 sil @foo : $@convention(thin) () -> () {
 bb0:
diff --git a/test/SIL/Parser/static_initializer.sil b/test/SIL/Parser/static_initializer.sil
index 8ff4081..8bccc07 100644
--- a/test/SIL/Parser/static_initializer.sil
+++ b/test/SIL/Parser/static_initializer.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s | FileCheck %s
+// RUN: %target-sil-opt %s | %FileCheck %s
 
 // Generated from
 // var x : Int32 = 2
diff --git a/test/SIL/Parser/stored_property.sil b/test/SIL/Parser/stored_property.sil
index b074e9a..b08ece0 100644
--- a/test/SIL/Parser/stored_property.sil
+++ b/test/SIL/Parser/stored_property.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s | FileCheck %s
+// RUN: %target-sil-opt %s | %FileCheck %s
 
 import Swift
 
diff --git a/test/SIL/Parser/typed_boxes.sil b/test/SIL/Parser/typed_boxes.sil
index 9ce333e..18d9505 100644
--- a/test/SIL/Parser/typed_boxes.sil
+++ b/test/SIL/Parser/typed_boxes.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 import Swift
 
diff --git a/test/SIL/Parser/undef.sil b/test/SIL/Parser/undef.sil
index a2880ad..0c6ea3d 100644
--- a/test/SIL/Parser/undef.sil
+++ b/test/SIL/Parser/undef.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s | %target-sil-opt | FileCheck %s
+// RUN: %target-sil-opt %s | %target-sil-opt | %FileCheck %s
 sil_stage raw
 
 import Builtin
diff --git a/test/SIL/Parser/where_clause.sil b/test/SIL/Parser/where_clause.sil
index ce56718..5b4addb 100644
--- a/test/SIL/Parser/where_clause.sil
+++ b/test/SIL/Parser/where_clause.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 // rdar://16238241
 // Make sure we can parse where clause with conformance & same-type requirements.
diff --git a/test/SIL/Parser/witness_protocol_from_import.sil b/test/SIL/Parser/witness_protocol_from_import.sil
index b930a88..ea6eaa8 100644
--- a/test/SIL/Parser/witness_protocol_from_import.sil
+++ b/test/SIL/Parser/witness_protocol_from_import.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 sil_stage raw
 
diff --git a/test/SIL/Parser/witness_specialize.sil b/test/SIL/Parser/witness_specialize.sil
index 6000cc9..c76d793 100644
--- a/test/SIL/Parser/witness_specialize.sil
+++ b/test/SIL/Parser/witness_specialize.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -module-name=witness_specialize | %target-sil-opt -module-name=witness_specialize | FileCheck %s
+// RUN: %target-sil-opt %s -module-name=witness_specialize | %target-sil-opt -module-name=witness_specialize | %FileCheck %s
 
 sil_stage raw
 
diff --git a/test/SIL/Parser/witness_tables.sil b/test/SIL/Parser/witness_tables.sil
index 16711e5..d408d85 100644
--- a/test/SIL/Parser/witness_tables.sil
+++ b/test/SIL/Parser/witness_tables.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -module-name=witness_tables | %target-sil-opt -module-name=witness_tables | FileCheck %s
+// RUN: %target-sil-opt %s -module-name=witness_tables | %target-sil-opt -module-name=witness_tables | %FileCheck %s
 
 protocol AssocReqt {
   func requiredMethod()
diff --git a/test/SIL/Parser/witness_with_inherited_gp.sil b/test/SIL/Parser/witness_with_inherited_gp.sil
index c73e5b2..134304b 100644
--- a/test/SIL/Parser/witness_with_inherited_gp.sil
+++ b/test/SIL/Parser/witness_with_inherited_gp.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -module-name WitnessTableWithGP | FileCheck %s
+// RUN: %target-sil-opt %s -module-name WitnessTableWithGP | %FileCheck %s
 
 // REQUIRES: disabled
 // FIXME: <rdar://problem/20592011>
diff --git a/test/SIL/Serialization/deserialize_appkit.sil b/test/SIL/Serialization/deserialize_appkit.sil
index 1b2389f..3ad45aa 100644
--- a/test/SIL/Serialization/deserialize_appkit.sil
+++ b/test/SIL/Serialization/deserialize_appkit.sil
@@ -1,6 +1,6 @@
 // Make sure that we can deserialize AppKit.
 // RUN: %target-sil-opt %platform-sdk-overlay-dir/AppKit.swiftmodule > /dev/null
-// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/AppKit.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/AppKit.swiftmodule | %FileCheck %s
 
 // REQUIRES: objc_interop
 // REQUIRES: OS=macosx
diff --git a/test/SIL/Serialization/deserialize_coregraphics.swift b/test/SIL/Serialization/deserialize_coregraphics.swift
index 0372815..60d57ce 100644
--- a/test/SIL/Serialization/deserialize_coregraphics.swift
+++ b/test/SIL/Serialization/deserialize_coregraphics.swift
@@ -1,6 +1,6 @@
 // Make sure that we can deserialize CoreGraphics.
 // RUN: %target-sil-opt %platform-sdk-overlay-dir/CoreGraphics.swiftmodule > /dev/null
-// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/CoreGraphics.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/CoreGraphics.swiftmodule | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SIL/Serialization/deserialize_darwin.sil b/test/SIL/Serialization/deserialize_darwin.sil
index 8aaa44d..31c94a1 100644
--- a/test/SIL/Serialization/deserialize_darwin.sil
+++ b/test/SIL/Serialization/deserialize_darwin.sil
@@ -1,6 +1,6 @@
 // Make sure that we can deserialize darwin.
 // RUN: %target-sil-opt %platform-sdk-overlay-dir/Darwin.swiftmodule > /dev/null
-// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/Darwin.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/Darwin.swiftmodule | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SIL/Serialization/deserialize_foundation.sil b/test/SIL/Serialization/deserialize_foundation.sil
index 551f841..ca1ad37 100644
--- a/test/SIL/Serialization/deserialize_foundation.sil
+++ b/test/SIL/Serialization/deserialize_foundation.sil
@@ -1,6 +1,6 @@
 // Make sure that we can deserialize foundation.
 // RUN: %target-sil-opt %platform-sdk-overlay-dir/Foundation.swiftmodule > /dev/null
-// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/Foundation.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/Foundation.swiftmodule | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SIL/Serialization/deserialize_generic.sil b/test/SIL/Serialization/deserialize_generic.sil
index 02c880c..39c900f 100644
--- a/test/SIL/Serialization/deserialize_generic.sil
+++ b/test/SIL/Serialization/deserialize_generic.sil
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -sil-serialize-all -o %t %S/Inputs/def_generic.swift
-// RUN: %target-sil-opt -linker -I %t %s | FileCheck %s
+// RUN: %target-sil-opt -linker -I %t %s | %FileCheck %s
 
 // Make sure that SILFunctionType with GenericSignature can match up with
 // SILFunctionType deserialized from module.
diff --git a/test/SIL/Serialization/deserialize_generic_marker.sil b/test/SIL/Serialization/deserialize_generic_marker.sil
index 84d02ad..1bcd2da 100644
--- a/test/SIL/Serialization/deserialize_generic_marker.sil
+++ b/test/SIL/Serialization/deserialize_generic_marker.sil
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -sil-serialize-all -o %t %S/Inputs/def_generic_marker.swift
-// RUN: %target-sil-opt -linker -I %t %s | FileCheck %s
+// RUN: %target-sil-opt -linker -I %t %s | %FileCheck %s
 
 // Make sure that SILFunctionType with GenericSignature can match up with
 // SILFunctionType deserialized from module.
diff --git a/test/SIL/Serialization/deserialize_objectivec.sil b/test/SIL/Serialization/deserialize_objectivec.sil
index 0eb0b3f..113a227 100644
--- a/test/SIL/Serialization/deserialize_objectivec.sil
+++ b/test/SIL/Serialization/deserialize_objectivec.sil
@@ -1,6 +1,6 @@
 // Make sure that we can deserialize Objective-C.
 // RUN: %target-sil-opt %platform-sdk-overlay-dir/ObjectiveC.swiftmodule > /dev/null
-// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/ObjectiveC.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %platform-sdk-overlay-dir/ObjectiveC.swiftmodule | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SIL/Serialization/deserialize_stdlib.sil b/test/SIL/Serialization/deserialize_stdlib.sil
index 80282cb..4176250 100644
--- a/test/SIL/Serialization/deserialize_stdlib.sil
+++ b/test/SIL/Serialization/deserialize_stdlib.sil
@@ -1,5 +1,5 @@
 // Make sure that we can deserialize the stdlib.
 // RUN: %target-sil-opt %platform-module-dir/Swift.swiftmodule > /dev/null
-// RUN: llvm-bcanalyzer %platform-module-dir/Swift.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %platform-module-dir/Swift.swiftmodule | %FileCheck %s
 
 // CHECK-NOT: Unknown
diff --git a/test/SIL/Serialization/effectsattr.sil b/test/SIL/Serialization/effectsattr.sil
index 559048e..e2a2d9e 100644
--- a/test/SIL/Serialization/effectsattr.sil
+++ b/test/SIL/Serialization/effectsattr.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -o - | FileCheck %s
+// RUN: %target-sil-opt %s -o - | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SIL/Serialization/function_param_convention.sil b/test/SIL/Serialization/function_param_convention.sil
index 898ee39..ab33f3c 100644
--- a/test/SIL/Serialization/function_param_convention.sil
+++ b/test/SIL/Serialization/function_param_convention.sil
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %target-swift-frontend -parse-sil -sil-inline-threshold 0 %S/Inputs/function_param_convention_input.sil -o %t/FunctionInput.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-name FunctionInput -sil-serialize-all -O
-// RUN: %target-sil-opt -I %t -linker %s -o - | FileCheck %s
+// RUN: %target-sil-opt -I %t -linker %s -o - | %FileCheck %s
 
 import Swift
 import FunctionInput
diff --git a/test/SIL/Serialization/init_existential_inst_deserializes_witness_tables.swift b/test/SIL/Serialization/init_existential_inst_deserializes_witness_tables.swift
index f04a11d..f65f4d6 100644
--- a/test/SIL/Serialization/init_existential_inst_deserializes_witness_tables.swift
+++ b/test/SIL/Serialization/init_existential_inst_deserializes_witness_tables.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %target-swift-frontend -sil-inline-threshold 0 %S/Inputs/init_existential_inst_deserializes_witness_tables_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -sil-serialize-all -O
-// RUN: %target-swift-frontend -I %t -O %s -emit-sil -o - | FileCheck %s
+// RUN: %target-swift-frontend -I %t -O %s -emit-sil -o - | %FileCheck %s
 
 // CHECK: sil_witness_table public_external [fragile] X: P module Swift {
 
diff --git a/test/SIL/Serialization/metatype_casts.sil b/test/SIL/Serialization/metatype_casts.sil
index da932c3..8364ea5 100644
--- a/test/SIL/Serialization/metatype_casts.sil
+++ b/test/SIL/Serialization/metatype_casts.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -o - | FileCheck %s
+// RUN: %target-sil-opt %s -o - | %FileCheck %s
 
 // Check that this file can be parsed at all.
 // SIL verifier should not crash on metatypes of metatypes.
diff --git a/test/SIL/Serialization/perf_inline_without_inline_all.swift b/test/SIL/Serialization/perf_inline_without_inline_all.swift
index dcc05d4..7c3b963 100644
--- a/test/SIL/Serialization/perf_inline_without_inline_all.swift
+++ b/test/SIL/Serialization/perf_inline_without_inline_all.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t; mkdir -p %t
 // RUN: %target-swift-frontend -emit-module %S/Inputs/nontransparent.swift -O -sil-serialize-all -parse-stdlib -parse-as-library -emit-module -o %t/Swift.swiftmodule -module-name=Swift -module-link-name swiftCore
-// RUN: %target-swift-frontend %s -O -I %t -emit-sil -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -O -I %t -emit-sil -o - | %FileCheck %s
 
 import Swift
 
diff --git a/test/SIL/Serialization/public_external.sil b/test/SIL/Serialization/public_external.sil
index 042fc87..a005c11 100644
--- a/test/SIL/Serialization/public_external.sil
+++ b/test/SIL/Serialization/public_external.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -parse-sil -emit-module -module-name Swift -module-link-name swiftCore -parse-stdlib -parse-as-library -sil-serialize-all -o - | %target-sil-opt -module-name Swift | FileCheck %s
+// RUN: %target-swift-frontend %s -parse-sil -emit-module -module-name Swift -module-link-name swiftCore -parse-stdlib -parse-as-library -sil-serialize-all -o - | %target-sil-opt -module-name Swift | %FileCheck %s
 
 // CHECK-NOT: sil public_external @pe : $@convention(thin) () -> () {
 // CHECK-NOT: sil hidden_external @he : $@convention(thin) () -> () {
diff --git a/test/SIL/Serialization/semanticsattr.sil b/test/SIL/Serialization/semanticsattr.sil
index b56aa87..468af78 100644
--- a/test/SIL/Serialization/semanticsattr.sil
+++ b/test/SIL/Serialization/semanticsattr.sil
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %target-swift-frontend -parse-sil -emit-sib -parse-as-library -parse-stdlib -module-name SemanticsAttr -o %t/SemanticsAttr.sib %s
-// RUN: %target-sil-opt %t/SemanticsAttr.sib -o - -sil-sort-output | FileCheck %s
+// RUN: %target-sil-opt %t/SemanticsAttr.sib -o - -sil-sort-output | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SIL/Serialization/shared_function_serialization.sil b/test/SIL/Serialization/shared_function_serialization.sil
index ab7a8ae..9060cd2 100644
--- a/test/SIL/Serialization/shared_function_serialization.sil
+++ b/test/SIL/Serialization/shared_function_serialization.sil
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %target-swift-frontend %S/Inputs/shared_function_serialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -sil-serialize-all -O
-// RUN: %target-sil-opt -enable-sil-verify-all -I %t -linker -inline %s -o - | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -I %t -linker -inline %s -o - | %FileCheck %s
 
 // CHECK: sil private @top_level_code 
 // CHECK: sil public_external [fragile] @{{.*}}_TFVs1XCfT_S_ 
diff --git a/test/SIL/Serialization/specializer_can_deserialize.swift b/test/SIL/Serialization/specializer_can_deserialize.swift
index 424b9c7..57d8113 100644
--- a/test/SIL/Serialization/specializer_can_deserialize.swift
+++ b/test/SIL/Serialization/specializer_can_deserialize.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %target-swift-frontend -emit-module %S/Inputs/specializer_input.swift -O -sil-serialize-all -parse-stdlib -parse-as-library -emit-module -o %t/Swift.swiftmodule -module-name=Swift -module-link-name swiftCore 
-// RUN: %target-swift-frontend %s -O -I %t -emit-sil -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -O -I %t -emit-sil -o - | %FileCheck %s
 
 import Swift
 
diff --git a/test/SIL/Serialization/visibility.sil b/test/SIL/Serialization/visibility.sil
index 98e7239e..10e40a9 100644
--- a/test/SIL/Serialization/visibility.sil
+++ b/test/SIL/Serialization/visibility.sil
@@ -1,6 +1,6 @@
 // RUN: %target-swift-frontend %s -parse-sil -sil-serialize-all -emit-module -o - -module-name Swift -module-link-name swiftCore -parse-as-library -parse-stdlib | %target-sil-opt -module-name Swift > %t.sil
-// RUN: FileCheck %s < %t.sil
-// RUN: FileCheck -check-prefix=NEG-CHECK %s < %t.sil
+// RUN: %FileCheck %s < %t.sil
+// RUN: %FileCheck -check-prefix=NEG-CHECK %s < %t.sil
 
 import Builtin
 
diff --git a/test/SIL/Serialization/vtable_deserialization.swift b/test/SIL/Serialization/vtable_deserialization.swift
index f98a7fa..d2f892a 100644
--- a/test/SIL/Serialization/vtable_deserialization.swift
+++ b/test/SIL/Serialization/vtable_deserialization.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: %target-swift-frontend %S/Inputs/vtable_deserialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -sil-serialize-all
-// RUN: %target-swift-frontend %s -emit-sil -O -I %t -o - | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-sil -O -I %t -o - | %FileCheck %s
 
 import Swift
 
diff --git a/test/SIL/Serialization/witness_tables.sil b/test/SIL/Serialization/witness_tables.sil
index deb5ea1..085b137 100644
--- a/test/SIL/Serialization/witness_tables.sil
+++ b/test/SIL/Serialization/witness_tables.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -sil-serialize-all -module-name witness_tables -emit-module -o - %s | %target-sil-opt -module-name witness_tables | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -sil-serialize-all -module-name witness_tables -emit-module -o - %s | %target-sil-opt -module-name witness_tables | %FileCheck %s
 
 protocol AssocReqt {
   func requiredMethod()
diff --git a/test/SIL/clone_init_existential.sil b/test/SIL/clone_init_existential.sil
index f87480e..1cde454 100644
--- a/test/SIL/clone_init_existential.sil
+++ b/test/SIL/clone_init_existential.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -inline %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -inline %s | %FileCheck %s
 
 // Check if cloning of init_existential_* works correctly with multiple
 // conformances.
diff --git a/test/SIL/clone_select_switch_value.sil b/test/SIL/clone_select_switch_value.sil
index 396353d..6e2a27e 100644
--- a/test/SIL/clone_select_switch_value.sil
+++ b/test/SIL/clone_select_switch_value.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -inline %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -inline %s | %FileCheck %s
 
 // Check if cloning of select_value and switch_value works correctly without
 // producing illegal SIL.
diff --git a/test/SIL/cloning.sil b/test/SIL/cloning.sil
index 2dfdb84..390532d 100644
--- a/test/SIL/cloning.sil
+++ b/test/SIL/cloning.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -inline %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -inline %s | %FileCheck %s
 
 // Check cloning of instructions.
 
diff --git a/test/SIL/printer_include_decls.swift b/test/SIL/printer_include_decls.swift
index d6c050d..a131e2f 100644
--- a/test/SIL/printer_include_decls.swift
+++ b/test/SIL/printer_include_decls.swift
@@ -1,7 +1,7 @@
 // RUN: rm -f %t.*
 // RUN: %target-swift-frontend -emit-sil %s -o %t.sil
-// RUN: FileCheck --input-file=%t.sil %s
-// RUN: %target-swift-frontend -emit-silgen %t.sil -module-name=printer_include_decl | FileCheck %s
+// RUN: %FileCheck --input-file=%t.sil %s
+// RUN: %target-swift-frontend -emit-silgen %t.sil -module-name=printer_include_decl | %FileCheck %s
 
 var x: Int
 // CHECK: var x: Int
diff --git a/test/SIL/type_dependent_operands.swift b/test/SIL/type_dependent_operands.swift
new file mode 100644
index 0000000..796a76b
--- /dev/null
+++ b/test/SIL/type_dependent_operands.swift
@@ -0,0 +1,60 @@
+// RUN: %target-swift-frontend -O -primary-file %s -emit-sil | %FileCheck %s
+
+
+// Test opened types
+
+protocol P {
+  func foo()
+}
+
+// CHECK-LABEL: sil {{.*}} @{{.*}}test_open_existential
+// CHECK: [[E:%[0-9]+]] = open_existential_addr %0
+// CHECK: [[W:%[0-9]+]] = witness_method $@opened{{.*}} [[E]] {{.*}} // type-defs: [[E]]
+// CHECK: apply [[W]]<@opened{{.*}} // type-defs: [[E]]
+// CHECK: return
+@inline(__always)
+func test_open_existential(p: P) {
+  p.foo()
+}
+
+// Check if after inlining (= cloning) everything is still okay.
+
+// CHECK-LABEL: sil {{.*}} @{{.*}}call_open_existential
+// CHECK: [[E:%[0-9]+]] = open_existential_addr %0
+// CHECK: [[W:%[0-9]+]] = witness_method $@opened{{.*}} [[E]] {{.*}} // type-defs: [[E]]
+// CHECK: apply [[W]]<@opened{{.*}} // type-defs: [[E]]
+// CHECK: return
+func call_open_existential(p: P) {
+  test_open_existential(p: p)
+}
+
+
+// Test dynamic self
+
+func idfunc<T>(_ t: T) -> T {
+  return t
+}
+
+final class X {
+// CHECK-LABEL: sil {{.*}} @{{.*}}test_dynself
+// CHECK: bb0(%0 : $@thick X.Type):
+// CHECK: apply %{{[0-9]+}}<@dynamic_self X>({{.*}} // type-defs: %0
+// CHECK: return
+  @inline(__always)
+  class func test_dynself() -> Self {
+    return idfunc(self.init())
+  }
+
+// Check if after inlining (= cloning) everything is still okay.
+
+// CHECK-LABEL: sil {{.*}} @{{.*}}call_dynself
+// CHECK: bb0(%0 : $@thick X.Type):
+// CHECK: apply %{{[0-9]+}}<@dynamic_self X>({{.*}} // type-defs: %0
+// CHECK: return
+  class func call_dynself() -> Self {
+    return test_dynself()
+  }
+
+  required init() { }
+}
+
diff --git a/test/SIL/unimplemented_initializer.swift b/test/SIL/unimplemented_initializer.swift
index 8703be9..4db8be3 100644
--- a/test/SIL/unimplemented_initializer.swift
+++ b/test/SIL/unimplemented_initializer.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -sdk %S/../SILGen/Inputs -I %S/../SILGen/Inputs -enable-source-import -primary-file %s -emit-sil -emit-verbose-sil | FileCheck %s -check-prefix=CHECK-DEBUG
-// RUN: %target-swift-frontend -sdk %S/../SILGen/Inputs -I %S/../SILGen/Inputs -enable-source-import -primary-file %s -emit-sil -emit-verbose-sil -O | FileCheck %s -check-prefix=CHECK-RELEASE
+// RUN: %target-swift-frontend -sdk %S/../SILGen/Inputs -I %S/../SILGen/Inputs -enable-source-import -primary-file %s -emit-sil -emit-verbose-sil | %FileCheck %s -check-prefix=CHECK-DEBUG
+// RUN: %target-swift-frontend -sdk %S/../SILGen/Inputs -I %S/../SILGen/Inputs -enable-source-import -primary-file %s -emit-sil -emit-verbose-sil -O | %FileCheck %s -check-prefix=CHECK-RELEASE
 
 // XFAIL: linux
 
diff --git a/test/SIL/whole_module_optimization.swift b/test/SIL/whole_module_optimization.swift
index 15f1951..a5c69cf 100644
--- a/test/SIL/whole_module_optimization.swift
+++ b/test/SIL/whole_module_optimization.swift
@@ -1,13 +1,13 @@
 // RUN: %target-swift-frontend -emit-sil -O %s %S/Inputs/whole_module_optimization_helper.swift -o %t.sil -module-name main
-// RUN: FileCheck %s < %t.sil
-// RUN: FileCheck %s -check-prefix=NEGATIVE < %t.sil
+// RUN: %FileCheck %s < %t.sil
+// RUN: %FileCheck %s -check-prefix=NEGATIVE < %t.sil
 
 // RUN: %target-swift-frontend -emit-sil -O -primary-file %s %S/Inputs/whole_module_optimization_helper.swift -o %t.unopt.sil -module-name main
-// RUN: FileCheck %s -check-prefix=CHECK-SINGLE-FILE < %t.unopt.sil
+// RUN: %FileCheck %s -check-prefix=CHECK-SINGLE-FILE < %t.unopt.sil
 
 // RUN: %target-swift-frontend -emit-sil -O -enable-testing %s %S/Inputs/whole_module_optimization_helper.swift -o %t.testing.sil -module-name main
-// RUN: FileCheck %s < %t.testing.sil
-// RUN: FileCheck %s -check-prefix=NEGATIVE-TESTABLE < %t.testing.sil
+// RUN: %FileCheck %s < %t.testing.sil
+// RUN: %FileCheck %s -check-prefix=NEGATIVE-TESTABLE < %t.testing.sil
 
 private func privateFn() -> Int32 {
   return 2
diff --git a/test/SILGen/Inputs/mangling_private_helper.swift b/test/SILGen/Inputs/mangling_private_helper.swift
index bbe8840..194f45b 100644
--- a/test/SILGen/Inputs/mangling_private_helper.swift
+++ b/test/SILGen/Inputs/mangling_private_helper.swift
@@ -5,5 +5,5 @@
 // Demonstrate the need for a vtable entry for privateMethod().
 // This isn't strictly necessary.
 private class Subclass : Base {
-  override private func privateMethod() {}
+  override fileprivate func privateMethod() {}
 }
diff --git a/test/SILGen/Inputs/objc_bridged_generic_conformance.h b/test/SILGen/Inputs/objc_bridged_generic_conformance.h
new file mode 100644
index 0000000..125808f
--- /dev/null
+++ b/test/SILGen/Inputs/objc_bridged_generic_conformance.h
@@ -0,0 +1,5 @@
+@import Foundation;
+
+@interface Thingy<T>: NSObject
+
+@end
diff --git a/test/SILGen/Inputs/usr/include/newtype.h b/test/SILGen/Inputs/usr/include/newtype.h
index 8bb7cb5..dd238cd 100644
--- a/test/SILGen/Inputs/usr/include/newtype.h
+++ b/test/SILGen/Inputs/usr/include/newtype.h
@@ -5,3 +5,5 @@
 extern const SNTErrorDomain SNTErrTwo;
 extern const SNTErrorDomain SNTErrorDomainThree;
 extern const SNTErrorDomain SNTFourErrorDomain;
+
+typedef NSInteger MyInt __attribute((swift_newtype(struct)));
diff --git a/test/SILGen/NSApplicationMain.swift b/test/SILGen/NSApplicationMain.swift
index 66272c0..a60973c 100644
--- a/test/SILGen/NSApplicationMain.swift
+++ b/test/SILGen/NSApplicationMain.swift
@@ -1,8 +1,8 @@
-// RUN: %target-swift-frontend -emit-silgen -parse-as-library -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
-// RUN: %target-swift-frontend -emit-ir -parse-as-library -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s -check-prefix=IR
+// RUN: %target-swift-frontend -emit-silgen -parse-as-library -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -parse-as-library -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s -check-prefix=IR
 
-// RUN: %target-swift-frontend -emit-silgen -parse-as-library -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -D REFERENCE | FileCheck %s
-// RUN: %target-swift-frontend -emit-ir -parse-as-library -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -D REFERENCE | FileCheck %s -check-prefix=IR
+// RUN: %target-swift-frontend -emit-silgen -parse-as-library -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -D REFERENCE | %FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -parse-as-library -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -D REFERENCE | %FileCheck %s -check-prefix=IR
 
 // REQUIRES: OS=macosx
 
diff --git a/test/SILGen/UIApplicationMain.swift b/test/SILGen/UIApplicationMain.swift
index 4172b1c..c6e9e97 100644
--- a/test/SILGen/UIApplicationMain.swift
+++ b/test/SILGen/UIApplicationMain.swift
@@ -1,20 +1,20 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-silgen-test-overlays
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library %s | FileCheck %s
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library %s | FileCheck %s -check-prefix=IR
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library %s | %FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library %s | %FileCheck %s -check-prefix=IR
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library %s -D REFERENCE | FileCheck %s
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library %s -D REFERENCE | FileCheck %s -check-prefix=IR
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library %s -D REFERENCE | %FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library %s -D REFERENCE | %FileCheck %s -check-prefix=IR
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library -primary-file %s %S/Inputs/UIApplicationMain-helper.swift -module-name test | FileCheck %s
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library -primary-file %s %S/Inputs/UIApplicationMain-helper.swift -module-name test | FileCheck %s -check-prefix=IR
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library -primary-file %s %S/Inputs/UIApplicationMain-helper.swift -module-name test | %FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library -primary-file %s %S/Inputs/UIApplicationMain-helper.swift -module-name test | %FileCheck %s -check-prefix=IR
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library %s %S/Inputs/UIApplicationMain-helper.swift -module-name test | FileCheck %s
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library %s %S/Inputs/UIApplicationMain-helper.swift -module-name test | FileCheck %s -check-prefix=IR
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library %s %S/Inputs/UIApplicationMain-helper.swift -module-name test | %FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library %s %S/Inputs/UIApplicationMain-helper.swift -module-name test | %FileCheck %s -check-prefix=IR
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library %S/Inputs/UIApplicationMain-helper.swift %s -module-name test | FileCheck %s
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library %S/Inputs/UIApplicationMain-helper.swift %s -module-name test | FileCheck %s -check-prefix=IR
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen -parse-as-library %S/Inputs/UIApplicationMain-helper.swift %s -module-name test | %FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-ir -parse-as-library %S/Inputs/UIApplicationMain-helper.swift %s -module-name test | %FileCheck %s -check-prefix=IR
 
 // REQUIRES: OS=ios
 // REQUIRES: objc_interop
diff --git a/test/SILGen/accessibility_vtables.swift b/test/SILGen/accessibility_vtables.swift
index 868bb28..989e3a4 100644
--- a/test/SILGen/accessibility_vtables.swift
+++ b/test/SILGen/accessibility_vtables.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-module -o %t %S/Inputs/accessibility_vtables_helper.swift
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -primary-file %s %S/Inputs/accessibility_vtables_other.swift -I %t -module-name accessibility_vtables | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -primary-file %s %S/Inputs/accessibility_vtables_other.swift -I %t -module-name accessibility_vtables | %FileCheck %s
 
 import accessibility_vtables_helper
 
diff --git a/test/SILGen/accessibility_warnings.swift b/test/SILGen/accessibility_warnings.swift
index 5b6b54e..5a88ef6 100644
--- a/test/SILGen/accessibility_warnings.swift
+++ b/test/SILGen/accessibility_warnings.swift
@@ -1,5 +1,5 @@
 // RUN: %target-parse-verify-swift
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // This file tests that the AST produced after fixing accessibility warnings
 // is valid according to SILGen and the verifiers.
diff --git a/test/SILGen/accessors.swift b/test/SILGen/accessors.swift
index 6556ec4..f447f25 100644
--- a/test/SILGen/accessors.swift
+++ b/test/SILGen/accessors.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 // Hold a reference to do to magically become non-POD.
 class Reference {}
diff --git a/test/SILGen/address_only_types.swift b/test/SILGen/address_only_types.swift
index 615e888..a8fddd6 100644
--- a/test/SILGen/address_only_types.swift
+++ b/test/SILGen/address_only_types.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -parse-stdlib -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -parse-stdlib -emit-silgen %s | %FileCheck %s
 
 precedencegroup AssignmentPrecedence { assignment: true }
 
diff --git a/test/SILGen/addressors.swift b/test/SILGen/addressors.swift
index 6159d91..3209976 100644
--- a/test/SILGen/addressors.swift
+++ b/test/SILGen/addressors.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -parse-stdlib -emit-sil %s | FileCheck %s
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | FileCheck %s -check-prefix=SILGEN
+// RUN: %target-swift-frontend -parse-stdlib -emit-sil %s | %FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | %FileCheck %s -check-prefix=SILGEN
 
 import Swift
 
diff --git a/test/SILGen/apply_abstraction_nested.swift b/test/SILGen/apply_abstraction_nested.swift
index a8ba96e..2da4743 100644
--- a/test/SILGen/apply_abstraction_nested.swift
+++ b/test/SILGen/apply_abstraction_nested.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 infix operator ~> { precedence 255 associativity left }
 
diff --git a/test/SILGen/argument_labels.swift b/test/SILGen/argument_labels.swift
index 03d20c1..5b47202 100644
--- a/test/SILGen/argument_labels.swift
+++ b/test/SILGen/argument_labels.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -suppress-argument-labels-in-types %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 public struct X { }
 public struct Y { }
diff --git a/test/SILGen/arguments.swift b/test/SILGen/arguments.swift
index 18c5bd7..c3efdbb 100644
--- a/test/SILGen/arguments.swift
+++ b/test/SILGen/arguments.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -module-name Swift -parse-stdlib -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -module-name Swift -parse-stdlib -emit-silgen %s | %FileCheck %s
 
 struct Int {}
 struct Float {}
diff --git a/test/SILGen/array_literal_abstraction.swift b/test/SILGen/array_literal_abstraction.swift
index 3f368a8..2fa3023 100644
--- a/test/SILGen/array_literal_abstraction.swift
+++ b/test/SILGen/array_literal_abstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // Verify that reabstraction happens when forming container literals.
 // <rdar://problem/16039286>
diff --git a/test/SILGen/assignment.swift b/test/SILGen/assignment.swift
index 4f0ae8b..cd024c6 100644
--- a/test/SILGen/assignment.swift
+++ b/test/SILGen/assignment.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class C {}
 
diff --git a/test/SILGen/auto_closures.swift b/test/SILGen/auto_closures.swift
index 9c2c467..684932e 100644
--- a/test/SILGen/auto_closures.swift
+++ b/test/SILGen/auto_closures.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | %FileCheck %s
 
 struct Bool {}
 var false_ = Bool()
diff --git a/test/SILGen/auto_generated_super_init_call.swift b/test/SILGen/auto_generated_super_init_call.swift
index 5f7dad3..556af65 100644
--- a/test/SILGen/auto_generated_super_init_call.swift
+++ b/test/SILGen/auto_generated_super_init_call.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // Test that we emit a call to super.init at the end of the initializer, when none has been previously added.
 
diff --git a/test/SILGen/availability_query.swift b/test/SILGen/availability_query.swift
index 230af9f..e164451 100644
--- a/test/SILGen/availability_query.swift
+++ b/test/SILGen/availability_query.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-frontend -emit-sil %s -target x86_64-apple-macosx10.50 -verify
-// RUN: %target-swift-frontend -emit-silgen %s -target x86_64-apple-macosx10.50 | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s -target x86_64-apple-macosx10.50 | %FileCheck %s
 
 // REQUIRES: OS=macosx
 
diff --git a/test/SILGen/boxed_existentials.swift b/test/SILGen/boxed_existentials.swift
index 95b24da..742b910 100644
--- a/test/SILGen/boxed_existentials.swift
+++ b/test/SILGen/boxed_existentials.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s --check-prefix=GUARANTEED
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s --check-prefix=GUARANTEED
 
 func test_type_lowering(_ x: Error) { }
 // CHECK-LABEL: sil hidden @_TF18boxed_existentials18test_type_loweringFPs5Error_T_ : $@convention(thin) (@owned Error) -> () {
diff --git a/test/SILGen/builtins.swift b/test/SILGen/builtins.swift
index c18eb17..960f34b 100644
--- a/test/SILGen/builtins.swift
+++ b/test/SILGen/builtins.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -emit-silgen -parse-stdlib %s -disable-objc-attr-requires-foundation-module | FileCheck %s
-// RUN: %target-swift-frontend -emit-sil -Onone -parse-stdlib %s -disable-objc-attr-requires-foundation-module | FileCheck -check-prefix=CANONICAL %s
+// RUN: %target-swift-frontend -emit-silgen -parse-stdlib %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -Onone -parse-stdlib %s -disable-objc-attr-requires-foundation-module | %FileCheck -check-prefix=CANONICAL %s
 
 import Swift
 
diff --git a/test/SILGen/c_function_pointers.swift b/test/SILGen/c_function_pointers.swift
index 35b12fa..83c8d08 100644
--- a/test/SILGen/c_function_pointers.swift
+++ b/test/SILGen/c_function_pointers.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -verify %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -verify %s | %FileCheck %s
 
 func values(_ arg: @escaping @convention(c) (Int) -> Int) -> @convention(c) (Int) -> Int {
   return arg
diff --git a/test/SILGen/c_materializeForSet_linkage.swift b/test/SILGen/c_materializeForSet_linkage.swift
index 3b62986..605273e 100644
--- a/test/SILGen/c_materializeForSet_linkage.swift
+++ b/test/SILGen/c_materializeForSet_linkage.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/call_chain_reabstraction.swift b/test/SILGen/call_chain_reabstraction.swift
index 8616535..a75dadd 100644
--- a/test/SILGen/call_chain_reabstraction.swift
+++ b/test/SILGen/call_chain_reabstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 struct A {
         func g<U>(_ recur: (A, U) -> U) -> (A, U) -> U {
diff --git a/test/SILGen/capture_inout.swift b/test/SILGen/capture_inout.swift
index e42e1eb..0e07e9a 100644
--- a/test/SILGen/capture_inout.swift
+++ b/test/SILGen/capture_inout.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | %FileCheck %s
 
 typealias Int = Builtin.Int64
 
diff --git a/test/SILGen/capture_typealias.swift b/test/SILGen/capture_typealias.swift
index 51409cf..61afe66 100644
--- a/test/SILGen/capture_typealias.swift
+++ b/test/SILGen/capture_typealias.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | %FileCheck %s
 
 typealias Int = Builtin.Int64
 
diff --git a/test/SILGen/capture_typed_boxes.swift b/test/SILGen/capture_typed_boxes.swift
index 519fe51..ea16f88 100644
--- a/test/SILGen/capture_typed_boxes.swift
+++ b/test/SILGen/capture_typed_boxes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func foo(_ x: Int) -> () -> Int {
   var x = x
diff --git a/test/SILGen/casts.swift b/test/SILGen/casts.swift
index e30fd55..d0a4a6c 100644
--- a/test/SILGen/casts.swift
+++ b/test/SILGen/casts.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class B { }
 class D : B { }
diff --git a/test/SILGen/cdecl.swift b/test/SILGen/cdecl.swift
index 869a9ef..db01cbc 100644
--- a/test/SILGen/cdecl.swift
+++ b/test/SILGen/cdecl.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden [thunk] @pear : $@convention(c)
 // CHECK:         function_ref @_TF5cdecl5apple
diff --git a/test/SILGen/cf.swift b/test/SILGen/cf.swift
index 7d6b1cf..ca0e846 100644
--- a/test/SILGen/cf.swift
+++ b/test/SILGen/cf.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -import-cf-types -sdk %S/Inputs %s -emit-silgen -o - | FileCheck %s
+// RUN: %target-swift-frontend -import-cf-types -sdk %S/Inputs %s -emit-silgen -o - | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/cf_members.swift b/test/SILGen/cf_members.swift
index bfeea91..26d0c24 100644
--- a/test/SILGen/cf_members.swift
+++ b/test/SILGen/cf_members.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -I %S/../IDE/Inputs/custom-modules %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -I %S/../IDE/Inputs/custom-modules %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
@@ -245,21 +245,6 @@
   c()
 }
 
-// CHECK-LABEL: sil @_TF10cf_members16importAsProtocolFPSo8IAMProto_T_
-public func importAsProtocol(_ x: IAMProto_t) {
-  // CHECK: function_ref @mutateSomeState : $@convention(c) <τ_0_0 where τ_0_0 : IAMProto> (τ_0_0) -> ()
-  x.mutateSomeState()
-  // CHECK: function_ref @mutateSomeStateWithParameter : $@convention(c) <τ_0_0 where τ_0_0 : IAMProto> (τ_0_0, Int) -> ()
-  x.mutateSomeState(withParameter: 0)
-  // CHECK: function_ref @mutateSomeStateWithFirstParameter : $@convention(c) <τ_0_0 where τ_0_0 : IAMProto> (Int, τ_0_0) -> ()
-  x.mutateSomeState(withFirstParameter: 0)
-
-  // CHECK: function_ref @getSomeValue : $@convention(c) <τ_0_0 where τ_0_0 : IAMProto> (τ_0_0) -> Int32
-  let y = x.someValue
-  // CHECK: function_ref @setSomeValue : $@convention(c) <τ_0_0 where τ_0_0 : IAMProto> (τ_0_0, Int32) -> Int32
-  x.someValue = y
-}
-
 // CHECK-LABEL: sil @_TF10cf_members28importGlobalVarsAsProperties
 public func importGlobalVarsAsProperties()
     -> (Double, CCPowerSupply, CCPowerSupply?) {
diff --git a/test/SILGen/class_bound_protocols.swift b/test/SILGen/class_bound_protocols.swift
index 0c4fcbc..80390c3 100644
--- a/test/SILGen/class_bound_protocols.swift
+++ b/test/SILGen/class_bound_protocols.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -parse-as-library -emit-silgen %s | %FileCheck %s
 
 // -- Class-bound archetypes and existentials are *not* address-only and can
 //    be manipulated using normal reference type value semantics.
diff --git a/test/SILGen/class_resilience.swift b/test/SILGen/class_resilience.swift
index 8eb4bb6..0c471a0 100644
--- a/test/SILGen/class_resilience.swift
+++ b/test/SILGen/class_resilience.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-silgen -enable-resilience %s | FileCheck %s
+// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-silgen -enable-resilience %s | %FileCheck %s
 
 import resilient_class
 
diff --git a/test/SILGen/closure_inline_initializer.swift b/test/SILGen/closure_inline_initializer.swift
index 23cc01d..698048f 100644
--- a/test/SILGen/closure_inline_initializer.swift
+++ b/test/SILGen/closure_inline_initializer.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil shared @_TFIvV26closure_inline_initializer3Foo3fooSiiU_FT_Si
 
diff --git a/test/SILGen/closure_script_global_escape.swift b/test/SILGen/closure_script_global_escape.swift
index 41cea01..941c538 100644
--- a/test/SILGen/closure_script_global_escape.swift
+++ b/test/SILGen/closure_script_global_escape.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -module-name foo -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -module-name foo -emit-silgen %s | %FileCheck %s
 // RUN: %target-swift-frontend -module-name foo -emit-sil -verify %s
 
 // CHECK-LABEL: sil @main
diff --git a/test/SILGen/closures.swift b/test/SILGen/closures.swift
index e25749c..7480be5 100644
--- a/test/SILGen/closures.swift
+++ b/test/SILGen/closures.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -parse-as-library -emit-silgen %s | %FileCheck %s
 
 import Swift
 
diff --git a/test/SILGen/collection_cast_crash.swift b/test/SILGen/collection_cast_crash.swift
index a4b4869..c6adab4 100644
--- a/test/SILGen/collection_cast_crash.swift
+++ b/test/SILGen/collection_cast_crash.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -primary-file %s -emit-sil -o - | FileCheck %s
+// RUN: %target-swift-frontend -O -primary-file %s -emit-sil -o - | %FileCheck %s
 
 // check if the compiler does not crash if a function is specialized
 // which contains a collection cast
diff --git a/test/SILGen/collection_downcast.swift b/test/SILGen/collection_downcast.swift
index 78ddcf5..89ad627 100644
--- a/test/SILGen/collection_downcast.swift
+++ b/test/SILGen/collection_downcast.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/collection_subtype_downcast.swift b/test/SILGen/collection_subtype_downcast.swift
index 4f8695f..172ee34 100644
--- a/test/SILGen/collection_subtype_downcast.swift
+++ b/test/SILGen/collection_subtype_downcast.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -enable-experimental-collection-casts -emit-silgen -sdk %S/Inputs %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs %s | %FileCheck %s
 
 struct S { var x, y: Int }
 
diff --git a/test/SILGen/collection_subtype_upcast.swift b/test/SILGen/collection_subtype_upcast.swift
index e025346..701ca80 100644
--- a/test/SILGen/collection_subtype_upcast.swift
+++ b/test/SILGen/collection_subtype_upcast.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -enable-experimental-collection-casts -emit-silgen -sdk %S/Inputs %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs %s | %FileCheck %s
 
 struct S { var x, y: Int }
 
diff --git a/test/SILGen/collection_upcast.swift b/test/SILGen/collection_upcast.swift
index 1d2c52b..c265040 100644
--- a/test/SILGen/collection_upcast.swift
+++ b/test/SILGen/collection_upcast.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // FIXME: rdar://problem/19648117 Needs splitting objc parts out
 // XFAIL: linux
diff --git a/test/SILGen/complete_object_init.swift b/test/SILGen/complete_object_init.swift
index 7f31fcf..02687ef 100644
--- a/test/SILGen/complete_object_init.swift
+++ b/test/SILGen/complete_object_init.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s
 
 struct X { }
 
diff --git a/test/SILGen/conditionally_unreachable.swift b/test/SILGen/conditionally_unreachable.swift
index 7c7e5fa..5c60d14 100644
--- a/test/SILGen/conditionally_unreachable.swift
+++ b/test/SILGen/conditionally_unreachable.swift
@@ -1,8 +1,8 @@
-// RUN: %target-swift-frontend -emit-silgen -parse-stdlib -primary-file %s | FileCheck %s -check-prefix=RAW
-// RUN: %target-swift-frontend -emit-sil -assert-config Debug -parse-stdlib -primary-file %s | FileCheck -check-prefix=DEBUG %s
-// RUN: %target-swift-frontend -emit-sil -O -assert-config Debug -parse-stdlib -primary-file %s | FileCheck -check-prefix=DEBUG %s
-// RUN: %target-swift-frontend -emit-sil -assert-config Release -parse-stdlib -primary-file %s | FileCheck -check-prefix=RELEASE %s
-// RUN: %target-swift-frontend -emit-sil -O -assert-config Release -parse-stdlib -primary-file %s | FileCheck -check-prefix=RELEASE %s
+// RUN: %target-swift-frontend -emit-silgen -parse-stdlib -primary-file %s | %FileCheck %s -check-prefix=RAW
+// RUN: %target-swift-frontend -emit-sil -assert-config Debug -parse-stdlib -primary-file %s | %FileCheck -check-prefix=DEBUG %s
+// RUN: %target-swift-frontend -emit-sil -O -assert-config Debug -parse-stdlib -primary-file %s | %FileCheck -check-prefix=DEBUG %s
+// RUN: %target-swift-frontend -emit-sil -assert-config Release -parse-stdlib -primary-file %s | %FileCheck -check-prefix=RELEASE %s
+// RUN: %target-swift-frontend -emit-sil -O -assert-config Release -parse-stdlib -primary-file %s | %FileCheck -check-prefix=RELEASE %s
 
 import Swift
 
diff --git a/test/SILGen/copy_lvalue_peepholes.swift b/test/SILGen/copy_lvalue_peepholes.swift
index c747623..57c89c6 100644
--- a/test/SILGen/copy_lvalue_peepholes.swift
+++ b/test/SILGen/copy_lvalue_peepholes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -parse-as-library -emit-silgen %s | %FileCheck %s
 
 precedencegroup AssignmentPrecedence { assignment: true }
 
diff --git a/test/SILGen/coverage_class.swift b/test/SILGen/coverage_class.swift
index 5de4aaa..d27df0a 100644
--- a/test/SILGen/coverage_class.swift
+++ b/test/SILGen/coverage_class.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sil -module-name coverage_class %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sil -module-name coverage_class %s | %FileCheck %s
 
 class C {
   // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_class.C.foo
diff --git a/test/SILGen/coverage_closures.swift b/test/SILGen/coverage_closures.swift
index 6b6c0b2..725758c 100644
--- a/test/SILGen/coverage_closures.swift
+++ b/test/SILGen/coverage_closures.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_closures %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_closures %s | %FileCheck %s
 
 // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_closures.bar
 func bar(arr: [(Int32) -> Int32]) {
diff --git a/test/SILGen/coverage_default_args.swift b/test/SILGen/coverage_default_args.swift
index 84a3aaa..71c2030 100644
--- a/test/SILGen/coverage_default_args.swift
+++ b/test/SILGen/coverage_default_args.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_default_args %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_default_args %s | %FileCheck %s
 
 // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_default_args.closureInArgs
 // CHECK: [[@LINE+2]]:41 -> [[@LINE+2]]:57 : 1
diff --git a/test/SILGen/coverage_exceptions.swift b/test/SILGen/coverage_exceptions.swift
index 4b09da3..e368def 100644
--- a/test/SILGen/coverage_exceptions.swift
+++ b/test/SILGen/coverage_exceptions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_catch %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_catch %s | %FileCheck %s
 
 enum SomeErr : Error {
   case Err1
diff --git a/test/SILGen/coverage_guard.swift b/test/SILGen/coverage_guard.swift
index 248e10cd..020d971 100644
--- a/test/SILGen/coverage_guard.swift
+++ b/test/SILGen/coverage_guard.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_guard %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_guard %s | %FileCheck %s
 
 // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_guard.foo
 func foo(_ x : Int32) { // CHECK: [[@LINE]]:23 -> [[END:[0-9]+:2]] : 0
diff --git a/test/SILGen/coverage_if.swift b/test/SILGen/coverage_if.swift
index 0abfee5..6e1419e 100644
--- a/test/SILGen/coverage_if.swift
+++ b/test/SILGen/coverage_if.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_if %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_if %s | %FileCheck %s
 
 // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_if.foo
 func foo(x : Bool) { // CHECK: [[@LINE]]:20 -> {{[0-9]+}}:2 : 0
diff --git a/test/SILGen/coverage_label.swift b/test/SILGen/coverage_label.swift
index 864981c..9865142 100644
--- a/test/SILGen/coverage_label.swift
+++ b/test/SILGen/coverage_label.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -suppress-warnings -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_label %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -suppress-warnings -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_label %s | %FileCheck %s
 
 // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_label.foo
 func foo() { // CHECK-DAG: [[@LINE]]:12 -> [[@LINE+19]]:2 : 0
diff --git a/test/SILGen/coverage_member_closure.swift b/test/SILGen/coverage_member_closure.swift
index e7b79c2..937ac80 100644
--- a/test/SILGen/coverage_member_closure.swift
+++ b/test/SILGen/coverage_member_closure.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sil -module-name coverage_member_closure %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sil -module-name coverage_member_closure %s | %FileCheck %s
 
 class C {
   // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_member_closure.C.__allocating_init
diff --git a/test/SILGen/coverage_smoke.swift b/test/SILGen/coverage_smoke.swift
index 72bc74e..8d816c4 100644
--- a/test/SILGen/coverage_smoke.swift
+++ b/test/SILGen/coverage_smoke.swift
@@ -2,11 +2,11 @@
 // RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -Xfrontend -disable-incremental-llvm-codegen -o %t/main
 // RUN: env LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
 // RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
-// RUN: %llvm-profdata show %t/default.profdata -function=f_internal | FileCheck %s --check-prefix=CHECK-INTERNAL
-// RUN: %llvm-profdata show %t/default.profdata -function=f_private | FileCheck %s --check-prefix=CHECK-PRIVATE
-// RUN: %llvm-profdata show %t/default.profdata -function=f_public | FileCheck %s --check-prefix=CHECK-PUBLIC
-// RUN: %llvm-profdata show %t/default.profdata -function=main | FileCheck %s --check-prefix=CHECK-MAIN
-// RUN: %llvm-cov show %t/main -instr-profile=%t/default.profdata | FileCheck %s --check-prefix=CHECK-COV
+// RUN: %llvm-profdata show %t/default.profdata -function=f_internal | %FileCheck %s --check-prefix=CHECK-INTERNAL
+// RUN: %llvm-profdata show %t/default.profdata -function=f_private | %FileCheck %s --check-prefix=CHECK-PRIVATE
+// RUN: %llvm-profdata show %t/default.profdata -function=f_public | %FileCheck %s --check-prefix=CHECK-PUBLIC
+// RUN: %llvm-profdata show %t/default.profdata -function=main | %FileCheck %s --check-prefix=CHECK-MAIN
+// RUN: %llvm-cov show %t/main -instr-profile=%t/default.profdata | %FileCheck %s --check-prefix=CHECK-COV
 // RUN: rm -rf %t
 
 // REQUIRES: profile_runtime
diff --git a/test/SILGen/coverage_switch.swift b/test/SILGen/coverage_switch.swift
index c724f37..953c472 100644
--- a/test/SILGen/coverage_switch.swift
+++ b/test/SILGen/coverage_switch.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_switch %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_switch %s | %FileCheck %s
 
 // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_switch.f1
 func f1(_ x : Int32) {
diff --git a/test/SILGen/coverage_ternary.swift b/test/SILGen/coverage_ternary.swift
index 04d0d4b..e5926eb 100644
--- a/test/SILGen/coverage_ternary.swift
+++ b/test/SILGen/coverage_ternary.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_ternary %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_ternary %s | %FileCheck %s
 
 // CHECK-LABEL: sil_coverage_map {{.*}}// coverage_ternary.foo
 func foo(_ x : Int32) -> Int32 {
diff --git a/test/SILGen/coverage_while.swift b/test/SILGen/coverage_while.swift
index 79fe332..7e7535e 100644
--- a/test/SILGen/coverage_while.swift
+++ b/test/SILGen/coverage_while.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -suppress-warnings -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_while %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -suppress-warnings -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_while %s | %FileCheck %s
 
 // CHECK-LABEL: // coverage_while.eoo () -> ()
 func eoo() {
diff --git a/test/SILGen/decls.swift b/test/SILGen/decls.swift
index 1a86947..df4bdb6 100644
--- a/test/SILGen/decls.swift
+++ b/test/SILGen/decls.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden @_TF5decls11void_returnFT_T_
 // CHECK: = tuple
diff --git a/test/SILGen/default_arguments.swift b/test/SILGen/default_arguments.swift
index d7d05de..480cb81 100644
--- a/test/SILGen/default_arguments.swift
+++ b/test/SILGen/default_arguments.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 // __FUNCTION__ used as top-level parameter produces the module name.
 // CHECK-LABEL: sil @main
diff --git a/test/SILGen/default_arguments_generic.swift b/test/SILGen/default_arguments_generic.swift
index c37fec4..d2d9c48 100644
--- a/test/SILGen/default_arguments_generic.swift
+++ b/test/SILGen/default_arguments_generic.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func foo<T: ExpressibleByIntegerLiteral>(x x: T = 0) { }
 
diff --git a/test/SILGen/default_arguments_imported.swift b/test/SILGen/default_arguments_imported.swift
index 08dd09c..b63a22e 100644
--- a/test/SILGen/default_arguments_imported.swift
+++ b/test/SILGen/default_arguments_imported.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | %FileCheck %s
 
 // Test SIL generation for imported default arguments.
 
diff --git a/test/SILGen/default_constructor.swift b/test/SILGen/default_constructor.swift
index 3fb88dc..841069a 100644
--- a/test/SILGen/default_constructor.swift
+++ b/test/SILGen/default_constructor.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -primary-file %s | %FileCheck %s
 
 struct B {
   var i : Int, j : Float
diff --git a/test/SILGen/deinit_in_vtable.swift b/test/SILGen/deinit_in_vtable.swift
index 80ee765..0ef4a3d 100644
--- a/test/SILGen/deinit_in_vtable.swift
+++ b/test/SILGen/deinit_in_vtable.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -emit-sil %s | %FileCheck %s
 
 // The second run tests is it can be compiled without crashes.
 // RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -S %s
diff --git a/test/SILGen/dependent_member_lowering.swift b/test/SILGen/dependent_member_lowering.swift
index 1db01377..586d686 100644
--- a/test/SILGen/dependent_member_lowering.swift
+++ b/test/SILGen/dependent_member_lowering.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol P {
   associatedtype A
diff --git a/test/SILGen/downcast_reabstraction.swift b/test/SILGen/downcast_reabstraction.swift
index 9cb29ae..3b985a0 100644
--- a/test/SILGen/downcast_reabstraction.swift
+++ b/test/SILGen/downcast_reabstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden @_TF22downcast_reabstraction19condFunctionFromAnyFP_T_ 
 // CHECK:         checked_cast_addr_br take_always Any in [[IN:%.*]] : $*Any to () -> () in [[OUT:%.*]] : $*@callee_owned (@in ()) -> @out (), [[YES:bb[0-9]+]], [[NO:bb[0-9]+]]
diff --git a/test/SILGen/dso_handle.swift b/test/SILGen/dso_handle.swift
index f8cdd0b..1d3657c 100644
--- a/test/SILGen/dso_handle.swift
+++ b/test/SILGen/dso_handle.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 // CHECK: sil_global hidden_external [[DSO:@__dso_handle]] : $Builtin.RawPointer
 
diff --git a/test/SILGen/dynamic.swift b/test/SILGen/dynamic.swift
index 3225f5c..e86475e 100644
--- a/test/SILGen/dynamic.swift
+++ b/test/SILGen/dynamic.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-silgen-test-overlays
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -Xllvm -sil-full-demangle -primary-file %s %S/Inputs/dynamic_other.swift -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -Xllvm -sil-full-demangle -primary-file %s %S/Inputs/dynamic_other.swift -emit-silgen | %FileCheck %s
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -Xllvm -sil-full-demangle -primary-file %s %S/Inputs/dynamic_other.swift -emit-sil -verify
 
 // REQUIRES: objc_interop
diff --git a/test/SILGen/dynamic_init.swift b/test/SILGen/dynamic_init.swift
index 671372b..495656c 100644
--- a/test/SILGen/dynamic_init.swift
+++ b/test/SILGen/dynamic_init.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class C {
   required init() { }
diff --git a/test/SILGen/dynamic_lookup.swift b/test/SILGen/dynamic_lookup.swift
index 3126ea4..d38ea6d 100644
--- a/test/SILGen/dynamic_lookup.swift
+++ b/test/SILGen/dynamic_lookup.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen -disable-objc-attr-requires-foundation-module %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/dynamic_self.swift b/test/SILGen/dynamic_self.swift
index 310c930..058aa15 100644
--- a/test/SILGen/dynamic_self.swift
+++ b/test/SILGen/dynamic_self.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 protocol P {
   func f() -> Self
diff --git a/test/SILGen/dynamic_self_reference_storage.swift b/test/SILGen/dynamic_self_reference_storage.swift
index 44d129c..dcf4895 100644
--- a/test/SILGen/dynamic_self_reference_storage.swift
+++ b/test/SILGen/dynamic_self_reference_storage.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class Foo {
   // CHECK-LABEL: sil hidden @_TFC30dynamic_self_reference_storage3Foo11dynamicSelf
diff --git a/test/SILGen/effectsattr.swift b/test/SILGen/effectsattr.swift
index c405f72..e7d2839 100644
--- a/test/SILGen/effectsattr.swift
+++ b/test/SILGen/effectsattr.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | %FileCheck %s
 
 
 //CHECK: [readonly] @func1
diff --git a/test/SILGen/enum.swift b/test/SILGen/enum.swift
index baa562f..b702534 100644
--- a/test/SILGen/enum.swift
+++ b/test/SILGen/enum.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -parse-as-library -emit-silgen -module-name Swift %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -parse-as-library -emit-silgen -module-name Swift %s | %FileCheck %s
 
 precedencegroup AssignmentPrecedence { assignment: true }
 
diff --git a/test/SILGen/enum_generic_raw_value.swift b/test/SILGen/enum_generic_raw_value.swift
index be7395f..00d48ff 100644
--- a/test/SILGen/enum_generic_raw_value.swift
+++ b/test/SILGen/enum_generic_raw_value.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden @_TFO22enum_generic_raw_value1EC
 enum E<T>: Int {
diff --git a/test/SILGen/enum_resilience.swift b/test/SILGen/enum_resilience.swift
index 6e070a5..9268b0f 100644
--- a/test/SILGen/enum_resilience.swift
+++ b/test/SILGen/enum_resilience.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-silgen -enable-resilience %s | FileCheck %s
+// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-silgen -enable-resilience %s | %FileCheck %s
 
 import resilient_enum
 
diff --git a/test/SILGen/erasure_reabstraction.swift b/test/SILGen/erasure_reabstraction.swift
index 9a16652..169bea1 100644
--- a/test/SILGen/erasure_reabstraction.swift
+++ b/test/SILGen/erasure_reabstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 struct Foo {}
 class Bar {}
diff --git a/test/SILGen/errors.swift b/test/SILGen/errors.swift
index 23e0815..7951a75 100644
--- a/test/SILGen/errors.swift
+++ b/test/SILGen/errors.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen -verify -primary-file %s %S/Inputs/errors_other.swift | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen -verify -primary-file %s %S/Inputs/errors_other.swift | %FileCheck %s
 
 import Swift
 
diff --git a/test/SILGen/existential_erasure.swift b/test/SILGen/existential_erasure.swift
index d7cdd16..6440d7d 100644
--- a/test/SILGen/existential_erasure.swift
+++ b/test/SILGen/existential_erasure.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol P {
   func downgrade(_ m68k: Bool) -> Self
diff --git a/test/SILGen/existential_metatypes.swift b/test/SILGen/existential_metatypes.swift
index 30b4479..3153119 100644
--- a/test/SILGen/existential_metatypes.swift
+++ b/test/SILGen/existential_metatypes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -parse-stdlib %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -parse-stdlib %s | %FileCheck %s
 
 protocol P {
   init()
diff --git a/test/SILGen/expressions.swift b/test/SILGen/expressions.swift
index 6c9934d..e88c1c6 100644
--- a/test/SILGen/expressions.swift
+++ b/test/SILGen/expressions.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: echo "public var x = Int()" | %target-swift-frontend -module-name FooBar -emit-module -o %t -
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s -I%t -disable-access-control | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s -I%t -disable-access-control | %FileCheck %s
 
 import Swift
 import FooBar
diff --git a/test/SILGen/extensions.swift b/test/SILGen/extensions.swift
index 2b98564..769b3a3 100644
--- a/test/SILGen/extensions.swift
+++ b/test/SILGen/extensions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class Foo {
   // CHECK-LABEL: sil hidden @_TFC10extensions3Foo3zim
diff --git a/test/SILGen/extensions_objc.swift b/test/SILGen/extensions_objc.swift
index 3cad0fd..7ddc7ac 100644
--- a/test/SILGen/extensions_objc.swift
+++ b/test/SILGen/extensions_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs %s -I %S/Inputs -enable-source-import -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs %s -I %S/Inputs -enable-source-import -emit-silgen | %FileCheck %s
 //
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/external_definitions.swift b/test/SILGen/external_definitions.swift
index 1cb53da..a40420f 100644
--- a/test/SILGen/external_definitions.swift
+++ b/test/SILGen/external_definitions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/final.swift b/test/SILGen/final.swift
index a32fa5c..c24fe19 100644
--- a/test/SILGen/final.swift
+++ b/test/SILGen/final.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class TestClass {
 
diff --git a/test/SILGen/force_cast_chained_optional.swift b/test/SILGen/force_cast_chained_optional.swift
index 50eb7b4..7097d06 100644
--- a/test/SILGen/force_cast_chained_optional.swift
+++ b/test/SILGen/force_cast_chained_optional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class Foo {
   var bar: Bar!
diff --git a/test/SILGen/foreach.swift b/test/SILGen/foreach.swift
index 05428e0..4941828 100644
--- a/test/SILGen/foreach.swift
+++ b/test/SILGen/foreach.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class C {}
 
diff --git a/test/SILGen/foreign_errors.swift b/test/SILGen/foreign_errors.swift
index 65d1252..0149d2b 100644
--- a/test/SILGen/foreign_errors.swift
+++ b/test/SILGen/foreign_errors.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen -parse-as-library %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen -parse-as-library %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
@@ -8,7 +8,7 @@
 // CHECK: sil hidden @_TF14foreign_errors5test0FzT_T_ : $@convention(thin) () -> @error Error
 func test0() throws {
   // CHECK: [[SELF:%.*]] = metatype $@thick ErrorProne.Type
-  // CHECK: [[METHOD:%.*]] = class_method [volatile] [[SELF]] : $@thick ErrorProne.Type, #ErrorProne.fail!1.foreign : (ErrorProne.Type) -> () throws -> () , $@convention(objc_method) (ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, @objc_metatype ErrorProne.Type) -> Bool
+  // CHECK: [[METHOD:%.*]] = class_method [volatile] [[SELF]] : $@thick ErrorProne.Type, #ErrorProne.fail!1.foreign : (ErrorProne.Type) -> () throws -> () , $@convention(objc_method) (ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, @objc_metatype ErrorProne.Type) -> ObjCBool
   // CHECK: [[OBJC_SELF:%.*]] = thick_to_objc_metatype [[SELF]]
 
   //   Create a strong temporary holding nil.
@@ -31,10 +31,10 @@
   // CHECK: assign [[T1]] to [[ERR_TEMP0]]
 
   //   Pull out the boolean value and compare it to zero.
-  // CHECK: [[T0:%.*]] = struct_extract [[RESULT]]
-  // CHECK: [[T1:%.*]] = integer_literal $Builtin.Int1
-  // CHECK: [[T2:%.*]] = builtin "cmp_eq_Int1"([[T0]] : $Builtin.Int1, [[T1]] : $Builtin.Int1)
-  // CHECK: cond_br [[T2]], [[ERROR_BB:bb[0-9]+]], [[NORMAL_BB:bb[0-9]+]]
+  // CHECK: [[FN:%.*]] = function_ref @_TF10ObjectiveC22_convertObjCBoolToBoolFVS_8ObjCBoolSb
+  // CHECK: [[BOOL:%.*]] = apply [[FN]]([[RESULT]])
+  // CHECK: [[BIT:%.*]] = struct_extract [[BOOL]]
+  // CHECK: cond_br [[BIT]], [[NORMAL_BB:bb[0-9]+]], [[ERROR_BB:bb[0-9]+]]
   try ErrorProne.fail()
 
   //   Normal path: fall out and return.
@@ -53,13 +53,14 @@
   @objc func abort() throws {
     throw NSError(domain: "", code: 1, userInfo: [:])
   }
-// CHECK-LABEL: sil hidden [thunk] @_TToFE14foreign_errorsCSo8NSObject5abort{{.*}} : $@convention(objc_method) (Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, NSObject) -> Bool
+// CHECK-LABEL: sil hidden [thunk] @_TToFE14foreign_errorsCSo8NSObject5abort{{.*}} : $@convention(objc_method) (Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, NSObject) -> ObjCBool
 // CHECK: [[T0:%.*]] = function_ref @_TFE14foreign_errorsCSo8NSObject5abort{{.*}} : $@convention(method) (@guaranteed NSObject) -> @error Error
 // CHECK: try_apply [[T0]](
 // CHECK: bb1(
-// CHECK:   [[T0:%.*]] = integer_literal $Builtin.Int1, -1
-// CHECK:   [[T1:%.*]] = struct $Bool ([[T0]] : $Builtin.Int1)
-// CHECK:   br bb6([[T1]] : $Bool)
+// CHECK:   [[BITS:%.*]] = integer_literal $Builtin.Int{{[18]}}, {{1|-1}}
+// CHECK:   [[VALUE:%.*]] = struct ${{Bool|UInt8}} ([[BITS]] : $Builtin.Int{{[18]}})
+// CHECK:   [[BOOL:%.*]] = struct $ObjCBool ([[VALUE]] : ${{Bool|UInt8}})
+// CHECK:   br bb6([[BOOL]] : $ObjCBool)
 // CHECK: bb2([[ERR:%.*]] : $Error):
 // CHECK:   switch_enum %0 : $Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, case #Optional.some!enumelt.1: bb3, case #Optional.none!enumelt: bb4
 // CHECK: bb3([[UNWRAPPED_OUT:%.+]] : $AutoreleasingUnsafeMutablePointer<Optional<NSError>>):
@@ -76,11 +77,12 @@
 // CHECK:   strong_release [[ERR]] : $Error
 // CHECK:   br bb5
 // CHECK: bb5:
-// CHECK:   [[T0:%.*]] = integer_literal $Builtin.Int1, 0
-// CHECK:   [[T1:%.*]] = struct $Bool ([[T0]] : $Builtin.Int1)
-// CHECK:   br bb6([[T1]] : $Bool)
-// CHECK: bb6([[T0:%.*]] : $Bool):
-// CHECK:   return [[T0]] : $Bool
+// CHECK:   [[BITS:%.*]] = integer_literal $Builtin.Int{{[18]}}, 0
+// CHECK:   [[VALUE:%.*]] = struct ${{Bool|UInt8}} ([[BITS]] : $Builtin.Int{{[18]}})
+// CHECK:   [[BOOL:%.*]] = struct $ObjCBool ([[VALUE]] : ${{Bool|UInt8}})
+// CHECK:   br bb6([[BOOL]] : $ObjCBool)
+// CHECK: bb6([[BOOL:%.*]] : $ObjCBool):
+// CHECK:   return [[BOOL]] : $ObjCBool
 
   @objc func badDescription() throws -> String {
     throw NSError(domain: "", code: 1, userInfo: [:])
@@ -114,11 +116,11 @@
 // CHECK: bb6([[T0:%.*]] : $Optional<NSString>):
 // CHECK:   return [[T0]] : $Optional<NSString>
 
-// CHECK-LABEL: sil hidden [thunk] @_TToFE14foreign_errorsCSo8NSObject7takeInt{{.*}} : $@convention(objc_method) (Int, Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, NSObject) -> Bool
+// CHECK-LABEL: sil hidden [thunk] @_TToFE14foreign_errorsCSo8NSObject7takeInt{{.*}} : $@convention(objc_method) (Int, Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, NSObject) -> ObjCBool
 // CHECK: bb0([[I:%[0-9]+]] : $Int, [[ERROR:%[0-9]+]] : $Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, [[SELF:%[0-9]+]] : $NSObject)
   @objc func takeInt(_ i: Int) throws { }
 
-// CHECK-LABEL: sil hidden [thunk] @_TToFE14foreign_errorsCSo8NSObject10takeDouble{{.*}} : $@convention(objc_method) (Double, Int, Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, @convention(block) (Int) -> Int, NSObject) -> Bool
+// CHECK-LABEL: sil hidden [thunk] @_TToFE14foreign_errorsCSo8NSObject10takeDouble{{.*}} : $@convention(objc_method) (Double, Int, Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, @convention(block) (Int) -> Int, NSObject) -> ObjCBool
 // CHECK: bb0([[D:%[0-9]+]] : $Double, [[INT:%[0-9]+]] : $Int, [[ERROR:%[0-9]+]] : $Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, [[CLOSURE:%[0-9]+]] : $@convention(block) (Int) -> Int, [[SELF:%[0-9]+]] : $NSObject):
   @objc func takeDouble(_ d: Double, int: Int, closure: (Int) -> Int) throws {
     throw NSError(domain: "", code: 1, userInfo: [:])
@@ -133,7 +135,7 @@
 
 // CHECK-LABEL: sil shared [thunk] @_TTOZFCSo10ErrorProne4fail{{.*}} : $@convention(method) (@thick ErrorProne.Type) -> @error Error {
 // CHECK:      [[SELF:%.*]] = thick_to_objc_metatype %0 : $@thick ErrorProne.Type to $@objc_metatype ErrorProne.Type
-// CHECK:      [[METHOD:%.*]] = class_method [volatile] [[T0]] : $@objc_metatype ErrorProne.Type, #ErrorProne.fail!1.foreign : (ErrorProne.Type) -> () throws -> () , $@convention(objc_method) (ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, @objc_metatype ErrorProne.Type) -> Bool
+// CHECK:      [[METHOD:%.*]] = class_method [volatile] [[T0]] : $@objc_metatype ErrorProne.Type, #ErrorProne.fail!1.foreign : (ErrorProne.Type) -> () throws -> () , $@convention(objc_method) (ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, @objc_metatype ErrorProne.Type) -> ObjCBool
 // CHECK:      [[TEMP:%.*]] = alloc_stack $Optional<NSError>
 // CHECK:      [[RESULT:%.*]] = apply [[METHOD]]({{%.*}}, [[SELF]])
 // CHECK:      cond_br
@@ -146,7 +148,7 @@
   try ErrorProne.consume(nil)
 }
 // CHECK: sil hidden @_TF14foreign_errors8testArgsFzT_T_ : $@convention(thin) () -> @error Error
-// CHECK:   class_method [volatile] %0 : $@thick ErrorProne.Type, #ErrorProne.consume!1.foreign : (ErrorProne.Type) -> (Any!) throws -> () , $@convention(objc_method) (ImplicitlyUnwrappedOptional<AnyObject>, ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, @objc_metatype ErrorProne.Type) -> Bool
+// CHECK:   class_method [volatile] %0 : $@thick ErrorProne.Type, #ErrorProne.consume!1.foreign : (ErrorProne.Type) -> (Any!) throws -> () , $@convention(objc_method) (ImplicitlyUnwrappedOptional<AnyObject>, ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, @objc_metatype ErrorProne.Type) -> ObjCBool
 
 func testBridgedResult() throws {
   let array = try ErrorProne.collection(withCount: 0)
@@ -178,12 +180,12 @@
 func testProtocol(_ p: ErrorProneProtocol) throws {
   // CHECK:   [[T0:%.*]] = open_existential_ref %0 : $ErrorProneProtocol to $[[OPENED:@opened(.*) ErrorProneProtocol]]
   // CHECK:   [[T1:%.*]] = witness_method [volatile] $[[OPENED]], #ErrorProneProtocol.obliterate!1.foreign, [[T0]] : $[[OPENED]] :
-  // CHECK:   apply [[T1]]<[[OPENED]]>({{%.*}}, [[T0]]) : $@convention(objc_method) <τ_0_0 where τ_0_0 : ErrorProneProtocol> (ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, τ_0_0) -> Bool
+  // CHECK:   apply [[T1]]<[[OPENED]]>({{%.*}}, [[T0]]) : $@convention(objc_method) <τ_0_0 where τ_0_0 : ErrorProneProtocol> (ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, τ_0_0) -> ObjCBool
   try p.obliterate()
 
   // CHECK:   [[T0:%.*]] = open_existential_ref %0 : $ErrorProneProtocol to $[[OPENED:@opened(.*) ErrorProneProtocol]]
   // CHECK:   [[T1:%.*]] = witness_method [volatile] $[[OPENED]], #ErrorProneProtocol.invigorate!1.foreign, [[T0]] : $[[OPENED]] :
-  // CHECK:   apply [[T1]]<[[OPENED]]>({{%.*}}, {{%.*}}, [[T0]]) : $@convention(objc_method) <τ_0_0 where τ_0_0 : ErrorProneProtocol> (ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, ImplicitlyUnwrappedOptional<@convention(block) () -> ()>, τ_0_0) -> Bool
+  // CHECK:   apply [[T1]]<[[OPENED]]>({{%.*}}, {{%.*}}, [[T0]]) : $@convention(objc_method) <τ_0_0 where τ_0_0 : ErrorProneProtocol> (ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, ImplicitlyUnwrappedOptional<@convention(block) () -> ()>, τ_0_0) -> ObjCBool
   try p.invigorate(callback: {})
 }
 
@@ -192,7 +194,7 @@
   override func conflict3(_ obj: Any, error: ()) throws {}
 }
 // CHECK: sil hidden @_TFC14foreign_errors19ExtremelyErrorProne9conflict3{{.*}}
-// CHECK: sil hidden [thunk] @_TToFC14foreign_errors19ExtremelyErrorProne9conflict3{{.*}} : $@convention(objc_method) (AnyObject, ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, ExtremelyErrorProne) -> Bool
+// CHECK: sil hidden [thunk] @_TToFC14foreign_errors19ExtremelyErrorProne9conflict3{{.*}} : $@convention(objc_method) (AnyObject, ImplicitlyUnwrappedOptional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>, ExtremelyErrorProne) -> ObjCBool
 
 // These conventions are usable because of swift_error. rdar://21715350
 func testNonNilError() throws -> Float {
@@ -221,8 +223,8 @@
 // CHECK:   [[RESULT:%.*]] = apply [[T1]](
 // CHECK:   [[T0:%.*]] = struct_extract [[RESULT]]
 // CHECK:   [[T1:%.*]] = integer_literal $[[PRIM:Builtin.Int[0-9]+]], 0
-// CHECK:   [[T2:%.*]] = builtin "cmp_eq_Int32"([[T0]] : $[[PRIM]], [[T1]] : $[[PRIM]])
-// CHECK:   cond_br [[T2]], [[ERROR_BB:bb[0-9]+]], [[NORMAL_BB:bb[0-9]+]]
+// CHECK:   [[T2:%.*]] = builtin "cmp_ne_Int32"([[T0]] : $[[PRIM]], [[T1]] : $[[PRIM]])
+// CHECK:   cond_br [[T2]], [[NORMAL_BB:bb[0-9]+]], [[ERROR_BB:bb[0-9]+]]
 // CHECK: [[NORMAL_BB]]:
 // CHECK-NOT: release
 // CHECK:   return [[RESULT]]
diff --git a/test/SILGen/fragile_globals.swift b/test/SILGen/fragile_globals.swift
index 0c6fef2..642d6d3 100644
--- a/test/SILGen/fragile_globals.swift
+++ b/test/SILGen/fragile_globals.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -parse-as-library -sil-serialize-all -o %t %S/Inputs/ModuleA.swift
 // RUN: %target-swift-frontend -emit-module -parse-as-library -sil-serialize-all -o %t %S/Inputs/ModuleB.swift
-// RUN: %target-swift-frontend -parse-as-library -I%t %s -Xllvm -sil-disable-pass="SIL Global Optimization" -O -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -I%t %s -Xllvm -sil-disable-pass="SIL Global Optimization" -O -emit-sil | %FileCheck %s
 
 import ModuleA
 import ModuleB
diff --git a/test/SILGen/function_conversion.swift b/test/SILGen/function_conversion.swift
index e49f094..5190d8d 100644
--- a/test/SILGen/function_conversion.swift
+++ b/test/SILGen/function_conversion.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // Check SILGen against various FunctionConversionExprs emitted by Sema.
 
diff --git a/test/SILGen/function_conversion_objc.swift b/test/SILGen/function_conversion_objc.swift
index d419b85..580e107 100644
--- a/test/SILGen/function_conversion_objc.swift
+++ b/test/SILGen/function_conversion_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs %s -I %S/Inputs -enable-source-import -emit-silgen -verify | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs %s -I %S/Inputs -enable-source-import -emit-silgen -verify | %FileCheck %s
 
 import Foundation
 
diff --git a/test/SILGen/functions.swift b/test/SILGen/functions.swift
index 9bac557..a1d435b 100644
--- a/test/SILGen/functions.swift
+++ b/test/SILGen/functions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-stdlib -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-stdlib -parse-as-library -emit-silgen %s | %FileCheck %s
 
 import Swift // just for Optional
 
diff --git a/test/SILGen/generic_casts.swift b/test/SILGen/generic_casts.swift
index f3b5488..d1d5161 100644
--- a/test/SILGen/generic_casts.swift
+++ b/test/SILGen/generic_casts.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 protocol ClassBound : class {}
 protocol NotClassBound {}
diff --git a/test/SILGen/generic_closures.swift b/test/SILGen/generic_closures.swift
index c3d95dd..7fe82fd 100644
--- a/test/SILGen/generic_closures.swift
+++ b/test/SILGen/generic_closures.swift
@@ -1,5 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | FileCheck %s
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen -suppress-argument-labels-in-types %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | %FileCheck %s
 
 import Swift
 
diff --git a/test/SILGen/generic_literals.swift b/test/SILGen/generic_literals.swift
index daa5295..fc780d0 100644
--- a/test/SILGen/generic_literals.swift
+++ b/test/SILGen/generic_literals.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden @_TF16generic_literals21genericIntegerLitera
 func genericIntegerLiteral<T : ExpressibleByIntegerLiteral>(x: T) {
diff --git a/test/SILGen/generic_objc_block_bridge.swift b/test/SILGen/generic_objc_block_bridge.swift
index 74d12bb..8a42e69 100644
--- a/test/SILGen/generic_objc_block_bridge.swift
+++ b/test/SILGen/generic_objc_block_bridge.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/generic_property_base_lifetime.swift b/test/SILGen/generic_property_base_lifetime.swift
index 2ab3750..0338d4a 100644
--- a/test/SILGen/generic_property_base_lifetime.swift
+++ b/test/SILGen/generic_property_base_lifetime.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 protocol ProtocolA: class {
     var intProp: Int { get set }
diff --git a/test/SILGen/generic_tuples.swift b/test/SILGen/generic_tuples.swift
index f2005ff..6f6f563 100644
--- a/test/SILGen/generic_tuples.swift
+++ b/test/SILGen/generic_tuples.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -parse-as-library %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -parse-as-library %s | %FileCheck %s
 
 
 func dup<T>(_ x: T) -> (T, T) { return (x,x) }
diff --git a/test/SILGen/generic_witness.swift b/test/SILGen/generic_witness.swift
index 198e724..cd5ea04 100644
--- a/test/SILGen/generic_witness.swift
+++ b/test/SILGen/generic_witness.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol Runcible {
   func runce<A>(_ x: A)
diff --git a/test/SILGen/global_init_attribute.swift b/test/SILGen/global_init_attribute.swift
index 8585814..67566f1 100644
--- a/test/SILGen/global_init_attribute.swift
+++ b/test/SILGen/global_init_attribute.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-module -o %t %S/Inputs/def_global.swift
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen -I %t %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen -I %t %s | %FileCheck %s
 //
 // Test that SILGen uses the "global_init" attribute for all global
 // variable addressors.
diff --git a/test/SILGen/global_resilience.swift b/test/SILGen/global_resilience.swift
index acdd57d..af67003 100644
--- a/test/SILGen/global_resilience.swift
+++ b/test/SILGen/global_resilience.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -emit-silgen -enable-source-import -parse-as-library -enable-resilience %s | FileCheck %s
-// RUN: %target-swift-frontend -I %S/../Inputs -emit-sil -enable-source-import -parse-as-library -enable-resilience %s -O | FileCheck --check-prefix=CHECK-OPT %s
+// RUN: %target-swift-frontend -I %S/../Inputs -emit-silgen -enable-source-import -parse-as-library -enable-resilience %s | %FileCheck %s
+// RUN: %target-swift-frontend -I %S/../Inputs -emit-sil -enable-source-import -parse-as-library -enable-resilience %s -O | %FileCheck --check-prefix=CHECK-OPT %s
 
 import resilient_global
 
diff --git a/test/SILGen/guaranteed_closure_context.swift b/test/SILGen/guaranteed_closure_context.swift
index ec41d73..4649c66 100644
--- a/test/SILGen/guaranteed_closure_context.swift
+++ b/test/SILGen/guaranteed_closure_context.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen -enable-guaranteed-closure-contexts %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen -enable-guaranteed-closure-contexts %s | %FileCheck %s
 
 func use<T>(_: T) {}
 
diff --git a/test/SILGen/guaranteed_self.swift b/test/SILGen/guaranteed_self.swift
index 28ed628..57ec939 100644
--- a/test/SILGen/guaranteed_self.swift
+++ b/test/SILGen/guaranteed_self.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 protocol Fooable {
   init()
diff --git a/test/SILGen/if_expr.swift b/test/SILGen/if_expr.swift
index 95741fa..84fcd8b 100644
--- a/test/SILGen/if_expr.swift
+++ b/test/SILGen/if_expr.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func fizzbuzz(i: Int) -> String {
   return i % 3 == 0
diff --git a/test/SILGen/if_while_binding.swift b/test/SILGen/if_while_binding.swift
index 1b8d8d6..5d47472 100644
--- a/test/SILGen/if_while_binding.swift
+++ b/test/SILGen/if_while_binding.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 func foo() -> String? { return "" }
 func bar() -> String? { return "" }
diff --git a/test/SILGen/implicitly_unwrapped_optional.swift b/test/SILGen/implicitly_unwrapped_optional.swift
index 3f31c56..63ec640 100644
--- a/test/SILGen/implicitly_unwrapped_optional.swift
+++ b/test/SILGen/implicitly_unwrapped_optional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func foo(f f: (() -> ())!) {
   var f: (() -> ())! = f
diff --git a/test/SILGen/import_as_member.swift b/test/SILGen/import_as_member.swift
index bc8a1b3..21ccb41 100644
--- a/test/SILGen/import_as_member.swift
+++ b/test/SILGen/import_as_member.swift
@@ -1,7 +1,6 @@
-// RUN: %target-swift-frontend -emit-silgen -I %S/../IDE/Inputs/custom-modules %s 2>&1 | FileCheck --check-prefix=SIL %s
+// RUN: %target-swift-frontend -emit-silgen -I %S/../IDE/Inputs/custom-modules %s 2>&1 | %FileCheck --check-prefix=SIL %s
 // REQUIRES: objc_interop
 import ImportAsMember.A
-import ImportAsMember.Proto
 import ImportAsMember.Class
 
 public func returnGlobalVar() -> Double {
@@ -13,14 +12,6 @@
 // SIL:   return %2 : $Double
 // SIL-NEXT: }
 
-// SIL-LABEL: sil {{.*}}useProto{{.*}} (@owned IAMProto) -> () {
-// TODO: Add in body checks
-public func useProto(p: IAMProto) {
-	p.mutateSomeState()
-	let v = p.someValue
-	p.someValue = v+1
-}
-
 // SIL-LABEL: sil {{.*}}anchor{{.*}} () -> () {
 func anchor() {}
 
diff --git a/test/SILGen/import_as_member_cf.swift b/test/SILGen/import_as_member_cf.swift
index 62663e7..d42efd6 100644
--- a/test/SILGen/import_as_member_cf.swift
+++ b/test/SILGen/import_as_member_cf.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -I %S/../IDE/Inputs/custom-modules %s 2>&1 | FileCheck --check-prefix=SIL %s
+// RUN: %target-swift-frontend -emit-silgen -I %S/../IDE/Inputs/custom-modules %s 2>&1 | %FileCheck --check-prefix=SIL %s
 // REQUIRES: objc_interop
 
 import ImportAsMember.C
diff --git a/test/SILGen/imported_struct_array_field.swift b/test/SILGen/imported_struct_array_field.swift
index 22763a5..016cbc6 100644
--- a/test/SILGen/imported_struct_array_field.swift
+++ b/test/SILGen/imported_struct_array_field.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -import-objc-header %S/Inputs/array_typedef.h %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -import-objc-header %S/Inputs/array_typedef.h %s | %FileCheck %s
 
 // CHECK-LABEL: sil shared [transparent] [fragile] @_TFVSC4NameC{{.*}} : $@convention(method) (UInt8, UInt8, UInt8, UInt8, @thin Name.Type) -> Name
 func useImportedArrayTypedefInit() -> Name {
diff --git a/test/SILGen/indirect_enum.swift b/test/SILGen/indirect_enum.swift
index b2f8b80..748d7c9 100644
--- a/test/SILGen/indirect_enum.swift
+++ b/test/SILGen/indirect_enum.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 indirect enum TreeA<T> {
   case Nil
diff --git a/test/SILGen/inherited_protocol_conformance_multi_file.swift b/test/SILGen/inherited_protocol_conformance_multi_file.swift
index 5d29b7b..82a7227 100644
--- a/test/SILGen/inherited_protocol_conformance_multi_file.swift
+++ b/test/SILGen/inherited_protocol_conformance_multi_file.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file.swift -module-name main | FileCheck %s --check-prefix=THIS_FILE
-// RUN: %target-swift-frontend -emit-silgen %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file.swift -module-name main | FileCheck %s --check-prefix=OTHER_FILE
+// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file.swift -module-name main | %FileCheck %s --check-prefix=THIS_FILE
+// RUN: %target-swift-frontend -emit-silgen %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file.swift -module-name main | %FileCheck %s --check-prefix=OTHER_FILE
 
 // THIS_FILE-NOT: sil_witness_table {{.*}} B: P
 // THIS_FILE-LABEL: sil_witness_table hidden D: R module main
diff --git a/test/SILGen/inherited_protocol_conformance_multi_file_2.swift b/test/SILGen/inherited_protocol_conformance_multi_file_2.swift
index 0cdf9c6..d58bd7f 100644
--- a/test/SILGen/inherited_protocol_conformance_multi_file_2.swift
+++ b/test/SILGen/inherited_protocol_conformance_multi_file_2.swift
@@ -1,46 +1,46 @@
 // -- Try all the permutations of file order possible.
 
 // Abc
-// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | FileCheck %s --check-prefix=FILE_A
+// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | %FileCheck %s --check-prefix=FILE_A
 // aBc
-// RUN: %target-swift-frontend -emit-silgen %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | FileCheck %s --check-prefix=FILE_B
+// RUN: %target-swift-frontend -emit-silgen %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | %FileCheck %s --check-prefix=FILE_B
 // abC
-// RUN: %target-swift-frontend -emit-silgen %s %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | FileCheck %s --check-prefix=FILE_C
+// RUN: %target-swift-frontend -emit-silgen %s %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | %FileCheck %s --check-prefix=FILE_C
 
 // Bac
-// RUN: %target-swift-frontend -emit-silgen -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %s %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | FileCheck %s --check-prefix=FILE_B
+// RUN: %target-swift-frontend -emit-silgen -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %s %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | %FileCheck %s --check-prefix=FILE_B
 // bAc
-// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | FileCheck %s --check-prefix=FILE_A
+// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | %FileCheck %s --check-prefix=FILE_A
 // baC
-// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | FileCheck %s --check-prefix=FILE_C
+// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -module-name main | %FileCheck %s --check-prefix=FILE_C
 
 // OS X 10.9
-// RUN: %target-swift-frontend -emit-silgen -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %s %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | FileCheck %s --check-prefix=FILE_C
+// RUN: %target-swift-frontend -emit-silgen -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %s %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | %FileCheck %s --check-prefix=FILE_C
 // cAb
-// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | FileCheck %s --check-prefix=FILE_A
+// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | %FileCheck %s --check-prefix=FILE_A
 // caB
-// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | FileCheck %s --check-prefix=FILE_B
+// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | %FileCheck %s --check-prefix=FILE_B
 
 // Acb
-// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | FileCheck %s --check-prefix=FILE_A
+// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | %FileCheck %s --check-prefix=FILE_A
 // aCb
-// RUN: %target-swift-frontend -emit-silgen %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | FileCheck %s --check-prefix=FILE_C
+// RUN: %target-swift-frontend -emit-silgen %s -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | %FileCheck %s --check-prefix=FILE_C
 // abC
-// RUN: %target-swift-frontend -emit-silgen %s %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | FileCheck %s --check-prefix=FILE_B
+// RUN: %target-swift-frontend -emit-silgen %s %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -module-name main | %FileCheck %s --check-prefix=FILE_B
 
 // Bca
-// RUN: %target-swift-frontend -emit-silgen -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %s -module-name main | FileCheck %s --check-prefix=FILE_B
+// RUN: %target-swift-frontend -emit-silgen -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %s -module-name main | %FileCheck %s --check-prefix=FILE_B
 // bCa
-// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %s -module-name main | FileCheck %s --check-prefix=FILE_C
+// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %s -module-name main | %FileCheck %s --check-prefix=FILE_C
 // bcA
-// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -primary-file %s -module-name main | FileCheck %s --check-prefix=FILE_A
+// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -primary-file %s -module-name main | %FileCheck %s --check-prefix=FILE_A
 
 // Cba
-// RUN: %target-swift-frontend -emit-silgen -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %s -module-name main | FileCheck %s --check-prefix=FILE_C
+// RUN: %target-swift-frontend -emit-silgen -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %s -module-name main | %FileCheck %s --check-prefix=FILE_C
 // cBa
-// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %s -module-name main | FileCheck %s --check-prefix=FILE_B
+// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift -primary-file %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift %s -module-name main | %FileCheck %s --check-prefix=FILE_B
 // cbA
-// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -primary-file %s -module-name main | FileCheck %s --check-prefix=FILE_A
+// RUN: %target-swift-frontend -emit-silgen %S/Inputs/inherited_protocol_conformance_other_file_2_c.swift %S/Inputs/inherited_protocol_conformance_other_file_2_b.swift -primary-file %s -module-name main | %FileCheck %s --check-prefix=FILE_A
 
 // FILE_A-NOT: sil [transparent] [thunk] @_TTWV4main5Things9EquatableS_ZFS1_oi2ee
 // FILE_A-NOT: sil [transparent] [thunk] @_TTWV4main5Things8HashableS_FS1_g9hashValueSi
diff --git a/test/SILGen/init_ref_delegation.swift b/test/SILGen/init_ref_delegation.swift
index e657a67..fe1ef24 100644
--- a/test/SILGen/init_ref_delegation.swift
+++ b/test/SILGen/init_ref_delegation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 struct X { }
 
diff --git a/test/SILGen/instrprof_basic.swift b/test/SILGen/instrprof_basic.swift
index efaf262..d17e60b 100644
--- a/test/SILGen/instrprof_basic.swift
+++ b/test/SILGen/instrprof_basic.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen -profile-generate %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen -profile-generate %s | %FileCheck %s
 
 // CHECK: sil hidden @[[F_EMPTY:.*empty.*]] :
 // CHECK: %[[NAME:.*]] = string_literal utf8 "{{.*}}instrprof_basic.swift:[[F_EMPTY]]"
diff --git a/test/SILGen/instrprof_operators.swift b/test/SILGen/instrprof_operators.swift
index 6c39cb3..70b6704 100644
--- a/test/SILGen/instrprof_operators.swift
+++ b/test/SILGen/instrprof_operators.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen -profile-generate %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen -profile-generate %s | %FileCheck %s
 
 // CHECK: sil hidden @[[F_OPERATORS:.*operators.*]] :
 // CHECK: %[[NAME:.*]] = string_literal utf8 "{{.*}}instrprof_operators.swift:[[F_OPERATORS]]"
diff --git a/test/SILGen/interface_type_mangling.swift b/test/SILGen/interface_type_mangling.swift
index 91d9fcd..e32224c 100644
--- a/test/SILGen/interface_type_mangling.swift
+++ b/test/SILGen/interface_type_mangling.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-silgen | %FileCheck %s
 
 protocol P {
   associatedtype Assoc1
diff --git a/test/SILGen/ivar_destroyer.swift b/test/SILGen/ivar_destroyer.swift
index 0b2ae37..0d3858e 100644
--- a/test/SILGen/ivar_destroyer.swift
+++ b/test/SILGen/ivar_destroyer.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | %FileCheck %s
 
 // Only derived classes with non-trivial ivars need an ivar destroyer.
 
diff --git a/test/SILGen/lazy_global_access.swift b/test/SILGen/lazy_global_access.swift
index 9c02883..93448fe 100644
--- a/test/SILGen/lazy_global_access.swift
+++ b/test/SILGen/lazy_global_access.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s -check-prefix=MAIN
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | FileCheck %s -check-prefix=LIBRARY
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s -check-prefix=MAIN
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | %FileCheck %s -check-prefix=LIBRARY
 
 // The following code is valid as a library or as a main source file. Script
 // variables should be accessed directly, whereas library global variables
diff --git a/test/SILGen/lazy_globals.swift b/test/SILGen/lazy_globals.swift
index 72979f2..2adb905 100644
--- a/test/SILGen/lazy_globals.swift
+++ b/test/SILGen/lazy_globals.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | %FileCheck %s
 
 // CHECK: sil private @globalinit_[[T:.*]]_func0 : $@convention(thin) () -> () {
 // CHECK:   alloc_global @_Tv12lazy_globals1xSi
diff --git a/test/SILGen/lazy_globals_multiple_vars.swift b/test/SILGen/lazy_globals_multiple_vars.swift
index 1564322..aaa149b 100644
--- a/test/SILGen/lazy_globals_multiple_vars.swift
+++ b/test/SILGen/lazy_globals_multiple_vars.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | %FileCheck %s
 
 // CHECK:       sil private [[INIT_A_B:@globalinit_.*]] :
 // CHECK:         alloc_global @_Tv26lazy_globals_multiple_vars1aSi
diff --git a/test/SILGen/let_decls.swift b/test/SILGen/let_decls.swift
index ac76154..6eb9f48 100644
--- a/test/SILGen/let_decls.swift
+++ b/test/SILGen/let_decls.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 func takeClosure(_ a : () -> Int) {}
 
diff --git a/test/SILGen/lifetime.swift b/test/SILGen/lifetime.swift
index d916e49..14a9f9b 100644
--- a/test/SILGen/lifetime.swift
+++ b/test/SILGen/lifetime.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen -primary-file %s | %FileCheck %s
 
 struct Buh<T> {
   var x: Int {
diff --git a/test/SILGen/lifetime_unions.swift b/test/SILGen/lifetime_unions.swift
index c2442c0..b919416 100644
--- a/test/SILGen/lifetime_unions.swift
+++ b/test/SILGen/lifetime_unions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | %FileCheck %s
 
 enum TrivialUnion {
   case Foo
diff --git a/test/SILGen/local_captures.swift b/test/SILGen/local_captures.swift
index 20b16f8..e7e4372 100644
--- a/test/SILGen/local_captures.swift
+++ b/test/SILGen/local_captures.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend  -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend  -parse-as-library -emit-silgen %s | %FileCheck %s
 
 // Check that we don't crash if a local function references another local
 // function without captures.
diff --git a/test/SILGen/local_recursion.swift b/test/SILGen/local_recursion.swift
index 46a4367..3f18d39 100644
--- a/test/SILGen/local_recursion.swift
+++ b/test/SILGen/local_recursion.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend  -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend  -parse-as-library -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden @_TF15local_recursion15local_recursionFTSi1ySi_T_ : $@convention(thin) (Int, Int) -> () {
 // CHECK:       bb0([[X:%0]] : $Int, [[Y:%1]] : $Int):
diff --git a/test/SILGen/lying_about_optional_return.swift b/test/SILGen/lying_about_optional_return.swift
index 1416dc4..211603d 100644
--- a/test/SILGen/lying_about_optional_return.swift
+++ b/test/SILGen/lying_about_optional_return.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -import-objc-header %S/Inputs/c_function_pointer_in_c_struct.h -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -import-objc-header %S/Inputs/c_function_pointer_in_c_struct.h -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden @_TF27lying_about_optional_return45optionalChainingForeignFunctionTypeProperties
 func optionalChainingForeignFunctionTypeProperties(a: SomeCallbacks?) {
diff --git a/test/SILGen/lying_about_optional_return_objc.swift b/test/SILGen/lying_about_optional_return_objc.swift
index 3cda001..5175856 100644
--- a/test/SILGen/lying_about_optional_return_objc.swift
+++ b/test/SILGen/lying_about_optional_return_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/block_property_in_objc_class.h -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/block_property_in_objc_class.h -emit-silgen %s | %FileCheck %s
 // REQUIRES: objc_interop
 
 // CHECK-LABEL: sil hidden @_TF32lying_about_optional_return_objc45optionalChainingForeignFunctionTypeProperties
@@ -6,13 +6,13 @@
   // CHECK: enum $Optional<()>, #Optional.some!enumelt.1, {{%.*}} : $()
   b?.readWriteBlock()
 
-  // CHECK: unchecked_bitwise_cast
+  // CHECK: enum $Optional
   _ = b?.readWriteBlock
 
   // CHECK: enum $Optional<()>, #Optional.some!enumelt.1, {{%.*}} : $()
   b?.readOnlyBlock()
 
-  // CHECK: unchecked_bitwise_cast
+  // CHECK: enum $Optional
   _ = b?.readOnlyBlock
 
   // CHECK: unchecked_trivial_bit_cast
diff --git a/test/SILGen/mangling.swift b/test/SILGen/mangling.swift
index 2c3de21..c89f17a 100644
--- a/test/SILGen/mangling.swift
+++ b/test/SILGen/mangling.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/mangling_ext_structA.swift b/test/SILGen/mangling_ext_structA.swift
index 5f4e9f0..bb67d39 100644
--- a/test/SILGen/mangling_ext_structA.swift
+++ b/test/SILGen/mangling_ext_structA.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_structA.swift
-// RUN: %target-swift-frontend -emit-silgen -module-name ext_structA -I %t %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -module-name ext_structA -I %t %s | %FileCheck %s
 
 // Ensure that members of extensions of types from another module are mangled
 // correctly.
diff --git a/test/SILGen/mangling_generic_extensions.swift b/test/SILGen/mangling_generic_extensions.swift
index adaf74b..5fabc7f 100644
--- a/test/SILGen/mangling_generic_extensions.swift
+++ b/test/SILGen/mangling_generic_extensions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 struct Foo<T> {
 }
diff --git a/test/SILGen/mangling_private.swift b/test/SILGen/mangling_private.swift
index 09f1114..6bef9d0 100644
--- a/test/SILGen/mangling_private.swift
+++ b/test/SILGen/mangling_private.swift
@@ -1,14 +1,14 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/mangling_private_helper.swift
-// RUN: %target-swift-frontend -emit-silgen %S/Inputs/mangling_private_helper.swift | FileCheck %s -check-prefix=CHECK-BASE
+// RUN: %target-swift-frontend -emit-silgen %S/Inputs/mangling_private_helper.swift | %FileCheck %s -check-prefix=CHECK-BASE
 
-// RUN: %target-swift-frontend %s -I %t -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %s -I %t -emit-silgen | %FileCheck %s
 
 // RUN: cp %s %t
-// RUN: %target-swift-frontend %t/mangling_private.swift -I %t -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend %t/mangling_private.swift -I %t -emit-silgen | %FileCheck %s
 
 // RUN: cp %s %t/other_name.swift
-// RUN: %target-swift-frontend %t/other_name.swift -I %t -emit-silgen -module-name mangling_private | FileCheck %s -check-prefix=OTHER-NAME
+// RUN: %target-swift-frontend %t/other_name.swift -I %t -emit-silgen -module-name mangling_private | %FileCheck %s -check-prefix=OTHER-NAME
 
 import mangling_private_helper
 
diff --git a/test/SILGen/materializeForSet.swift b/test/SILGen/materializeForSet.swift
index e1ef4af..6e3cbbb 100644
--- a/test/SILGen/materializeForSet.swift
+++ b/test/SILGen/materializeForSet.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class Base {
   var stored: Int = 0
diff --git a/test/SILGen/metatype_abstraction.swift b/test/SILGen/metatype_abstraction.swift
index a702dea..70c84e8 100644
--- a/test/SILGen/metatype_abstraction.swift
+++ b/test/SILGen/metatype_abstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -module-name Swift -parse-stdlib %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -module-name Swift -parse-stdlib %s | %FileCheck %s
 
 enum Optional<Wrapped> {
   case none
diff --git a/test/SILGen/metatype_casts.swift b/test/SILGen/metatype_casts.swift
index 06be9a3..5156172 100644
--- a/test/SILGen/metatype_casts.swift
+++ b/test/SILGen/metatype_casts.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden @_TF14metatype_casts6t_is_u
 // CHECK:         checked_cast_br {{.*}} $@thick T.Type to $@thick U.Type
diff --git a/test/SILGen/metatype_object_conversion.swift b/test/SILGen/metatype_object_conversion.swift
index 5b2768c..0fab2ec 100644
--- a/test/SILGen/metatype_object_conversion.swift
+++ b/test/SILGen/metatype_object_conversion.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/metatypes.swift b/test/SILGen/metatypes.swift
index c99eb8e..6908d5f 100644
--- a/test/SILGen/metatypes.swift
+++ b/test/SILGen/metatypes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | %FileCheck %s
 
 import Swift
 
diff --git a/test/SILGen/multi_file.swift b/test/SILGen/multi_file.swift
index 3f05d36..2a4fd09 100644
--- a/test/SILGen/multi_file.swift
+++ b/test/SILGen/multi_file.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/multi_file_helper.swift | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/multi_file_helper.swift | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/SILGen/nested_generics.swift b/test/SILGen/nested_generics.swift
index c797f49..0fa4660 100644
--- a/test/SILGen/nested_generics.swift
+++ b/test/SILGen/nested_generics.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -enable-experimental-nested-generic-types -parse-as-library %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -enable-experimental-nested-generic-types -parse-as-library %s | %FileCheck %s
 // RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-sil -enable-experimental-nested-generic-types -parse-as-library %s > /dev/null
 // RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-sil -O -enable-experimental-nested-generic-types -parse-as-library %s > /dev/null
 // RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-ir -enable-experimental-nested-generic-types -parse-as-library %s > /dev/null
diff --git a/test/SILGen/newtype.swift b/test/SILGen/newtype.swift
index 29f0ed8..50c7a12 100644
--- a/test/SILGen/newtype.swift
+++ b/test/SILGen/newtype.swift
@@ -1,6 +1,6 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import -enable-swift-newtype  %s | FileCheck %s -check-prefix=CHECK-RAW
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import -enable-swift-newtype  %s | %FileCheck %s -check-prefix=CHECK-RAW
 
-// RUN: %target-swift-frontend -emit-sil -sdk %S/Inputs -I %S/Inputs -enable-source-import -enable-swift-newtype  %s | FileCheck %s -check-prefix=CHECK-CANONICAL
+// RUN: %target-swift-frontend -emit-sil -sdk %S/Inputs -I %S/Inputs -enable-source-import -enable-swift-newtype  %s | %FileCheck %s -check-prefix=CHECK-CANONICAL
 
 // REQUIRES: objc_interop
 
@@ -39,3 +39,17 @@
 // CHECK-RAW: [[STRING_RESULT:%[0-9]+]] = load [[STRING_RESULT_ADDR]]
 // CHECK-RAW: return [[STRING_RESULT]]
 
+class ObjCTest {
+  // CHECK-RAW-LABEL: sil hidden @_TFC7newtype8ObjCTest19optionalPassThroughfGSqVSC11ErrorDomain_GSqS1__ : $@convention(method) (@owned Optional<ErrorDomain>, @guaranteed ObjCTest) -> @owned Optional<ErrorDomain> {
+  // CHECK-RAW: sil hidden [thunk] @_TToFC7newtype8ObjCTest19optionalPassThroughfGSqVSC11ErrorDomain_GSqS1__ : $@convention(objc_method) (Optional<ErrorDomain>, ObjCTest) -> Optional<ErrorDomain> {
+  @objc func optionalPassThrough(_ ed: ErrorDomain?) -> ErrorDomain? {
+    return ed
+  }  
+
+  // CHECK-RAW-LABEL: sil hidden @_TFC7newtype8ObjCTest18integerPassThroughfVSC5MyIntS1_ : $@convention(method) (MyInt, @guaranteed ObjCTest) -> MyInt {
+  // CHECK-RAW: sil hidden [thunk] @_TToFC7newtype8ObjCTest18integerPassThroughfVSC5MyIntS1_ : $@convention(objc_method) (MyInt, ObjCTest) -> MyInt {
+  @objc func integerPassThrough(_ ed: MyInt) -> MyInt {
+    return ed
+  }  
+}
+
diff --git a/test/SILGen/noescape_reabstraction.swift b/test/SILGen/noescape_reabstraction.swift
index 6dbdb13..85ffcfe 100644
--- a/test/SILGen/noescape_reabstraction.swift
+++ b/test/SILGen/noescape_reabstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 struct S {}
 
diff --git a/test/SILGen/nsmanaged-witness.swift b/test/SILGen/nsmanaged-witness.swift
index b0d7088..df59846 100644
--- a/test/SILGen/nsmanaged-witness.swift
+++ b/test/SILGen/nsmanaged-witness.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs %s -I %S/Inputs -enable-source-import -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs %s -I %S/Inputs -enable-source-import -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_attr_NSManaged.swift b/test/SILGen/objc_attr_NSManaged.swift
index b55ec3b..13193f1 100644
--- a/test/SILGen/objc_attr_NSManaged.swift
+++ b/test/SILGen/objc_attr_NSManaged.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs %s -I %S/Inputs -enable-source-import -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs %s -I %S/Inputs -enable-source-import -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_attr_NSManaged_multi.swift b/test/SILGen/objc_attr_NSManaged_multi.swift
index 6035717..2e24dde 100644
--- a/test/SILGen/objc_attr_NSManaged_multi.swift
+++ b/test/SILGen/objc_attr_NSManaged_multi.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s %S/objc_attr_NSManaged.swift -I %S/Inputs -enable-source-import -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s %S/objc_attr_NSManaged.swift -I %S/Inputs -enable-source-import -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_blocks_bridging.swift b/test/SILGen/objc_blocks_bridging.swift
index 5348629..a5b3b7a 100644
--- a/test/SILGen/objc_blocks_bridging.swift
+++ b/test/SILGen/objc_blocks_bridging.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-silgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -verify -emit-silgen -I %S/Inputs -disable-objc-attr-requires-foundation-module %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -verify -emit-silgen -I %S/Inputs -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_bool_bridging.swift b/test/SILGen/objc_bool_bridging.swift
index 030bda6..919f275 100644
--- a/test/SILGen/objc_bool_bridging.swift
+++ b/test/SILGen/objc_bool_bridging.swift
@@ -3,7 +3,7 @@
 
 // XFAIL: *
 
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen %s -import-objc-header %S/Inputs/BoolBridgingTests.h | FileCheck %s --check-prefix=CHECK $(test '%target-os' = 'macosx' -o '(' '%target-os' = 'ios' -a '%target-ptrsize' = '32' ')' && echo '--check-prefix=CHECK-OBJCBOOL')
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen %s -import-objc-header %S/Inputs/BoolBridgingTests.h | %FileCheck %s --check-prefix=CHECK $(test '%target-os' = 'macosx' -o '(' '%target-os' = 'ios' -a '%target-ptrsize' = '32' ')' && echo '--check-prefix=CHECK-OBJCBOOL')
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_bridged_generic_conformance.swift b/test/SILGen/objc_bridged_generic_conformance.swift
new file mode 100644
index 0000000..83abe43
--- /dev/null
+++ b/test/SILGen/objc_bridged_generic_conformance.swift
@@ -0,0 +1,8 @@
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen %s -import-objc-header %S/Inputs/objc_bridged_generic_conformance.h -verify
+// REQUIRES: objc_interop
+
+protocol P { func test() }
+
+extension Thingy: P {
+  func test() {}
+}
diff --git a/test/SILGen/objc_bridged_results.swift b/test/SILGen/objc_bridged_results.swift
index d5091d7..b25080d 100644
--- a/test/SILGen/objc_bridged_results.swift
+++ b/test/SILGen/objc_bridged_results.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-silgen-test-overlays
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen %s -import-objc-header %S/Inputs/objc_bridged_results.h | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen %s -import-objc-header %S/Inputs/objc_bridged_results.h | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_bridging.swift b/test/SILGen/objc_bridging.swift
index a1725d3..19760e9 100644
--- a/test/SILGen/objc_bridging.swift
+++ b/test/SILGen/objc_bridging.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-silgen-test-overlays
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-module -o %t -I %S/../Inputs/ObjCBridging %S/../Inputs/ObjCBridging/Appliances.swift
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -I %S/../Inputs/ObjCBridging -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-cpu --check-prefix=CHECK-%target-os-%target-cpu
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -I %S/../Inputs/ObjCBridging -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-cpu --check-prefix=CHECK-%target-os-%target-cpu
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_bridging_any.swift b/test/SILGen/objc_bridging_any.swift
index 927a1b7..78d4b34 100644
--- a/test/SILGen/objc_bridging_any.swift
+++ b/test/SILGen/objc_bridging_any.swift
@@ -1,7 +1,8 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-id-as-any -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen %s | %FileCheck %s
 // REQUIRES: objc_interop
 
 import Foundation
+import objc_generics
 
 protocol P {}
 protocol CP: class {}
@@ -17,6 +18,7 @@
                            classExistential: CP,
                            generic: U,
                            existential: P,
+                           error: Error,
                            any: Any,
                            knownUnbridged: KnownUnbridged,
                            optionalA: String?,
@@ -30,6 +32,7 @@
   // CHECK: [[CLASS_EXISTENTIAL:%.*]] : $CP
   // CHECK: [[GENERIC:%.*]] : $*U
   // CHECK: [[EXISTENTIAL:%.*]] : $*P
+  // CHECK: [[ERROR:%.*]] : $Error
   // CHECK: [[ANY:%.*]] : $*Any
   // CHECK: [[KNOWN_UNBRIDGED:%.*]] : $KnownUnbridged
   // CHECK: [[OPT_STRING:%.*]] : $Optional<String>
@@ -90,6 +93,19 @@
   receiver.takesId(existential)
 
   // CHECK: [[METHOD:%.*]] = class_method [volatile] [[SELF]] : $NSIdLover,
+  // CHECK-NEXT: strong_retain [[ERROR]] : $Error
+  // CHECK-NEXT: [[ERROR_BOX:%[0-9]+]] = open_existential_box [[ERROR]] : $Error to $*@opened([[ERROR_ARCHETYPE:"[^"]*"]]) Error
+  // CHECK-NEXT: [[ERROR_STACK:%[0-9]+]] = alloc_stack $@opened([[ERROR_ARCHETYPE]]) Error
+  // CHECK-NEXT: copy_addr [[ERROR_BOX]] to [initialization] [[ERROR_STACK]] : $*@opened([[ERROR_ARCHETYPE]]) Error
+  // CHECK: [[BRIDGE_FUNCTION:%[0-9]+]] = function_ref @_TFs27_bridgeAnythingToObjectiveCurFxPs9AnyObject_
+  // CHECK-NEXT: [[BRIDGED_ERROR:%[0-9]+]] = apply [[BRIDGE_FUNCTION]]<@opened([[ERROR_ARCHETYPE]]) Error>([[ERROR_STACK]])
+  // CHECK-NEXT: apply [[METHOD]]([[BRIDGED_ERROR]], [[SELF]])
+  // CHECK-NEXT: strong_release [[BRIDGED_ERROR]] : $AnyObject
+  // CHECK-NEXT: dealloc_stack [[ERROR_STACK]] : $*@opened([[ERROR_ARCHETYPE]]) Error
+  // CHECK-NEXT: strong_release [[ERROR]] : $Error
+  receiver.takesId(error)
+
+  // CHECK: [[METHOD:%.*]] = class_method [volatile] [[SELF]] : $NSIdLover,
   // CHECK-NEXT: [[COPY:%.*]] = alloc_stack $Any
   // CHECK-NEXT: copy_addr [[ANY]] to [initialization] [[COPY]]
   // CHECK-NEXT: [[OPENED_COPY:%.*]] = open_existential_addr [[COPY]] : $*Any to $*[[OPENED_TYPE:@opened.*Any]],
@@ -146,6 +162,7 @@
                                    classExistential: CP,
                                    generic: U,
                                    existential: P,
+                                   error: Error,
                                    any: Any,
                                    knownUnbridged: KnownUnbridged,
                                    optString: String?,
@@ -169,6 +186,7 @@
   // CHECK: [[CLASS_EXISTENTIAL:%.*]] : $CP
   // CHECK: [[GENERIC:%.*]] : $*U
   // CHECK: [[EXISTENTIAL:%.*]] : $*P
+  // CHECK: [[ERROR:%.*]] : $Error
   // CHECK: [[ANY:%.*]] : $*Any,
   // CHECK: [[KNOWN_UNBRIDGED:%.*]] : $KnownUnbridged,
   // CHECK: [[OPT_STRING:%.*]] : $Optional<String>,
@@ -243,6 +261,20 @@
   receiver.takesNullableId(existential)
 
   // CHECK: [[METHOD:%.*]] = class_method [volatile] [[SELF]] : $NSIdLover,
+  // CHECK-NEXT: strong_retain [[ERROR]] : $Error
+  // CHECK-NEXT: [[ERROR_BOX:%[0-9]+]] = open_existential_box [[ERROR]] : $Error to $*@opened([[ERROR_ARCHETYPE:"[^"]*"]]) Error
+  // CHECK-NEXT: [[ERROR_STACK:%[0-9]+]] = alloc_stack $@opened([[ERROR_ARCHETYPE]]) Error
+  // CHECK-NEXT: copy_addr [[ERROR_BOX]] to [initialization] [[ERROR_STACK]] : $*@opened([[ERROR_ARCHETYPE]]) Error
+  // CHECK: [[BRIDGE_FUNCTION:%[0-9]+]] = function_ref @_TFs27_bridgeAnythingToObjectiveCurFxPs9AnyObject_
+  // CHECK-NEXT: [[BRIDGED_ERROR:%[0-9]+]] = apply [[BRIDGE_FUNCTION]]<@opened([[ERROR_ARCHETYPE]]) Error>([[ERROR_STACK]])
+  // CHECK-NEXT: [[BRIDGED_ERROR_OPT:%[0-9]+]] = enum $Optional<AnyObject>, #Optional.some!enumelt.1, [[BRIDGED_ERROR]] : $AnyObject
+  // CHECK-NEXT: apply [[METHOD]]([[BRIDGED_ERROR_OPT]], [[SELF]])
+  // CHECK-NEXT: strong_release [[BRIDGED_ERROR]] : $AnyObject
+  // CHECK-NEXT: dealloc_stack [[ERROR_STACK]] : $*@opened([[ERROR_ARCHETYPE]]) Error
+  // CHECK-NEXT: strong_release [[ERROR]] : $Error
+  receiver.takesNullableId(error)
+
+  // CHECK: [[METHOD:%.*]] = class_method [volatile] [[SELF]] : $NSIdLover,
   // CHECK-NEXT: [[COPY:%.*]] = alloc_stack $Any
   // CHECK-NEXT: copy_addr [[ANY]] to [initialization] [[COPY]]
   // CHECK-NEXT: [[OPENED_COPY:%.*]] = open_existential_addr [[COPY]] : $*Any to $*[[OPENED_TYPE:@opened.*Any]],
@@ -326,10 +358,11 @@
   // CHECK:     bb0(%0 : $AnyObject, %1 : $SwiftIdLover):
   // CHECK-NEXT:  strong_retain %0
   // CHECK-NEXT:  strong_retain %1
-  // CHECK-NEXT:  [[OPENED:%.*]] = open_existential_ref %0
+  // CHECK-NEXT:  [[OPTIONAL:%.*]] = unchecked_ref_cast %0
+  // CHECK-NEXT:  // function_ref
+  // CHECK-NEXT:  [[BRIDGE_TO_ANY:%.*]] = function_ref [[BRIDGE_TO_ANY_FUNC:@.*]] :
   // CHECK-NEXT:  [[RESULT:%.*]] = alloc_stack $Any
-  // CHECK-NEXT:  [[RESULT_VAL:%.*]] = init_existential_addr [[RESULT]]
-  // CHECK-NEXT:  store [[OPENED]] to [[RESULT_VAL]]
+  // CHECK-NEXT:  [[RESULT_VAL:%.*]] = apply [[BRIDGE_TO_ANY]]([[RESULT]], [[OPTIONAL]])
   // CHECK-NEXT:  // function_ref
   // CHECK-NEXT:  [[METHOD:%.*]] = function_ref @_TFC17objc_bridging_any12SwiftIdLover15methodTakingAnyfT1aP__T_
   // CHECK-NEXT:  apply [[METHOD]]([[RESULT]], %1)
@@ -341,7 +374,7 @@
   // CHECK-LABEL: sil hidden @_TFC17objc_bridging_any12SwiftIdLover23methodTakingOptionalAny
 
   // CHECK-LABEL: sil hidden [thunk] @_TToFC17objc_bridging_any12SwiftIdLover23methodTakingOptionalAny
-  // CHECK: init_existential_addr %11 : $*Any, $@opened({{.*}}) AnyObject
+  // CHECK: function_ref [[BRIDGE_TO_ANY_FUNC]]
 
   // CHECK-LABEL: sil hidden @_TFC17objc_bridging_any12SwiftIdLover26methodTakingBlockTakingAnyfFP_T_T_ : $@convention(method) (@owned @callee_owned (@in Any) -> (), @guaranteed SwiftIdLover) -> ()
 
@@ -395,10 +428,11 @@
   // CHECK-NEXT:  [[FUNCTION:%.*]] = load [[BLOCK_STORAGE_ADDR]]
   // CHECK-NEXT:  strong_retain [[FUNCTION]]
   // CHECK-NEXT:  strong_retain %1
-  // CHECK-NEXT:  [[OPENED:%.*]] = open_existential_ref %1
+  // CHECK-NEXT:  [[OPTIONAL:%.*]] = unchecked_ref_cast %1
+  // CHECK-NEXT:  // function_ref
+  // CHECK-NEXT:  [[BRIDGE_TO_ANY:%.*]] = function_ref [[BRIDGE_TO_ANY_FUNC:@.*]] :
   // CHECK-NEXT:  [[RESULT:%.*]] = alloc_stack $Any
-  // CHECK-NEXT:  [[RESULT_VAL:%.*]] = init_existential_addr [[RESULT]] : $*Any
-  // CHECK-NEXT:  store [[OPENED]] to [[RESULT_VAL]]
+  // CHECK-NEXT:  [[RESULT_VAL:%.*]] = apply [[BRIDGE_TO_ANY]]([[RESULT]], [[OPTIONAL]])
   // CHECK-NEXT:  apply [[FUNCTION]]([[RESULT]])
   // CHECK-NEXT:  [[VOID:%.*]] = tuple ()
   // CHECK-NEXT:  dealloc_stack [[RESULT]]
@@ -424,10 +458,11 @@
   // CHECK-LABEL: sil shared [transparent] [reabstraction_thunk] @_TTRXFdCb__aPs9AnyObject__XFo__iP__ : $@convention(thin) (@owned @convention(block) () -> @autoreleased AnyObject) -> @out Any
   // CHECK:     bb0(%0 : $*Any, %1 : $@convention(block) () -> @autoreleased AnyObject):
   // CHECK-NEXT:  [[BRIDGED:%.*]] = apply %1()
-  // CHECK-NEXT:  [[OPENED:%.*]] = open_existential_ref [[BRIDGED]]
+  // CHECK-NEXT:  [[OPTIONAL:%.*]] = unchecked_ref_cast [[BRIDGED]]
+  // CHECK-NEXT:  // function_ref
+  // CHECK-NEXT:  [[BRIDGE_TO_ANY:%.*]] = function_ref [[BRIDGE_TO_ANY_FUNC:@.*]] :
   // CHECK-NEXT:  [[RESULT:%.*]] = alloc_stack $Any
-  // CHECK-NEXT:  [[RESULT_VAL:%.*]] = init_existential_addr [[RESULT]]
-  // CHECK-NEXT:  store [[OPENED]] to [[RESULT_VAL]]
+  // CHECK-NEXT:  [[RESULT_VAL:%.*]] = apply [[BRIDGE_TO_ANY]]([[RESULT]], [[OPTIONAL]])
 
   // TODO: Should elide the copy
   // CHECK-NEXT:  copy_addr [take] [[RESULT]] to [initialization] %0
@@ -498,3 +533,29 @@
   _ = x.anyProperty
   _ = x[IndexForAnySubscript()]
 }
+
+extension GenericClass {
+  // CHECK-LABEL: sil hidden @_TFE17objc_bridging_anyCSo12GenericClass23pseudogenericAnyErasurefT1xx_P_
+  func pseudogenericAnyErasure(x: T) -> Any {
+    // CHECK: [[ANY_BUF:%.*]] = init_existential_addr %0 : $*Any, $AnyObject
+    // CHECK: [[ANYOBJECT:%.*]] = init_existential_ref %1 : $T : $T, $AnyObject
+    // CHECK: store [[ANYOBJECT]] to [[ANY_BUF]]
+    return x
+  }
+}
+
+// Make sure AnyHashable erasure marks Hashable conformance as used
+class AnyHashableClass : NSObject {
+  // CHECK-LABEL: sil hidden @_TFC17objc_bridging_any16AnyHashableClass18returnsAnyHashablefT_Vs11AnyHashable
+  // CHECK: [[FN:%.*]] = function_ref @_swift_convertToAnyHashable
+  // CHECK: apply [[FN]]<GenericOption>({{.*}})
+  func returnsAnyHashable() -> AnyHashable {
+    return GenericOption.multithreaded
+  }
+}
+
+// CHECK-LABEL: sil_witness_table shared [fragile] GenericOption: Hashable module objc_generics {
+// CHECK-NEXT: base_protocol _Hashable: GenericOption: _Hashable module objc_generics
+// CHECK-NEXT: base_protocol Equatable: GenericOption: Equatable module objc_generics
+// CHECK-NEXT: method #Hashable.hashValue!getter.1: @_TTWVSC13GenericOptions8Hashable13objc_genericsFS0_g9hashValueSi
+// CHECK-NEXT: }
diff --git a/test/SILGen/objc_currying.swift b/test/SILGen/objc_currying.swift
index c9f28ff..1368171 100644
--- a/test/SILGen/objc_currying.swift
+++ b/test/SILGen/objc_currying.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %build-silgen-test-overlays
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_dealloc.swift b/test/SILGen/objc_dealloc.swift
index f559354..219f17e 100644
--- a/test/SILGen/objc_dealloc.swift
+++ b/test/SILGen/objc_dealloc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_dictionary_bridging.swift b/test/SILGen/objc_dictionary_bridging.swift
index 1bb30c2..a782ba0 100644
--- a/test/SILGen/objc_dictionary_bridging.swift
+++ b/test/SILGen/objc_dictionary_bridging.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-silgen-test-overlays
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_disable_brigding.swift b/test/SILGen/objc_disable_brigding.swift
index a2237ce..db349f8 100644
--- a/test/SILGen/objc_disable_brigding.swift
+++ b/test/SILGen/objc_disable_brigding.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-silgen-test-overlays
 // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-module -o %t -I %S/../Inputs/ObjCBridging %S/../Inputs/ObjCBridging/Appliances.swift -I %t
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -I %S/../Inputs/ObjCBridging -disable-swift-bridge-attr -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-cpu --check-prefix=CHECK-%target-os-%target-cpu
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -I %S/../Inputs/ObjCBridging -disable-swift-bridge-attr -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-cpu --check-prefix=CHECK-%target-os-%target-cpu
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_enum.swift b/test/SILGen/objc_enum.swift
index 15dc1d9..2944c03 100644
--- a/test/SILGen/objc_enum.swift
+++ b/test/SILGen/objc_enum.swift
@@ -1,6 +1,6 @@
 // RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen > %t.out
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-%target-ptrsize %s < %t.out
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t.out
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=CHECK-%target-ptrsize %s < %t.out
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t.out
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_enum_errortype.swift b/test/SILGen/objc_enum_errortype.swift
index 95c07d4..f66952d 100644
--- a/test/SILGen/objc_enum_errortype.swift
+++ b/test/SILGen/objc_enum_errortype.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s -import-objc-header %S/Inputs/objc_enum_errortype.h | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s -import-objc-header %S/Inputs/objc_enum_errortype.h | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_enum_unused_witnesses.swift b/test/SILGen/objc_enum_unused_witnesses.swift
index ebb75e5..ab9fa42 100644
--- a/test/SILGen/objc_enum_unused_witnesses.swift
+++ b/test/SILGen/objc_enum_unused_witnesses.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_error.swift b/test/SILGen/objc_error.swift
index 3629204..bffb6be 100644
--- a/test/SILGen/objc_error.swift
+++ b/test/SILGen/objc_error.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-clang-importer-objc-overlays
 
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-silgen %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
@@ -15,7 +15,8 @@
 }
 
 // CHECK-LABEL: sil hidden @_TF10objc_error30NSErrorError_archetype_erasure
-// CHECK:         [[ERROR_TYPE:%.*]] = init_existential_ref %0 : $T : $T, $Error
+// CHECK:         [[T0:%.*]] = upcast %0 : $T to $NSError
+// CHECK:         [[ERROR_TYPE:%.*]] = init_existential_ref [[T0]] : $NSError : $NSError, $Error
 // CHECK:         return [[ERROR_TYPE]]
 func NSErrorError_archetype_erasure<T : NSError>(_ t: T) -> Error {
   return t
@@ -81,18 +82,14 @@
 // CHECK-LABEL: sil hidden @_TF10objc_error16testProduceError
 func testProduceError() -> Error {
   // CHECK: function_ref @produceError : $@convention(c) () -> @autoreleased NSError
-  // CHECK-NOT: return
-  // CHECK: enum $Optional<NSError>, #Optional.some!enumelt.1
-  // CHECK-NOT: return
-  // CHECK: function_ref @swift_convertNSErrorToError
+  // CHECK: init_existential_ref {{.*}} : $NSError : $NSError, $Error
   return produceError()
 }
 
 // CHECK-LABEL: sil hidden @_TF10objc_error24testProduceOptionalError
 func testProduceOptionalError() -> Error? {
   // CHECK: function_ref @produceOptionalError
-  // CHECK-NOT: return
-  // CHECK: function_ref @swift_convertNSErrorToError
+  // CHECK: init_existential_ref {{.*}} : $NSError : $NSError, $Error
   return produceOptionalError();
 }
 
@@ -112,8 +109,7 @@
 // CHECK-LABEL: sil hidden @_TF10objc_error25eraseFictionalServerErrorFT_Ps5Error_
 func eraseFictionalServerError() -> Error {
   // CHECK-NOT: return
-  // CHECK: [[NSERROR_GETTER:%[0-9]+]] = function_ref @_TFVSC20FictionalServerErrorg8_nsErrorCSo7NSError
-  // CHECK: [[NSERROR:%[0-9]+]] = apply [[NSERROR_GETTER]]
+  // CHECK: [[NSERROR:%[0-9]+]] = struct_extract {{.*}} : $FictionalServerError, #FictionalServerError._nsError
   // CHECK: [[ERROR:%[0-9]+]] = init_existential_ref [[NSERROR]]
   // CHECK: return [[ERROR]]
   return FictionalServerError(.meltedDown)
@@ -124,21 +120,26 @@
   // CHECK-LABEL: sil hidden @_TFE10objc_errorPs5Error16convertToNSErrorfT_CSo7NSError
   // CHECK: bb0([[SELF:%[0-9]+]] : $*Self)
 	func convertToNSError() -> NSError {
+    // CHECK: [[COPY:%.*]] = alloc_stack $Self
+    // CHECK: copy_addr [[SELF]] to [initialization] [[COPY]]
+    // CHECK: [[COPY2:%.*]] = alloc_stack $Self
+    // CHECK: copy_addr [[COPY]] to [initialization] [[COPY2]]
     // CHECK: [[GET_EMBEDDED_FN:%[0-9]+]] = function_ref @swift_stdlib_getErrorEmbeddedNSError
-    // CHECK: [[EMBEDDED_RESULT_OPT:%[0-9]+]] = apply [[GET_EMBEDDED_FN]]
-    // CHECK: [[HAS_EMBEDDED_RESULT:%[0-9]+]] = select_enum [[EMBEDDED_RESULT_OPT]] : $Optional<AnyObject>
-    // CHECK: cond_br [[HAS_EMBEDDED_RESULT]], [[SUCCESS:bb[0-9]+]], [[FAILURE:bb[0-9]+]]
+    // CHECK: [[EMBEDDED_RESULT_OPT:%[0-9]+]] = apply [[GET_EMBEDDED_FN]]<Self>([[COPY2]])
+    // CHECK: switch_enum [[EMBEDDED_RESULT_OPT]] : $Optional<AnyObject>,
+    // CHECK-SAME: case #Optional.some!enumelt.1: [[SUCCESS:bb[0-9]+]],
+    // CHECK-SAME: case #Optional.none!enumelt: [[FAILURE:bb[0-9]+]]
 
-    // CHECK: [[SUCCESS]]:
-    // CHECK: [[EMBEDDED_RESULT:%[0-9]+]] = unchecked_enum_data [[EMBEDDED_RESULT_OPT]] : $Optional<AnyObject>, #Optional.some!enumelt.1
+    // CHECK: [[SUCCESS]]([[EMBEDDED_RESULT:%.*]] : $AnyObject):
     // CHECK: [[EMBEDDED_NSERROR:%[0-9]+]] = unchecked_ref_cast [[EMBEDDED_RESULT]] : $AnyObject to $NSError
     // CHECK: [[ERROR:%[0-9]+]] = init_existential_ref [[EMBEDDED_NSERROR]] : $NSError : $NSError, $Error
+    // CHECK: destroy_addr [[COPY]] : $*Self
     // CHECK: br [[CONTINUATION:bb[0-9]+]]([[ERROR]] : $Error)
 
     // CHECK: [[FAILURE]]:
     // CHECK: [[ERROR_BOX:%[0-9]+]] = alloc_existential_box $Error, $Self
     // CHECK: [[ERROR_PROJECTED:%[0-9]+]] = project_existential_box $Self in [[ERROR_BOX]] : $Error
-    // CHECK: copy_addr [[SELF]] to [initialization] [[ERROR_PROJECTED]] : $*Self
+    // CHECK: copy_addr [take] [[COPY]] to [initialization] [[ERROR_PROJECTED]] : $*Self
     // CHECK: br [[CONTINUATION]]([[ERROR_BOX]] : $Error)
 
     // CHECK: [[CONTINUATION]]([[ERROR_ARG:%[0-9]+]] : $Error):
diff --git a/test/SILGen/objc_extensions.swift b/test/SILGen/objc_extensions.swift
index 28b2efd..5236741 100644
--- a/test/SILGen/objc_extensions.swift
+++ b/test/SILGen/objc_extensions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs/ -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs/ -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_final.swift b/test/SILGen/objc_final.swift
index d41407a..5551bb7 100644
--- a/test/SILGen/objc_final.swift
+++ b/test/SILGen/objc_final.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -emit-verbose-sil | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -emit-verbose-sil | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_generic_class.swift b/test/SILGen/objc_generic_class.swift
index 8fda7fb..980b7fd 100644
--- a/test/SILGen/objc_generic_class.swift
+++ b/test/SILGen/objc_generic_class.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_implicitly_unwrapped_optional.swift b/test/SILGen/objc_implicitly_unwrapped_optional.swift
index ede0876..84eaf0a 100644
--- a/test/SILGen/objc_implicitly_unwrapped_optional.swift
+++ b/test/SILGen/objc_implicitly_unwrapped_optional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil -assert-config Release %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil -assert-config Release %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_imported_generic.swift b/test/SILGen/objc_imported_generic.swift
index e0a0a65..df6f0ba 100644
--- a/test/SILGen/objc_imported_generic.swift
+++ b/test/SILGen/objc_imported_generic.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen %s | %FileCheck %s
 // For integration testing, ensure we get through IRGen too.
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -verify -DIRGEN_INTEGRATION_TEST %s
 
@@ -103,5 +103,29 @@
   }
 }
 
+// CHECK-LABEL: sil hidden @_TF21objc_imported_generic23configureWithoutOptionsFT_T_ : $@convention(thin) () -> ()
+// CHECK: [[NIL_FN:%.*]] = function_ref @_TFSqCfT10nilLiteralT__GSqx_ : $@convention(method) <τ_0_0> (@thin Optional<τ_0_0>.Type) -> @out Optional<τ_0_0>
+// CHECK: apply [[NIL_FN]]<[GenericOption : Any]>({{.*}})
+// CHECK: return
+func configureWithoutOptions() {
+  _ = GenericClass<NSObject>(options: nil)
+}
+
+// foreign to native thunk for init(options:), uses GenericOption : Hashable
+// conformance
+
+// CHECK-LABEL: sil shared [thunk] @_TTOFCSo12GenericClasscfT7optionsGSqGVs10DictionaryVSC13GenericOptionP____GSQGS_x__ : $@convention(method) <T where T : AnyObject> (@owned Optional<Dictionary<GenericOption, Any>>, @owned GenericClass<T>) -> @owned ImplicitlyUnwrappedOptional<GenericClass<T>>
+// CHECK: [[FN:%.*]] = function_ref @_TFE10FoundationVs10Dictionary19_bridgeToObjectiveCfT_CSo12NSDictionary : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@guaranteed Dictionary<τ_0_0, τ_0_1>) -> @owned NSDictionary
+// CHECK: apply [[FN]]<GenericOption, Any>({{.*}}) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@guaranteed Dictionary<τ_0_0, τ_0_1>) -> @owned NSDictionary
+// CHECK: return
+
+// This gets emitted down here for some reason
+
 // CHECK-LABEL: sil shared [thunk] @_TTOFCSo12GenericClasscfT13arrayOfThings
 // CHECK:         class_method [volatile] {{%.*}} : $GenericClass<T>, #GenericClass.init!initializer.1.foreign {{.*}}, $@convention(objc_method) @pseudogeneric <τ_0_0 where τ_0_0 : AnyObject> (NSArray, @owned GenericClass<τ_0_0>) -> @owned ImplicitlyUnwrappedOptional<GenericClass<τ_0_0>>
+
+// Make sure we emitted the witness table for the above conformance
+
+// CHECK-LABEL: sil_witness_table shared [fragile] GenericOption: Hashable module objc_generics {
+// CHECK: method #Hashable.hashValue!getter.1: @_TTWVSC13GenericOptions8Hashable13objc_genericsFS0_g9hashValueSi
+// CHECK: }
diff --git a/test/SILGen/objc_imported_init.swift b/test/SILGen/objc_imported_init.swift
index c77cd2f..fc2267c 100644
--- a/test/SILGen/objc_imported_init.swift
+++ b/test/SILGen/objc_imported_init.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -verify -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -verify -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_init_ref_delegation.swift b/test/SILGen/objc_init_ref_delegation.swift
index 24071c9..e349f77 100644
--- a/test/SILGen/objc_init_ref_delegation.swift
+++ b/test/SILGen/objc_init_ref_delegation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_keypath.swift b/test/SILGen/objc_keypath.swift
index d115179..85a4b47 100644
--- a/test/SILGen/objc_keypath.swift
+++ b/test/SILGen/objc_keypath.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_local.swift b/test/SILGen/objc_local.swift
index 94c8ff5..7eb9850 100644
--- a/test/SILGen/objc_local.swift
+++ b/test/SILGen/objc_local.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_metatypes.swift b/test/SILGen/objc_metatypes.swift
index c12ddf8..ce585b8 100644
--- a/test/SILGen/objc_metatypes.swift
+++ b/test/SILGen/objc_metatypes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_nonnull_lie_hack.swift b/test/SILGen/objc_nonnull_lie_hack.swift
index 9440184..aaedbd7 100644
--- a/test/SILGen/objc_nonnull_lie_hack.swift
+++ b/test/SILGen/objc_nonnull_lie_hack.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t/APINotes
 // RUN: mkdir -p %t/APINotes
 // RUN: %clang_apinotes -yaml-to-binary %S/Inputs/gizmo.apinotes -o %t/APINotes/gizmo.apinotesc
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -I %t/APINotes -enable-source-import -primary-file %s | FileCheck -check-prefix=SILGEN %s
-// RUN: %target-swift-frontend -emit-sil -O -sdk %S/Inputs -I %S/Inputs -I %t/APINotes -enable-source-import -primary-file %s | FileCheck -check-prefix=OPT %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -I %t/APINotes -enable-source-import -primary-file %s | %FileCheck -check-prefix=SILGEN %s
+// RUN: %target-swift-frontend -emit-sil -O -sdk %S/Inputs -I %S/Inputs -I %t/APINotes -enable-source-import -primary-file %s | %FileCheck -check-prefix=OPT %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_ownership_conventions.swift b/test/SILGen/objc_ownership_conventions.swift
index 5fb921d..908b92f 100644
--- a/test/SILGen/objc_ownership_conventions.swift
+++ b/test/SILGen/objc_ownership_conventions.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_properties.swift b/test/SILGen/objc_properties.swift
index 32ba3f8..125edf5 100644
--- a/test/SILGen/objc_properties.swift
+++ b/test/SILGen/objc_properties.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen -emit-verbose-sil -sdk %S/Inputs -I %S/Inputs -enable-source-import | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen -emit-verbose-sil -sdk %S/Inputs -I %S/Inputs -enable-source-import | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_protocols.swift b/test/SILGen/objc_protocols.swift
index 639bdb3..cfa25d6 100644
--- a/test/SILGen/objc_protocols.swift
+++ b/test/SILGen/objc_protocols.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_selector.swift b/test/SILGen/objc_selector.swift
index 2e3acab..bc51cf7 100644
--- a/test/SILGen/objc_selector.swift
+++ b/test/SILGen/objc_selector.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_set_bridging.swift b/test/SILGen/objc_set_bridging.swift
index c644b49..0d54d4e 100644
--- a/test/SILGen/objc_set_bridging.swift
+++ b/test/SILGen/objc_set_bridging.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %build-silgen-test-overlays
 
-// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) -emit-silgen %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_subscript.swift b/test/SILGen/objc_subscript.swift
index bde2836..71f6182 100644
--- a/test/SILGen/objc_subscript.swift
+++ b/test/SILGen/objc_subscript.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-silgen -emit-verbose-sil -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-silgen -emit-verbose-sil -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_super.swift b/test/SILGen/objc_super.swift
index 649d2e5..31d6825 100644
--- a/test/SILGen/objc_super.swift
+++ b/test/SILGen/objc_super.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_thunks.swift b/test/SILGen/objc_thunks.swift
index a0f7912..8deaad9 100644
--- a/test/SILGen/objc_thunks.swift
+++ b/test/SILGen/objc_thunks.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -emit-verbose-sil | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -sdk %S/Inputs -I %S/Inputs -enable-source-import %s -emit-silgen -emit-verbose-sil | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/objc_witnesses.swift b/test/SILGen/objc_witnesses.swift
index 43c0fd4..480093d 100644
--- a/test/SILGen/objc_witnesses.swift
+++ b/test/SILGen/objc_witnesses.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/optional-cast.swift b/test/SILGen/optional-cast.swift
index 7d523f0..4344daf 100644
--- a/test/SILGen/optional-cast.swift
+++ b/test/SILGen/optional-cast.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class A {}
 class B : A {}
diff --git a/test/SILGen/optional.swift b/test/SILGen/optional.swift
index d9fb27e..30a15d2 100644
--- a/test/SILGen/optional.swift
+++ b/test/SILGen/optional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func testCall(_ f: (() -> ())?) {
   f?()
diff --git a/test/SILGen/optional_lvalue.swift b/test/SILGen/optional_lvalue.swift
index 908c0a0..c9d7330 100644
--- a/test/SILGen/optional_lvalue.swift
+++ b/test/SILGen/optional_lvalue.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden @_TF15optional_lvalue22assign_optional_lvalueFTRGSqSi_Si_T_
 // CHECK:         [[SHADOW:%.*]] = alloc_box $Optional<Int>
diff --git a/test/SILGen/optional_to_bool.swift b/test/SILGen/optional_to_bool.swift
index 969e7af..f4dc7b5 100644
--- a/test/SILGen/optional_to_bool.swift
+++ b/test/SILGen/optional_to_bool.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 
 public protocol P {}
 extension Int: P {}
diff --git a/test/SILGen/partial_apply_generic.swift b/test/SILGen/partial_apply_generic.swift
index ac9612d..734410b 100644
--- a/test/SILGen/partial_apply_generic.swift
+++ b/test/SILGen/partial_apply_generic.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol Foo {
   static func staticFunc()
diff --git a/test/SILGen/partial_apply_init.swift b/test/SILGen/partial_apply_init.swift
index 66aaf46..2e37ddb 100644
--- a/test/SILGen/partial_apply_init.swift
+++ b/test/SILGen/partial_apply_init.swift
@@ -1,5 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
-// RUN: %target-swift-frontend -emit-silgen -suppress-argument-labels-in-types %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class C {
   init(x: Int) {}
diff --git a/test/SILGen/partial_apply_protocol_class_refinement_method.swift b/test/SILGen/partial_apply_protocol_class_refinement_method.swift
index f7a77a2..38c98c7 100644
--- a/test/SILGen/partial_apply_protocol_class_refinement_method.swift
+++ b/test/SILGen/partial_apply_protocol_class_refinement_method.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol P { func foo() }
 protocol Q: class, P {}
diff --git a/test/SILGen/partial_apply_super.swift b/test/SILGen/partial_apply_super.swift
index 654acc6..d6fd900 100644
--- a/test/SILGen/partial_apply_super.swift
+++ b/test/SILGen/partial_apply_super.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -I %t -emit-module -emit-module-path=%t/resilient_struct.swiftmodule -module-name resilient_struct %S/../Inputs/resilient_struct.swift
 // RUN: %target-swift-frontend -I %t -emit-module -emit-module-path=%t/resilient_class.swiftmodule -module-name resilient_class %S/../Inputs/resilient_class.swift
-// RUN: %target-swift-frontend -enable-resilience -emit-silgen -parse-as-library -I %t %s | FileCheck %s
+// RUN: %target-swift-frontend -enable-resilience -emit-silgen -parse-as-library -I %t %s | %FileCheck %s
 
 import resilient_class
 
diff --git a/test/SILGen/pointer_conversion.swift b/test/SILGen/pointer_conversion.swift
index c58ef49..b601e50 100644
--- a/test/SILGen/pointer_conversion.swift
+++ b/test/SILGen/pointer_conversion.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // FIXME: rdar://problem/19648117 Needs splitting objc parts out
 // XFAIL: linux
diff --git a/test/SILGen/properties.swift b/test/SILGen/properties.swift
index 77401c4..2734401 100644
--- a/test/SILGen/properties.swift
+++ b/test/SILGen/properties.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen -disable-objc-attr-requires-foundation-module %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
 
 var zero: Int = 0
 
diff --git a/test/SILGen/property_abstraction.swift b/test/SILGen/property_abstraction.swift
index 2747c4e..71d5efb 100644
--- a/test/SILGen/property_abstraction.swift
+++ b/test/SILGen/property_abstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 struct Int {
   mutating func foo() {}
diff --git a/test/SILGen/property_behavior.swift b/test/SILGen/property_behavior.swift
index 7701b5c..efa46ad 100644
--- a/test/SILGen/property_behavior.swift
+++ b/test/SILGen/property_behavior.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -enable-experimental-property-behaviors %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -enable-experimental-property-behaviors %s | %FileCheck %s
 protocol behavior {
   associatedtype Value
 }
diff --git a/test/SILGen/property_behavior_init.swift b/test/SILGen/property_behavior_init.swift
index a429851..cfcbd18 100644
--- a/test/SILGen/property_behavior_init.swift
+++ b/test/SILGen/property_behavior_init.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -enable-experimental-property-behaviors -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -enable-experimental-property-behaviors -emit-silgen %s | %FileCheck %s
 protocol diBehavior {
   associatedtype Value
   var storage: Value { get set }
diff --git a/test/SILGen/protocol_class_refinement.swift b/test/SILGen/protocol_class_refinement.swift
index a4bc5b2..3519831 100644
--- a/test/SILGen/protocol_class_refinement.swift
+++ b/test/SILGen/protocol_class_refinement.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol UID {
     func uid() -> Int
diff --git a/test/SILGen/protocol_extensions.swift b/test/SILGen/protocol_extensions.swift
index bf84600..526a364 100644
--- a/test/SILGen/protocol_extensions.swift
+++ b/test/SILGen/protocol_extensions.swift
@@ -1,5 +1,4 @@
-// RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module -emit-silgen %s | FileCheck %s
-// RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module -emit-silgen -suppress-argument-labels-in-types %s | FileCheck %s
+// RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module -emit-silgen %s | %FileCheck %s
 
 public protocol P1 {
   func reqP1a()
diff --git a/test/SILGen/protocol_optional.swift b/test/SILGen/protocol_optional.swift
index ffdb990..d9700dd 100644
--- a/test/SILGen/protocol_optional.swift
+++ b/test/SILGen/protocol_optional.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen -disable-objc-attr-requires-foundation-module %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
 
 @objc protocol P1 {
   @objc optional func method(_ x: Int)
diff --git a/test/SILGen/protocol_resilience.swift b/test/SILGen/protocol_resilience.swift
index 1ad1da4..76d33f1 100644
--- a/test/SILGen/protocol_resilience.swift
+++ b/test/SILGen/protocol_resilience.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-silgen -enable-resilience %s | FileCheck %s --check-prefix=CHECK
+// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-silgen -enable-resilience %s | %FileCheck %s --check-prefix=CHECK
 
 import resilient_protocol
 
diff --git a/test/SILGen/protocol_resilience_objc.swift b/test/SILGen/protocol_resilience_objc.swift
index 2202e1f..fb8dd34 100644
--- a/test/SILGen/protocol_resilience_objc.swift
+++ b/test/SILGen/protocol_resilience_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -disable-objc-attr-requires-foundation-module -enable-resilience %s | FileCheck %s --check-prefix=CHECK
+// RUN: %target-swift-frontend -emit-silgen -disable-objc-attr-requires-foundation-module -enable-resilience %s | %FileCheck %s --check-prefix=CHECK
 // REQUIRES: objc_interop
 
 // @objc protocols don't need default witness tables
diff --git a/test/SILGen/protocols.swift b/test/SILGen/protocols.swift
index 13ccc6e..1f7fb61 100644
--- a/test/SILGen/protocols.swift
+++ b/test/SILGen/protocols.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 //===----------------------------------------------------------------------===//
 // Calling Existential Subscripts
diff --git a/test/SILGen/reabstract.swift b/test/SILGen/reabstract.swift
index e04257c..6604ce1 100644
--- a/test/SILGen/reabstract.swift
+++ b/test/SILGen/reabstract.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 func takeFn<T>(_ f : (T) -> T?) {}
 func liftOptional(_ x : Int) -> Int? { return x }
diff --git a/test/SILGen/reabstract_lvalue.swift b/test/SILGen/reabstract_lvalue.swift
index e0ff41c..78a56cb 100644
--- a/test/SILGen/reabstract_lvalue.swift
+++ b/test/SILGen/reabstract_lvalue.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 struct MyMetatypeIsThin {}
 
diff --git a/test/SILGen/required_init.swift b/test/SILGen/required_init.swift
index d9ab5d7..bbb8204 100644
--- a/test/SILGen/required_init.swift
+++ b/test/SILGen/required_init.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func subclassFloatLiteral() -> Bar {
   let x: Bar = 1.0
diff --git a/test/SILGen/result_abstraction.swift b/test/SILGen/result_abstraction.swift
index 8b52ca1..020ba4d 100644
--- a/test/SILGen/result_abstraction.swift
+++ b/test/SILGen/result_abstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 struct S {}
 struct R {}
diff --git a/test/SILGen/rethrows.swift b/test/SILGen/rethrows.swift
index e8d3423..d5c946d 100644
--- a/test/SILGen/rethrows.swift
+++ b/test/SILGen/rethrows.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -verify %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -verify %s | %FileCheck %s
 
 @discardableResult
 func rethrower(_ fn: () throws -> Int) rethrows -> Int {
diff --git a/test/SILGen/same_type_abstraction.swift b/test/SILGen/same_type_abstraction.swift
index f73044c..54a249e 100644
--- a/test/SILGen/same_type_abstraction.swift
+++ b/test/SILGen/same_type_abstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol Associated {
   associatedtype Assoc
diff --git a/test/SILGen/scalar_to_tuple_args.swift b/test/SILGen/scalar_to_tuple_args.swift
index f260051..736d716 100644
--- a/test/SILGen/scalar_to_tuple_args.swift
+++ b/test/SILGen/scalar_to_tuple_args.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func inoutWithDefaults(_ x: inout Int, y: Int = 0, z: Int = 0) {}
 func inoutWithCallerSideDefaults(_ x: inout Int, y: Int = #line) {}
diff --git a/test/SILGen/semanticsattr.swift b/test/SILGen/semanticsattr.swift
index d9c3d1b..6ba5d82 100644
--- a/test/SILGen/semanticsattr.swift
+++ b/test/SILGen/semanticsattr.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-stdlib -emit-silgen %s | %FileCheck %s
 
 // CHECK: [_semantics "123"] [_semantics "223"] @func1
 @_semantics("223") @_semantics("123")
diff --git a/test/SILGen/sil_locations.swift b/test/SILGen/sil_locations.swift
index db406bd..1b9d81d 100644
--- a/test/SILGen/sil_locations.swift
+++ b/test/SILGen/sil_locations.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -emit-verbose-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -emit-verbose-sil %s | %FileCheck %s
 
 // FIXME: Not sure if this an ideal source info for the branch - 
 // it points to if, not the last instruction in the block.
diff --git a/test/SILGen/sil_locations_top_level.swift b/test/SILGen/sil_locations_top_level.swift
index f492cc8..09358e0 100644
--- a/test/SILGen/sil_locations_top_level.swift
+++ b/test/SILGen/sil_locations_top_level.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -emit-verbose-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen -emit-verbose-sil %s | %FileCheck %s
 
 // Test top-level/module locations.
 class TopLevelObjectTy {
diff --git a/test/SILGen/specialize_attr.swift b/test/SILGen/specialize_attr.swift
index 6a3d2a9..cf6ace2 100644
--- a/test/SILGen/specialize_attr.swift
+++ b/test/SILGen/specialize_attr.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -emit-verbose-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -emit-verbose-sil %s | %FileCheck %s
 
 // CHECK-LABEL: @_specialize(Int, Float)
 // CHECK-NEXT: func specializeThis<T, U>(_ t: T, u: U)
diff --git a/test/SILGen/statements.swift b/test/SILGen/statements.swift
index 98f8a3d..70eeced 100644
--- a/test/SILGen/statements.swift
+++ b/test/SILGen/statements.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen -verify %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -parse-as-library -emit-silgen -verify %s | %FileCheck %s
 
 class MyClass { 
   func foo() { }
@@ -591,45 +591,6 @@
   return t
 }
 
-enum MyOptional<Wrapped> {
-  case none
-  case some(Wrapped)
-}
-
-// CHECK-LABEL: sil hidden @_TF10statements28testAddressOnlyEnumInRequire
-// CHECK: bb0(%0 : $*T, %1 : $*MyOptional<T>):
-// CHECK-NEXT: debug_value_addr %1 : $*MyOptional<T>, let, name "a"
-// CHECK-NEXT: %3 = alloc_stack $T, let, name "t"
-// CHECK-NEXT: %4 = alloc_stack $MyOptional<T>
-// CHECK-NEXT: copy_addr %1 to [initialization] %4 : $*MyOptional<T>
-// CHECK-NEXT: switch_enum_addr %4 : $*MyOptional<T>, case #MyOptional.some!enumelt.1: bb2, default bb1
-func testAddressOnlyEnumInRequire<T>(_ a: MyOptional<T>) -> T {
-  // CHECK:  bb1:
-  // CHECK-NEXT:   dealloc_stack %4
-  // CHECK-NEXT:   dealloc_stack %3
-  // CHECK-NEXT:   br bb3
-  guard let t = a else { abort() }
-
-  // CHECK:    bb2:
-  // CHECK-NEXT:     %10 = unchecked_take_enum_data_addr %4 : $*MyOptional<T>, #MyOptional.some!enumelt.1
-  // CHECK-NEXT:     copy_addr [take] %10 to [initialization] %3 : $*T
-  // CHECK-NEXT:     dealloc_stack %4
-  // CHECK-NEXT:     copy_addr [take] %3 to [initialization] %0 : $*T
-  // CHECK-NEXT:     dealloc_stack %3
-  // CHECK-NEXT:     destroy_addr %1 : $*MyOptional<T>
-  // CHECK-NEXT:     tuple ()
-  // CHECK-NEXT:     return
-
-  // CHECK:    bb3:
-  // CHECK-NEXT:     // function_ref statements.abort () -> Swift.Never
-  // CHECK-NEXT:     %18 = function_ref @_TF10statements5abortFT_Os5Never
-  // CHECK-NEXT:     %19 = apply %18() : $@convention(thin) () -> Never
-  // CHECK-NEXT:     unreachable
-
-  return t
-}
-
-
 
 // CHECK-LABEL: sil hidden @_TF10statements19testCleanupEmission
 // <rdar://problem/20563234> let-else problem: cleanups for bound patterns shouldn't be run in the else block
diff --git a/test/SILGen/struct_resilience.swift b/test/SILGen/struct_resilience.swift
index 88458a6..831143b 100644
--- a/test/SILGen/struct_resilience.swift
+++ b/test/SILGen/struct_resilience.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-silgen -enable-resilience %s | FileCheck %s
+// RUN: %target-swift-frontend -I %S/../Inputs -enable-source-import -emit-silgen -enable-resilience %s | %FileCheck %s
 
 import resilient_struct
 
diff --git a/test/SILGen/super.swift b/test/SILGen/super.swift
index c408025..9072cb7 100644
--- a/test/SILGen/super.swift
+++ b/test/SILGen/super.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -I %t -emit-module -emit-module-path=%t/resilient_struct.swiftmodule -module-name resilient_struct %S/../Inputs/resilient_struct.swift
 // RUN: %target-swift-frontend -I %t -emit-module -emit-module-path=%t/resilient_class.swiftmodule -module-name resilient_class %S/../Inputs/resilient_class.swift
-// RUN: %target-swift-frontend -emit-silgen -parse-as-library -I %t %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -parse-as-library -I %t %s | %FileCheck %s
 
 import resilient_class
 
diff --git a/test/SILGen/super_init_refcounting.swift b/test/SILGen/super_init_refcounting.swift
index aac7e2c..8f589c0 100644
--- a/test/SILGen/super_init_refcounting.swift
+++ b/test/SILGen/super_init_refcounting.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 class Foo {
   init() {}
diff --git a/test/SILGen/super_objc_class_method.swift b/test/SILGen/super_objc_class_method.swift
index 80fb13e..9815cb2 100644
--- a/test/SILGen/super_objc_class_method.swift
+++ b/test/SILGen/super_objc_class_method.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/switch.swift b/test/SILGen/switch.swift
index abc4834..5b17e52 100644
--- a/test/SILGen/switch.swift
+++ b/test/SILGen/switch.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/SILGen/switch_abstraction.swift b/test/SILGen/switch_abstraction.swift
index 4627535..b802195 100644
--- a/test/SILGen/switch_abstraction.swift
+++ b/test/SILGen/switch_abstraction.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -parse-stdlib %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -parse-stdlib %s | %FileCheck %s
 
 struct A {}
 
diff --git a/test/SILGen/switch_fallthrough.swift b/test/SILGen/switch_fallthrough.swift
index 611a3c4..62568fe 100644
--- a/test/SILGen/switch_fallthrough.swift
+++ b/test/SILGen/switch_fallthrough.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // Some fake predicates for pattern guards.
 func runced() -> Bool { return true }
diff --git a/test/SILGen/switch_isa.swift b/test/SILGen/switch_isa.swift
index db2ff53..e8938db 100644
--- a/test/SILGen/switch_isa.swift
+++ b/test/SILGen/switch_isa.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/SILGen/switch_objc.swift b/test/SILGen/switch_objc.swift
index 4fd1c92..1752bed 100644
--- a/test/SILGen/switch_objc.swift
+++ b/test/SILGen/switch_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILGen/switch_var.swift b/test/SILGen/switch_var.swift
index 3341399..35ec8e7 100644
--- a/test/SILGen/switch_var.swift
+++ b/test/SILGen/switch_var.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // TODO: Implement tuple equality in the library.
 // BLOCKED: <rdar://problem/13822406>
diff --git a/test/SILGen/toplevel.swift b/test/SILGen/toplevel.swift
index 5def6ba..68b12ba 100644
--- a/test/SILGen/toplevel.swift
+++ b/test/SILGen/toplevel.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 func markUsed<T>(_ t: T) {}
 
diff --git a/test/SILGen/toplevel_errors.swift b/test/SILGen/toplevel_errors.swift
index 7bf0580..081edbe 100644
--- a/test/SILGen/toplevel_errors.swift
+++ b/test/SILGen/toplevel_errors.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 enum MyError : Error {
   case A, B
diff --git a/test/SILGen/transparent_attribute.swift b/test/SILGen/transparent_attribute.swift
index ac3ead0..f87becc 100644
--- a/test/SILGen/transparent_attribute.swift
+++ b/test/SILGen/transparent_attribute.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen -emit-verbose-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -emit-verbose-sil %s | %FileCheck %s
 
 // Test if 'transparent' attribute gets propagated correctly to apply instructions.
 
diff --git a/test/SILGen/tuples.swift b/test/SILGen/tuples.swift
index 6ca0be6..5b79f51 100644
--- a/test/SILGen/tuples.swift
+++ b/test/SILGen/tuples.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 class C {}
 
 enum Foo {
diff --git a/test/SILGen/types.swift b/test/SILGen/types.swift
index 6224fbf..a5ecba7 100644
--- a/test/SILGen/types.swift
+++ b/test/SILGen/types.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -emit-silgen %s | %FileCheck %s
 
 class C {
   var member: Int = 0
diff --git a/test/SILGen/unicode_scalar_concat.swift b/test/SILGen/unicode_scalar_concat.swift
index 4dc8373..b422a44 100644
--- a/test/SILGen/unicode_scalar_concat.swift
+++ b/test/SILGen/unicode_scalar_concat.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // Check that string literals that are unicode scalar literals 
 // are emitted as string_literal instead of integers.
diff --git a/test/SILGen/unmanaged.swift b/test/SILGen/unmanaged.swift
index a1a953e..e27a0d3 100644
--- a/test/SILGen/unmanaged.swift
+++ b/test/SILGen/unmanaged.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
 
 class C {}
 
diff --git a/test/SILGen/unowned.swift b/test/SILGen/unowned.swift
index 6768466..9d2e278 100644
--- a/test/SILGen/unowned.swift
+++ b/test/SILGen/unowned.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 func takeClosure(_ fn: () -> Int) {}
 
diff --git a/test/SILGen/unsafe_pointer_gen.swift b/test/SILGen/unsafe_pointer_gen.swift
new file mode 100644
index 0000000..471ac99
--- /dev/null
+++ b/test/SILGen/unsafe_pointer_gen.swift
@@ -0,0 +1,8 @@
+// RUN: %target-swift-frontend -O -emit-sil -parse-as-library %s | %FileCheck %s
+
+// Test the absence of a 'strict' flag.
+// CHECK-LABEL: _TF18unsafe_pointer_gen13test_raw_loadFT2rpSV_Si
+// CHECK: pointer_to_address {{%.*}} : $Builtin.RawPointer to $*Int
+public func test_raw_load(rp: UnsafeRawPointer) -> Int {
+  return rp.load(as: Int.self)
+}
diff --git a/test/SILGen/vtable_thunks.swift b/test/SILGen/vtable_thunks.swift
index affb56a..5ec7532 100644
--- a/test/SILGen/vtable_thunks.swift
+++ b/test/SILGen/vtable_thunks.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -emit-silgen -I %S/Inputs -enable-source-import %s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -emit-silgen -I %S/Inputs -enable-source-import %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 protocol AddrOnly {}
 
diff --git a/test/SILGen/vtable_thunks_reabstraction.swift b/test/SILGen/vtable_thunks_reabstraction.swift
index 184be79..3920544 100644
--- a/test/SILGen/vtable_thunks_reabstraction.swift
+++ b/test/SILGen/vtable_thunks_reabstraction.swift
@@ -31,7 +31,7 @@
   override func inAndOutTuples(x: ObnoxiousTuple) -> ObnoxiousTuple { return x }
   override func variantOptionality(x: S?) -> S { return x! }
   override func variantOptionalityMetatypes(x: S.Type?) -> S.Type { return x! }
-  override func variantOptionalityFunctions(x: (@escaping (S) -> S)?) -> (S) -> S { return x! }
+  override func variantOptionalityFunctions(x: ((S) -> S)?) -> (S) -> S { return x! }
   override func variantOptionalityTuples(x: ObnoxiousTuple?) -> ObnoxiousTuple { return x! }
 }
 
@@ -42,7 +42,7 @@
   override func inAndOutTuples(x: ObnoxiousTuple) -> ObnoxiousTuple { return x }
   override func variantOptionality(x: C?) -> C { return x! }
   override func variantOptionalityMetatypes(x: C.Type?) -> C.Type { return x! }
-  override func variantOptionalityFunctions(x: (@escaping (C) -> C)?) -> (C) -> C { return x! }
+  override func variantOptionalityFunctions(x: ((C) -> C)?) -> (C) -> C { return x! }
   override func variantOptionalityTuples(x: ObnoxiousTuple?) -> ObnoxiousTuple { return x! }
 }
 
diff --git a/test/SILGen/vtable_thunks_reabstraction_final.swift b/test/SILGen/vtable_thunks_reabstraction_final.swift
index c8f3ad8..c28a429 100644
--- a/test/SILGen/vtable_thunks_reabstraction_final.swift
+++ b/test/SILGen/vtable_thunks_reabstraction_final.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol Fooable {
   func foo(_ x: Int) -> Int?
diff --git a/test/SILGen/vtables.swift b/test/SILGen/vtables.swift
index 9cf30c5..35ca425 100644
--- a/test/SILGen/vtables.swift
+++ b/test/SILGen/vtables.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -emit-silgen -I %S/Inputs -enable-source-import %s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -emit-silgen -I %S/Inputs -enable-source-import %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 // FIXME: rdar://problem/19648117 Needs splitting objc parts out
 // XFAIL: linux
diff --git a/test/SILGen/weak.swift b/test/SILGen/weak.swift
index 16c8b24..03d9761 100644
--- a/test/SILGen/weak.swift
+++ b/test/SILGen/weak.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 class C {
   func f() -> Int { return 42 }
diff --git a/test/SILGen/witness_same_type.swift b/test/SILGen/witness_same_type.swift
index 8a8da2a..99c4d1e 100644
--- a/test/SILGen/witness_same_type.swift
+++ b/test/SILGen/witness_same_type.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol Fooable {
   associatedtype Bar
diff --git a/test/SILGen/witness_single_tuple.swift b/test/SILGen/witness_single_tuple.swift
index 03e1d67..3ba022a 100644
--- a/test/SILGen/witness_single_tuple.swift
+++ b/test/SILGen/witness_single_tuple.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol Runcible {
   func runce(x: Int)
diff --git a/test/SILGen/witness_tables.swift b/test/SILGen/witness_tables.swift
index 31d7ebb..590dd14 100644
--- a/test/SILGen/witness_tables.swift
+++ b/test/SILGen/witness_tables.swift
@@ -1,10 +1,10 @@
 // RUN: %target-swift-frontend -emit-silgen -I %S/Inputs -enable-source-import %s -disable-objc-attr-requires-foundation-module > %t.sil
-// RUN: FileCheck -check-prefix=TABLE -check-prefix=TABLE-ALL %s < %t.sil
-// RUN: FileCheck -check-prefix=SYMBOL %s < %t.sil
+// RUN: %FileCheck -check-prefix=TABLE -check-prefix=TABLE-ALL %s < %t.sil
+// RUN: %FileCheck -check-prefix=SYMBOL %s < %t.sil
 
 // RUN: %target-swift-frontend -emit-silgen -I %S/Inputs -enable-source-import %s -disable-objc-attr-requires-foundation-module -enable-testing > %t.testable.sil
-// RUN: FileCheck -check-prefix=TABLE-TESTABLE -check-prefix=TABLE-ALL %s < %t.testable.sil
-// RUN: FileCheck -check-prefix=SYMBOL-TESTABLE %s < %t.testable.sil
+// RUN: %FileCheck -check-prefix=TABLE-TESTABLE -check-prefix=TABLE-ALL %s < %t.testable.sil
+// RUN: %FileCheck -check-prefix=SYMBOL-TESTABLE %s < %t.testable.sil
 
 import witness_tables_b
 
diff --git a/test/SILGen/witness_tables_multifile.swift b/test/SILGen/witness_tables_multifile.swift
index 05e88fb..4c447a3 100644
--- a/test/SILGen/witness_tables_multifile.swift
+++ b/test/SILGen/witness_tables_multifile.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/witness_tables_multifile_2.swift | FileCheck %s -check-prefix=CHECK-FIRST-FILE
-// RUN: %target-swift-frontend -emit-silgen %s -primary-file %S/Inputs/witness_tables_multifile_2.swift | FileCheck %S/Inputs/witness_tables_multifile_2.swift -check-prefix=CHECK-SECOND-FILE
+// RUN: %target-swift-frontend -emit-silgen -primary-file %s %S/Inputs/witness_tables_multifile_2.swift | %FileCheck %s -check-prefix=CHECK-FIRST-FILE
+// RUN: %target-swift-frontend -emit-silgen %s -primary-file %S/Inputs/witness_tables_multifile_2.swift | %FileCheck %S/Inputs/witness_tables_multifile_2.swift -check-prefix=CHECK-SECOND-FILE
 
 
 protocol InheritsFooable : Fooable {}
diff --git a/test/SILGen/witnesses.swift b/test/SILGen/witnesses.swift
index 2e032d0..cff0d5e 100644
--- a/test/SILGen/witnesses.swift
+++ b/test/SILGen/witnesses.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 infix operator <~> {}
 
diff --git a/test/SILGen/witnesses_canonical.swift b/test/SILGen/witnesses_canonical.swift
index 9a85542..a23d0f9 100644
--- a/test/SILGen/witnesses_canonical.swift
+++ b/test/SILGen/witnesses_canonical.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 // rdar://problem/20714534 -- we need to canonicalize an associated type's
 // protocols when emitting witness method table for a conformance.
diff --git a/test/SILGen/witnesses_class.swift b/test/SILGen/witnesses_class.swift
index c732f2a..2f212ed 100644
--- a/test/SILGen/witnesses_class.swift
+++ b/test/SILGen/witnesses_class.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol Fooable: class {
   func foo()
diff --git a/test/SILGen/witnesses_inheritance.swift b/test/SILGen/witnesses_inheritance.swift
index 9d89ba2..150990c 100644
--- a/test/SILGen/witnesses_inheritance.swift
+++ b/test/SILGen/witnesses_inheritance.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol Fooable {
   func foo()
diff --git a/test/SILGen/witnesses_refinement.swift b/test/SILGen/witnesses_refinement.swift
index a69295b..2bbe412 100644
--- a/test/SILGen/witnesses_refinement.swift
+++ b/test/SILGen/witnesses_refinement.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
 
 protocol Saturable: Comparable {
   func saturated(max: Self) -> Self
diff --git a/test/SILGen/writeback.swift b/test/SILGen/writeback.swift
index 77f15d8..60ecd33 100644
--- a/test/SILGen/writeback.swift
+++ b/test/SILGen/writeback.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-silgen %s | %FileCheck %s
 
 struct Foo {
   mutating           // used to test writeback.
diff --git a/test/SILOptimizer/DestructorAnalysis.swift b/test/SILOptimizer/DestructorAnalysis.swift
index ed0822a..60ba39c 100644
--- a/test/SILOptimizer/DestructorAnalysis.swift
+++ b/test/SILOptimizer/DestructorAnalysis.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s -Xllvm -debug-only=destructor-analysis 2>&1 | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s -Xllvm -debug-only=destructor-analysis 2>&1 | %FileCheck %s
 
 // This test depends on asserts because we look at debug output.
 // REQUIRES: asserts
diff --git a/test/SILOptimizer/Inputs/devirt_access_other_module.swift b/test/SILOptimizer/Inputs/devirt_access_other_module.swift
index 4507fc4..878f41f 100644
--- a/test/SILOptimizer/Inputs/devirt_access_other_module.swift
+++ b/test/SILOptimizer/Inputs/devirt_access_other_module.swift
@@ -14,5 +14,5 @@
 }
 
 private class PrivateSubclass : ExternalClass {
-  override private func foo() {}
+  override fileprivate func foo() {}
 }
diff --git a/test/SILOptimizer/abcopts.sil b/test/SILOptimizer/abcopts.sil
index 7e82302..144a18d 100644
--- a/test/SILOptimizer/abcopts.sil
+++ b/test/SILOptimizer/abcopts.sil
@@ -1,6 +1,6 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -loop-rotate -dce -simplify-cfg -abcopts -enable-abcopts=1 %s | FileCheck %s
-// RUN: %target-sil-opt -enable-sil-verify-all -loop-rotate -dce -simplify-cfg -abcopts -dce -enable-abcopts -enable-abc-hoisting %s | FileCheck %s --check-prefix=HOIST
-// RUN: %target-sil-opt -enable-sil-verify-all  -abcopts  %s | FileCheck %s --check-prefix=RANGECHECK
+// RUN: %target-sil-opt -enable-sil-verify-all -loop-rotate -dce -simplify-cfg -abcopts -enable-abcopts=1 %s | %FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -loop-rotate -dce -simplify-cfg -abcopts -dce -enable-abcopts -enable-abc-hoisting %s | %FileCheck %s --check-prefix=HOIST
+// RUN: %target-sil-opt -enable-sil-verify-all  -abcopts  %s | %FileCheck %s --check-prefix=RANGECHECK
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/alias-crash.sil b/test/SILOptimizer/alias-crash.sil
index 9dce07c..d45aa0f 100644
--- a/test/SILOptimizer/alias-crash.sil
+++ b/test/SILOptimizer/alias-crash.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -redundant-load-elim | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -redundant-load-elim | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/allocbox_to_stack.sil b/test/SILOptimizer/allocbox_to_stack.sil
index 4932a57..d138cd0 100644
--- a/test/SILOptimizer/allocbox_to_stack.sil
+++ b/test/SILOptimizer/allocbox_to_stack.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -allocbox-to-stack | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -allocbox-to-stack | %FileCheck %s
 
 import Builtin
 
diff --git a/test/SILOptimizer/allocbox_to_stack_with_false.swift b/test/SILOptimizer/allocbox_to_stack_with_false.swift
index 273c0eb..1f85f27 100644
--- a/test/SILOptimizer/allocbox_to_stack_with_false.swift
+++ b/test/SILOptimizer/allocbox_to_stack_with_false.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil %s -verify | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil %s -verify | %FileCheck %s
 
 // Make sure that materializations of computed properties such as 'false' and
 // 'true' don't leave needless stack allocations. <rdar://problem/15272642>
diff --git a/test/SILOptimizer/always_inline.sil b/test/SILOptimizer/always_inline.sil
index 20dfa4c..9dcb688 100644
--- a/test/SILOptimizer/always_inline.sil
+++ b/test/SILOptimizer/always_inline.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -dce -sil-inline-threshold=1 | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -dce -sil-inline-threshold=1 | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/arcsequenceopts.sil b/test/SILOptimizer/arcsequenceopts.sil
index 17e25f8..c2e5b2a 100644
--- a/test/SILOptimizer/arcsequenceopts.sil
+++ b/test/SILOptimizer/arcsequenceopts.sil
@@ -1,6 +1,6 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=0 -arc-sequence-opts %s | FileCheck %s
-// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=1 -arc-sequence-opts %s | FileCheck -check-prefix=CHECK -check-prefix=CHECK-LOOP %s
-// RUN: %target-sil-opt -enable-sil-verify-all -arc-loop-opts  %s | FileCheck -check-prefix=CHECK -check-prefix=CHECK-LOOP %s
+// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=0 -arc-sequence-opts %s | %FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=1 -arc-sequence-opts %s | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-LOOP %s
+// RUN: %target-sil-opt -enable-sil-verify-all -arc-loop-opts  %s | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-LOOP %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/arcsequenceopts_casts.sil b/test/SILOptimizer/arcsequenceopts_casts.sil
index 934a650..d182cd3 100644
--- a/test/SILOptimizer/arcsequenceopts_casts.sil
+++ b/test/SILOptimizer/arcsequenceopts_casts.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all -arc-sequence-opts -enable-loop-arc=0 %s | FileCheck %s
-// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all -arc-sequence-opts -enable-loop-arc=1 %s | FileCheck %s
+// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all -arc-sequence-opts -enable-loop-arc=0 %s | %FileCheck %s
+// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all -arc-sequence-opts -enable-loop-arc=1 %s | %FileCheck %s
 
 import Builtin
 
diff --git a/test/SILOptimizer/arcsequenceopts_loops.sil b/test/SILOptimizer/arcsequenceopts_loops.sil
index b4d1cc2..457f9aa 100644
--- a/test/SILOptimizer/arcsequenceopts_loops.sil
+++ b/test/SILOptimizer/arcsequenceopts_loops.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=1 -arc-sequence-opts  %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=1 -arc-sequence-opts  %s | %FileCheck %s
 
 //////////////////
 // Declarations //
diff --git a/test/SILOptimizer/arcsequenceopts_loops.sil.gyb b/test/SILOptimizer/arcsequenceopts_loops.sil.gyb
index 3c78a3f..9466cf1 100644
--- a/test/SILOptimizer/arcsequenceopts_loops.sil.gyb
+++ b/test/SILOptimizer/arcsequenceopts_loops.sil.gyb
@@ -2,7 +2,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %gyb %s > %t/arc-sequence-opts-loops.sil
-// RUN: %target-sil-opt -enable-sil-verify-all -arc-sequence-opts %t/arc-sequence-opts-loops.sil -enable-loop-arc=0 | FileCheck %t/arc-sequence-opts-loops.sil
+// RUN: %target-sil-opt -enable-sil-verify-all -arc-sequence-opts %t/arc-sequence-opts-loops.sil -enable-loop-arc=0 | %FileCheck %t/arc-sequence-opts-loops.sil
 
 %# Ignore the following admonition; it applies to the resulting .sil
 %# test file only.
diff --git a/test/SILOptimizer/arcsequenceopts_rcidentityanalysis.sil b/test/SILOptimizer/arcsequenceopts_rcidentityanalysis.sil
index fc6ccbb..ff4be59 100644
--- a/test/SILOptimizer/arcsequenceopts_rcidentityanalysis.sil
+++ b/test/SILOptimizer/arcsequenceopts_rcidentityanalysis.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=0 -arc-sequence-opts %s | FileCheck %s
-// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=1 -arc-sequence-opts %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=0 -arc-sequence-opts %s | %FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=1 -arc-sequence-opts %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/arcsequenceopts_uniquecheck.sil b/test/SILOptimizer/arcsequenceopts_uniquecheck.sil
index 72d94da..ff83d6b 100644
--- a/test/SILOptimizer/arcsequenceopts_uniquecheck.sil
+++ b/test/SILOptimizer/arcsequenceopts_uniquecheck.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=0 -arc-sequence-opts %s | FileCheck %s
-// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=1 -arc-sequence-opts %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=0 -arc-sequence-opts %s | %FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -enable-loop-arc=1 -arc-sequence-opts %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/array_count_propagation.sil b/test/SILOptimizer/array_count_propagation.sil
index 96d9fac..298ecb5 100644
--- a/test/SILOptimizer/array_count_propagation.sil
+++ b/test/SILOptimizer/array_count_propagation.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -array-count-propagation %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -array-count-propagation %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/array_element_propagation.sil b/test/SILOptimizer/array_element_propagation.sil
index 0ab18ed..7245819 100644
--- a/test/SILOptimizer/array_element_propagation.sil
+++ b/test/SILOptimizer/array_element_propagation.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -array-element-propagation %s | FileCheck %s
+// RUN: %target-sil-opt -array-element-propagation %s | %FileCheck %s
 sil_stage canonical
 
 import Builtin
diff --git a/test/SILOptimizer/array_mutable_assertonly.swift b/test/SILOptimizer/array_mutable_assertonly.swift
index 8cc99e7..bb69f28 100644
--- a/test/SILOptimizer/array_mutable_assertonly.swift
+++ b/test/SILOptimizer/array_mutable_assertonly.swift
@@ -1,16 +1,16 @@
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST1
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST2
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST3
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST4
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST5
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST6
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST7
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST8
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST9
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST10
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST11
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST12
-// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | FileCheck %s --check-prefix=TEST13
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST1
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST2
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST3
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST4
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST5
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST6
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST7
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST8
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST9
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST10
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST11
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST12
+// RUN: %target-swift-frontend -O -emit-sil -Xllvm -debug-only=cowarray-opts -primary-file %s 2>&1 | %FileCheck %s --check-prefix=TEST13
 // REQUIRES: asserts,swift_stdlib_no_asserts,optimized_stdlib
 
 // TEST1-LABEL: COW Array Opts in Func {{.*}}inoutarr{{.*}}
diff --git a/test/SILOptimizer/assert_configuration.sil b/test/SILOptimizer/assert_configuration.sil
index d1f9844..6aaa449 100644
--- a/test/SILOptimizer/assert_configuration.sil
+++ b/test/SILOptimizer/assert_configuration.sil
@@ -1,6 +1,6 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnostic-constant-propagation -assert-conf-id 1 | FileCheck %s --check-prefix=ONE
-// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnostic-constant-propagation -assert-conf-id 4294967295 | FileCheck %s --check-prefix=DISABLED
-// RUN: %target-sil-opt -enable-sil-verify-all %s -performance-constant-propagation -assert-conf-id 1 | FileCheck %s --check-prefix=PERFONE
+// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnostic-constant-propagation -assert-conf-id 1 | %FileCheck %s --check-prefix=ONE
+// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnostic-constant-propagation -assert-conf-id 4294967295 | %FileCheck %s --check-prefix=DISABLED
+// RUN: %target-sil-opt -enable-sil-verify-all %s -performance-constant-propagation -assert-conf-id 1 | %FileCheck %s --check-prefix=PERFONE
 
 import Builtin
 
diff --git a/test/SILOptimizer/basic-aa.sil b/test/SILOptimizer/basic-aa.sil
index bb1f0d2..358ab97 100644
--- a/test/SILOptimizer/basic-aa.sil
+++ b/test/SILOptimizer/basic-aa.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -module-name Swift %s -aa=basic-aa -aa-dump -o /dev/null | FileCheck %s
+// RUN: %target-sil-opt -module-name Swift %s -aa=basic-aa -aa-dump -o /dev/null | %FileCheck %s
 
 // REQUIRES: asserts
 
diff --git a/test/SILOptimizer/basic-callee-printer.sil b/test/SILOptimizer/basic-callee-printer.sil
index 5766c40..4a73e7c 100644
--- a/test/SILOptimizer/basic-callee-printer.sil
+++ b/test/SILOptimizer/basic-callee-printer.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -basic-callee-printer -o /dev/null | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOWMO %s
-// RUN: %target-sil-opt -enable-sil-verify-all %s -wmo -basic-callee-printer -o /dev/null | FileCheck --check-prefix=CHECK --check-prefix=CHECK-WMO %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -basic-callee-printer -o /dev/null | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOWMO %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -wmo -basic-callee-printer -o /dev/null | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-WMO %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/basic-instruction-properties.sil b/test/SILOptimizer/basic-instruction-properties.sil
index 69ac85b..f5540c4 100644
--- a/test/SILOptimizer/basic-instruction-properties.sil
+++ b/test/SILOptimizer/basic-instruction-properties.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -basic-instruction-property-dump -o /dev/null | FileCheck %s
+// RUN: %target-sil-opt %s -basic-instruction-property-dump -o /dev/null | %FileCheck %s
 
 // REQUIRES: asserts
 
diff --git a/test/SILOptimizer/bridged_casts_folding.swift b/test/SILOptimizer/bridged_casts_folding.swift
index e3d6042..da0f6be 100644
--- a/test/SILOptimizer/bridged_casts_folding.swift
+++ b/test/SILOptimizer/bridged_casts_folding.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILOptimizer/bridging_checked_cast.sil b/test/SILOptimizer/bridging_checked_cast.sil
index 2c3ca97..59434fa 100644
--- a/test/SILOptimizer/bridging_checked_cast.sil
+++ b/test/SILOptimizer/bridging_checked_cast.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -inline %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -inline %s | %FileCheck %s
 // REQUIRES: objc_interop
 
 import Swift
diff --git a/test/SILOptimizer/caller_analysis_printer.sil b/test/SILOptimizer/caller_analysis_printer.sil
index 657fa3b..8dbd811 100644
--- a/test/SILOptimizer/caller_analysis_printer.sil
+++ b/test/SILOptimizer/caller_analysis_printer.sil
@@ -1,17 +1,22 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -caller-analysis-printer -o /dev/null | FileCheck --check-prefix=CHECK %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -caller-analysis-printer -o /dev/null | %FileCheck --check-prefix=CHECK %s
 
-// CHECK: Function dead_func has caller: false
-// CHECK: Function call_top has caller: false
-// CHECK: Function call_middle has caller: true
-// CHECK: Function call_bottom has caller: true
-// CHECK: Function self_recursive_func has caller: true
-// CHECK: Function mutual_recursive_func1 has caller: true
-// CHECK: Function mutual_recursive_func2 has caller: true
-// CHECK: Function multi_called has caller: true
-// CHECK: Function multi_calles has caller: false
-// CHECK: Function multi_callers has caller: true
-// CHECK: Function multi_caller1 has caller: false
-// CHECK: Function multi_caller2 has caller: false
+// CHECK: Function dead_func has caller: false, partial applied args = 0
+// CHECK: Function call_top has caller: false, partial applied args = 0
+// CHECK: Function call_middle has caller: true, partial applied args = 0
+// CHECK: Function call_bottom has caller: true, partial applied args = 0
+// CHECK: Function self_recursive_func has caller: true, partial applied args = 0
+// CHECK: Function mutual_recursive_func1 has caller: true, partial applied args = 0
+// CHECK: Function mutual_recursive_func2 has caller: true, partial applied args = 0
+// CHECK: Function multi_called has caller: true, partial applied args = 0
+// CHECK: Function multi_calles has caller: false, partial applied args = 0
+// CHECK: Function multi_callers has caller: true, partial applied args = 0
+// CHECK: Function multi_caller1 has caller: false, partial applied args = 0
+// CHECK: Function multi_caller2 has caller: false, partial applied args = 0
+// CHECK: Function closure1 has caller: false, partial applied args = 1
+// CHECK: Function closure2 has caller: false, partial applied args = 2
+// CHECK: Function partial_apply_one_arg has caller: false, partial applied args = 0
+// CHECK: Function partial_apply_two_args1 has caller: false, partial applied args = 0
+// CHECK: Function partial_apply_two_args2 has caller: false, partial applied args = 0
 
 sil_stage canonical
 
@@ -111,3 +116,34 @@
   %2 = tuple ()
   return %2 : $()
 }
+
+sil @closure1 : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32 {
+bb0(%0 : $Builtin.Int32, %1 : $Builtin.Int32):
+  return %0 : $Builtin.Int32
+}
+
+sil @closure2 : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32 {
+bb0(%0 : $Builtin.Int32, %1 : $Builtin.Int32):
+  return %0 : $Builtin.Int32
+}
+
+sil @partial_apply_one_arg : $@convention(thin) (Builtin.Int32) -> @owned @callee_owned (Builtin.Int32) -> Builtin.Int32 {
+bb0(%0 : $Builtin.Int32):
+  %1 = function_ref @closure1 : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32
+  %2 = partial_apply %1(%0) : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32
+  return %2 : $@callee_owned (Builtin.Int32) -> Builtin.Int32
+}
+
+sil @partial_apply_two_args1 : $@convention(thin) (Builtin.Int32) -> @owned @callee_owned () -> Builtin.Int32 {
+bb0(%0 : $Builtin.Int32):
+  %1 = function_ref @closure1 : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32
+  %2 = partial_apply %1(%0, %0) : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32
+  return %2 : $@callee_owned () -> Builtin.Int32
+}
+
+sil @partial_apply_two_args2 : $@convention(thin) (Builtin.Int32) -> @owned @callee_owned () -> Builtin.Int32 {
+bb0(%0 : $Builtin.Int32):
+  %1 = function_ref @closure2 : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32
+  %2 = partial_apply %1(%0, %0) : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> Builtin.Int32
+  return %2 : $@callee_owned () -> Builtin.Int32
+}
diff --git a/test/SILOptimizer/canonicalize_switch_enum.sil b/test/SILOptimizer/canonicalize_switch_enum.sil
index 8b1de4e..7a2d9fc 100644
--- a/test/SILOptimizer/canonicalize_switch_enum.sil
+++ b/test/SILOptimizer/canonicalize_switch_enum.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/capture_promotion.sil b/test/SILOptimizer/capture_promotion.sil
index 4674ece..08576a8 100644
--- a/test/SILOptimizer/capture_promotion.sil
+++ b/test/SILOptimizer/capture_promotion.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -capture-promotion | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -capture-promotion | %FileCheck %s
 
 // Check to make sure that the process of promoting closure captures results in
 // a correctly cloned and modified closure function body. This test
diff --git a/test/SILOptimizer/capture_promotion.swift b/test/SILOptimizer/capture_promotion.swift
index 6fd1949..ede4990 100644
--- a/test/SILOptimizer/capture_promotion.swift
+++ b/test/SILOptimizer/capture_promotion.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-sil -o - -verify | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-sil -o - -verify | %FileCheck %s
 
 class Foo {
   func foo() -> Int {
diff --git a/test/SILOptimizer/capture_promotion_reachability.sil b/test/SILOptimizer/capture_promotion_reachability.sil
index b336f54..a5be1c6 100644
--- a/test/SILOptimizer/capture_promotion_reachability.sil
+++ b/test/SILOptimizer/capture_promotion_reachability.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -capture-promotion | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -capture-promotion | %FileCheck %s
 
 sil_stage raw
 
diff --git a/test/SILOptimizer/capture_propagation.sil b/test/SILOptimizer/capture_propagation.sil
index 88d2353..8314fea 100644
--- a/test/SILOptimizer/capture_propagation.sil
+++ b/test/SILOptimizer/capture_propagation.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -capture-prop | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -capture-prop | %FileCheck %s
 
 // Check the CapturePropagation specialized the reabstraction thunk.
 
@@ -11,7 +11,7 @@
 
 // CHECK-LABEL: test_capture_propagation
 // CHECK: %[[FR:[0-9]+]] = function_ref @_TTSf3cpfr24_TF8capturep6helperFSiT__n___TTRXFo_dSi_dT__XFo_iSi_dT__ : $@convention(thin) (@in Int32) -> ()
-// CHECK: partial_apply %[[FR]]() : $@convention(thin) (@in Int32) -> ()
+// CHECK: thin_to_thick_function %[[FR]] : $@convention(thin) (@in Int32) -> ()
 sil private @test_capture_propagation : $@convention(thin) () -> () {
 bb0:
   %0 = alloc_stack $Int32                           // users: %3, %9, %10
@@ -113,3 +113,232 @@
   %9999 = tuple()
   return %9999 : $()
 }
+
+// Test dead partial applied arguments
+
+sil @specialized_nonthrowing_closure : $@convention(thin) (Int32, Int32) -> Bool
+
+sil @nonthrowing_closure : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %3 = function_ref @specialized_nonthrowing_closure : $@convention(thin) (Int32, Int32) -> Bool
+  %4 = apply %3(%0, %1) : $@convention(thin) (Int32, Int32) -> Bool
+  return %4 : $Bool
+}
+
+// CHECK-LABEL: sil @return_nonthrowing_closure
+// CHECK: [[F:%[0-9]+]] = function_ref @specialized_nonthrowing_closure
+// CHECK: [[R:%[0-9]+]] = thin_to_thick_function [[F]]
+// CHECK: return [[R]]
+sil @return_nonthrowing_closure : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> Bool {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @nonthrowing_closure : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  return %2 : $@callee_owned (Int32, Int32) -> Bool
+}
+
+sil @specialized_throwing_closure : $@convention(thin) (Int32, Int32) -> (Bool, @error Error)
+
+sil @throwing_closure : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error) {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %3 = function_ref @specialized_throwing_closure : $@convention(thin) (Int32, Int32) -> (Bool, @error Error)
+  try_apply %3(%0, %1) : $@convention(thin) (Int32, Int32) -> (Bool, @error Error), normal bb1, error bb2
+
+bb1(%5 : $Bool):
+  return %5 : $Bool
+
+bb2(%7 : $Error):
+  throw %7 : $Error
+}
+
+// CHECK-LABEL: sil @return_throwing_closure
+// CHECK: [[F:%[0-9]+]] = function_ref @specialized_throwing_closure
+// CHECK: [[R:%[0-9]+]] = thin_to_thick_function [[F]]
+// CHECK: return [[R]]
+sil @return_throwing_closure : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> (Bool, @error Error) {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @throwing_closure : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error)
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error)
+  return %2 : $@callee_owned (Int32, Int32) -> (Bool, @error Error)
+}
+
+// Negative tests
+
+sil @swapped_arguments : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %3 = function_ref @specialized_nonthrowing_closure : $@convention(thin) (Int32, Int32) -> Bool
+  %4 = apply %3(%1, %0) : $@convention(thin) (Int32, Int32) -> Bool
+  return %4 : $Bool
+}
+
+// CHECK-LABEL: sil @return_swapped_arguments
+// CHECK: [[M:%[0-9]+]] = metatype
+// CHECK: [[F:%[0-9]+]] = function_ref @swapped_arguments
+// CHECK: [[R:%[0-9]+]] = partial_apply [[F]]([[M]])
+// CHECK: return [[R]]
+sil @return_swapped_arguments : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> Bool {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @swapped_arguments : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  return %2 : $@callee_owned (Int32, Int32) -> Bool
+}
+
+
+sil @wrong_return1 : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %3 = function_ref @specialized_nonthrowing_closure : $@convention(thin) (Int32, Int32) -> Bool
+  %4 = apply %3(%0, %1) : $@convention(thin) (Int32, Int32) -> Bool
+  %i = integer_literal $Builtin.Int1, 0
+  %b = struct $Bool (%i : $Builtin.Int1)
+  return %b : $Bool
+}
+
+// CHECK-LABEL: sil @return_wrong_return1
+// CHECK: [[M:%[0-9]+]] = metatype
+// CHECK: [[F:%[0-9]+]] = function_ref @wrong_return1
+// CHECK: [[R:%[0-9]+]] = partial_apply [[F]]([[M]])
+// CHECK: return [[R]]
+sil @return_wrong_return1 : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> Bool {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @wrong_return1 : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  return %2 : $@callee_owned (Int32, Int32) -> Bool
+}
+
+
+sil @second_apply : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %3 = function_ref @specialized_nonthrowing_closure : $@convention(thin) (Int32, Int32) -> Bool
+  %u = apply %3(%0, %1) : $@convention(thin) (Int32, Int32) -> Bool
+  %4 = apply %3(%0, %1) : $@convention(thin) (Int32, Int32) -> Bool
+  return %4 : $Bool
+}
+
+// CHECK-LABEL: sil @return_second_apply
+// CHECK: [[M:%[0-9]+]] = metatype
+// CHECK: [[F:%[0-9]+]] = function_ref @second_apply
+// CHECK: [[R:%[0-9]+]] = partial_apply [[F]]([[M]])
+// CHECK: return [[R]]
+sil @return_second_apply : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> Bool {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @second_apply : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  return %2 : $@callee_owned (Int32, Int32) -> Bool
+}
+
+
+class X { }
+
+sil @other_inst : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %3 = function_ref @specialized_nonthrowing_closure : $@convention(thin) (Int32, Int32) -> Bool
+  %4 = apply %3(%0, %1) : $@convention(thin) (Int32, Int32) -> Bool
+  %r = alloc_ref $X
+  strong_release %r : $X
+  return %4 : $Bool
+}
+
+// CHECK-LABEL: sil @return_other_inst
+// CHECK: [[M:%[0-9]+]] = metatype
+// CHECK: [[F:%[0-9]+]] = function_ref @other_inst
+// CHECK: [[R:%[0-9]+]] = partial_apply [[F]]([[M]])
+// CHECK: return [[R]]
+sil @return_other_inst : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> Bool {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @other_inst : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  return %2 : $@callee_owned (Int32, Int32) -> Bool
+}
+
+
+sil @other_inst_in_returnblock : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error) {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %3 = function_ref @specialized_throwing_closure : $@convention(thin) (Int32, Int32) -> (Bool, @error Error)
+  try_apply %3(%0, %1) : $@convention(thin) (Int32, Int32) -> (Bool, @error Error), normal bb1, error bb2
+
+bb1(%5 : $Bool):
+  %r = alloc_ref $X
+  strong_release %r : $X
+  return %5 : $Bool
+
+bb2(%7 : $Error):
+  throw %7 : $Error
+}
+
+// CHECK-LABEL: sil @return_other_inst_in_returnblock
+// CHECK: [[M:%[0-9]+]] = metatype
+// CHECK: [[F:%[0-9]+]] = function_ref @other_inst_in_returnblock
+// CHECK: [[R:%[0-9]+]] = partial_apply [[F]]([[M]])
+// CHECK: return [[R]]
+sil @return_other_inst_in_returnblock : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> (Bool, @error Error) {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @other_inst_in_returnblock : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error)
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error)
+  return %2 : $@callee_owned (Int32, Int32) -> (Bool, @error Error)
+}
+
+
+sil @wrong_return2 : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error) {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %3 = function_ref @specialized_throwing_closure : $@convention(thin) (Int32, Int32) -> (Bool, @error Error)
+  try_apply %3(%0, %1) : $@convention(thin) (Int32, Int32) -> (Bool, @error Error), normal bb1, error bb2
+
+bb1(%5 : $Bool):
+  %i = integer_literal $Builtin.Int1, 0
+  %b = struct $Bool (%i : $Builtin.Int1)
+  return %b : $Bool
+
+bb2(%7 : $Error):
+  throw %7 : $Error
+}
+
+// CHECK-LABEL: sil @return_wrong_return2
+// CHECK: [[M:%[0-9]+]] = metatype
+// CHECK: [[F:%[0-9]+]] = function_ref @wrong_return2
+// CHECK: [[R:%[0-9]+]] = partial_apply [[F]]([[M]])
+// CHECK: return [[R]]
+sil @return_wrong_return2 : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> (Bool, @error Error) {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @wrong_return2 : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error)
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error)
+  return %2 : $@callee_owned (Int32, Int32) -> (Bool, @error Error)
+}
+
+
+sil @wrong_terminator : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error) {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %3 = function_ref @specialized_throwing_closure : $@convention(thin) (Int32, Int32) -> (Bool, @error Error)
+  try_apply %3(%0, %1) : $@convention(thin) (Int32, Int32) -> (Bool, @error Error), normal bb1, error bb2
+
+bb1(%5 : $Bool):
+  return %5 : $Bool
+
+bb2(%7 : $Error):
+  br bb3
+
+bb3:
+  %i = integer_literal $Builtin.Int1, 1
+  cond_fail %i : $Builtin.Int1
+  unreachable
+}
+
+// CHECK-LABEL: sil @return_wrong_terminator
+// CHECK: [[M:%[0-9]+]] = metatype
+// CHECK: [[F:%[0-9]+]] = function_ref @wrong_terminator
+// CHECK: [[R:%[0-9]+]] = partial_apply [[F]]([[M]])
+// CHECK: return [[R]]
+sil @return_wrong_terminator : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> (Bool, @error Error) {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @wrong_terminator : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error)
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> (Bool, @error Error)
+  return %2 : $@callee_owned (Int32, Int32) -> (Bool, @error Error)
+}
+
diff --git a/test/SILOptimizer/capture_propagation_linkage.swift b/test/SILOptimizer/capture_propagation_linkage.swift
index 3d26b7d..0af6223 100644
--- a/test/SILOptimizer/capture_propagation_linkage.swift
+++ b/test/SILOptimizer/capture_propagation_linkage.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t 
 // RUN: %target-build-swift %S/Inputs/capture_propagation_linkage/main.swift %s -O -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s
+// RUN: %target-run %t/a.out | %FileCheck %s
 // REQUIRES: executable_test
 
 // CHECK: test ok
diff --git a/test/SILOptimizer/cast_folding.swift b/test/SILOptimizer/cast_folding.swift
index ffdb0f2..b715591 100644
--- a/test/SILOptimizer/cast_folding.swift
+++ b/test/SILOptimizer/cast_folding.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 // We want to check two things here:
 // - Correctness
 // - That certain "is" checks are eliminated based on static analysis at compile-time
diff --git a/test/SILOptimizer/cast_folding_no_bridging.sil b/test/SILOptimizer/cast_folding_no_bridging.sil
index 5791961..effde0f 100644
--- a/test/SILOptimizer/cast_folding_no_bridging.sil
+++ b/test/SILOptimizer/cast_folding_no_bridging.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 // REQUIRES: objc_interop
 
 // We want to check that casts between two types which are both Swift types or
@@ -59,3 +59,44 @@
 bb3:
   br bb2(%1 : $NSSet)
 }
+
+sil @fail : $@convention(thin) () -> Never
+
+// CHECK-LABEL: sil @testCFToObjC
+// CHECK: bb0(
+// CHECK-NEXT: [[T0:%.*]] = load %1 : $*CFString
+// CHECK-NEXT: [[T1:%.*]] = unchecked_ref_cast [[T0]] : $CFString to $NSString
+// CHECK-NEXT: store [[T1]] to %0 : $*NSString
+sil @testCFToObjC : $@convention(thin) (@in CFString) -> @out NSString {
+bb0(%0 : $*NSString, %1 : $*CFString):
+  checked_cast_addr_br take_always CFString in %1 : $*CFString to NSString in %0 : $*NSString, bb1, bb2
+
+bb1:
+  %ret = tuple ()
+  return %ret : $()
+
+bb2:
+  %fn = function_ref @fail : $@convention(thin) () -> Never
+  apply %fn() : $@convention(thin) () -> Never
+  unreachable
+}
+
+// CHECK-LABEL: sil @testCFToSwift
+// CHECK: bb0(
+// CHECK-NEXT: [[T0:%.*]] = load %1 : $*CFString
+// CHECK-NEXT: [[T1:%.*]] = unchecked_ref_cast [[T0]] : $CFString to $NSString
+// CHECK:      [[FN:%.*]] = function_ref @_TTWSSs21_ObjectiveCBridgeable10FoundationZFS_34_conditionallyBridgeFromObjectiveCfTwx15_ObjectiveCType6resultRGSqx__Sb : $@convention(witness_method) (@owned NSString, @inout Optional<String>, @thick String.Type) -> Bool
+// CHECK: apply [[FN]]([[T1]], {{.*}}, {{.*}})
+sil @testCFToSwift : $@convention(thin) (@in CFString) -> @out String {
+bb0(%0 : $*String, %1 : $*CFString):
+  checked_cast_addr_br take_always CFString in %1 : $*CFString to String in %0 : $*String, bb1, bb2
+
+bb1:
+  %ret = tuple ()
+  return %ret : $()
+
+bb2:
+  %fn = function_ref @fail : $@convention(thin) () -> Never
+  apply %fn() : $@convention(thin) () -> Never
+  unreachable
+}
diff --git a/test/SILOptimizer/cast_folding_objc.swift b/test/SILOptimizer/cast_folding_objc.swift
index 2324626..7e73815 100644
--- a/test/SILOptimizer/cast_folding_objc.swift
+++ b/test/SILOptimizer/cast_folding_objc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -emit-sil %s | %FileCheck %s
 // We want to check two things here:
 // - Correctness
 // - That certain "is" checks are eliminated based on static analysis at compile-time
diff --git a/test/SILOptimizer/cast_folding_objc_generics.swift b/test/SILOptimizer/cast_folding_objc_generics.swift
index 25d2ae0..4550731 100644
--- a/test/SILOptimizer/cast_folding_objc_generics.swift
+++ b/test/SILOptimizer/cast_folding_objc_generics.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -O -emit-sil %s | %FileCheck %s
 // REQUIRES: objc_interop
 
 import objc_generics
diff --git a/test/SILOptimizer/cast_folding_objc_no_foundation.swift b/test/SILOptimizer/cast_folding_objc_no_foundation.swift
index 5e2c43a..8709810 100644
--- a/test/SILOptimizer/cast_folding_objc_no_foundation.swift
+++ b/test/SILOptimizer/cast_folding_objc_no_foundation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -O -emit-sil %s | %FileCheck %s
 // REQUIRES: objc_interop
 
 // TODO: Update optimizer for id-as-Any changes.
diff --git a/test/SILOptimizer/cast_foldings.sil b/test/SILOptimizer/cast_foldings.sil
index 06f06df..d1294d0 100644
--- a/test/SILOptimizer/cast_foldings.sil
+++ b/test/SILOptimizer/cast_foldings.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -sil-combine %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -sil-combine %s | %FileCheck %s
 
 import Swift
 
diff --git a/test/SILOptimizer/cast_promote.sil b/test/SILOptimizer/cast_promote.sil
index 9f29698..529c5d8 100644
--- a/test/SILOptimizer/cast_promote.sil
+++ b/test/SILOptimizer/cast_promote.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/closure_spec_and_inline.swift b/test/SILOptimizer/closure_spec_and_inline.swift
index 0d4afbb..cb47153 100644
--- a/test/SILOptimizer/closure_spec_and_inline.swift
+++ b/test/SILOptimizer/closure_spec_and_inline.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -O -module-name=test %s -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -O -module-name=test %s -emit-sil | %FileCheck %s
 
 func closure(_ a: Int, b: Int) -> Bool {
   return a < b
diff --git a/test/SILOptimizer/closure_specialize.sil b/test/SILOptimizer/closure_specialize.sil
index 88ed538..73e842c 100644
--- a/test/SILOptimizer/closure_specialize.sil
+++ b/test/SILOptimizer/closure_specialize.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -closure-specialize %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -closure-specialize %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/closure_specialize_consolidated.sil b/test/SILOptimizer/closure_specialize_consolidated.sil
index fccd253..89193f8 100644
--- a/test/SILOptimizer/closure_specialize_consolidated.sil
+++ b/test/SILOptimizer/closure_specialize_consolidated.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -closure-specialize %s | FileCheck %s -check-prefix=REMOVECLOSURES
-// RUN: %target-sil-opt -enable-sil-verify-all -closure-specialize-eliminate-dead-closures=0 -closure-specialize %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -closure-specialize %s | %FileCheck %s -check-prefix=REMOVECLOSURES
+// RUN: %target-sil-opt -enable-sil-verify-all -closure-specialize-eliminate-dead-closures=0 -closure-specialize %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/closure_specialize_simple.sil b/test/SILOptimizer/closure_specialize_simple.sil
index 502be7a..9b4310b 100644
--- a/test/SILOptimizer/closure_specialize_simple.sil
+++ b/test/SILOptimizer/closure_specialize_simple.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -closure-specialize %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -closure-specialize %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/conditionforwarding.sil b/test/SILOptimizer/conditionforwarding.sil
index 368c330..7b43416 100644
--- a/test/SILOptimizer/conditionforwarding.sil
+++ b/test/SILOptimizer/conditionforwarding.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -condition-forwarding | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -condition-forwarding | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/const_fold_objc_bridge.sil b/test/SILOptimizer/const_fold_objc_bridge.sil
index fac0d86..147432c 100644
--- a/test/SILOptimizer/const_fold_objc_bridge.sil
+++ b/test/SILOptimizer/const_fold_objc_bridge.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -performance-constant-propagation | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -performance-constant-propagation | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILOptimizer/constant_propagation.sil b/test/SILOptimizer/constant_propagation.sil
index 1466a9d..ad62eb5 100644
--- a/test/SILOptimizer/constant_propagation.sil
+++ b/test/SILOptimizer/constant_propagation.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnostic-constant-propagation | FileCheck %s
-// RUN: %target-sil-opt -enable-sil-verify-all %s -performance-constant-propagation | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnostic-constant-propagation | %FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -performance-constant-propagation | %FileCheck %s
 
 import Builtin
 
diff --git a/test/SILOptimizer/copyforward.sil b/test/SILOptimizer/copyforward.sil
index 5f8da15..5e0259a 100644
--- a/test/SILOptimizer/copyforward.sil
+++ b/test/SILOptimizer/copyforward.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -copy-forwarding -enable-copyforwarding -enable-destroyhoisting | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -copy-forwarding -enable-copyforwarding -enable-destroyhoisting | %FileCheck %s
 
 sil_stage canonical
 
@@ -269,10 +269,10 @@
   return %t : $()
 }
 
-//CHECK-LABEL: xbranch
+//CHECK-LABEL: branch
 //CHECK-NOT: copy_addr
 //CHECK: return
-sil hidden @xbranch : $@convention(thin) <T> (@in T, Bool) -> () {
+sil hidden @branch : $@convention(thin) <T> (@in T, Bool) -> () {
 bb0(%0 : $*T, %1 : $Bool):
   %2 = struct_extract %1 : $Bool, #Bool._value     // user: %3
   cond_br %2, bb1, bb2                            // id: %3
diff --git a/test/SILOptimizer/cowarray_opt.sil b/test/SILOptimizer/cowarray_opt.sil
index 9209470..d40da89 100644
--- a/test/SILOptimizer/cowarray_opt.sil
+++ b/test/SILOptimizer/cowarray_opt.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -cowarray-opt %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -cowarray-opt %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/cropoverflow.sil b/test/SILOptimizer/cropoverflow.sil
index d27cd37..f530524 100644
--- a/test/SILOptimizer/cropoverflow.sil
+++ b/test/SILOptimizer/cropoverflow.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -remove-redundant-overflow-checks | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -remove-redundant-overflow-checks | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/cse.sil b/test/SILOptimizer/cse.sil
index 3ac1f2a..687e454 100644
--- a/test/SILOptimizer/cse.sil
+++ b/test/SILOptimizer/cse.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -cse | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -cse | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/cse_apply.sil b/test/SILOptimizer/cse_apply.sil
index 9100a9a..477774a 100644
--- a/test/SILOptimizer/cse_apply.sil
+++ b/test/SILOptimizer/cse_apply.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -cse | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -cse | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/cse_objc.sil b/test/SILOptimizer/cse_objc.sil
index eeb4a31..eebb43d 100644
--- a/test/SILOptimizer/cse_objc.sil
+++ b/test/SILOptimizer/cse_objc.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -cse | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -cse | %FileCheck %s
 // REQUIRES: objc_interop
 
 import Builtin
diff --git a/test/SILOptimizer/dead_alloc_elim.sil b/test/SILOptimizer/dead_alloc_elim.sil
index 15aa503..ee6ffad 100644
--- a/test/SILOptimizer/dead_alloc_elim.sil
+++ b/test/SILOptimizer/dead_alloc_elim.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -deadobject-elim %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -deadobject-elim %s | %FileCheck %s
 
 import Swift
 import Builtin
diff --git a/test/SILOptimizer/dead_array_elim.sil b/test/SILOptimizer/dead_array_elim.sil
index 6ac745a..4b5ad5b 100644
--- a/test/SILOptimizer/dead_array_elim.sil
+++ b/test/SILOptimizer/dead_array_elim.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -deadobject-elim %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -deadobject-elim %s | %FileCheck %s
 
 // Linux doesn't have the same symbol name for _ArrayBuffer.
 // XFAIL: linux
diff --git a/test/SILOptimizer/dead_code_elimination.sil b/test/SILOptimizer/dead_code_elimination.sil
index 7cca374..6e57490 100644
--- a/test/SILOptimizer/dead_code_elimination.sil
+++ b/test/SILOptimizer/dead_code_elimination.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -dce %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -dce %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/dead_func_init_method.sil b/test/SILOptimizer/dead_func_init_method.sil
index 6d2dc2f..7ecea97 100644
--- a/test/SILOptimizer/dead_func_init_method.sil
+++ b/test/SILOptimizer/dead_func_init_method.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -sil-deadfuncelim %s | FileCheck %s
+// RUN: %target-sil-opt -sil-deadfuncelim %s | %FileCheck %s
 
 // Check that we don't crash on this.
 
diff --git a/test/SILOptimizer/dead_function_elimination.swift b/test/SILOptimizer/dead_function_elimination.swift
index afba3e8..899f344 100644
--- a/test/SILOptimizer/dead_function_elimination.swift
+++ b/test/SILOptimizer/dead_function_elimination.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend %s -O -emit-sil | FileCheck %s
-// RUN: %target-swift-frontend %s -O -emit-sil -enable-testing | FileCheck -check-prefix=CHECK-TESTING %s
+// RUN: %target-swift-frontend %s -O -emit-sil | %FileCheck %s
+// RUN: %target-swift-frontend %s -O -emit-sil -enable-testing | %FileCheck -check-prefix=CHECK-TESTING %s
 
 // Check if cycles are removed.
 
diff --git a/test/SILOptimizer/dead_inlined_func.swift b/test/SILOptimizer/dead_inlined_func.swift
index 36d9fbc..b1ef650 100644
--- a/test/SILOptimizer/dead_inlined_func.swift
+++ b/test/SILOptimizer/dead_inlined_func.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -O -g %s -emit-sil | FileCheck %s -check-prefix=CHECK-SIL
-// RUN: %target-swift-frontend -O -g %s -sil-serialize-all -emit-ir | FileCheck %s -check-prefix=CHECK-IR
+// RUN: %target-swift-frontend -O -g %s -emit-sil | %FileCheck %s -check-prefix=CHECK-SIL
+// RUN: %target-swift-frontend -O -g %s -sil-serialize-all -emit-ir | %FileCheck %s -check-prefix=CHECK-IR
 
 // The dead inlined function should not be in the SIL
 // CHECK-SIL-NOT: sil {{.*}}to_be_inlined
diff --git a/test/SILOptimizer/dead_internal_func.swift b/test/SILOptimizer/dead_internal_func.swift
index 300e6a1..5752c7f 100644
--- a/test/SILOptimizer/dead_internal_func.swift
+++ b/test/SILOptimizer/dead_internal_func.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -O -emit-sil %s %S/Inputs/internal_func.swift  | FileCheck %s
-// RUN: %target-swift-frontend -O -enable-testing -emit-sil %s %S/Inputs/internal_func.swift  | FileCheck -check-prefix=CHECK-TESTABLE %s
+// RUN: %target-swift-frontend -O -emit-sil %s %S/Inputs/internal_func.swift  | %FileCheck %s
+// RUN: %target-swift-frontend -O -enable-testing -emit-sil %s %S/Inputs/internal_func.swift  | %FileCheck -check-prefix=CHECK-TESTABLE %s
 
 // Check that an internal function from another file is removed after it gets
 // dead through inlining.
diff --git a/test/SILOptimizer/dead_method.swift b/test/SILOptimizer/dead_method.swift
index d169498..a6799eb 100644
--- a/test/SILOptimizer/dead_method.swift
+++ b/test/SILOptimizer/dead_method.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -primary-file %s %S/Inputs/public_class.swift -parse-as-library -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -O -primary-file %s %S/Inputs/public_class.swift -parse-as-library -emit-sil | %FileCheck %s
 
 private class Derived : Base {
   override func visible() {
diff --git a/test/SILOptimizer/dead_partial_apply_arg.swift b/test/SILOptimizer/dead_partial_apply_arg.swift
new file mode 100644
index 0000000..73a7c43
--- /dev/null
+++ b/test/SILOptimizer/dead_partial_apply_arg.swift
@@ -0,0 +1,24 @@
+// RUN: %target-swift-frontend -parse-as-library -module-name=test -primary-file %s -O -emit-sil | %FileCheck %s
+
+
+// Check if the compiler can convert a partial_apply of a dead argument (an
+// unused metatype) to a thin_to_thick_function
+
+extension Int32 {
+
+// This function has an unused metatype argument.
+
+// CHECK-LABEL: sil [thunk] [always_inline] @_TZFE4testVs5Int328lessthanfT3lhsS0_3rhsS0__Sb : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  public static func lessthan (lhs: Int32, rhs: Int32) -> Bool {
+    return lhs < rhs
+  }
+}
+
+// CHECK-LABEL: sil hidden @_TF4test6callitFT_FTVs5Int32S0__Sb : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> Bool
+// CHECK: [[F:%[0-9]+]] = function_ref @_TTSf4n_n_d___TZFE4testVs5Int328lessthanfT3lhsS0_3rhsS0__Sb
+// CHECK: [[R:%[0-9]+]] = thin_to_thick_function [[F]]
+// CHECK: return [[R]]
+func callit()  -> (Int32, Int32) -> Bool {
+  return (Int32.lessthan)
+}
+
diff --git a/test/SILOptimizer/dead_store_elim.sil b/test/SILOptimizer/dead_store_elim.sil
index 295398f..e658bec 100644
--- a/test/SILOptimizer/dead_store_elim.sil
+++ b/test/SILOptimizer/dead_store_elim.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -dead-store-elim -max-partial-store-count=2 -enable-sil-verify-all | FileCheck %s
+// RUN: %target-sil-opt %s -dead-store-elim -max-partial-store-count=2 -enable-sil-verify-all | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/dead_witness_module.swift b/test/SILOptimizer/dead_witness_module.swift
index e2d4cfb..9fa32b1 100644
--- a/test/SILOptimizer/dead_witness_module.swift
+++ b/test/SILOptimizer/dead_witness_module.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -Onone -parse-stdlib -parse-as-library  -module-name TestModule -sil-serialize-all %S/Inputs/TestModule.swift -emit-module-path %t/TestModule.swiftmodule 
-// RUN: %target-swift-frontend -O %s -I %t -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -O %s -I %t -emit-sil | %FileCheck %s
 
 // DeadFunctionElimination may not remove a method from a witness table which
 // is imported from another module.
diff --git a/test/SILOptimizer/deadargsignatureopt.sil b/test/SILOptimizer/deadargsignatureopt.sil
new file mode 100644
index 0000000..a38c19d
--- /dev/null
+++ b/test/SILOptimizer/deadargsignatureopt.sil
@@ -0,0 +1,72 @@
+// RUN: %target-sil-opt -enable-sil-verify-all -dead-arg-signature-opt %s | %FileCheck %s
+
+import Builtin
+import Swift
+
+// Specialize to a function with removed dead argument.
+
+// CHECK-LABEL: sil [thunk] [always_inline] @one_arg_dead
+// CHECK: [[F:%[0-9]+]] = function_ref @_TTSf4n_n_d__one_arg_dead
+// CHECK: [[A:%[0-9]+]] = apply [[F]](%0, %1)
+// CHECK: return [[A]]
+sil @one_arg_dead : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %5 = struct_extract %0 : $Int32, #Int32._value
+  %6 = struct_extract %1 : $Int32, #Int32._value
+  %7 = builtin "cmp_slt_Int32"(%5 : $Builtin.Int32, %6 : $Builtin.Int32) : $Builtin.Int1
+  %8 = struct $Bool (%7 : $Builtin.Int1)
+  return %8 : $Bool
+}
+
+
+// Still delete only one dead arg as only one arg is partially applied.
+
+// CHECK-LABEL: sil [thunk] [always_inline] @two_args_dead
+// CHECK: [[F:%[0-9]+]] = function_ref @_TTSf4n_n_d__two_args_dead
+// CHECK: [[A:%[0-9]+]] = apply [[F]](%0, %1)
+// CHECK: return [[A]]
+sil @two_args_dead : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %5 = struct_extract %0 : $Int32, #Int32._value
+  %7 = builtin "cmp_slt_Int32"(%5 : $Builtin.Int32, %5 : $Builtin.Int32) : $Builtin.Int1
+  %8 = struct $Bool (%7 : $Builtin.Int1)
+  return %8 : $Bool
+}
+
+// Don't specialize at this function is not partially applied.
+
+// CHECK-LABEL: sil @not_used
+// CHECK-NOT: apply
+// CHECK: return
+sil @not_used : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool {
+bb0(%0 : $Int32, %1 : $Int32, %2 : $@thin Int32.Type):
+  %5 = struct_extract %0 : $Int32, #Int32._value
+  %6 = struct_extract %1 : $Int32, #Int32._value
+  %7 = builtin "cmp_slt_Int32"(%5 : $Builtin.Int32, %6 : $Builtin.Int32) : $Builtin.Int1
+  %8 = struct $Bool (%7 : $Builtin.Int1)
+  return %8 : $Bool
+}
+
+sil @partial_apply_one_arg_dead : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> Bool {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @one_arg_dead : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  return %2 : $@callee_owned (Int32, Int32) -> Bool
+}
+
+sil @partial_apply_two_args_dead : $@convention(thin) () -> @owned @callee_owned (Int32, Int32) -> Bool {
+bb0:
+  %0 = metatype $@thin Int32.Type
+  %1 = function_ref @two_args_dead : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  %2 = partial_apply %1(%0) : $@convention(method) (Int32, Int32, @thin Int32.Type) -> Bool
+  return %2 : $@callee_owned (Int32, Int32) -> Bool
+}
+
+// CHECK-LABEL: sil @_TTSf4n_n_d__one_arg_dead
+// CHECK: builtin
+// CHECK: return
+
+// CHECK-LABEL: sil @_TTSf4n_n_d__two_args_dead
+// CHECK: builtin
+// CHECK: return
diff --git a/test/SILOptimizer/definite_init.sil b/test/SILOptimizer/definite_init.sil
index 895e1df..edcaee8 100644
--- a/test/SILOptimizer/definite_init.sil
+++ b/test/SILOptimizer/definite_init.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -definite-init -verify | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -definite-init -verify | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/definite_init_crashes.sil b/test/SILOptimizer/definite_init_crashes.sil
index 36dba60..4e7fa50 100644
--- a/test/SILOptimizer/definite_init_crashes.sil
+++ b/test/SILOptimizer/definite_init_crashes.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -definite-init | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -definite-init | %FileCheck %s
 
 // These are all regression tests to ensure that the memory promotion pass
 // doesn't crash.
diff --git a/test/SILOptimizer/definite_init_diagnostics.swift b/test/SILOptimizer/definite_init_diagnostics.swift
index 95ac998..25ed0b4 100644
--- a/test/SILOptimizer/definite_init_diagnostics.swift
+++ b/test/SILOptimizer/definite_init_diagnostics.swift
@@ -414,7 +414,6 @@
 //  Delegating initializers
 //===----------------------------------------------------------------------===//
 
-
 class DelegatingCtorClass {
   var ivar: EmptyStruct
 
@@ -531,50 +530,15 @@
 }
 
 extension TriviallyConstructible {
-  init(up: Int) {
-    self.init()
-    go(up)
-  }
-
   init(down: Int) {
     go(down) // expected-error {{'self' used before self.init call}}
     self.init()
   }
 }
 
-class TrivialClass : TriviallyConstructible {
-  required init() {}
-
-  func go(_ x: Int) {}
-
-  convenience init(y: Int) {
-    self.init(up: y * y)
-  }
-}
-
-struct TrivialStruct : TriviallyConstructible {
-  init() {}
-
-  func go(_ x: Int) {}
-
-  init(y: Int) {
-    self.init(up: y * y)
-  }
-}
-
-enum TrivialEnum : TriviallyConstructible {
-  case NotSoTrivial
-
-  init() {
-    self = .NotSoTrivial
-  }
-
-  func go(_ x: Int) {}
-
-  init(y: Int) {
-    self.init(up: y * y)
-  }
-}
+//===----------------------------------------------------------------------===//
+//  Various bugs
+//===----------------------------------------------------------------------===//
 
 // rdar://16119509 - Dataflow problem where we reject valid code.
 class rdar16119509_Buffer {
diff --git a/test/SILOptimizer/definite_init_failable_initializers.swift b/test/SILOptimizer/definite_init_failable_initializers.swift
index c117289..400235a 100644
--- a/test/SILOptimizer/definite_init_failable_initializers.swift
+++ b/test/SILOptimizer/definite_init_failable_initializers.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -disable-objc-attr-requires-foundation-module %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
 
 // High-level tests that DI handles early returns from failable and throwing
 // initializers properly. The main complication is conditional release of self
diff --git a/test/SILOptimizer/definite_init_objc_factory_init.swift b/test/SILOptimizer/definite_init_objc_factory_init.swift
index a07efed..03949e0 100644
--- a/test/SILOptimizer/definite_init_objc_factory_init.swift
+++ b/test/SILOptimizer/definite_init_objc_factory_init.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/../IDE/Inputs/custom-modules %s -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/../IDE/Inputs/custom-modules %s -emit-sil | %FileCheck %s
 
 // REQUIRES: objc_interop
 
@@ -30,7 +30,8 @@
     // CHECK: [[OBJC_META:%[0-9]+]] = thick_to_objc_metatype [[META]] : $@thick Hive.Type to $@objc_metatype Hive.Type
     // CHECK: apply [[FACTORY]]([[QUEEN:%[0-9]+]], [[OBJC_META]]) : $@convention(objc_method) (ImplicitlyUnwrappedOptional<Bee>, @objc_metatype Hive.Type) -> @autoreleased ImplicitlyUnwrappedOptional<Hive>
     // CHECK: store [[NEW_SELF:%[0-9]+]] to [[SELF_ADDR]]
-    // CHECK: strong_release [[OLD_SELF]] : $Hive
+    // CHECK: [[METATYPE:%.*]] = value_metatype $@thick Hive.Type, [[OLD_SELF]] : $Hive
+    // CHECK: dealloc_partial_ref [[OLD_SELF]] : $Hive, [[METATYPE]] : $@thick Hive.Type
     // CHECK: dealloc_stack [[SELF_ADDR]]
     // CHECK: return [[NEW_SELF]]
     self.init(queen: other)
diff --git a/test/SILOptimizer/definite_init_protocol_init.swift b/test/SILOptimizer/definite_init_protocol_init.swift
new file mode 100644
index 0000000..6c566c0
--- /dev/null
+++ b/test/SILOptimizer/definite_init_protocol_init.swift
@@ -0,0 +1,147 @@
+// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
+
+// Ensure that convenience initializers on concrete types can
+// delegate to factory initializers defined in protocol
+// extensions.
+
+protocol TriviallyConstructible {
+  init(lower: Int)
+}
+
+extension TriviallyConstructible {
+  init(middle: Int) {
+    self.init(lower: middle)
+  }
+
+  init?(failingMiddle: Int) {
+    self.init(lower: failingMiddle)
+  }
+
+  init(throwingMiddle: Int) throws {
+    try self.init(lower: throwingMiddle)
+  }
+}
+
+class TrivialClass : TriviallyConstructible {
+  required init(lower: Int) {}
+
+  // CHECK-LABEL: sil hidden @_TFC27definite_init_protocol_init12TrivialClasscfT5upperSi_S0_
+  // CHECK:     bb0(%0 : $Int, %1 : $TrivialClass):
+  // CHECK-NEXT:  [[SELF_BOX:%.*]] = alloc_stack $TrivialClass
+  // CHECK:       store %1 to [[SELF_BOX]]
+  // CHECK-NEXT:  [[METATYPE:%.*]] = value_metatype $@thick TrivialClass.Type, %1
+  // CHECK:       [[FN:%.*]] = function_ref @_TFE27definite_init_protocol_initPS_22TriviallyConstructibleCfT6middleSi_x
+  // CHECK-NEXT:  [[RESULT:%.*]] = alloc_stack $TrivialClass
+  // CHECK-NEXT:  apply [[FN]]<TrivialClass>([[RESULT]], %0, [[METATYPE]])
+  // CHECK-NEXT:  [[NEW_SELF:%.*]] = load [[RESULT]]
+  // CHECK-NEXT:  store [[NEW_SELF]] to [[SELF_BOX]]
+  // CHECK-NEXT:  [[METATYPE:%.*]] = value_metatype $@thick TrivialClass.Type, %1
+  // CHECK-NEXT:  dealloc_partial_ref %1 : $TrivialClass, [[METATYPE]] : $@thick TrivialClass.Type
+  // CHECK-NEXT:  dealloc_stack [[RESULT]]
+  // CHECK-NEXT:  dealloc_stack [[SELF_BOX]]
+  // CHECK-NEXT:  return [[NEW_SELF]]
+  convenience init(upper: Int) {
+    self.init(middle: upper)
+  }
+
+  convenience init?(failingUpper: Int) {
+    self.init(failingMiddle: failingUpper)
+  }
+
+  convenience init(throwingUpper: Int) throws {
+    try self.init(throwingMiddle: throwingUpper)
+  }
+}
+
+struct TrivialStruct : TriviallyConstructible {
+  let x: Int
+
+  init(lower: Int) { self.x = lower }
+
+// CHECK-LABEL: sil hidden @_TFV27definite_init_protocol_init13TrivialStructCfT5upperSi_S0_
+// CHECK:     bb0(%0 : $Int, %1 : $@thin TrivialStruct.Type):
+// CHECK-NEXT: [[SELF:%.*]] = alloc_stack $TrivialStruct
+// CHECK:      [[FN:%.*]] = function_ref @_TFE27definite_init_protocol_initPS_22TriviallyConstructibleCfT6middleSi_x
+// CHECK-NEXT: [[METATYPE:%.*]] = metatype $@thick TrivialStruct.Type
+// CHECK-NEXT: [[SELF_BOX:%.*]] = alloc_stack $TrivialStruct
+// CHECK-NEXT: apply [[FN]]<TrivialStruct>([[SELF_BOX]], %0, [[METATYPE]])
+// CHECK-NEXT: [[NEW_SELF:%.*]] = load [[SELF_BOX]]
+// CHECK-NEXT: store [[NEW_SELF]] to [[SELF]]
+// CHECK-NEXT: dealloc_stack [[SELF_BOX]]
+// CHECK-NEXT: dealloc_stack [[SELF]]
+// CHECK-NEXT: return [[NEW_SELF]]
+  init(upper: Int) {
+    self.init(middle: upper)
+  }
+
+  init?(failingUpper: Int) {
+    self.init(failingMiddle: failingUpper)
+  }
+
+  init(throwingUpper: Int) throws {
+    try self.init(throwingMiddle: throwingUpper)
+  }
+}
+
+struct AddressOnlyStruct : TriviallyConstructible {
+  let x: Any
+
+  init(lower: Int) { self.x = lower }
+
+// CHECK-LABEL: sil hidden @_TFV27definite_init_protocol_init17AddressOnlyStructCfT5upperSi_S0_
+// CHECK:     bb0(%0 : $*AddressOnlyStruct, %1 : $Int, %2 : $@thin AddressOnlyStruct.Type):
+// CHECK-NEXT: [[SELF:%.*]] = alloc_stack $AddressOnlyStruct
+// CHECK:      [[FN:%.*]] = function_ref @_TFE27definite_init_protocol_initPS_22TriviallyConstructibleCfT6middleSi_x
+// CHECK-NEXT: [[METATYPE:%.*]] = metatype $@thick AddressOnlyStruct.Type
+// CHECK-NEXT: [[SELF_BOX:%.*]] = alloc_stack $AddressOnlyStruct
+// CHECK-NEXT: apply [[FN]]<AddressOnlyStruct>([[SELF_BOX]], %1, [[METATYPE]])
+// CHECK-NEXT: copy_addr [take] [[SELF_BOX]] to [initialization] [[SELF]]
+// CHECK-NEXT: dealloc_stack [[SELF_BOX]]
+// CHECK-NEXT: copy_addr [take] [[SELF]] to [initialization] %0
+// CHECK-NEXT: [[RESULT:%.*]] = tuple ()
+// CHECK-NEXT: dealloc_stack [[SELF]]
+// CHECK-NEXT: return [[RESULT]]
+  init(upper: Int) {
+    self.init(middle: upper)
+  }
+
+  init?(failingUpper: Int) {
+    self.init(failingMiddle: failingUpper)
+  }
+
+  init(throwingUpper: Int) throws {
+    try self.init(throwingMiddle: throwingUpper)
+  }
+}
+
+enum TrivialEnum : TriviallyConstructible {
+  case NotSoTrivial
+
+  init(lower: Int) {
+    self = .NotSoTrivial
+  }
+
+// CHECK-LABEL: sil hidden @_TFO27definite_init_protocol_init11TrivialEnumCfT5upperSi_S0_
+// CHECK:     bb0(%0 : $Int, %1 : $@thin TrivialEnum.Type):
+// CHECK-NEXT: [[SELF:%.*]] = alloc_stack $TrivialEnum
+// CHECK:      [[FN:%.*]] = function_ref @_TFE27definite_init_protocol_initPS_22TriviallyConstructibleCfT6middleSi_x
+// CHECK-NEXT: [[METATYPE:%.*]] = metatype $@thick TrivialEnum.Type
+// CHECK-NEXT: [[SELF_BOX:%.*]] = alloc_stack $TrivialEnum
+// CHECK-NEXT: apply [[FN]]<TrivialEnum>([[SELF_BOX]], %0, [[METATYPE]])
+// CHECK-NEXT: [[NEW_SELF:%.*]] = load [[SELF_BOX]]
+// CHECK-NEXT: store [[NEW_SELF]] to [[SELF]]
+// CHECK-NEXT: dealloc_stack [[SELF_BOX]]
+// CHECK-NEXT: dealloc_stack [[SELF]]
+// CHECK-NEXT: return [[NEW_SELF]]
+  init(upper: Int) {
+    self.init(middle: upper)
+  }
+
+  init?(failingUpper: Int) {
+    self.init(failingMiddle: failingUpper)
+  }
+
+  init(throwingUpper: Int) throws {
+    try self.init(throwingMiddle: throwingUpper)
+  }
+}
diff --git a/test/SILOptimizer/destructor_analysis.sil b/test/SILOptimizer/destructor_analysis.sil
index 1e3ee62..3ccc7c8 100644
--- a/test/SILOptimizer/destructor_analysis.sil
+++ b/test/SILOptimizer/destructor_analysis.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -abcopts %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -abcopts %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirt_access.sil b/test/SILOptimizer/devirt_access.sil
index 2c9c8b0..bdd5a65 100644
--- a/test/SILOptimizer/devirt_access.sil
+++ b/test/SILOptimizer/devirt_access.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirt_access.swift b/test/SILOptimizer/devirt_access.swift
index a3c5552..87c6b2a 100644
--- a/test/SILOptimizer/devirt_access.swift
+++ b/test/SILOptimizer/devirt_access.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-swift-frontend -emit-module -Onone -o %t %S/Inputs/devirt_access_other_module.swift
 
-// RUN: %target-swift-frontend -O -primary-file %s %S/Inputs/devirt_access_helper.swift -I %t -emit-sil -sil-inline-threshold 1000 -sil-verify-all | FileCheck -check-prefix=WHOLE-MODULE %s
-// RUN: %target-swift-frontend -O -primary-file %s %S/Inputs/devirt_access_helper.swift -I %t -emit-sil -sil-inline-threshold 1000 -sil-verify-all | FileCheck -check-prefix=PRIMARY-FILE %s
+// RUN: %target-swift-frontend -O -primary-file %s %S/Inputs/devirt_access_helper.swift -I %t -emit-sil -sil-inline-threshold 1000 -sil-verify-all | %FileCheck -check-prefix=WHOLE-MODULE %s
+// RUN: %target-swift-frontend -O -primary-file %s %S/Inputs/devirt_access_helper.swift -I %t -emit-sil -sil-inline-threshold 1000 -sil-verify-all | %FileCheck -check-prefix=PRIMARY-FILE %s
 
 import devirt_access_other_module
 
diff --git a/test/SILOptimizer/devirt_access_other_module.swift b/test/SILOptimizer/devirt_access_other_module.swift
index dea6075..8d2f026 100644
--- a/test/SILOptimizer/devirt_access_other_module.swift
+++ b/test/SILOptimizer/devirt_access_other_module.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -O %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -O %s | %FileCheck %s
 
 // Check that this file does not crash a compiler.
 //
diff --git a/test/SILOptimizer/devirt_alloc_ref_dynamic.sil b/test/SILOptimizer/devirt_alloc_ref_dynamic.sil
index aa59d11..586fcaf 100644
--- a/test/SILOptimizer/devirt_alloc_ref_dynamic.sil
+++ b/test/SILOptimizer/devirt_alloc_ref_dynamic.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -devirtualizer -dce | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -devirtualizer -dce | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirt_archetype_method.swift b/test/SILOptimizer/devirt_archetype_method.swift
index f10f7f0..5c88de5 100644
--- a/test/SILOptimizer/devirt_archetype_method.swift
+++ b/test/SILOptimizer/devirt_archetype_method.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil -primary-file %s | %FileCheck %s
 
 // We can't deserialize apply_inst with subst lists. When radar://14443304
 // is fixed then we should convert this test to a SIL test.
diff --git a/test/SILOptimizer/devirt_base_class.swift b/test/SILOptimizer/devirt_base_class.swift
index 7ac4db0..1a0850f 100644
--- a/test/SILOptimizer/devirt_base_class.swift
+++ b/test/SILOptimizer/devirt_base_class.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 public class Base1 { @inline(never) func f() -> Int { return 0 } }
 
diff --git a/test/SILOptimizer/devirt_concrete_subclass_of_generic_class.swift b/test/SILOptimizer/devirt_concrete_subclass_of_generic_class.swift
index 1ea65c8..0f0a6a7 100644
--- a/test/SILOptimizer/devirt_concrete_subclass_of_generic_class.swift
+++ b/test/SILOptimizer/devirt_concrete_subclass_of_generic_class.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -O %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -O %s | %FileCheck %s
 
 // Check that devirtualizer can properly handle concrete non-generic subclasses 
 // of generic classes.
diff --git a/test/SILOptimizer/devirt_contravariant_args.swift b/test/SILOptimizer/devirt_contravariant_args.swift
index c4c6ec9..3a14528 100644
--- a/test/SILOptimizer/devirt_contravariant_args.swift
+++ b/test/SILOptimizer/devirt_contravariant_args.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -primary-file %s -emit-sil -sil-inline-threshold 1000 -sil-verify-all | FileCheck %s
+// RUN: %target-swift-frontend -O -primary-file %s -emit-sil -sil-inline-threshold 1000 -sil-verify-all | %FileCheck %s
 
 // Make sure that we can dig all the way through the class hierarchy and
 // protocol conformances.
diff --git a/test/SILOptimizer/devirt_covariant_return.swift b/test/SILOptimizer/devirt_covariant_return.swift
index bc77c18..9e31d16 100644
--- a/test/SILOptimizer/devirt_covariant_return.swift
+++ b/test/SILOptimizer/devirt_covariant_return.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -Xllvm -disable-sil-cm-rr-cm=0  -primary-file %s -emit-sil -sil-inline-threshold 1000 -sil-verify-all | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -Xllvm -disable-sil-cm-rr-cm=0  -primary-file %s -emit-sil -sil-inline-threshold 1000 -sil-verify-all | %FileCheck %s
 
 // Make sure that we can dig all the way through the class hierarchy and
 // protocol conformances with covariant return types correctly. The verifier
diff --git a/test/SILOptimizer/devirt_ctors.sil b/test/SILOptimizer/devirt_ctors.sil
index 6806df9..9d9693a 100644
--- a/test/SILOptimizer/devirt_ctors.sil
+++ b/test/SILOptimizer/devirt_ctors.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -devirtualizer | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -devirtualizer | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirt_default_case.swift b/test/SILOptimizer/devirt_default_case.swift
index fafaad0..1aa71d4 100644
--- a/test/SILOptimizer/devirt_default_case.swift
+++ b/test/SILOptimizer/devirt_default_case.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -O -module-name devirt_default_case -emit-sil %s | FileCheck -check-prefix=CHECK -check-prefix=CHECK-NORMAL %s
-// RUN: %target-swift-frontend -O -module-name devirt_default_case -emit-sil -enable-testing %s | FileCheck -check-prefix=CHECK -check-prefix=CHECK-TESTABLE %s
+// RUN: %target-swift-frontend -O -module-name devirt_default_case -emit-sil %s | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-NORMAL %s
+// RUN: %target-swift-frontend -O -module-name devirt_default_case -emit-sil -enable-testing %s | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-TESTABLE %s
 
 @_silgen_name("action")
 func action(_ n:Int) -> ()
diff --git a/test/SILOptimizer/devirt_default_witness_method.sil b/test/SILOptimizer/devirt_default_witness_method.sil
index e11633d..703cdc2 100644
--- a/test/SILOptimizer/devirt_default_witness_method.sil
+++ b/test/SILOptimizer/devirt_default_witness_method.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -enable-resilience | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -enable-resilience | %FileCheck %s
 sil_stage canonical
 
 import Builtin
diff --git a/test/SILOptimizer/devirt_dependent_types.swift b/test/SILOptimizer/devirt_dependent_types.swift
index a3ddfff..81c2ceb 100644
--- a/test/SILOptimizer/devirt_dependent_types.swift
+++ b/test/SILOptimizer/devirt_dependent_types.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -O %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -O %s | %FileCheck %s
 
 protocol Bar {
   associatedtype Element
diff --git a/test/SILOptimizer/devirt_extension.swift b/test/SILOptimizer/devirt_extension.swift
index 0ef203a..1e4390c 100644
--- a/test/SILOptimizer/devirt_extension.swift
+++ b/test/SILOptimizer/devirt_extension.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 protocol DrawingElementDispatch {}
 
diff --git a/test/SILOptimizer/devirt_inherited_conformance.swift b/test/SILOptimizer/devirt_inherited_conformance.swift
index 4bc2330..d3d1b3f 100644
--- a/test/SILOptimizer/devirt_inherited_conformance.swift
+++ b/test/SILOptimizer/devirt_inherited_conformance.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O %s -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -O %s -emit-sil | %FileCheck %s
 
 // Make sure that we can dig all the way through the class hierarchy and
 // protocol conformances.
diff --git a/test/SILOptimizer/devirt_jump_thread.sil b/test/SILOptimizer/devirt_jump_thread.sil
index e6c3669..802b8c2 100644
--- a/test/SILOptimizer/devirt_jump_thread.sil
+++ b/test/SILOptimizer/devirt_jump_thread.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg -cse | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg -cse | %FileCheck %s
 
 // Check that jump-threading works for sequences of checked_cast_br instructions produced by the devirtualizer.
 // This allows for simplifications of code like e.g. f.foo() + f.foo()
diff --git a/test/SILOptimizer/devirt_jump_thread_crasher.sil b/test/SILOptimizer/devirt_jump_thread_crasher.sil
index 25bb9ff..e353363 100644
--- a/test/SILOptimizer/devirt_jump_thread_crasher.sil
+++ b/test/SILOptimizer/devirt_jump_thread_crasher.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | %FileCheck %s
 
 // REQUIRES: objc_interop
 // FIXME: this test relies on standard library implementation details that are
diff --git a/test/SILOptimizer/devirt_materializeForSet.swift b/test/SILOptimizer/devirt_materializeForSet.swift
index 435d153..59fad1c 100644
--- a/test/SILOptimizer/devirt_materializeForSet.swift
+++ b/test/SILOptimizer/devirt_materializeForSet.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 // Check that compiler does not crash on the devirtualization of materializeForSet methods
 // and produces a correct code.
diff --git a/test/SILOptimizer/devirt_method_with_generic_params.swift b/test/SILOptimizer/devirt_method_with_generic_params.swift
index 900d02c..4d1963b 100644
--- a/test/SILOptimizer/devirt_method_with_generic_params.swift
+++ b/test/SILOptimizer/devirt_method_with_generic_params.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -O %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -O %s | %FileCheck %s
 
 class S<T> {
   func f<U>(_ x: T, _ y: U) -> T { return x }
diff --git a/test/SILOptimizer/devirt_override.sil b/test/SILOptimizer/devirt_override.sil
index 2f8ddd5..9011652 100644
--- a/test/SILOptimizer/devirt_override.sil
+++ b/test/SILOptimizer/devirt_override.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -devirtualizer | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -devirtualizer | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirt_protocol_method_invocations.swift b/test/SILOptimizer/devirt_protocol_method_invocations.swift
index 32c1656..6dfbd59 100644
--- a/test/SILOptimizer/devirt_protocol_method_invocations.swift
+++ b/test/SILOptimizer/devirt_protocol_method_invocations.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 public protocol Foo { 
   func foo(_ x:Int) -> Int
diff --git a/test/SILOptimizer/devirt_release.sil b/test/SILOptimizer/devirt_release.sil
index 06bcbd72..53e219f 100644
--- a/test/SILOptimizer/devirt_release.sil
+++ b/test/SILOptimizer/devirt_release.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -release-devirtualizer -module-name=test | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -release-devirtualizer -module-name=test | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirt_single_module_in_multiple_files.swift b/test/SILOptimizer/devirt_single_module_in_multiple_files.swift
index c81c5f7..b5d9f51 100644
--- a/test/SILOptimizer/devirt_single_module_in_multiple_files.swift
+++ b/test/SILOptimizer/devirt_single_module_in_multiple_files.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swiftc_driver -module-name devirt_single_module_in_multiple_files -O  %s %S/Inputs/BaseProblem.swift %S/Inputs/Problems.swift -parse-as-library -Xllvm -sil-disable-pass="Performance Inliner" -emit-sil 2>&1 | FileCheck %s
+// RUN: %target-swiftc_driver -module-name devirt_single_module_in_multiple_files -O  %s %S/Inputs/BaseProblem.swift %S/Inputs/Problems.swift -parse-as-library -Xllvm -sil-disable-pass="Performance Inliner" -emit-sil 2>&1 | %FileCheck %s
 
 public func test() {
   let e = Evaluator()
diff --git a/test/SILOptimizer/devirt_specialized_conformance.swift b/test/SILOptimizer/devirt_specialized_conformance.swift
index 9378417..ec97f85 100644
--- a/test/SILOptimizer/devirt_specialized_conformance.swift
+++ b/test/SILOptimizer/devirt_specialized_conformance.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O %s -emit-sil -sil-verify-all | FileCheck %s
+// RUN: %target-swift-frontend -O %s -emit-sil -sil-verify-all | %FileCheck %s
 
 // Make sure that we completely inline/devirtualize/substitute all the way down
 // to unknown1.
diff --git a/test/SILOptimizer/devirt_specialized_inherited_interplay.swift b/test/SILOptimizer/devirt_specialized_inherited_interplay.swift
index ce0d0c1..1b6a6ad 100644
--- a/test/SILOptimizer/devirt_specialized_inherited_interplay.swift
+++ b/test/SILOptimizer/devirt_specialized_inherited_interplay.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sil-verify-all -O %s -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -sil-verify-all -O %s -emit-sil | %FileCheck %s
 
 // This file consists of tests for making sure that protocol conformances and
 // inherited conformances work well together when applied to each other. The
diff --git a/test/SILOptimizer/devirt_speculate.swift b/test/SILOptimizer/devirt_speculate.swift
index c9f0ccd..e2bfc6a 100644
--- a/test/SILOptimizer/devirt_speculate.swift
+++ b/test/SILOptimizer/devirt_speculate.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -parse-as-library -O -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend %s -parse-as-library -O -emit-sil | %FileCheck %s
 //
 // Test speculative devirtualization.
 
diff --git a/test/SILOptimizer/devirt_speculative.sil b/test/SILOptimizer/devirt_speculative.sil
index 99fc383..61b8fd8 100644
--- a/test/SILOptimizer/devirt_speculative.sil
+++ b/test/SILOptimizer/devirt_speculative.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt  | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt  | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirt_static_witness_method.sil b/test/SILOptimizer/devirt_static_witness_method.sil
index 958b9f7..091fa72 100644
--- a/test/SILOptimizer/devirt_static_witness_method.sil
+++ b/test/SILOptimizer/devirt_static_witness_method.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 sil_stage canonical
 
 import Builtin
diff --git a/test/SILOptimizer/devirt_try_apply.sil b/test/SILOptimizer/devirt_try_apply.sil
index a29a8dc..0aa3beb 100644
--- a/test/SILOptimizer/devirt_try_apply.sil
+++ b/test/SILOptimizer/devirt_try_apply.sil
@@ -1,6 +1,6 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer -inline  | FileCheck %s --check-prefix=CHECK-DEVIRT
-// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt  | FileCheck %s --check-prefix=CHECK-SPECDEVIRT
-// RUN: %target-sil-opt -enable-sil-verify-all %s -mandatory-inlining  | FileCheck %s --check-prefix=CHECK-MANDATORY-INLINING
+// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer -inline  | %FileCheck %s --check-prefix=CHECK-DEVIRT
+// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt  | %FileCheck %s --check-prefix=CHECK-SPECDEVIRT
+// RUN: %target-sil-opt -enable-sil-verify-all %s -mandatory-inlining  | %FileCheck %s --check-prefix=CHECK-MANDATORY-INLINING
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirt_unbound_generic.swift b/test/SILOptimizer/devirt_unbound_generic.swift
index 36b40d2..7f0210e 100644
--- a/test/SILOptimizer/devirt_unbound_generic.swift
+++ b/test/SILOptimizer/devirt_unbound_generic.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -O %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -O %s | %FileCheck %s
 
 // We used to crash on this when trying to devirtualize t.boo(a, 1),
 // because it is an "apply" with unbound generic arguments and
diff --git a/test/SILOptimizer/devirt_value_metatypes.swift b/test/SILOptimizer/devirt_value_metatypes.swift
index 356f1c3..92d2110 100644
--- a/test/SILOptimizer/devirt_value_metatypes.swift
+++ b/test/SILOptimizer/devirt_value_metatypes.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -O %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -O %s | %FileCheck %s
 
 open class A {
   @inline(never)
diff --git a/test/SILOptimizer/devirtualize.sil b/test/SILOptimizer/devirtualize.sil
index 9a1f784..f6c3e1d 100644
--- a/test/SILOptimizer/devirtualize.sil
+++ b/test/SILOptimizer/devirtualize.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer -dce | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer -dce | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirtualize1.swift b/test/SILOptimizer/devirtualize1.swift
index 072d9b4..2a8dc1f 100644
--- a/test/SILOptimizer/devirtualize1.swift
+++ b/test/SILOptimizer/devirtualize1.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -O -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend %s -O -emit-sil | %FileCheck %s
 
 class Bar<T> {
   var m_x : Int
diff --git a/test/SILOptimizer/devirtualize2.sil b/test/SILOptimizer/devirtualize2.sil
index 648be81..9f2d3c4 100644
--- a/test/SILOptimizer/devirtualize2.sil
+++ b/test/SILOptimizer/devirtualize2.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer -dce | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer -dce | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/devirtualize_existential.swift b/test/SILOptimizer/devirtualize_existential.swift
index c49514f..86c920e 100644
--- a/test/SILOptimizer/devirtualize_existential.swift
+++ b/test/SILOptimizer/devirtualize_existential.swift
@@ -1,7 +1,4 @@
-// RUN: %target-swift-frontend %s -O -emit-sil | not FileCheck %s
-
-// FIXME: Existential devirtualization needs to be updated to work with
-// open_existential_addr instructions. rdar://problem/18506660
+// RUN: %target-swift-frontend %s -O -emit-sil | %FileCheck %s
 
 protocol Pingable {
  func ping(_ x : Int);
@@ -15,7 +12,7 @@
 //CHECK-NOT: init_existential_addr
 //CHECK-NOT: apply
 //CHECK: return
-func interesting_stuff() {
+public func interesting_stuff() {
  var x : Pingable = Foo()
  x.ping(1)
 }
diff --git a/test/SILOptimizer/diagnose_unreachable.sil b/test/SILOptimizer/diagnose_unreachable.sil
index adabd7e..eebd62b 100644
--- a/test/SILOptimizer/diagnose_unreachable.sil
+++ b/test/SILOptimizer/diagnose_unreachable.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnose-unreachable | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnose-unreachable | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/diagnostic_constant_propagation_int.swift b/test/SILOptimizer/diagnostic_constant_propagation_int.swift
index b6b53fe..98049fe 100644
--- a/test/SILOptimizer/diagnostic_constant_propagation_int.swift
+++ b/test/SILOptimizer/diagnostic_constant_propagation_int.swift
@@ -1,4 +1,4 @@
-// RUN: not %target-swift-frontend -emit-sil %s 2>&1 | FileCheck --check-prefix=CHECK-%target-ptrsize %s
+// RUN: not %target-swift-frontend -emit-sil %s 2>&1 | %FileCheck --check-prefix=CHECK-%target-ptrsize %s
 
 // FIXME: This test should be merged back into
 // diagnostic_constant_propagation.swift when we have fixed:
diff --git a/test/SILOptimizer/eager_specialize.sil b/test/SILOptimizer/eager_specialize.sil
index a45b455..a67cee4 100644
--- a/test/SILOptimizer/eager_specialize.sil
+++ b/test/SILOptimizer/eager_specialize.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -eager-specializer  %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -eager-specializer  %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/earlycodemotion.sil b/test/SILOptimizer/earlycodemotion.sil
index 49508b8..a79ab00 100644
--- a/test/SILOptimizer/earlycodemotion.sil
+++ b/test/SILOptimizer/earlycodemotion.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all %s -early-codemotion -retain-sinking -disable-with-critical-edge=1 | FileCheck %s
+// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all %s -early-codemotion -retain-sinking -disable-with-critical-edge=1 | %FileCheck %s
 
 import Builtin
 
diff --git a/test/SILOptimizer/enum_jump_thread.sil b/test/SILOptimizer/enum_jump_thread.sil
index ce8aa7c..0563bfb 100644
--- a/test/SILOptimizer/enum_jump_thread.sil
+++ b/test/SILOptimizer/enum_jump_thread.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg -cse | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg -cse | %FileCheck %s
 
 // Test if jump-threading is done to combine two enum instructions
 // into a single block.
diff --git a/test/SILOptimizer/epilogue_arc_dumper.sil b/test/SILOptimizer/epilogue_arc_dumper.sil
index cd8fc7e..7730c94 100644
--- a/test/SILOptimizer/epilogue_arc_dumper.sil
+++ b/test/SILOptimizer/epilogue_arc_dumper.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -sil-epilogue-arc-dumper %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -sil-epilogue-arc-dumper %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/epilogue_release_dumper.sil b/test/SILOptimizer/epilogue_release_dumper.sil
index bb24c17..c02e7a5 100644
--- a/test/SILOptimizer/epilogue_release_dumper.sil
+++ b/test/SILOptimizer/epilogue_release_dumper.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -sil-epilogue-retain-release-dumper %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -sil-epilogue-retain-release-dumper %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/escape_analysis.sil b/test/SILOptimizer/escape_analysis.sil
index 1509e0d..baf9ad8 100644
--- a/test/SILOptimizer/escape_analysis.sil
+++ b/test/SILOptimizer/escape_analysis.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -escapes-dump -o /dev/null | FileCheck %s
+// RUN: %target-sil-opt %s -escapes-dump -o /dev/null | %FileCheck %s
 
 // REQUIRES: asserts
 
diff --git a/test/SILOptimizer/existential_type_propagation.sil b/test/SILOptimizer/existential_type_propagation.sil
index 903f724..a6b55ca 100644
--- a/test/SILOptimizer/existential_type_propagation.sil
+++ b/test/SILOptimizer/existential_type_propagation.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -inline -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -inline -sil-combine | %FileCheck %s
 
 // Check that type propagation is performed correctly for existentials.
 // The concrete type set in init_existential instructions should be propagated
diff --git a/test/SILOptimizer/external_defs_to_decls.sil b/test/SILOptimizer/external_defs_to_decls.sil
index 3337270..891e0c6 100644
--- a/test/SILOptimizer/external_defs_to_decls.sil
+++ b/test/SILOptimizer/external_defs_to_decls.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -external-defs-to-decls %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -external-defs-to-decls %s | %FileCheck %s
 
 // CHECK: sil @no_op : $@convention(thin) () -> ()
 sil public_external @no_op : $@convention(thin) () -> () {
diff --git a/test/SILOptimizer/fold_enums.sil b/test/SILOptimizer/fold_enums.sil
index e391745..cb922fb 100644
--- a/test/SILOptimizer/fold_enums.sil
+++ b/test/SILOptimizer/fold_enums.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 // Check that the optimizer can detect when an enum (e.g. Optional) is being deconstructed
 // and then recreated in the same form. It should replace it with the original value in
diff --git a/test/SILOptimizer/function_order.sil b/test/SILOptimizer/function_order.sil
index e902659..30853f7 100644
--- a/test/SILOptimizer/function_order.sil
+++ b/test/SILOptimizer/function_order.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -function-order-printer -o /dev/null | FileCheck --check-prefix=CHECK %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -function-order-printer -o /dev/null | %FileCheck --check-prefix=CHECK %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/functionsigopts.sil b/test/SILOptimizer/functionsigopts.sil
index aa2a04e..37072ea 100644
--- a/test/SILOptimizer/functionsigopts.sil
+++ b/test/SILOptimizer/functionsigopts.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -inline -function-signature-opts %s | FileCheck %s
-// RUN: %target-sil-opt -enable-sil-verify-all -inline -function-signature-opts %s | FileCheck -check-prefix=CHECK-NEGATIVE %s
+// RUN: %target-sil-opt -enable-sil-verify-all -inline -function-signature-opts %s | %FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -inline -function-signature-opts %s | %FileCheck -check-prefix=CHECK-NEGATIVE %s
 
 import Builtin
 import Swift
@@ -1300,6 +1300,53 @@
   return %9999 : $()
 }
 
+
+// CHECK-NEGATIVE-NOT: sil {{.*}}_dont_explode_single_enum
+
+sil [noinline] @dont_explode_single_enum : $@convention(thin) (@owned Optional<(foo, foo)>) -> @owned foo {
+bb0(%0 : $Optional<(foo, foo)>):
+  %281 = unchecked_enum_data %0 : $Optional<(foo, foo)>, #Optional.some!enumelt.1
+  %282 = tuple_extract %281 : $(foo, foo), 0
+  %283 = tuple_extract %281 : $(foo, foo), 1
+  strong_release %283 : $foo
+  return %282 : $foo
+}
+
+
+
+// CHECK-LABEL: sil @call_with_single_enum
+// CHECK: [[F:%[0-9]+]] = function_ref @dont_explode_single_enum : $@convention(thin) (@owned Optional<(foo, foo)>) -> @owned foo
+// CHECK: apply [[F]](%0)
+// CHECK: return
+sil @call_with_single_enum : $@convention(thin) (@owned Optional<(foo, foo)>) -> @owned foo {
+bb0(%0 : $Optional<(foo, foo)>):
+  %f = function_ref @dont_explode_single_enum : $@convention(thin) (@owned Optional<(foo, foo)>) -> @owned foo
+  %a = apply %f(%0) : $@convention(thin) (@owned Optional<(foo, foo)>) -> @owned foo
+  return %a : $foo
+}
+
+
+// Check if externally available functions are optimized.
+
+sil public_external [noinline] @externally_available_with_dead_arg : $@convention(thin) (@guaranteed foo) -> () {
+bb0(%0 : $foo):
+  %r = tuple()
+  return %r : $()
+}
+
+// CHECK-LABEL: sil @call_externally_available
+// CHECK: [[F:%[0-9]+]] = function_ref @_TTSf4d__externally_available_with_dead_arg : $@convention(thin) () -> ()
+// CHECK: apply [[F]]()
+// CHECK: return
+sil @call_externally_available : $@convention(thin) (@guaranteed foo) -> () {
+bb0(%0 : $foo):
+  %f = function_ref @externally_available_with_dead_arg : $@convention(thin) (@guaranteed foo) -> ()
+  %a = apply %f(%0) : $@convention(thin) (@guaranteed foo) -> ()
+  %r = tuple()
+  return %r : $()
+}
+
+
 // We should remove the array semantic from specialized calls.
 
 // CHECK-LABEL: sil [fragile] [thunk] [always_inline] [_semantics "array.foobar"] @array_semantic : $@convention(method) (@owned Builtin.NativeObject) -> () {
diff --git a/test/SILOptimizer/functionsigopts_self.swift b/test/SILOptimizer/functionsigopts_self.swift
index 2f07246..c80ca66 100644
--- a/test/SILOptimizer/functionsigopts_self.swift
+++ b/test/SILOptimizer/functionsigopts_self.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -sil-inline-threshold 0 -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -sil-inline-threshold 0 -emit-sil -primary-file %s | %FileCheck %s
 //
 // This is a .swift test because the SIL parser does not support Self.
 
diff --git a/test/SILOptimizer/functionsigopts_sroa.sil b/test/SILOptimizer/functionsigopts_sroa.sil
index a96fad1..abc8b2e 100644
--- a/test/SILOptimizer/functionsigopts_sroa.sil
+++ b/test/SILOptimizer/functionsigopts_sroa.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -inline -function-signature-opts %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -inline -function-signature-opts %s | %FileCheck %s
 
 import Builtin
 
diff --git a/test/SILOptimizer/global_property_opt.sil b/test/SILOptimizer/global_property_opt.sil
index c778320..b4a3c00 100644
--- a/test/SILOptimizer/global_property_opt.sil
+++ b/test/SILOptimizer/global_property_opt.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -global-property-opt %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -global-property-opt %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/global_property_opt_objc.sil b/test/SILOptimizer/global_property_opt_objc.sil
index c74fb16..100aa00 100644
--- a/test/SILOptimizer/global_property_opt_objc.sil
+++ b/test/SILOptimizer/global_property_opt_objc.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -global-property-opt %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -global-property-opt %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILOptimizer/globalopt.sil b/test/SILOptimizer/globalopt.sil
index 16a2a22..f489fa3 100644
--- a/test/SILOptimizer/globalopt.sil
+++ b/test/SILOptimizer/globalopt.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -global-opt | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -global-opt | %FileCheck %s
 //
 // ginit.cold has a hammock with an initializer call on the slow path.
 // ginit.loop has a loop containing an initializer call.
diff --git a/test/SILOptimizer/globalopt_global_propagation.swift b/test/SILOptimizer/globalopt_global_propagation.swift
index 507bc7e..a3c3edc 100644
--- a/test/SILOptimizer/globalopt_global_propagation.swift
+++ b/test/SILOptimizer/globalopt_global_propagation.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend  -O -emit-sil  %s | FileCheck %s
-// RUN: %target-swift-frontend  -O -wmo -emit-sil  %s | FileCheck -check-prefix=CHECK-WMO %s
+// RUN: %target-swift-frontend  -O -emit-sil  %s | %FileCheck %s
+// RUN: %target-swift-frontend  -O -wmo -emit-sil  %s | %FileCheck -check-prefix=CHECK-WMO %s
 
 // Check that values of internal and private global variables, which are provably assigned only 
 // once, are propagated into their uses and enable further optimizations like constant
diff --git a/test/SILOptimizer/globalopt_let_propagation.swift b/test/SILOptimizer/globalopt_let_propagation.swift
index f781a1b..932eb14 100644
--- a/test/SILOptimizer/globalopt_let_propagation.swift
+++ b/test/SILOptimizer/globalopt_let_propagation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend  -O -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend  -O -emit-sil -primary-file %s | %FileCheck %s
 
 // Check that values of static let and global let variables are propagated into their uses
 // and enable further optimizations like constant propagation, simplifications, etc.
diff --git a/test/SILOptimizer/high_level_cse.sil b/test/SILOptimizer/high_level_cse.sil
index b722065..7f32d5b 100644
--- a/test/SILOptimizer/high_level_cse.sil
+++ b/test/SILOptimizer/high_level_cse.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -high-level-cse | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -high-level-cse | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/high_level_licm.sil b/test/SILOptimizer/high_level_licm.sil
index 2154edd..b24855d 100644
--- a/test/SILOptimizer/high_level_licm.sil
+++ b/test/SILOptimizer/high_level_licm.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -high-level-licm | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -high-level-licm | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/inline_addressor.swift b/test/SILOptimizer/inline_addressor.swift
index 7bde395..c78e0a2 100644
--- a/test/SILOptimizer/inline_addressor.swift
+++ b/test/SILOptimizer/inline_addressor.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -parse-as-library -emit-sil -O | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -parse-as-library -emit-sil -O | %FileCheck %s
 
 var inputval = nonTrivialInit(false)
 
diff --git a/test/SILOptimizer/inline_caches.sil b/test/SILOptimizer/inline_caches.sil
index 2ba7404..ebbf88b 100644
--- a/test/SILOptimizer/inline_caches.sil
+++ b/test/SILOptimizer/inline_caches.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/inline_deep.swift b/test/SILOptimizer/inline_deep.swift
index 59df8b3..ffca360 100644
--- a/test/SILOptimizer/inline_deep.swift
+++ b/test/SILOptimizer/inline_deep.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 class S<T> {
   @inline(__always) func l0(_ x: T) -> T { return x }
diff --git a/test/SILOptimizer/inline_devirtualize_specialize.sil b/test/SILOptimizer/inline_devirtualize_specialize.sil
index 39b0c6f..42a8339 100644
--- a/test/SILOptimizer/inline_devirtualize_specialize.sil
+++ b/test/SILOptimizer/inline_devirtualize_specialize.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -devirtualizer -generic-specializer -dce | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer -generic-specializer -inline -dce | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/inline_heuristics.sil b/test/SILOptimizer/inline_heuristics.sil
index db3d8b5..da2fb4e 100644
--- a/test/SILOptimizer/inline_heuristics.sil
+++ b/test/SILOptimizer/inline_heuristics.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
-// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -debug-only=sil-inliner 2>%t/log | FileCheck %s
-// RUN: FileCheck %s --check-prefix=CHECK-LOG <%t/log
+// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -debug-only=sil-inliner 2>%t/log | %FileCheck %s
+// RUN: %FileCheck %s --check-prefix=CHECK-LOG <%t/log
 // REQUIRES: asserts
 
 // This test checks the inline heuristics based on the debug log output of
diff --git a/test/SILOptimizer/inline_recursive.swift b/test/SILOptimizer/inline_recursive.swift
index bae5d6b..360c3e3 100644
--- a/test/SILOptimizer/inline_recursive.swift
+++ b/test/SILOptimizer/inline_recursive.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s  -parse-as-library -emit-sil -O | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s  -parse-as-library -emit-sil -O | %FileCheck %s
 
 private func recFunc(_ x: Int32) -> Int32 {
   if x > 0 {
diff --git a/test/SILOptimizer/inline_self.swift b/test/SILOptimizer/inline_self.swift
index 652002c..e499be6 100644
--- a/test/SILOptimizer/inline_self.swift
+++ b/test/SILOptimizer/inline_self.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -emit-sil  -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -O -emit-sil  -primary-file %s | %FileCheck %s
 //
 // This is a .swift test because the SIL parser does not support Self.
 
diff --git a/test/SILOptimizer/inline_semantics.sil b/test/SILOptimizer/inline_semantics.sil
index c75c2b9..040983d 100644
--- a/test/SILOptimizer/inline_semantics.sil
+++ b/test/SILOptimizer/inline_semantics.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -early-inline -sil-inline-threshold=50 | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -early-inline -sil-inline-threshold=50 | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/inline_thunk.swift b/test/SILOptimizer/inline_thunk.swift
index 80af7e7..1fde85e 100644
--- a/test/SILOptimizer/inline_thunk.swift
+++ b/test/SILOptimizer/inline_thunk.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -parse-as-library -emit-ir -O | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -parse-as-library -emit-ir -O | %FileCheck %s
 
 // Two thunks are generated:
 // 1. from function signature opts
diff --git a/test/SILOptimizer/inline_tryApply.sil b/test/SILOptimizer/inline_tryApply.sil
index 0fbdcb6..eb4474a 100644
--- a/test/SILOptimizer/inline_tryApply.sil
+++ b/test/SILOptimizer/inline_tryApply.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -early-inline -sil-inline-threshold=50 | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -early-inline -sil-inline-threshold=50 | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/inlinecaches_arc.sil b/test/SILOptimizer/inlinecaches_arc.sil
index e41b976..322734c 100644
--- a/test/SILOptimizer/inlinecaches_arc.sil
+++ b/test/SILOptimizer/inlinecaches_arc.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  -sil-sort-output | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  -sil-sort-output | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/inlinecaches_objc.sil b/test/SILOptimizer/inlinecaches_objc.sil
index 61e2244..1a18490 100644
--- a/test/SILOptimizer/inlinecaches_objc.sil
+++ b/test/SILOptimizer/inlinecaches_objc.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/inliner_coldblocks.sil b/test/SILOptimizer/inliner_coldblocks.sil
index fb05dfb..e612cb2 100644
--- a/test/SILOptimizer/inliner_coldblocks.sil
+++ b/test/SILOptimizer/inliner_coldblocks.sil
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t && mkdir -p %t
-// RUN: %target-sil-opt -enable-sil-verify-all %s -inline | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -inline | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/inliner_spa.sil b/test/SILOptimizer/inliner_spa.sil
index bb730d0..fc58b67 100644
--- a/test/SILOptimizer/inliner_spa.sil
+++ b/test/SILOptimizer/inliner_spa.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-sil-opt %s -inline -print-shortest-path-info 2>%t/log >/dev/null
-// RUN: FileCheck %s <%t/log
+// RUN: %FileCheck %s <%t/log
 // REQUIRES: asserts
 
 sil_stage canonical
diff --git a/test/SILOptimizer/inout_deshadow.sil b/test/SILOptimizer/inout_deshadow.sil
index 7afbf78..8f87ff7 100644
--- a/test/SILOptimizer/inout_deshadow.sil
+++ b/test/SILOptimizer/inout_deshadow.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -inout-deshadow | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -inout-deshadow | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/inout_deshadow_integration.swift b/test/SILOptimizer/inout_deshadow_integration.swift
index 998752c..c80ecb1 100644
--- a/test/SILOptimizer/inout_deshadow_integration.swift
+++ b/test/SILOptimizer/inout_deshadow_integration.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-sil | %FileCheck %s
 
 // This is an integration check for the inout-deshadow pass, verifying that it
 // deshadows the inout variables in certain cases.  These test should not be
diff --git a/test/SILOptimizer/iv_info_printer.sil b/test/SILOptimizer/iv_info_printer.sil
index a3911bf..192ca1a 100644
--- a/test/SILOptimizer/iv_info_printer.sil
+++ b/test/SILOptimizer/iv_info_printer.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -iv-info-printer 2>&1 | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -iv-info-printer 2>&1 | %FileCheck %s
 
 // REQUIRES: asserts
 
diff --git a/test/SILOptimizer/latecodemotion.sil b/test/SILOptimizer/latecodemotion.sil
index eb92ceb..d8fb40a 100644
--- a/test/SILOptimizer/latecodemotion.sil
+++ b/test/SILOptimizer/latecodemotion.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -late-codemotion -release-hoisting -retain-sinking -disable-with-critical-edge=1  | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -late-codemotion -release-hoisting -retain-sinking -disable-with-critical-edge=1  | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/let_propagation.swift b/test/SILOptimizer/let_propagation.swift
index 44c7a22..f7b3cf1 100644
--- a/test/SILOptimizer/let_propagation.swift
+++ b/test/SILOptimizer/let_propagation.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s  -emit-sil -O | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s  -emit-sil -O | %FileCheck %s
 
 // Check that LoadStoreOpts can handle "let" variables properly.
 // Such variables should be loaded only once and their loaded values can be reused.
diff --git a/test/SILOptimizer/let_properties_opts.swift b/test/SILOptimizer/let_properties_opts.swift
index d485d2b..c540d01 100644
--- a/test/SILOptimizer/let_properties_opts.swift
+++ b/test/SILOptimizer/let_properties_opts.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend %s -O -emit-sil | FileCheck -check-prefix=CHECK-WMO %s
-// RUN: %target-swift-frontend -primary-file %s -O -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend %s -O -emit-sil | %FileCheck -check-prefix=CHECK-WMO %s
+// RUN: %target-swift-frontend -primary-file %s -O -emit-sil | %FileCheck %s
 
 // Test propagation of non-static let properties with compile-time constant values.
 
diff --git a/test/SILOptimizer/let_properties_opts_runtime.swift b/test/SILOptimizer/let_properties_opts_runtime.swift
index 74f6f3c..24d053b 100644
--- a/test/SILOptimizer/let_properties_opts_runtime.swift
+++ b/test/SILOptimizer/let_properties_opts_runtime.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -O  %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s -check-prefix=CHECK-OUTPUT
+// RUN: %target-run %t/a.out | %FileCheck %s -check-prefix=CHECK-OUTPUT
 // RUN: %target-build-swift -O -wmo %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s -check-prefix=CHECK-OUTPUT
+// RUN: %target-run %t/a.out | %FileCheck %s -check-prefix=CHECK-OUTPUT
 // REQUIRES: executable_test
 
 // Check that in optimized builds the compiler generates correct code for
diff --git a/test/SILOptimizer/licm.sil b/test/SILOptimizer/licm.sil
index 2630ab0..65203c5 100644
--- a/test/SILOptimizer/licm.sil
+++ b/test/SILOptimizer/licm.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -licm | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -licm | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/licm_apply.sil b/test/SILOptimizer/licm_apply.sil
index a19b429..376e695 100644
--- a/test/SILOptimizer/licm_apply.sil
+++ b/test/SILOptimizer/licm_apply.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -licm | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -licm | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/linker.swift b/test/SILOptimizer/linker.swift
index 69d6b62..87580bf 100644
--- a/test/SILOptimizer/linker.swift
+++ b/test/SILOptimizer/linker.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module %S/Inputs/linker_pass_input.swift -o %t/Swift.swiftmodule -parse-stdlib -parse-as-library -module-name Swift -sil-serialize-all -module-link-name swiftCore
-// RUN: %target-swift-frontend %s -O -I %t -sil-debug-serialization -o - -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend %s -O -I %t -sil-debug-serialization -o - -emit-sil | %FileCheck %s
 
 // CHECK: sil public_external [fragile] @_TFs11doSomethingFT_T_ : $@convention(thin) () -> () {
 doSomething()
diff --git a/test/SILOptimizer/loop-region-analysis.sil b/test/SILOptimizer/loop-region-analysis.sil
index 85cfcb9..d64233d 100644
--- a/test/SILOptimizer/loop-region-analysis.sil
+++ b/test/SILOptimizer/loop-region-analysis.sil
@@ -1,6 +1,6 @@
 // All bbs should have IDs that match the rpo order put out when printing with -sil-sort-output
 
-// RUN: %target-sil-opt %s -module-name Swift -loop-region-view-text -o /dev/null | FileCheck %s
+// RUN: %target-sil-opt %s -module-name Swift -loop-region-view-text -o /dev/null | %FileCheck %s
 
 import Builtin
 
diff --git a/test/SILOptimizer/loop_canonicalizer.sil b/test/SILOptimizer/loop_canonicalizer.sil
index f2446e7..560fe21 100644
--- a/test/SILOptimizer/loop_canonicalizer.sil
+++ b/test/SILOptimizer/loop_canonicalizer.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -compute-dominance-info -compute-loop-info -loop-canonicalizer %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -compute-dominance-info -compute-loop-info -loop-canonicalizer %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/loop_info_printer.sil b/test/SILOptimizer/loop_info_printer.sil
index 166477d..09305d8 100644
--- a/test/SILOptimizer/loop_info_printer.sil
+++ b/test/SILOptimizer/loop_info_printer.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -loop-info-printer 2>&1 | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -loop-info-printer 2>&1 | %FileCheck %s
 
 // REQUIRES: asserts
 
diff --git a/test/SILOptimizer/loop_unroll.sil b/test/SILOptimizer/loop_unroll.sil
index 2f55bdc..100f8b5 100644
--- a/test/SILOptimizer/loop_unroll.sil
+++ b/test/SILOptimizer/loop_unroll.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -loop-unroll %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -loop-unroll %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/looprotate.sil b/test/SILOptimizer/looprotate.sil
index 8f90f64..5bd9532 100644
--- a/test/SILOptimizer/looprotate.sil
+++ b/test/SILOptimizer/looprotate.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -loop-rotate %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -loop-rotate %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/loweraggregateinstrs.sil b/test/SILOptimizer/loweraggregateinstrs.sil
index 83c3f33..65f9785 100644
--- a/test/SILOptimizer/loweraggregateinstrs.sil
+++ b/test/SILOptimizer/loweraggregateinstrs.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -lower-aggregate-instrs | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -lower-aggregate-instrs | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/lslocation_expansion.sil b/test/SILOptimizer/lslocation_expansion.sil
index f84c7e0..5d7838a 100644
--- a/test/SILOptimizer/lslocation_expansion.sil
+++ b/test/SILOptimizer/lslocation_expansion.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -lslocation-dump -ml=only-expansion | FileCheck %s
+// RUN: %target-sil-opt %s -lslocation-dump -ml=only-expansion | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/lslocation_reduction.sil b/test/SILOptimizer/lslocation_reduction.sil
index 909fedb..8249812 100644
--- a/test/SILOptimizer/lslocation_reduction.sil
+++ b/test/SILOptimizer/lslocation_reduction.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -lslocation-dump -ml=only-reduction | FileCheck %s
+// RUN: %target-sil-opt %s -lslocation-dump -ml=only-reduction | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/lslocation_type_only_expansion.sil b/test/SILOptimizer/lslocation_type_only_expansion.sil
index 3bea193..3eb6e39 100644
--- a/test/SILOptimizer/lslocation_type_only_expansion.sil
+++ b/test/SILOptimizer/lslocation_type_only_expansion.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt %s -lslocation-dump -ml=only-type-expansion | FileCheck %s
-// RUN: %target-sil-opt %s -lslocation-dump-use-new-projection -lslocation-dump -ml=only-type-expansion | FileCheck %s
+// RUN: %target-sil-opt %s -lslocation-dump -ml=only-type-expansion | %FileCheck %s
+// RUN: %target-sil-opt %s -lslocation-dump-use-new-projection -lslocation-dump -ml=only-type-expansion | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/mandatory_inlining.sil b/test/SILOptimizer/mandatory_inlining.sil
index 55a65a6..6cf6f84 100644
--- a/test/SILOptimizer/mandatory_inlining.sil
+++ b/test/SILOptimizer/mandatory_inlining.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -mandatory-inlining | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -mandatory-inlining | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/mandatory_inlining.swift b/test/SILOptimizer/mandatory_inlining.swift
index 2345c5d..15c9e01 100644
--- a/test/SILOptimizer/mandatory_inlining.swift
+++ b/test/SILOptimizer/mandatory_inlining.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-sil -o - -verify | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-sil -o - -verify | %FileCheck %s
 
 // These tests are deliberately shallow, because I do not want to depend on the
 // specifics of SIL generation, which might change for reasons unrelated to this
diff --git a/test/SILOptimizer/mandatory_nil_comparison_inlining.swift b/test/SILOptimizer/mandatory_nil_comparison_inlining.swift
index acd2398..dbfd712 100644
--- a/test/SILOptimizer/mandatory_nil_comparison_inlining.swift
+++ b/test/SILOptimizer/mandatory_nil_comparison_inlining.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-sil -o - -verify | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-sil -o - -verify | %FileCheck %s
 
 
 // CHECK-LABEL: sil {{.*}} @{{.*}}generic_func
diff --git a/test/SILOptimizer/mem-behavior.sil b/test/SILOptimizer/mem-behavior.sil
index bfc885d..a5cf093 100644
--- a/test/SILOptimizer/mem-behavior.sil
+++ b/test/SILOptimizer/mem-behavior.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -aa=basic-aa -mem-behavior-dump -o /dev/null | FileCheck %s
+// RUN: %target-sil-opt %s -aa=basic-aa -mem-behavior-dump -o /dev/null | %FileCheck %s
 
 // REQUIRES: asserts
 
diff --git a/test/SILOptimizer/mem2reg.sil b/test/SILOptimizer/mem2reg.sil
index 0e716f1..cf95203 100644
--- a/test/SILOptimizer/mem2reg.sil
+++ b/test/SILOptimizer/mem2reg.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -mem2reg | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -mem2reg | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/mem2reg_liveness.sil b/test/SILOptimizer/mem2reg_liveness.sil
index 7833a24..a12976b 100644
--- a/test/SILOptimizer/mem2reg_liveness.sil
+++ b/test/SILOptimizer/mem2reg_liveness.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -mem2reg | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -mem2reg | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/mem2reg_simple.sil b/test/SILOptimizer/mem2reg_simple.sil
index d6266a0..42a1510 100644
--- a/test/SILOptimizer/mem2reg_simple.sil
+++ b/test/SILOptimizer/mem2reg_simple.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -mem2reg | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -mem2reg | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/merge_cond_fail.sil b/test/SILOptimizer/merge_cond_fail.sil
index c2cf7bd..b298de2 100644
--- a/test/SILOptimizer/merge_cond_fail.sil
+++ b/test/SILOptimizer/merge_cond_fail.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -merge-cond_fails | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -merge-cond_fails | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/mm_inlinecaches_multiple.sil b/test/SILOptimizer/mm_inlinecaches_multiple.sil
index fe93c19..f5168d0 100644
--- a/test/SILOptimizer/mm_inlinecaches_multiple.sil
+++ b/test/SILOptimizer/mm_inlinecaches_multiple.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  | FileCheck %s
-// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  -wmo | FileCheck --check-prefix=CHECK-WMO %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  | %FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  -wmo | %FileCheck --check-prefix=CHECK-WMO %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/move_cond_fail.sil b/test/SILOptimizer/move_cond_fail.sil
index 5c59970..0e154dc 100644
--- a/test/SILOptimizer/move_cond_fail.sil
+++ b/test/SILOptimizer/move_cond_fail.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -licm | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -licm | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/move_cond_fail_simplify_cfg.sil b/test/SILOptimizer/move_cond_fail_simplify_cfg.sil
index ede272b..fc3dc15 100644
--- a/test/SILOptimizer/move_cond_fail_simplify_cfg.sil
+++ b/test/SILOptimizer/move_cond_fail_simplify_cfg.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -move-cond-fail-to-preds | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -move-cond-fail-to-preds | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/no-external-defs-onone.sil b/test/SILOptimizer/no-external-defs-onone.sil
index e79bbb1..8049405 100644
--- a/test/SILOptimizer/no-external-defs-onone.sil
+++ b/test/SILOptimizer/no-external-defs-onone.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -module-name=test -Onone -emit-ir %s | FileCheck %s
+// RUN: %target-swift-frontend -module-name=test -Onone -emit-ir %s | %FileCheck %s
 
 // CHECK-DAG: define linkonce_odr hidden void @shared_external_test()
 // CHECK-DAG: declare void @public_external_test()
diff --git a/test/SILOptimizer/no_opt.swift b/test/SILOptimizer/no_opt.swift
index 675822f..f6e2030 100644
--- a/test/SILOptimizer/no_opt.swift
+++ b/test/SILOptimizer/no_opt.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 func bar(_ x : Int) { }
 
diff --git a/test/SILOptimizer/noreturn_folding.sil b/test/SILOptimizer/noreturn_folding.sil
index b995c94..7cdbea8 100644
--- a/test/SILOptimizer/noreturn_folding.sil
+++ b/test/SILOptimizer/noreturn_folding.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all -noreturn-folding < %s | FileCheck %s
+// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all -noreturn-folding < %s | %FileCheck %s
 
 import Builtin
 
diff --git a/test/SILOptimizer/optimize_never.sil b/test/SILOptimizer/optimize_never.sil
index 7a17a06..dec22df 100644
--- a/test/SILOptimizer/optimize_never.sil
+++ b/test/SILOptimizer/optimize_never.sil
@@ -1,5 +1,5 @@
 // RUN: %target-sil-opt -enable-sil-verify-all -inline -generic-specializer -inline %s > %t.sil
-// RUN: %target-sil-opt -sil-full-demangle -enable-sil-verify-all -specdevirt %t.sil | FileCheck %s
+// RUN: %target-sil-opt -sil-full-demangle -enable-sil-verify-all -specdevirt %t.sil | %FileCheck %s
 
 // Check that the  @_semantics("optimize.sil.never") annotation prevents
 // any optimizations of the annotated function:
diff --git a/test/SILOptimizer/pa_removal.sil b/test/SILOptimizer/pa_removal.sil
index 5c23834..29ad787 100644
--- a/test/SILOptimizer/pa_removal.sil
+++ b/test/SILOptimizer/pa_removal.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/peephole_thick_to_objc_metatype.sil b/test/SILOptimizer/peephole_thick_to_objc_metatype.sil
index 88e3c45..136c56c 100644
--- a/test/SILOptimizer/peephole_thick_to_objc_metatype.sil
+++ b/test/SILOptimizer/peephole_thick_to_objc_metatype.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILOptimizer/peephole_trunc_and_ext.sil b/test/SILOptimizer/peephole_trunc_and_ext.sil
index 6d867f9..c52280e 100644
--- a/test/SILOptimizer/peephole_trunc_and_ext.sil
+++ b/test/SILOptimizer/peephole_trunc_and_ext.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend %s -emit-sil -O -o - -verify | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-sil -O -o - -verify | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/performance_inliner.sil b/test/SILOptimizer/performance_inliner.sil
index 245b83f..d35b60f 100644
--- a/test/SILOptimizer/performance_inliner.sil
+++ b/test/SILOptimizer/performance_inliner.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -sil-combine | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/polymorphic_inline_caches.sil b/test/SILOptimizer/polymorphic_inline_caches.sil
index 83e159d..b4311f9 100644
--- a/test/SILOptimizer/polymorphic_inline_caches.sil
+++ b/test/SILOptimizer/polymorphic_inline_caches.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  -dce -early-codemotion -disable-sil-cm-rr-cm=0  -retain-sinking | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -specdevirt -code-sinking  -dce -early-codemotion -disable-sil-cm-rr-cm=0  -retain-sinking | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/predictable_memopt.sil b/test/SILOptimizer/predictable_memopt.sil
index 45298d0..4008e2a 100644
--- a/test/SILOptimizer/predictable_memopt.sil
+++ b/test/SILOptimizer/predictable_memopt.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -predictable-memopt  | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -predictable-memopt  | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/predictable_memopt_unreferenceable_storage.swift b/test/SILOptimizer/predictable_memopt_unreferenceable_storage.swift
index 829e844..df2f152 100644
--- a/test/SILOptimizer/predictable_memopt_unreferenceable_storage.swift
+++ b/test/SILOptimizer/predictable_memopt_unreferenceable_storage.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil %s | %FileCheck %s
 
 import ctypes
 struct S {
diff --git a/test/SILOptimizer/prespecialization_with_definition.sil b/test/SILOptimizer/prespecialization_with_definition.sil
index fccad8f..eb94d9c 100644
--- a/test/SILOptimizer/prespecialization_with_definition.sil
+++ b/test/SILOptimizer/prespecialization_with_definition.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-ir %s -module-name main | FileCheck %s
+// RUN: %target-swift-frontend -emit-ir %s -module-name main | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/prespecialize.swift b/test/SILOptimizer/prespecialize.swift
index c3d4b5d..96b9d08 100644
--- a/test/SILOptimizer/prespecialize.swift
+++ b/test/SILOptimizer/prespecialize.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend  %s -Onone  -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend  %s -Onone  -emit-sil | %FileCheck %s
 
 // REQUIRES: optimized_stdlib
 
diff --git a/test/SILOptimizer/protocol_lookup.swift b/test/SILOptimizer/protocol_lookup.swift
index 78e5f68..5b9cb49 100644
--- a/test/SILOptimizer/protocol_lookup.swift
+++ b/test/SILOptimizer/protocol_lookup.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil -primary-file %s | %FileCheck %s
 
 // Check that this file can be compiled using -O at all (it used to crash due to a bug in the SILCloner)
 // Check that it can be compiled correctly.
diff --git a/test/SILOptimizer/pure_apply.swift b/test/SILOptimizer/pure_apply.swift
index 9141f0b..6995a85 100644
--- a/test/SILOptimizer/pure_apply.swift
+++ b/test/SILOptimizer/pure_apply.swift
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/rcidentity.sil b/test/SILOptimizer/rcidentity.sil
index 54b1188..fcd7cdf 100644
--- a/test/SILOptimizer/rcidentity.sil
+++ b/test/SILOptimizer/rcidentity.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -rc-id-dumper %s -o /dev/null | FileCheck %s
+// RUN: %target-sil-opt -rc-id-dumper %s -o /dev/null | %FileCheck %s
 
 import Builtin
 
diff --git a/test/SILOptimizer/recursive_func.sil b/test/SILOptimizer/recursive_func.sil
index 5766e6c..d196e8b 100644
--- a/test/SILOptimizer/recursive_func.sil
+++ b/test/SILOptimizer/recursive_func.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O %s  -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -O %s  -emit-sil | %FileCheck %s
 
 // rdar://16761933
 // Make sure we can handle recursive function within a class.
diff --git a/test/SILOptimizer/recursive_single.sil b/test/SILOptimizer/recursive_single.sil
index ccab975..d19bd6a 100644
--- a/test/SILOptimizer/recursive_single.sil
+++ b/test/SILOptimizer/recursive_single.sil
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O %s -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -O %s -emit-sil | %FileCheck %s
 
 // rdar://16761933
 // Make sure we can handle recursive function within a class that
diff --git a/test/SILOptimizer/redundant_load_and_dead_store_elim.sil b/test/SILOptimizer/redundant_load_and_dead_store_elim.sil
index c2303d5..64d8ad6 100644
--- a/test/SILOptimizer/redundant_load_and_dead_store_elim.sil
+++ b/test/SILOptimizer/redundant_load_and_dead_store_elim.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -redundant-load-elim -dead-store-elim | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -redundant-load-elim -dead-store-elim | %FileCheck %s
 
 // NOTE, the order redundant-load and dead-store are ran is important. we have a pass dependence for some
 // of the tests to work.
diff --git a/test/SILOptimizer/redundant_load_elim.sil b/test/SILOptimizer/redundant_load_elim.sil
index eb0a0ab..3401cde 100644
--- a/test/SILOptimizer/redundant_load_elim.sil
+++ b/test/SILOptimizer/redundant_load_elim.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -redundant-load-elim | FileCheck %s 
+// RUN: %target-sil-opt -enable-sil-verify-all %s -redundant-load-elim | %FileCheck %s 
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/globalredundantloadelimination.sil b/test/SILOptimizer/redundant_load_elim_with_casts.sil
similarity index 93%
rename from test/SILOptimizer/globalredundantloadelimination.sil
rename to test/SILOptimizer/redundant_load_elim_with_casts.sil
index 57ab343..1d483d5 100644
--- a/test/SILOptimizer/globalredundantloadelimination.sil
+++ b/test/SILOptimizer/redundant_load_elim_with_casts.sil
@@ -1,5 +1,12 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -module-name Swift -redundant-load-elim
-// FIXME: This test is not FileCheck'd
+// RUN: %target-sil-opt -enable-sil-verify-all %s -module-name Swift -redundant-load-elim | %FileCheck -check-prefix=CHECK-FUTURE %s
+//
+// FIXME: Contains tests which are handled by old RLE, but not current one. Mostly due to casting. Eventually we probably should
+// handle these cases if they turn out to be important. 
+//
+// The problem is the current RLE uses type projection tree/path to model fields in an object. This makes it difficult for it to
+// reason about casts, i.e. 1 memory with different types.
+//
+// Tracked by rdar://23023366
 
 import Builtin
 
@@ -59,7 +66,7 @@
   var value : Builtin.Int32
 }
 
-// CHECK-LABEL: sil @tbaa_class_alias_nonclass
+// CHECK-FUTURE: sil @tbaa_class_alias_nonclass
 // CHECK: strong_retain [[RET:%[0-9]+]]
 // CHECK: strong_retain [[RET]]
 // CHECK: return
@@ -79,7 +86,7 @@
 }
 
 // FIXME: When RLE uses TBAA it should remove the second load.
-// CHECK-LABEL: sil @tbaa_struct
+// CHECK-FUTURE: sil @tbaa_struct
 // CHECK: load
 // CHECK: store
 // CHECK: load
@@ -96,7 +103,7 @@
 }
 
 // Even with TBAA, RLE should not remove the second load.
-// CHECK-LABEL: sil @tbaa_bind_memory
+// CHECK-FUTURE: sil @tbaa_bind_memory
 // CHECK: load
 // CHECK: bind_memory
 // CHECK: store
@@ -118,7 +125,7 @@
 }
 
 // *NOTE* This does not handle raw pointer since raw pointer is only layout compatible with heap references.
-// CHECK-LABEL: sil @store_to_load_forward_unchecked_addr_cast_struct : $@convention(thin) (Optional<A>) -> () {
+// CHECK-FUTURE: sil @store_to_load_forward_unchecked_addr_cast_struct : $@convention(thin) (Optional<A>) -> () {
 // CHECK: bb0([[INPUT:%[0-9]+]]
 // CHECK-NEXT: [[LOCAL:%[0-9]+]] = alloc_stack
 // CHECK: unchecked_trivial_bit_cast [[INPUT]] : $Optional<A> to $Builtin.Int32
@@ -161,7 +168,7 @@
 // source type is known to be greater or equal to the size of the
 // destination type.
 //
-// CHECK-LABEL: sil @store_to_load_forward_unchecked_addr_cast_nopromote : $@convention(thin) (@inout IntPtr) -> () {
+// CHECK-FUTURE: sil @store_to_load_forward_unchecked_addr_cast_nopromote : $@convention(thin) (@inout IntPtr) -> () {
 // CHECK: bb0([[INPUT:%[0-9]+]] : $*IntPtr)
 // CHECK-NEXT: [[LOCAL:%[0-9]+]] = alloc_stack
 // CHECK: [[CAST:%[0-9]+]] = unchecked_addr_cast [[INPUT]] : $*IntPtr to $*Builtin.Int32
@@ -185,7 +192,7 @@
 // compatible with heap references, but does not have reference
 // semantics b/c it is a trivial type. We currently do not handle such a case.
 
-// CHECK-LABEL: sil @store_to_load_forward_unchecked_addr_cast_class : $@convention(thin) (Optional<B>) -> () {
+// CHECK-FUTURE: sil @store_to_load_forward_unchecked_addr_cast_class : $@convention(thin) (Optional<B>) -> () {
 // CHECK: bb0([[INPUT:%[0-9]+]]
 // CHECK-NEXT: [[LOCAL:%[0-9]+]] = alloc_stack
 // CHECK: unchecked_trivial_bit_cast [[INPUT]] : $Optional<B> to $Builtin.Int32
@@ -221,7 +228,7 @@
 }
 
 // *NOTE* This does not handle raw pointer since raw pointer is only layout compatible with heap references.
-// CHECK-LABEL: sil @load_to_load_forward_unchecked_addr_cast_struct : $@convention(thin) (@inout Optional<A>) -> () {
+// CHECK-FUTURE: sil @load_to_load_forward_unchecked_addr_cast_struct : $@convention(thin) (@inout Optional<A>) -> () {
 // CHECK: bb0(
 
 // CHECK: unchecked_trivial_bit_cast {{%[0-9]+}} : $Optional<A> to $Builtin.Int32
@@ -256,7 +263,7 @@
 // compatible with heap references, but does not have reference
 // semantics b/c it is a trivial type. We currently do not handle such a case.
 
-// CHECK-LABEL: sil @load_to_load_forward_unchecked_addr_cast_class : $@convention(thin) (@inout Optional<B>) -> () {
+// CHECK-FUTURE: sil @load_to_load_forward_unchecked_addr_cast_class : $@convention(thin) (@inout Optional<B>) -> () {
 // CHECK: bb0({{%[0-9]+}} : $*Optional<B>):
 // CHECK: unchecked_trivial_bit_cast {{%[0-9]+}} : $Optional<B> to $Builtin.Int32
 // CHECK: unchecked_ref_bit_cast {{%[0-9]+}} : $Optional<B> to $B
@@ -287,7 +294,7 @@
 }
 
 // Don't bitcast differently sized structs.
-// CHECK-LABEL: sil @store_to_load_forward_unchecked_addr_cast_different_sized_struct
+// CHECK-FUTURE: sil @store_to_load_forward_unchecked_addr_cast_different_sized_struct
 // CHECK-NOT: unchecked_trivial_bit_cast
 // CHECK: return
 sil @store_to_load_forward_unchecked_addr_cast_different_sized_struct : $@convention(thin) (C) -> () {
@@ -303,7 +310,7 @@
 
 
 /// Make sure that we don't crash and don't optimize here.
-// CHECK-LABEL: sil @covering_store_with_unchecked_addr : $@convention(thin) (C, C) -> () {
+// CHECK-FUTURE: sil @covering_store_with_unchecked_addr : $@convention(thin) (C, C) -> () {
 // CHECK-NOT: unchecked_trivial_bit_cast
 // CHECK: unchecked_addr_cast
 // CHECK-NOT: unchecked_trivial_bit_cast
@@ -338,7 +345,7 @@
 /// 4. %5 can write to memory, so we try to check if it can alias %0#1. We look
 /// up the load that was erased and will use it in a memory unsafe way.
 //
-// CHECK-LABEL: sil @invalidate_dead_loads_with_only_store_user_correctly : $@convention(thin) () -> () {
+// CHECK-FUTURE: sil @invalidate_dead_loads_with_only_store_user_correctly : $@convention(thin) () -> () {
 // CHECK-NOT: load
 // CHECK-NOT: {{%.*}} = store
 sil @invalidate_dead_loads_with_only_store_user_correctly : $@convention(thin) () -> () {
@@ -361,7 +368,7 @@
 
 // Ensure we don't forward the stored value from the switch_enum
 // branches past the inout appearance of the stored-to location.
-// CHECK-LABEL: sil @bad_store_forward
+// CHECK-FUTURE: sil @bad_store_forward
 sil @bad_store_forward : $@convention(thin) (@guaranteed Optional<HoldsRef>) -> () {
 // CHECK: bb0
 bb0(%0 : $Optional<HoldsRef>):
@@ -409,7 +416,7 @@
 // We internally use a map vector to represent stores. This means that when we iterate over
 // the stores it should be in insertion order. Use this to test whether or not we only set
 // the no-dependency bit if we do not forward a load.
-// CHECK-LABEL: sil @test_unchecked_addr_cast_3
+// CHECK-FUTURE: sil @test_unchecked_addr_cast_3
 // CHECK: bb0([[ARG1:%.*]] : $D, [[ARG2:%.*]] : $D):
 // CHECK-NEXT: [[BOX1:%.*]] = alloc_stack $D
 // CHECK-NEXT: [[BOX2:%.*]] = alloc_stack $D
@@ -441,7 +448,7 @@
 // ((A, B), C) -> (A, B) is safe
 // ((A, B), C) -> (A, B, C) is NOT safe
 //
-// CHECK-LABEL: sil @unchecked_addr_cast_tuple_promote
+// CHECK-FUTURE: sil @unchecked_addr_cast_tuple_promote
 // CHECK: bb0(%0 : $*(Builtin.Int32, Builtin.Int32, Builtin.Int32), %1 : $*((Builtin.Int32, Builtin.Int32), Builtin.Int32)):
 // CHECK: load %0 : $*(Builtin.Int32, Builtin.Int32, Builtin.Int32)
 // CHECK: alloc_stack $(Builtin.Int32, Builtin.Int32, Builtin.Int32)
@@ -512,7 +519,7 @@
 // ((A, B), C) -> (A, B) is safe
 // ((A, B), C) -> (A, B, C) is NOT safe
 //
-// CHECK-LABEL: sil @forward_tuple_elements
+// CHECK-FUTURE: sil @forward_tuple_elements
 // CHECK: tuple_element_addr
 // CHECK: tuple_element_addr
 // CHECK: tuple_element_addr
diff --git a/test/SILOptimizer/ref_elt_addr.sil b/test/SILOptimizer/ref_elt_addr.sil
index 473ff89..37fe64a 100644
--- a/test/SILOptimizer/ref_elt_addr.sil
+++ b/test/SILOptimizer/ref_elt_addr.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -cse | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -cse | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/remove_pins.sil b/test/SILOptimizer/remove_pins.sil
index 65f1f0e..611cfda 100644
--- a/test/SILOptimizer/remove_pins.sil
+++ b/test/SILOptimizer/remove_pins.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -remove-pins %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -remove-pins %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/remove_unused_func.sil b/test/SILOptimizer/remove_unused_func.sil
index eb600f9..e3f5507 100644
--- a/test/SILOptimizer/remove_unused_func.sil
+++ b/test/SILOptimizer/remove_unused_func.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-deadfuncelim | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-deadfuncelim | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/retain_release_code_motion.sil b/test/SILOptimizer/retain_release_code_motion.sil
index 5a4ca7e..eb4c903 100644
--- a/test/SILOptimizer/retain_release_code_motion.sil
+++ b/test/SILOptimizer/retain_release_code_motion.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -retain-sinking -late-release-hoisting %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -retain-sinking -late-release-hoisting %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/return.swift b/test/SILOptimizer/return.swift
index 102d58a..6fd7255 100644
--- a/test/SILOptimizer/return.swift
+++ b/test/SILOptimizer/return.swift
@@ -9,6 +9,32 @@
   y += 1
 } // expected-error {{missing return in a function expected to return 'Int'}}
 
+enum NoCasesButNotNever {}
+
+func diagnoseNoCaseEnumMissingReturn() -> NoCasesButNotNever {
+} // expected-error {{function with uninhabited return type 'NoCasesButNotNever' is missing call to another never-returning function on all paths}} 
+
+func diagnoseNeverMissingBody() -> Never {
+} // expected-error {{function with uninhabited return type 'Never' is missing call to another never-returning function on all paths}} 
+
+_ = { () -> Never in
+}() // expected-error {{closure with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}-
+
+func diagnoseNeverWithBody(i : Int) -> Never {
+  if (i == -1) {
+    print("Oh no!")
+  } else {
+    switch i {
+    case 0:
+      exit()
+    case 1:
+      fatalError()
+    default:
+      repeat { } while true 
+    } 
+  }
+} // expected-error {{function with uninhabited return type 'Never' is missing call to another never-returning function on all paths}}
+
 class MyClassWithClosure {
   var f : (_ s: String) -> String = { (_ s: String) -> String in } // expected-error {{missing return in a closure expected to return 'String'}}
 }
diff --git a/test/SILOptimizer/select_enum_addr_reads_memory.sil b/test/SILOptimizer/select_enum_addr_reads_memory.sil
index 2995da1..339e6c1 100644
--- a/test/SILOptimizer/select_enum_addr_reads_memory.sil
+++ b/test/SILOptimizer/select_enum_addr_reads_memory.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -loop-rotate %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -loop-rotate %s | %FileCheck %s
 
 import Builtin
 
diff --git a/test/SILOptimizer/side-effect.sil b/test/SILOptimizer/side-effect.sil
index 98b212d..80eae03 100644
--- a/test/SILOptimizer/side-effect.sil
+++ b/test/SILOptimizer/side-effect.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -module-name Swift -side-effects-dump -o /dev/null | FileCheck %s
+// RUN: %target-sil-opt %s -module-name Swift -side-effects-dump -o /dev/null | %FileCheck %s
 
 // REQUIRES: asserts
 
diff --git a/test/SILOptimizer/sil_combine.sil b/test/SILOptimizer/sil_combine.sil
index d5e06fd..3ab6819 100644
--- a/test/SILOptimizer/sil_combine.sil
+++ b/test/SILOptimizer/sil_combine.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -verify-skip-unreachable-must-be-last | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -verify-skip-unreachable-must-be-last | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/sil_combine_bitops.sil b/test/SILOptimizer/sil_combine_bitops.sil
index fa00de7..4126846 100644
--- a/test/SILOptimizer/sil_combine_bitops.sil
+++ b/test/SILOptimizer/sil_combine_bitops.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 // Test optimizations for binary bit operations.
 
diff --git a/test/SILOptimizer/sil_combine_devirt.sil b/test/SILOptimizer/sil_combine_devirt.sil
index adc3ada..c819238 100644
--- a/test/SILOptimizer/sil_combine_devirt.sil
+++ b/test/SILOptimizer/sil_combine_devirt.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -devirtualizer | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/sil_combine_enum_addr.sil b/test/SILOptimizer/sil_combine_enum_addr.sil
index 5c2aa8d..9e6da8e 100644
--- a/test/SILOptimizer/sil_combine_enum_addr.sil
+++ b/test/SILOptimizer/sil_combine_enum_addr.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -simplify-cfg | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -simplify-cfg | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/sil_combine_enums.sil b/test/SILOptimizer/sil_combine_enums.sil
index e47f467..b59c803 100644
--- a/test/SILOptimizer/sil_combine_enums.sil
+++ b/test/SILOptimizer/sil_combine_enums.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/sil_combine_objc.sil b/test/SILOptimizer/sil_combine_objc.sil
index e22bb16..d92af47 100644
--- a/test/SILOptimizer/sil_combine_objc.sil
+++ b/test/SILOptimizer/sil_combine_objc.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -verify-skip-unreachable-must-be-last | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -verify-skip-unreachable-must-be-last | %FileCheck %s
 // REQUIRES: objc_interop
 
 sil_stage canonical
diff --git a/test/SILOptimizer/sil_combine_objc_bridge.sil b/test/SILOptimizer/sil_combine_objc_bridge.sil
index 7f6b89b..58521df 100644
--- a/test/SILOptimizer/sil_combine_objc_bridge.sil
+++ b/test/SILOptimizer/sil_combine_objc_bridge.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILOptimizer/sil_combine_same_ops.sil b/test/SILOptimizer/sil_combine_same_ops.sil
index 512f871..33ba113 100644
--- a/test/SILOptimizer/sil_combine_same_ops.sil
+++ b/test/SILOptimizer/sil_combine_same_ops.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 // Test optimization of various builtins which receive the same value in their first and second operand.
 
diff --git a/test/SILOptimizer/sil_combine_uncheck.sil b/test/SILOptimizer/sil_combine_uncheck.sil
index c5b425f..086c842 100644
--- a/test/SILOptimizer/sil_combine_uncheck.sil
+++ b/test/SILOptimizer/sil_combine_uncheck.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -remove-runtime-asserts | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -remove-runtime-asserts | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/sil_concat_string_literals.sil b/test/SILOptimizer/sil_concat_string_literals.sil
index 1f1b1ff..96baeea 100644
--- a/test/SILOptimizer/sil_concat_string_literals.sil
+++ b/test/SILOptimizer/sil_concat_string_literals.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -sil-verify-without-invalidation | FileCheck %s
-// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnostic-constant-propagation -sil-verify-without-invalidation | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -sil-verify-without-invalidation | %FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -diagnostic-constant-propagation -sil-verify-without-invalidation | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/sil_locations.sil b/test/SILOptimizer/sil_locations.sil
index 00df574..594cc6f 100644
--- a/test/SILOptimizer/sil_locations.sil
+++ b/test/SILOptimizer/sil_locations.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -mandatory-inlining -emit-verbose-sil %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -mandatory-inlining -emit-verbose-sil %s | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/sil_locations.swift b/test/SILOptimizer/sil_locations.swift
index 36ab672..e01280b 100644
--- a/test/SILOptimizer/sil_locations.swift
+++ b/test/SILOptimizer/sil_locations.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -emit-sil -emit-verbose-sil | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -emit-sil -emit-verbose-sil | %FileCheck %s
 
 func searchForMe(_ x: Float) -> Float {
   return x
diff --git a/test/SILOptimizer/sil_simplify_instrs.sil b/test/SILOptimizer/sil_simplify_instrs.sil
index f6ab038..1b4d9cc 100644
--- a/test/SILOptimizer/sil_simplify_instrs.sil
+++ b/test/SILOptimizer/sil_simplify_instrs.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/sil_witness_tables_external_witnesstable.swift b/test/SILOptimizer/sil_witness_tables_external_witnesstable.swift
index c806d84..7de56aa 100644
--- a/test/SILOptimizer/sil_witness_tables_external_witnesstable.swift
+++ b/test/SILOptimizer/sil_witness_tables_external_witnesstable.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module %S/Inputs/sil_witness_tables_external_input.swift -o %t/Swift.swiftmodule -parse-stdlib -parse-as-library -module-name Swift -sil-serialize-all -module-link-name swiftCore
-// RUN: %target-swift-frontend -O -I %t %s -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -O -I %t %s -emit-sil | %FileCheck %s
 
 import Swift
 
diff --git a/test/SILOptimizer/simp_enum.sil b/test/SILOptimizer/simp_enum.sil
index bf2f2de..91d1df2 100644
--- a/test/SILOptimizer/simp_enum.sil
+++ b/test/SILOptimizer/simp_enum.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/simplify_cfg.sil b/test/SILOptimizer/simplify_cfg.sil
index 7458a65..56dea14 100644
--- a/test/SILOptimizer/simplify_cfg.sil
+++ b/test/SILOptimizer/simplify_cfg.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | %FileCheck %s
 // FIXME: Update for select_enum change.
 
 import Builtin
diff --git a/test/SILOptimizer/simplify_cfg_and_combine.sil b/test/SILOptimizer/simplify_cfg_and_combine.sil
index ece4f88..54a56a2 100644
--- a/test/SILOptimizer/simplify_cfg_and_combine.sil
+++ b/test/SILOptimizer/simplify_cfg_and_combine.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg -sil-combine -simplify-cfg -sil-combine | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg -sil-combine -simplify-cfg -sil-combine | %FileCheck %s
 
 // These require both SimplifyCFG and SILCombine
 
diff --git a/test/SILOptimizer/simplify_cfg_args.sil b/test/SILOptimizer/simplify_cfg_args.sil
index 77238cf..c9f9a2d 100644
--- a/test/SILOptimizer/simplify_cfg_args.sil
+++ b/test/SILOptimizer/simplify_cfg_args.sil
@@ -1,5 +1,5 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | FileCheck %s
-// RUN: %target-sil-opt -enable-sil-verify-all %s -late-codemotion -simplify-cfg | FileCheck %s --check-prefix=CHECK_WITH_CODEMOTION
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | %FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -late-codemotion -simplify-cfg | %FileCheck %s --check-prefix=CHECK_WITH_CODEMOTION
 
 sil_stage raw
 
diff --git a/test/SILOptimizer/simplify_cfg_args_crash.sil b/test/SILOptimizer/simplify_cfg_args_crash.sil
index d4f499b..670606c 100644
--- a/test/SILOptimizer/simplify_cfg_args_crash.sil
+++ b/test/SILOptimizer/simplify_cfg_args_crash.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-bb-args -sroa-bb-args | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-bb-args -sroa-bb-args | %FileCheck %s
 sil_stage canonical
 
 import Builtin
diff --git a/test/SILOptimizer/simplify_cfg_jump_thread_crash.sil b/test/SILOptimizer/simplify_cfg_jump_thread_crash.sil
index d73c212..0be1574 100644
--- a/test/SILOptimizer/simplify_cfg_jump_thread_crash.sil
+++ b/test/SILOptimizer/simplify_cfg_jump_thread_crash.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/simplify_cfg_select_enum.sil b/test/SILOptimizer/simplify_cfg_select_enum.sil
index 6861333..a6d807e 100644
--- a/test/SILOptimizer/simplify_cfg_select_enum.sil
+++ b/test/SILOptimizer/simplify_cfg_select_enum.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -simplify-cfg | %FileCheck %s
 
 // Two select_enum instructions must not be considered as the same "condition",
 // even if they have the same enum operand.
diff --git a/test/SILOptimizer/sink.sil b/test/SILOptimizer/sink.sil
index 96e716f..01677f7 100644
--- a/test/SILOptimizer/sink.sil
+++ b/test/SILOptimizer/sink.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -code-sinking | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -code-sinking | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/spec_archetype_method.swift b/test/SILOptimizer/spec_archetype_method.swift
index 93740b4..511c6bc 100644
--- a/test/SILOptimizer/spec_archetype_method.swift
+++ b/test/SILOptimizer/spec_archetype_method.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -disable-arc-opts -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -disable-arc-opts -emit-sil -primary-file %s | %FileCheck %s
 
 // We can't deserialize apply_inst with subst lists. When radar://14443304
 // is fixed then we should convert this test to a SIL test.
diff --git a/test/SILOptimizer/spec_conf1.swift b/test/SILOptimizer/spec_conf1.swift
index ccac17c..7b620e6 100644
--- a/test/SILOptimizer/spec_conf1.swift
+++ b/test/SILOptimizer/spec_conf1.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -disable-arc-opts -emit-sil -Xllvm -enable-destroyhoisting=false %s | FileCheck %s
+// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -disable-arc-opts -emit-sil -Xllvm -enable-destroyhoisting=false %s | %FileCheck %s
 
 // We can't deserialize apply_inst with subst lists. When radar://14443304
 // is fixed then we should convert this test to a SIL test.
diff --git a/test/SILOptimizer/spec_conf2.swift b/test/SILOptimizer/spec_conf2.swift
index 0aa9764..99540d2 100644
--- a/test/SILOptimizer/spec_conf2.swift
+++ b/test/SILOptimizer/spec_conf2.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -disable-arc-opts -emit-sil -Xllvm -enable-destroyhoisting=false %s | FileCheck %s
+// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -disable-arc-opts -emit-sil -Xllvm -enable-destroyhoisting=false %s | %FileCheck %s
 
 // We can't deserialize apply_inst with subst lists. When radar://14443304
 // is fixed then we should convert this test to a SIL test.
diff --git a/test/SILOptimizer/spec_recursion.swift b/test/SILOptimizer/spec_recursion.swift
index 6278d72..95e1a83 100644
--- a/test/SILOptimizer/spec_recursion.swift
+++ b/test/SILOptimizer/spec_recursion.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O  -emit-sil %s |  FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 // Make sure we are not looping forever.
 
diff --git a/test/SILOptimizer/specialization_of_stdlib_binary_only.swift b/test/SILOptimizer/specialization_of_stdlib_binary_only.swift
index a7016d2..dd814f5 100644
--- a/test/SILOptimizer/specialization_of_stdlib_binary_only.swift
+++ b/test/SILOptimizer/specialization_of_stdlib_binary_only.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -parse-stdlib -parse-as-library -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -parse-stdlib -parse-as-library -emit-sil %s | %FileCheck %s
 
 // Make sure specialization of stdlib_binary_only functions are not marked
 // shared. Marking them shared would make their visibility hidden. Because
diff --git a/test/SILOptimizer/specialize.sil b/test/SILOptimizer/specialize.sil
index 8c72dfb..37fdb88 100644
--- a/test/SILOptimizer/specialize.sil
+++ b/test/SILOptimizer/specialize.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -generic-specializer %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -generic-specializer %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/specialize_anyobject.swift b/test/SILOptimizer/specialize_anyobject.swift
index 336385c..72909cb 100644
--- a/test/SILOptimizer/specialize_anyobject.swift
+++ b/test/SILOptimizer/specialize_anyobject.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend  -O -sil-inline-threshold 0 -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend  -O -sil-inline-threshold 0 -emit-sil -primary-file %s | %FileCheck %s
 
 // rdar://problem/20338028
 protocol PA: class { }
diff --git a/test/SILOptimizer/specialize_apply_conf.swift b/test/SILOptimizer/specialize_apply_conf.swift
index 772f365..a0d9d51 100644
--- a/test/SILOptimizer/specialize_apply_conf.swift
+++ b/test/SILOptimizer/specialize_apply_conf.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -sil-inline-threshold 0 -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -O -sil-inline-threshold 0 -emit-sil -primary-file %s | %FileCheck %s
 
 // We can't deserialize apply_inst with subst lists. When radar://14443304
 // is fixed then we should convert this test to a SIL test.
diff --git a/test/SILOptimizer/specialize_cg_update_crash.sil b/test/SILOptimizer/specialize_cg_update_crash.sil
index 76b07d2..77cdf3b 100644
--- a/test/SILOptimizer/specialize_cg_update_crash.sil
+++ b/test/SILOptimizer/specialize_cg_update_crash.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -parse-stdlib -parse-as-library  -module-name TestMod -sil-serialize-all %S/Inputs/TestMod.sil -emit-module-path %t/TestMod.swiftmodule 
-// RUN: %target-sil-opt -enable-sil-verify-all -inline -I %t %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -inline -I %t %s | %FileCheck %s
 
 // Test if the CG is updated correctly during specialization and
 // there is no crash because of a missing CG node for a deserialized function.
diff --git a/test/SILOptimizer/specialize_chain.swift b/test/SILOptimizer/specialize_chain.swift
index 430e63b..f946abf 100644
--- a/test/SILOptimizer/specialize_chain.swift
+++ b/test/SILOptimizer/specialize_chain.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend  -O -Xllvm -sil-disable-pass="Function Signature Optimization" -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend  -O -Xllvm -sil-disable-pass="Function Signature Optimization" -emit-sil -primary-file %s | %FileCheck %s
 
 // We can't deserialize apply_inst with subst lists. When radar://14443304
 // is fixed then we should convert this test to a SIL test.
diff --git a/test/SILOptimizer/specialize_checked_cast_branch.swift b/test/SILOptimizer/specialize_checked_cast_branch.swift
index ee48516..af63ade 100644
--- a/test/SILOptimizer/specialize_checked_cast_branch.swift
+++ b/test/SILOptimizer/specialize_checked_cast_branch.swift
@@ -1,6 +1,4 @@
-// RUN: %target-swift-frontend  -emit-sil -O -sil-inline-threshold 0 %s -o - | not FileCheck %s
-
-// FIXME: rdar://problem/18603827
+// RUN: %target-swift-frontend  -emit-sil -O -sil-inline-threshold 0 %s -o - | %FileCheck %s
 
 class C {}
 class D : C {}
@@ -16,322 +14,330 @@
 ////////////////////////
 // Arch to Arch Casts //
 ////////////////////////
-
-func ArchetypeToArchetypeCast<T1, T2>(t1 t1 : T1, t2 : T2) -> T2 {
+public func ArchetypeToArchetypeCast<T1, T2>(t1 : T1, t2 : T2) -> T2 {
   if let x = t1 as? T2 {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
 
-// x -> x where x is a class.
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C_S0____TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastU___FT2t1Q_2t2Q0__Q0_ : $@convention(thin) (@out C, @in C, @in C) -> () {
-// CHECK: [[T0:%.*]] = load %1 : $*C
-// CHECK: enum $Optional<C>, #Optional.some!enumelt.1, [[T0]] : $C
-// CHECK: strong_retain [[T0]]
-// CHECK: bb1:
-ArchetypeToArchetypeCast(t1: c, t2: c)
+// CHECK-LABEL: sil shared @_TTSg5Vs5UInt8___TF30specialize_checked_cast_branch28ArchetypeToConcreteCastUInt8urFT1tx_Vs5UInt8 : $@convention(thin) (UInt8) -> UInt8 {
+// CHECK: bb0
+// CHECK: return %0 : $UInt8
 
-// x -> x where x is not a class.
-// CHECK-LABEL: sil shared @_TTSgVs5UInt8_S____TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastU___FT2t1Q_2t2Q0__Q0_ : $@convention(thin) (@out UInt8, @in UInt8, @in UInt8) -> () {
-// CHECK: [[T0:%.*]] = load %1 : $*UInt8
-// CHECK: enum $Optional<UInt8>, #Optional.some!enumelt.1, [[T0]] : $UInt8
-// CHECK: bb1:
-ArchetypeToArchetypeCast(t1: b, t2: b)
+// CHECK-LABEL: sil shared @_TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastCurFT1tx_CS_1C : $@convention(thin) (@owned C) -> @owned C {
+// CHECK: bb0
+// CHECK: return %0 : $C
 
-// x -> y where x,y are not classes and x is a different type from y.
-// CHECK-LABEL: sil shared @_TTSgVs5UInt8_Vs6UInt64___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastU___FT2t1Q_2t2Q0__Q0_ : $@convention(thin) (@out UInt64, @in UInt8, @in UInt64) -> () {
-// CHECK: enum $Optional<UInt64>, #Optional.none
-// CHECK: bb1:
-ArchetypeToArchetypeCast(t1: b, t2: f)
-
-// x -> y where x is not a class but y is.
-// CHECK-LABEL: sil shared @_TTSgVs5UInt8_C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastU___FT2t1Q_2t2Q0__Q0_ : $@convention(thin) (@out C, @in UInt8, @in C) -> () {
-// CHECK: enum $Optional<C>, #Optional.none
-// CHECK: bb1:
-ArchetypeToArchetypeCast(t1: b, t2: c)
-
-// y -> x where x is a class but y is not.
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C_Vs5UInt8___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastU___FT2t1Q_2t2Q0__Q0_ : $@convention(thin) (@out UInt8, @in C, @in UInt8) -> () {
-// CHECK: enum $Optional<UInt8>, #Optional.none
-// CHECK: bb1:
-ArchetypeToArchetypeCast(t1: c, t2: b)
+// CHECK-LABEL: sil shared @_TTSg5C30specialize_checked_cast_branch1D___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastCurFT1tx_CS_1C : $@convention(thin) (@owned D) -> @owned C {
+// CHECK: bb0
+// CHECK:  [[CAST:%.*]] = upcast %0 : $D to $C
+// CHECK: return [[CAST]]
 
 // x -> y where x is a super class of y.
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C_CS_1D___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastU___FT2t1Q_2t2Q0__Q0_ : $@convention(thin) (@out D, @in C, @in D) -> () {
-// CHECK:   [[TMP:%.*]] = alloc_stack $Optional<D>
-// CHECK:   [[V:%.*]] = load %1 : $*C
-// CHECK:   checked_cast_br [[V]] : $C to $D,
+// CHECK-LABEL: sil shared @_TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastDurFT1tx_CS_1D : $@convention(thin) (@owned C) -> @owned D {
+// CHECK: checked_cast_br %0 : $C to $D,
 // CHECK: bb1([[T0:%.*]] : $D):
-// CHECK:   [[T1:%.*]] = enum $Optional<D>, #Optional.some!enumelt.1, [[T0]] : $D
-// CHECK:   store [[T1]] to [[TMP]] : $*Optional<D>
-// CHECK:   strong_retain [[V]] : $C
-// CHECK:   br bb3
+// CHECK: return [[T0]] : $D
 // CHECK: bb2:
-// CHECK:   [[T0:%.*]] = enum $Optional<D>, #Optional.none
-// CHECK:   store [[T0]] to [[TMP]] : $*Optional<D>
-// CHECK:   br bb3
-ArchetypeToArchetypeCast(t1: c, t2: d)
+// CHECK: integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail
+// CHECK: unreachable
+
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1C_CS_1D___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastu0_rFT2t1x2t2q__q_ : $@convention(thin) (@owned C) -> @owned D
+// CHECK: bb0
+// CHECK:  checked_cast_br %0 : $C to $D, bb1, bb2
+// CHECK: bb1(
+// CHECK:   return
+// CHECK: bb2
+// CHECK:   integer_literal $Builtin.Int1, -1
+// CHECK:   cond_fail
+// CHECK:   unreachable
+
+// x -> x where x is a class.
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1C_S0____TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastu0_rFT2t1x2t2q__q_ : $@convention(thin) (@owned C) -> @owned C {
+// CHECK: bb0
+// CHECK-NOT: bb1
+// CHECK: return %0 : $C
+
+// x -> x where x is not a class.
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5Vs5UInt8_S____TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastu0_rFT2t1x2t2q__q_ : $@convention(thin) (UInt8) -> UInt8 {
+// CHECK: bb0
+// CHECK-NOT: bb1
+// CHECK: return %0 : $UInt8
+
+// x -> y where x,y are not classes and x is a different type from y.
+// CHECK-LABEL: sil shared @_TTSf4d_d___TTSg5Vs5UInt8_Vs6UInt64___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastu0_rFT2t1x2t2q__q_ : $@convention(thin) () -> UInt64 {
+// CHECK: bb0
+// CHECK-NOT: bb1
+// CHECK: %0 = integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail %0 : $Builtin.Int1
+// CHECK: unreachable
+
+// x -> y where x is not a class but y is.
+// CHECK-LABEL: sil shared @_TTSf4d_d___TTSg5Vs5UInt8_C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastu0_rFT2t1x2t2q__q_ : $@convention(thin) () -> @owned C {
+// CHECK: bb0
+// CHECK-NOT: bb1
+// CHECK: %0 = integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail %0 : $Builtin.Int1
+// CHECK: unreachable
+
+// y -> x where x is a class but y is not.
+// CHECK-LABEL: sil shared @_TTSf4d_d___TTSg5C30specialize_checked_cast_branch1C_Vs5UInt8___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastu0_rFT2t1x2t2q__q_ : $@convention(thin) () -> UInt8 {
+// CHECK: bb0
+// CHECK-NOT: bb1
+// CHECK: %0 = integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail %0 : $Builtin.Int1
+// CHECK: unreachable
 
 // y -> x where x is a super class of y.
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1D_CS_1C___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastU___FT2t1Q_2t2Q0__Q0_ : $@convention(thin) (@out C, @in D, @in C) -> () {
-// CHECK: [[T0:%.*]] = load %1 : $*D
-// CHECK: [[T1:%.*]] = upcast [[T0]] : $D to $C
-// CHECK: enum $Optional<C>, #Optional.some!enumelt.1, [[T1]] : $C
-// CHECK: strong_retain [[T0]] : $D
-// CHECK: bb1:
-ArchetypeToArchetypeCast(t1: d, t2: c)
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1D_CS_1C___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastu0_rFT2t1x2t2q__q_ : $@convention(thin) (@owned D) -> @owned C {
+// CHECK: [[T1:%.*]] = upcast %0 : $D to $C
+// CHECK: return [[T1]] : $C
 
 // x -> y where x and y are unrelated.
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C_CS_1E___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastU___FT2t1Q_2t2Q0__Q0_ : $@convention(thin) (@out E, @in C, @in E) -> () {
-// CHECK: enum $Optional<E>, #Optional.none
-// CHECK: bb1:
-ArchetypeToArchetypeCast(t1: c, t2: e)
+// CHECK-LABEL: sil shared @_TTSf4d_d___TTSg5C30specialize_checked_cast_branch1C_CS_1E___TF30specialize_checked_cast_branch24ArchetypeToArchetypeCastu0_rFT2t1x2t2q__q_ : $@convention(thin) () -> @owned E {
+// CHECK: bb0
+// CHECK-NOT: bb1
+// CHECK: %0 = integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail %0 : $Builtin.Int1
+// CHECK: unreachable
+
+
+_ = ArchetypeToArchetypeCast(t1: c, t2: d)
+_ = ArchetypeToArchetypeCast(t1: c, t2: c)
+_ = ArchetypeToArchetypeCast(t1: b, t2: b)
+_ = ArchetypeToArchetypeCast(t1: b, t2: f)
+_ = ArchetypeToArchetypeCast(t1: b, t2: c)
+_ = ArchetypeToArchetypeCast(t1: c, t2: b)
+_ = ArchetypeToArchetypeCast(t1: d, t2: c)
+_ = ArchetypeToArchetypeCast(t1: c, t2: e)
 
 ///////////////////////////
 // Archetype To Concrete //
 ///////////////////////////
 
-func ArchetypeToConcreteCastUInt8<T>(t t : T) -> UInt8 {
+func ArchetypeToConcreteCastUInt8<T>(t : T) -> UInt8 {
   if let x = t as? UInt8 {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
 
-func ArchetypeToConcreteCastC<T>(t t : T) -> C {
+func ArchetypeToConcreteCastC<T>(t : T) -> C {
   if let x = t as? C {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
 
-func ArchetypeToConcreteCastD<T>(t t : T) -> D {
+func ArchetypeToConcreteCastD<T>(t : T) -> D {
   if let x = t as? D {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
 
-func ArchetypeToConcreteCastE<T>(t t : T) -> E {
+func ArchetypeToConcreteCastE<T>(t : T) -> E {
   if let x = t as? E {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
 
-// CHECK-LABEL: sil shared @_TTSgVs5UInt8___TF30specialize_checked_cast_branch28ArchetypeToConcreteCastUInt8U__FT1tQ__Vs5UInt8 : $@convention(thin) (@in UInt8) -> UInt8 {
-// CHECK-NEXT: bb0
-// CHECK-NEXT: [[VALUE:%.*]] = load %0 : $*UInt8
-ArchetypeToConcreteCastUInt8(t: b)
+_ = ArchetypeToConcreteCastUInt8(t: b)
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch28ArchetypeToConcreteCastUInt8U__FT1tQ__Vs5UInt8 : $@convention(thin) (@in C) -> UInt8 {
+// CHECK-LABEL: sil shared @_TTSf4d___TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch28ArchetypeToConcreteCastUInt8urFT1tx_Vs5UInt8 : $@convention(thin) () -> UInt8 {
 // CHECK: bb0
-// CHECK-NOT: checked_cast_br archetype_to_concrete
+// CHECK-NOT: checked_cast_br
 // CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
 // CHECK: cond_fail [[TRUE]]
 // CHECK: unreachable
-ArchetypeToConcreteCastUInt8(t: c)
 
-// CHECK-LABEL: sil shared @_TTSgVs6UInt64___TF30specialize_checked_cast_branch28ArchetypeToConcreteCastUInt8U__FT1tQ__Vs5UInt8 : $@convention(thin) (@in UInt64) -> UInt8 {
+// CHECK-LABEL: sil shared @_TTSf4d___TTSg5Vs6UInt64___TF30specialize_checked_cast_branch28ArchetypeToConcreteCastUInt8urFT1tx_Vs5UInt8 : $@convention(thin) () -> UInt8 {
 // CHECK-NEXT: bb0
 // CHECK-NOT: checked_cast_br archetype_to_concrete
 // CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
 // CHECK: cond_fail [[TRUE]]
 // CHECK: unreachable
-ArchetypeToConcreteCastUInt8(t: f)
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastCU__FT1tQ__CS_1C : $@convention(thin) (@in C) -> @owned C {
-// CHECK-NEXT: bb0
-// CHECK-NEXT:  [[VALUE:%.*]] = load %0 : $*C
-ArchetypeToConcreteCastC(t: c)
-
-// CHECK-LABEL: sil shared @_TTSgVs5UInt8___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastCU__FT1tQ__CS_1C : $@convention(thin) (@in UInt8) -> @owned C {
+// CHECK-LABEL: sil shared @_TTSf4d___TTSg5Vs5UInt8___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastCurFT1tx_CS_1C : $@convention(thin) () -> @owned C {
 // CHECK: bb0
-// CHECK-NOT: checked_cast_br archetype_to_concrete
+// CHECK-NOT: checked_cast_br
 // CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
 // CHECK: cond_fail [[TRUE]]
 // CHECK: unreachable
-ArchetypeToConcreteCastC(t: b)
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1D___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastCU__FT1tQ__CS_1C : $@convention(thin) (@in D) -> @owned C {
-// CHECK: bb0
-// CHECK:  [[VALUE:%.*]] = load %0 : $*D
-// CHECK:  [[CAST:%.*]] = upcast [[VALUE]] : $D to $C
-// CHECK: return [[CAST]]
-ArchetypeToConcreteCastC(t: d)
-
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1E___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastCU__FT1tQ__CS_1C : $@convention(thin) (@in E) -> @owned C {
+// CHECK-LABEL: sil shared @_TTSf4d___TTSg5C30specialize_checked_cast_branch1E___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastCurFT1tx_CS_1C : $@convention(thin) () -> @owned C {
 // CHECK: bb0
 // CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
 // CHECK: cond_fail [[TRUE]]
 // CHECK: unreachable
-ArchetypeToConcreteCastC(t: e)
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastDU__FT1tQ__CS_1D : $@convention(thin) (@in C) -> @owned D {
-// CHECK: bb0
-// CHECK:  [[T0:%.*]] = load %0 : $*C
-// CHECK:  checked_cast_br [[T0]] : $C to $D, bb1, bb2
-// CHECK: bb1(
-// CHECK: strong_retain [[T0]] : $C
-// CHECK: bb0
-ArchetypeToConcreteCastD(t: c)
-
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastEU__FT1tQ__CS_1E : $@convention(thin) (@in C) -> @owned E {
+// CHECK-LABEL: sil shared @_TTSf4d___TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ArchetypeToConcreteCastEurFT1tx_CS_1E : $@convention(thin) () -> @owned E {
 // CHECK: bb0
 // CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
 // CHECK: cond_fail [[TRUE]]
 // CHECK: unreachable
-ArchetypeToConcreteCastE(t: c)
+
+_ = ArchetypeToConcreteCastUInt8(t: c)
+_ = ArchetypeToConcreteCastUInt8(t: f)
+_ = ArchetypeToConcreteCastC(t: c)
+_ = ArchetypeToConcreteCastC(t: b)
+_ = ArchetypeToConcreteCastC(t: d)
+_ = ArchetypeToConcreteCastC(t: e)
+_ = ArchetypeToConcreteCastD(t: c)
+_ = ArchetypeToConcreteCastE(t: c)
 
 ///////////////////////////
 // Concrete To Archetype //
 ///////////////////////////
 
-func ConcreteToArchetypeCastUInt8<T>(t t: UInt8, t2: T) -> T {
+func ConcreteToArchetypeCastUInt8<T>(t: UInt8, t2: T) -> T {
   if let x = t as? T {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
-func ConcreteToArchetypeCastC<T>(t t: C, t2: T) -> T {
+func ConcreteToArchetypeCastC<T>(t: C, t2: T) -> T {
   if let x = t as? T {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
-func ConcreteToArchetypeCastD<T>(t t: D, t2: T) -> T {
+func ConcreteToArchetypeCastD<T>(t: D, t2: T) -> T {
   if let x = t as? T {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
 
-// CHECK-LABEL: sil shared @_TTSgVs5UInt8___TF30specialize_checked_cast_branch28ConcreteToArchetypeCastUInt8U__FT1tVs5UInt82t2Q__Q_ : $@convention(thin) (@out UInt8, UInt8, @in UInt8) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5Vs5UInt8___TF30specialize_checked_cast_branch28ConcreteToArchetypeCastUInt8urFT1tVs5UInt82t2x_x : $@convention(thin) (UInt8) -> UInt8
 // CHECK: bb0
-// CHECK:  enum $Optional<UInt8>, #Optional.some!enumelt.1, %1
-// CHECK: bb1
-ConcreteToArchetypeCastUInt8(t: b, t2: b)
+// CHECK: return %0
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch28ConcreteToArchetypeCastUInt8U__FT1tVs5UInt82t2Q__Q_ : $@convention(thin) (@out C, UInt8, @in C) -> () {
+// CHECK-LABEL: sil shared @_TTSf4d_d___TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch28ConcreteToArchetypeCastUInt8urFT1tVs5UInt82t2x_x : $@convention(thin) () -> @owned C
 // CHECK: bb0
-// CHECK:  enum $Optional<C>, #Optional.none
-// CHECK: bb1
-ConcreteToArchetypeCastUInt8(t: b, t2: c)
+// CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail [[TRUE]]
+// CHECK: unreachable
 
-// CHECK-LABEL: sil shared @_TTSgVs6UInt64___TF30specialize_checked_cast_branch28ConcreteToArchetypeCastUInt8U__FT1tVs5UInt82t2Q__Q_ : $@convention(thin) (@out UInt64, UInt8, @in UInt64) -> () {
+// CHECK-LABEL: sil shared @_TTSf4d_d___TTSg5Vs6UInt64___TF30specialize_checked_cast_branch28ConcreteToArchetypeCastUInt8urFT1tVs5UInt82t2x_x : $@convention(thin) () -> UInt64
 // CHECK: bb0
-// CHECK:  enum $Optional<UInt64>, #Optional.none
-// CHECK: bb1
-ConcreteToArchetypeCastUInt8(t: b, t2: f)
+// CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail [[TRUE]]
+// CHECK: unreachable
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastCU__FT1tCS_1C2t2Q__Q_ : $@convention(thin) (@out C, @owned C, @in C) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastCurFT1tCS_1C2t2x_x : $@convention(thin) (@owned C) -> @owned C
 // CHECK: bb0
-// CHECK:  enum $Optional<C>, #Optional.some!enumelt.1, %1
-// CHECK: bb1
-ConcreteToArchetypeCastC(t: c, t2: c)
+// CHECK: return %0
 
-// CHECK-LABEL: sil shared @_TTSgVs5UInt8___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastCU__FT1tCS_1C2t2Q__Q_ : $@convention(thin) (@out UInt8, @owned C, @in UInt8) -> () {
+// CHECK-LABEL: sil shared @_TTSf4d_d___TTSg5Vs5UInt8___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastCurFT1tCS_1C2t2x_x : $@convention(thin) () -> UInt8
 // CHECK: bb0
-// CHECK:  enum $Optional<UInt8>, #Optional.none
-// CHECK: bb1
-ConcreteToArchetypeCastC(t: c, t2: b)
+// CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail [[TRUE]]
+// CHECK: unreachable
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1D___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastCU__FT1tCS_1C2t2Q__Q_ : $@convention(thin) (@out D, @owned C, @in D) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1D___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastCurFT1tCS_1C2t2x_x : $@convention(thin) (@owned C) -> @owned D
 // CHECK: bb0
-// CHECK:  checked_cast_br %1 : $C to $D
+// CHECK:  checked_cast_br %0 : $C to $D
 // CHECK: bb1
-ConcreteToArchetypeCastC(t: c, t2: d)
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1E___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastCU__FT1tCS_1C2t2Q__Q_ : $@convention(thin) (@out E, @owned C, @in E) -> () {
+// CHECK-LABEL: sil shared @_TTSf4d_d___TTSg5C30specialize_checked_cast_branch1E___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastCurFT1tCS_1C2t2x_x : $@convention(thin) () -> @owned E
 // CHECK: bb0
-// CHECK:  enum $Optional<E>, #Optional.none
-// CHECK: bb1
-ConcreteToArchetypeCastC(t: c, t2: e)
+// CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail [[TRUE]]
+// CHECK: unreachable
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastDU__FT1tCS_1D2t2Q__Q_ : $@convention(thin) (@out C, @owned D, @in C) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch24ConcreteToArchetypeCastDurFT1tCS_1D2t2x_x : $@convention(thin) (@owned D) -> @owned C
 // CHECK: bb0
-// CHECK:  [[T0:%.*]] = upcast %1 : $D to $C
-// CHECK:  enum $Optional<C>, #Optional.some!enumelt.1, [[T0]] : $C
-// CHECK: bb1
-ConcreteToArchetypeCastD(t: d, t2: c)
+// CHECK:  [[T0:%.*]] = upcast %0 : $D to $C
+// CHECK:  return [[T0]]
+
+_ = ConcreteToArchetypeCastUInt8(t: b, t2: b)
+_ = ConcreteToArchetypeCastUInt8(t: b, t2: c)
+_ = ConcreteToArchetypeCastUInt8(t: b, t2: f)
+_ = ConcreteToArchetypeCastC(t: c, t2: c)
+_ = ConcreteToArchetypeCastC(t: c, t2: b)
+_ = ConcreteToArchetypeCastC(t: c, t2: d)
+_ = ConcreteToArchetypeCastC(t: c, t2: e)
+_ = ConcreteToArchetypeCastD(t: d, t2: c)
 
 ////////////////////////
 // Super To Archetype //
 ////////////////////////
 
-func SuperToArchetypeCastC<T>(c c : C, t : T) -> T {
+func SuperToArchetypeCastC<T>(c : C, t : T) -> T {
   if let x = c as? T {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
 
-func SuperToArchetypeCastD<T>(d d : D, t : T) -> T {
+func SuperToArchetypeCastD<T>(d : D, t : T) -> T {
   if let x = d as? T {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch21SuperToArchetypeCastCU__FT1cCS_1C1tQ__Q_ : $@convention(thin) (@out C, @owned C, @in C) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch21SuperToArchetypeCastCurFT1cCS_1C1tx_x : $@convention(thin) (@owned C) -> @owned C
 // CHECK: bb0
-// CHECK:  enum $Optional<C>, #Optional.some!enumelt.1, %1
-// CHECK: bb1
-SuperToArchetypeCastC(c: c, t: c)
+// CHECK: return %0 : $C
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1D___TF30specialize_checked_cast_branch21SuperToArchetypeCastCU__FT1cCS_1C1tQ__Q_ : $@convention(thin) (@out D, @owned C, @in D) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1D___TF30specialize_checked_cast_branch21SuperToArchetypeCastCurFT1cCS_1C1tx_x : $@convention(thin) (@owned C) -> @owned D
 // CHECK: bb0
-// CHECK:  checked_cast_br %1 : $C to $D
+// CHECK:  checked_cast_br %0 : $C to $D
 // CHECK: bb1
-SuperToArchetypeCastC(c: c, t: d)
 
-// CHECK-LABEL: sil shared @_TTSgVs5UInt8___TF30specialize_checked_cast_branch21SuperToArchetypeCastCU__FT1cCS_1C1tQ__Q_ : $@convention(thin) (@out UInt8, @owned C, @in UInt8) -> () {
+// CHECK-LABEL: sil shared @_TTSf4d_d___TTSg5Vs5UInt8___TF30specialize_checked_cast_branch21SuperToArchetypeCastCurFT1cCS_1C1tx_x : $@convention(thin) () -> UInt8
 // CHECK: bb0
-// CHECK:  enum $Optional<UInt8>, #Optional.none
-// CHECK: bb1
-SuperToArchetypeCastC(c: c, t: b)
+// CHECK: [[TRUE:%.*]] = integer_literal $Builtin.Int1, -1
+// CHECK: cond_fail [[TRUE]]
+// CHECK: unreachable
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch21SuperToArchetypeCastDU__FT1dCS_1D1tQ__Q_ : $@convention(thin) (@out C, @owned D, @in C) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch21SuperToArchetypeCastDurFT1dCS_1D1tx_x : $@convention(thin) (@owned D) -> @owned C
 // CHECK: bb0
-// CHECK:  [[T0:%.*]] = upcast %1 : $D to $C
-// CHECK:  enum $Optional<C>, #Optional.some!enumelt.1, [[T0]] : $C
-// CHECK: bb1
-SuperToArchetypeCastD(d: d, t: c)
+// CHECK:  [[T0:%.*]] = upcast %0 : $D to $C
+// CHECK:  return [[T0]]
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1D___TF30specialize_checked_cast_branch21SuperToArchetypeCastDU__FT1dCS_1D1tQ__Q_ : $@convention(thin) (@out D, @owned D, @in D) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1D___TF30specialize_checked_cast_branch21SuperToArchetypeCastDurFT1dCS_1D1tx_x : $@convention(thin) (@owned D) -> @owned D
 // CHECK: bb0
-// CHECK:  enum $Optional<D>, #Optional.some!enumelt.1, %1
-// CHECK: bb1
-SuperToArchetypeCastD(d: d, t: d)
+// CHECK: return %0 : $D
+
+_ = SuperToArchetypeCastC(c: c, t: c)
+_ = SuperToArchetypeCastC(c: c, t: d)
+_ = SuperToArchetypeCastC(c: c, t: b)
+_ = SuperToArchetypeCastD(d: d, t: c)
+_ = SuperToArchetypeCastD(d: d, t: d)
 
 //////////////////////////////
 // Existential To Archetype //
 //////////////////////////////
 
-func ExistentialToArchetypeCast<T>(o o : AnyObject, t : T) -> T {
+func ExistentialToArchetypeCast<T>(o : AnyObject, t : T) -> T {
   if let x = o as? T {
     return x
   }
   _preconditionFailure("??? Profit?")
 }
 
-// CHECK-LABEL: sil shared @_TTSgC30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch26ExistentialToArchetypeCastU__FT1oPs9AnyObject_1tQ__Q_ : $@convention(thin) (@out C, @owned AnyObject, @in C) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5C30specialize_checked_cast_branch1C___TF30specialize_checked_cast_branch26ExistentialToArchetypeCasturFT1oPs9AnyObject_1tx_x : $@convention(thin) (@owned AnyObject) -> @owned C
 // CHECK: bb0
-// CHECK:  checked_cast_br %1 : $AnyObject to $C
+// CHECK:  checked_cast_br %0 : $AnyObject to $C
 // CHECK: bb1
-ExistentialToArchetypeCast(o: o, t: c)
 
-// CHECK-LABEL: sil shared @_TTSgVs5UInt8___TF30specialize_checked_cast_branch26ExistentialToArchetypeCastU__FT1oPs9AnyObject_1tQ__Q_ : $@convention(thin) (@out UInt8, @owned AnyObject, @in UInt8) -> () {
+// CHECK-LABEL: sil shared @_TTSf4g_d___TTSg5Vs5UInt8___TF30specialize_checked_cast_branch26ExistentialToArchetypeCasturFT1oPs9AnyObject_1tx_x : $@convention(thin) (@guaranteed AnyObject) -> UInt8
 // CHECK: bb0
 // CHECK:  checked_cast_addr_br take_always AnyObject in {{%.*}} : $*AnyObject to UInt8 in {{%.*}} : $*UInt8,
 // CHECK: bb1
-ExistentialToArchetypeCast(o: o, t: b)
 
-// CHECK-LABEL: sil shared @_TTSgPs9AnyObject____TF30specialize_checked_cast_branch26ExistentialToArchetypeCastU__FT1oPs9AnyObject_1tQ__Q_ : $@convention(thin) (@out AnyObject, @owned AnyObject, @in AnyObject) -> () {
+// CHECK-LABEL: sil shared @_TTSf4n_d___TTSg5Ps9AnyObject____TF30specialize_checked_cast_branch26ExistentialToArchetypeCasturFT1oPs9AnyObject_1tx_x : $@convention(thin) (@owned AnyObject) -> @owned AnyObject
 // CHECK: bb0
 // CHECK-NOT: checked_cast_br %
-// CHECK:  enum $Optional<AnyObject>, #Optional.some!enumelt.1, %1 : $AnyObject
+// CHECK: return %0 : $AnyObject
 // CHECK-NOT: checked_cast_br %
-// CHECK: bb1
-ExistentialToArchetypeCast(o: o, t: o)
+
+_ = ExistentialToArchetypeCast(o: o, t: c)
+_ = ExistentialToArchetypeCast(o: o, t: b)
+_ = ExistentialToArchetypeCast(o: o, t: o)
diff --git a/test/SILOptimizer/specialize_class_inherits_base_inherits_protocol.swift b/test/SILOptimizer/specialize_class_inherits_base_inherits_protocol.swift
index d6af9cc..9a98d31 100644
--- a/test/SILOptimizer/specialize_class_inherits_base_inherits_protocol.swift
+++ b/test/SILOptimizer/specialize_class_inherits_base_inherits_protocol.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -O %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -O %s | %FileCheck %s
 
 protocol P { func p() -> Any.Type }
 protocol Q: P { }
diff --git a/test/SILOptimizer/specialize_deep_generics.swift b/test/SILOptimizer/specialize_deep_generics.swift
index 31c3edb..f9d8d00 100644
--- a/test/SILOptimizer/specialize_deep_generics.swift
+++ b/test/SILOptimizer/specialize_deep_generics.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 
 // Check that this Church Numerals inspired example does not hang
 // a compiler in the generic specializer.
diff --git a/test/SILOptimizer/specialize_default_witness.sil b/test/SILOptimizer/specialize_default_witness.sil
index b952629..16533c9 100644
--- a/test/SILOptimizer/specialize_default_witness.sil
+++ b/test/SILOptimizer/specialize_default_witness.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -generic-specializer %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -generic-specializer %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/specialize_ext.swift b/test/SILOptimizer/specialize_ext.swift
index be510e9..44ce9d7 100644
--- a/test/SILOptimizer/specialize_ext.swift
+++ b/test/SILOptimizer/specialize_ext.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend  -O -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend  -O -emit-sil -primary-file %s | %FileCheck %s
 
 struct XXX<T> {
   init(t : T) {m_t = t}
diff --git a/test/SILOptimizer/specialize_inherited.sil b/test/SILOptimizer/specialize_inherited.sil
index 6e42562..51969dd 100644
--- a/test/SILOptimizer/specialize_inherited.sil
+++ b/test/SILOptimizer/specialize_inherited.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -generic-specializer -module-name inherit | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -generic-specializer -module-name inherit | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/specialize_metatypes_with_nondefault_representation.sil b/test/SILOptimizer/specialize_metatypes_with_nondefault_representation.sil
index b3edfdf..7705188 100644
--- a/test/SILOptimizer/specialize_metatypes_with_nondefault_representation.sil
+++ b/test/SILOptimizer/specialize_metatypes_with_nondefault_representation.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -generic-specializer | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -generic-specializer | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILOptimizer/specialize_partial_apply.swift b/test/SILOptimizer/specialize_partial_apply.swift
index 54f9687..bf5fed2 100644
--- a/test/SILOptimizer/specialize_partial_apply.swift
+++ b/test/SILOptimizer/specialize_partial_apply.swift
@@ -1,10 +1,10 @@
 // First check the SIL.
-// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -module-name=test -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass="Function Signature Optimization" -module-name=test -emit-sil -primary-file %s | %FileCheck %s
 
 // Also do an end-to-end test to check all components, including IRGen.
 // RUN: rm -rf %t && mkdir -p %t 
 // RUN: %target-build-swift -O -Xllvm -sil-disable-pass="Function Signature Optimization" -module-name=test %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck %s -check-prefix=CHECK-OUTPUT
+// RUN: %target-run %t/a.out | %FileCheck %s -check-prefix=CHECK-OUTPUT
 // REQUIRES: executable_test
 
 struct MyError : Error {
diff --git a/test/SILOptimizer/specialize_property_behavior.swift b/test/SILOptimizer/specialize_property_behavior.swift
index 22f8800..70dc89e 100644
--- a/test/SILOptimizer/specialize_property_behavior.swift
+++ b/test/SILOptimizer/specialize_property_behavior.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil -parse-as-library -O -enable-experimental-property-behaviors %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -parse-as-library -O -enable-experimental-property-behaviors %s | %FileCheck %s
 
 @inline(never) func whatever<T>() -> T { fatalError("") }
 
diff --git a/test/SILOptimizer/specialize_reabstraction.sil b/test/SILOptimizer/specialize_reabstraction.sil
index be63d0f..1b6f4a9 100644
--- a/test/SILOptimizer/specialize_reabstraction.sil
+++ b/test/SILOptimizer/specialize_reabstraction.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -generic-specializer %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -generic-specializer %s | %FileCheck %s
 
 
 sil_stage canonical
diff --git a/test/SILOptimizer/specialize_recursive_generics.sil b/test/SILOptimizer/specialize_recursive_generics.sil
index 4cfc7e7..540eb8a 100644
--- a/test/SILOptimizer/specialize_recursive_generics.sil
+++ b/test/SILOptimizer/specialize_recursive_generics.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -generic-specializer -cse | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -generic-specializer -cse | %FileCheck %s
 
 // Check that SIL cloner can correctly handle specialization of recursive
 // functions with generic arguments.
diff --git a/test/SILOptimizer/specialize_self.swift b/test/SILOptimizer/specialize_self.swift
index dd1cdf3..a93067f 100644
--- a/test/SILOptimizer/specialize_self.swift
+++ b/test/SILOptimizer/specialize_self.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle  -O -sil-inline-threshold 0 -emit-sil -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle  -O -sil-inline-threshold 0 -emit-sil -primary-file %s | %FileCheck %s
 
 // CHECK-NOT: generic specialization <Swift.AnyObject, Self> of specialize_self.cast <A, B>(A) -> Swift.Optional<B>
 
diff --git a/test/SILOptimizer/specialize_unconditional_checked_cast.swift b/test/SILOptimizer/specialize_unconditional_checked_cast.swift
index 6b07e28..aa3f7a9 100644
--- a/test/SILOptimizer/specialize_unconditional_checked_cast.swift
+++ b/test/SILOptimizer/specialize_unconditional_checked_cast.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend  -Xllvm -sil-disable-pass="Function Signature Optimization" -emit-sil -o - -O %s | FileCheck %s
+// RUN: %target-swift-frontend  -Xllvm -sil-disable-pass="Function Signature Optimization" -emit-sil -o - -O %s | %FileCheck %s
 
 //////////////////
 // Declarations //
diff --git a/test/SILOptimizer/split_critical_edges.sil b/test/SILOptimizer/split_critical_edges.sil
index 76ce59a..89a6859 100644
--- a/test/SILOptimizer/split_critical_edges.sil
+++ b/test/SILOptimizer/split_critical_edges.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -split-critical-edges | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -split-critical-edges | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/sroa.sil b/test/SILOptimizer/sroa.sil
index 729f257..3b6875d 100644
--- a/test/SILOptimizer/sroa.sil
+++ b/test/SILOptimizer/sroa.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -sroa %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -sroa %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/sroa_bbargs.sil b/test/SILOptimizer/sroa_bbargs.sil
index aa2702c..8a08751 100644
--- a/test/SILOptimizer/sroa_bbargs.sil
+++ b/test/SILOptimizer/sroa_bbargs.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -sroa-bb-args %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -sroa-bb-args %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/sroa_unreferenced_members.swift b/test/SILOptimizer/sroa_unreferenced_members.swift
index 7b626e4..cce1ea7 100644
--- a/test/SILOptimizer/sroa_unreferenced_members.swift
+++ b/test/SILOptimizer/sroa_unreferenced_members.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -sdk %S/Inputs -O -emit-sil -I %S/Inputs -enable-source-import -primary-file %s | FileCheck %s
+// RUN: %target-swift-frontend -sdk %S/Inputs -O -emit-sil -I %S/Inputs -enable-source-import -primary-file %s | %FileCheck %s
 
 import gizmo
 
diff --git a/test/SILOptimizer/stack_promotion.sil b/test/SILOptimizer/stack_promotion.sil
index a6b1cc7..30c6d66 100644
--- a/test/SILOptimizer/stack_promotion.sil
+++ b/test/SILOptimizer/stack_promotion.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -stack-promotion -enable-sil-verify-all %s | FileCheck %s
+// RUN: %target-sil-opt -stack-promotion -enable-sil-verify-all %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/stack_promotion_escaping.swift b/test/SILOptimizer/stack_promotion_escaping.swift
index 39cb4c6..692e0a5 100644
--- a/test/SILOptimizer/stack_promotion_escaping.swift
+++ b/test/SILOptimizer/stack_promotion_escaping.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse-as-library -O -module-name=test %s -emit-sil | FileCheck %s
+// RUN: %target-swift-frontend -parse-as-library -O -module-name=test %s -emit-sil | %FileCheck %s
 
 final class Item {}
 
diff --git a/test/SILOptimizer/static_initializer.sil b/test/SILOptimizer/static_initializer.sil
index 420ca5d..ae746cc 100644
--- a/test/SILOptimizer/static_initializer.sil
+++ b/test/SILOptimizer/static_initializer.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all %s -global-opt | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %s -global-opt | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/SILOptimizer/strip_debug_info.sil b/test/SILOptimizer/strip_debug_info.sil
index 4ecddbb..351d37f 100644
--- a/test/SILOptimizer/strip_debug_info.sil
+++ b/test/SILOptimizer/strip_debug_info.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -strip-debug-info %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -strip-debug-info %s | %FileCheck %s
 
 sil_stage canonical
 
diff --git a/test/SILOptimizer/super_class_method.swift b/test/SILOptimizer/super_class_method.swift
index be112e9..873261a 100644
--- a/test/SILOptimizer/super_class_method.swift
+++ b/test/SILOptimizer/super_class_method.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil  %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil  %s | %FileCheck %s
 
 class Parent {
   @inline(never)
diff --git a/test/SILOptimizer/super_init.swift b/test/SILOptimizer/super_init.swift
index 388251b..3d7dd4d 100644
--- a/test/SILOptimizer/super_init.swift
+++ b/test/SILOptimizer/super_init.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
 
 // CHECK-LABEL: sil hidden [noinline] @_TFC10super_init3FooCfSiS0_ : $@convention(method) (Int, @thick Foo.Type) -> @owned Foo
 // CHECK-NOT:     class_method
diff --git a/test/SILOptimizer/super_method.swift b/test/SILOptimizer/super_method.swift
index e83b790..c8c0f28 100644
--- a/test/SILOptimizer/super_method.swift
+++ b/test/SILOptimizer/super_method.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil  %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil  %s | %FileCheck %s
 
 class Parent {
   @inline(never)
diff --git a/test/SILOptimizer/super_objc_class_method.swift b/test/SILOptimizer/super_objc_class_method.swift
index d16d204..a18ee3b 100644
--- a/test/SILOptimizer/super_objc_class_method.swift
+++ b/test/SILOptimizer/super_objc_class_method.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -emit-sil %s | FileCheck %s
-// RUN: %target-swift-frontend -emit-sil -I %S/Inputs -enable-source-import %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -I %S/Inputs -enable-source-import %s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/SILOptimizer/swap_refcnt.swift b/test/SILOptimizer/swap_refcnt.swift
index 69c0dcf..6abfc17 100644
--- a/test/SILOptimizer/swap_refcnt.swift
+++ b/test/SILOptimizer/swap_refcnt.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -O -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
 // REQUIRES: rdar:27506150> SILOptimizer/swap_refcnt.swift fails after noreturn -> Never changes
 
 // Make sure we can swap two values in an array without retaining anything.
diff --git a/test/SILOptimizer/throw_inline.swift b/test/SILOptimizer/throw_inline.swift
index a6ac0c8..cbfe9fb 100644
--- a/test/SILOptimizer/throw_inline.swift
+++ b/test/SILOptimizer/throw_inline.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -emit-sil %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
 
 // Make sure that we are able to inline try-apply instructions.
 
diff --git a/test/SILOptimizer/typed-access-tb-aa.sil b/test/SILOptimizer/typed-access-tb-aa.sil
index 47af2fb..94242f2 100644
--- a/test/SILOptimizer/typed-access-tb-aa.sil
+++ b/test/SILOptimizer/typed-access-tb-aa.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt %s -aa=typed-access-tb-aa -aa-dump -o /dev/null | FileCheck %s
+// RUN: %target-sil-opt %s -aa=typed-access-tb-aa -aa-dump -o /dev/null | %FileCheck %s
 
 // REQUIRES: asserts
 
diff --git a/test/SILOptimizer/unexpected_error.sil b/test/SILOptimizer/unexpected_error.sil
index 9be8ffd..e57a4af 100644
--- a/test/SILOptimizer/unexpected_error.sil
+++ b/test/SILOptimizer/unexpected_error.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -dce %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -dce %s | %FileCheck %s
 import Swift
 
 // CHECK-LABEL: sil @unexpected_error : $@convention(thin) (Error) -> () {
diff --git a/test/SILOptimizer/unreachable_dealloc_stack.sil b/test/SILOptimizer/unreachable_dealloc_stack.sil
index 7cfbf09..2ccff1b 100644
--- a/test/SILOptimizer/unreachable_dealloc_stack.sil
+++ b/test/SILOptimizer/unreachable_dealloc_stack.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all %s -diagnostics | FileCheck %s
+// RUN: %target-sil-opt -module-name Swift -enable-sil-verify-all %s -diagnostics | %FileCheck %s
 
 sil_stage raw
 
diff --git a/test/SILOptimizer/unsafe_guaranteed_peephole.sil b/test/SILOptimizer/unsafe_guaranteed_peephole.sil
index ec95490..c5aee94 100644
--- a/test/SILOptimizer/unsafe_guaranteed_peephole.sil
+++ b/test/SILOptimizer/unsafe_guaranteed_peephole.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-opt -enable-sil-verify-all -unsafe-guaranteed-peephole %s | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all -unsafe-guaranteed-peephole %s | %FileCheck %s
 sil_stage canonical
 
 import Builtin
diff --git a/test/SILOptimizer/unused_containers.swift b/test/SILOptimizer/unused_containers.swift
index 858d449..69e5f37 100644
--- a/test/SILOptimizer/unused_containers.swift
+++ b/test/SILOptimizer/unused_containers.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -primary-file %s -O -emit-sil | grep -v 'builtin "onFastPath"' | FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -O -emit-sil | grep -v 'builtin "onFastPath"' | %FileCheck %s
 
 // REQUIRES: swift_stdlib_no_asserts
 
diff --git a/test/SILOptimizer/verifier_reject.sil b/test/SILOptimizer/verifier_reject.sil
index 28fb40f..ecfeacc 100644
--- a/test/SILOptimizer/verifier_reject.sil
+++ b/test/SILOptimizer/verifier_reject.sil
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: not --crash %target-sil-opt -enable-sil-verify-all %s 2> %t/err.txt
-// RUN: FileCheck %s < %t/err.txt
+// RUN: %FileCheck %s < %t/err.txt
 
 // REQUIRES: asserts
 
diff --git a/test/Sanitizers/asan.swift b/test/Sanitizers/asan.swift
index 08fe17e..732c060 100644
--- a/test/Sanitizers/asan.swift
+++ b/test/Sanitizers/asan.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swiftc_driver %s -g -sanitize=address -o %t_tsan-binary
-// RUN: not env ASAN_OPTIONS=abort_on_error=0 %target-run %t_tsan-binary 2>&1 | FileCheck %s
+// RUN: not env ASAN_OPTIONS=abort_on_error=0 %target-run %t_tsan-binary 2>&1 | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
 // REQUIRES: asan_runtime
diff --git a/test/Sanitizers/tsan.swift b/test/Sanitizers/tsan.swift
index 776a3aa..af7f98f 100644
--- a/test/Sanitizers/tsan.swift
+++ b/test/Sanitizers/tsan.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swiftc_driver %s -g -sanitize=thread -o %t_tsan-binary
-// RUN: not env TSAN_OPTIONS=abort_on_error=0 %target-run %t_tsan-binary 2>&1 | FileCheck %s
+// RUN: not env TSAN_OPTIONS=abort_on_error=0 %target-run %t_tsan-binary 2>&1 | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
 // REQUIRES: CPU=x86_64
diff --git a/test/Sema/accessibility.swift b/test/Sema/accessibility.swift
index 9d08ba4..be0f2c2 100644
--- a/test/Sema/accessibility.swift
+++ b/test/Sema/accessibility.swift
@@ -22,7 +22,7 @@
   private func publicReq() {} // expected-error {{method 'publicReq()' must be declared public because it matches a requirement in public protocol 'PublicProto'}} {{3-10=public}}
   private func internalReq() {} // expected-error {{method 'internalReq()' must be declared internal because it matches a requirement in internal protocol 'InternalProto'}} {{3-10=internal}}
   private func filePrivateReq() {} // expected-error {{method 'filePrivateReq()' must be declared fileprivate because it matches a requirement in fileprivate protocol 'FilePrivateProto'}} {{3-10=fileprivate}}
-  private func privateReq() {} // expected-error {{method 'privateReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'PrivateProto'}} {{3-10=fileprivate}}
+  private func privateReq() {} // expected-error {{method 'privateReq()' must be declared fileprivate because it matches a requirement in fileprivate protocol 'PrivateProto'}} {{3-10=fileprivate}}
 
   public var publicVar = 0
 }
@@ -32,7 +32,7 @@
   private func publicReq() {} // expected-error {{method 'publicReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'PublicProto'}} {{3-10=internal}}
   private func internalReq() {} // expected-error {{method 'internalReq()' must be declared internal because it matches a requirement in internal protocol 'InternalProto'}} {{3-10=internal}}
   private func filePrivateReq() {} // expected-error {{method 'filePrivateReq()' must be declared fileprivate because it matches a requirement in fileprivate protocol 'FilePrivateProto'}} {{3-10=fileprivate}}
-  private func privateReq() {} // expected-error {{method 'privateReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'PrivateProto'}} {{3-10=fileprivate}}
+  private func privateReq() {} // expected-error {{method 'privateReq()' must be declared fileprivate because it matches a requirement in fileprivate protocol 'PrivateProto'}} {{3-10=fileprivate}}
 
   public var publicVar = 0
 }
@@ -42,7 +42,7 @@
   private func publicReq() {} // expected-error {{method 'publicReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'PublicProto'}} {{3-10=fileprivate}}
   private func internalReq() {} // expected-error {{method 'internalReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'InternalProto'}} {{3-10=fileprivate}}
   private func filePrivateReq() {} // expected-error {{method 'filePrivateReq()' must be declared fileprivate because it matches a requirement in fileprivate protocol 'FilePrivateProto'}} {{3-10=fileprivate}}
-  private func privateReq() {} // expected-error {{method 'privateReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'PrivateProto'}} {{3-10=fileprivate}}
+  private func privateReq() {} // expected-error {{method 'privateReq()' must be declared fileprivate because it matches a requirement in fileprivate protocol 'PrivateProto'}} {{3-10=fileprivate}}
 
   public var publicVar = 0
 }
@@ -52,7 +52,7 @@
   private func publicReq() {} // expected-error {{method 'publicReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'PublicProto'}} {{3-10=fileprivate}}
   private func internalReq() {} // expected-error {{method 'internalReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'InternalProto'}} {{3-10=fileprivate}}
   private func filePrivateReq() {} // expected-error {{method 'filePrivateReq()' must be declared fileprivate because it matches a requirement in fileprivate protocol 'FilePrivateProto'}} {{3-10=fileprivate}}
-  private func privateReq() {} // expected-error {{method 'privateReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'PrivateProto'}} {{3-10=fileprivate}}
+  private func privateReq() {} // expected-error {{method 'privateReq()' must be declared fileprivate because it matches a requirement in fileprivate protocol 'PrivateProto'}} {{3-10=fileprivate}}
 
   public var publicVar = 0
 }
@@ -198,6 +198,38 @@
   }
 }
 
+private class PrivateSub: Base {
+  required private init() {} // expected-error {{'required' initializer must be as accessible as its enclosing type}} {{12-19=fileprivate}}
+  private override func foo() {} // expected-error {{overriding instance method must be as accessible as its enclosing type}} {{3-10=fileprivate}}
+  private override var bar: Int { // expected-error {{overriding var must be as accessible as its enclosing type}} {{3-10=fileprivate}}
+    get { return 0 }
+    set {}
+  }
+  private override subscript () -> () { return () } // expected-error {{overriding subscript must be as accessible as its enclosing type}} {{3-10=fileprivate}}
+}
+
+private class PrivateSubGood: Base {
+  required fileprivate init() {}
+  fileprivate override func foo() {}
+  fileprivate override var bar: Int {
+    get { return 0 }
+    set {}
+  }
+  fileprivate override subscript () -> () { return () }
+}
+
+private class PrivateSubPrivateSet: Base {
+  required fileprivate init() {}
+  fileprivate override func foo() {}
+  private(set) override var bar: Int { // expected-error {{setter of overriding var must be as accessible as its enclosing type}}
+    get { return 0 }
+    set {}
+  }
+  private(set) override subscript () -> () { // okay; read-only in base class
+    get { return () }
+    set {}
+  }
+}
 
 public typealias PublicTA1 = PublicStruct
 public typealias PublicTA2 = InternalStruct // expected-error {{type alias cannot be declared public because its underlying type uses an internal type}}
@@ -389,6 +421,7 @@
   case A(PublicStruct) // no-warning
 }
 
+
 struct DefaultGeneric<T> {}
 // FIXME: These types are actually private; they're just being reported as
 // fileprivate because they're top-level.
@@ -536,3 +569,64 @@
 private prefix func !(input: PrivateOperatorAdopter.Inner) -> PrivateOperatorAdopter.Inner {
   return input
 }
+
+
+public protocol Equatablish {
+  static func ==(lhs: Self, rhs: Self) /* -> bool */ // expected-note {{protocol requires function '=='}}
+}
+
+fileprivate struct EquatablishOuter {
+  internal struct Inner : Equatablish {}
+}
+private func ==(lhs: EquatablishOuter.Inner, rhs: EquatablishOuter.Inner) {}
+// expected-note@-1 {{candidate has non-matching type}}
+
+fileprivate struct EquatablishOuter2 {
+  internal struct Inner : Equatablish {
+    fileprivate static func ==(lhs: Inner, rhs: Inner) {}
+    // expected-note@-1 {{candidate has non-matching type}}
+  }
+}
+
+fileprivate struct EquatablishOuterProblem {
+  internal struct Inner : Equatablish { // expected-error {{type 'EquatablishOuterProblem.Inner' does not conform to protocol 'Equatablish'}}
+    private static func ==(lhs: Inner, rhs: Inner) {}
+  }
+}
+
+internal struct EquatablishOuterProblem2 {
+  public struct Inner : Equatablish {
+    fileprivate static func ==(lhs: Inner, rhs: Inner) {} // expected-error {{method '==' must be as accessible as its enclosing type because it matches a requirement in protocol 'Equatablish'}} {{5-16=internal}}
+    // expected-note@-1 {{candidate has non-matching type}}
+  }
+}
+
+internal struct EquatablishOuterProblem3 {
+  public struct Inner : Equatablish {
+  }
+}
+private func ==(lhs: EquatablishOuterProblem3.Inner, rhs: EquatablishOuterProblem3.Inner) {} // expected-error {{method '==' must be as accessible as its enclosing type because it matches a requirement in protocol 'Equatablish'}} {{1-8=internal}}
+// expected-note@-1 {{candidate has non-matching type}}
+
+
+public protocol AssocTypeProto {
+  associatedtype Assoc
+}
+
+fileprivate struct AssocTypeOuter {
+  internal struct Inner : AssocTypeProto {
+    fileprivate typealias Assoc = Int
+  }
+}
+
+fileprivate struct AssocTypeOuterProblem {
+  internal struct Inner : AssocTypeProto {
+    private typealias Assoc = Int // expected-error {{type alias 'Assoc' must be as accessible as its enclosing type because it matches a requirement in protocol 'AssocTypeProto'}} {{5-12=fileprivate}}
+  }
+}
+
+internal struct AssocTypeOuterProblem2 {
+  public struct Inner : AssocTypeProto {
+    fileprivate typealias Assoc = Int // expected-error {{type alias 'Assoc' must be as accessible as its enclosing type because it matches a requirement in protocol 'AssocTypeProto'}} {{5-16=internal}}
+  }
+}
diff --git a/test/Sema/availability_refinement_contexts.swift b/test/Sema/availability_refinement_contexts.swift
index 9336681..f1e8af0 100644
--- a/test/Sema/availability_refinement_contexts.swift
+++ b/test/Sema/availability_refinement_contexts.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-frontend -parse -dump-type-refinement-contexts %s > %t.dump 2>&1
-// RUN: FileCheck --strict-whitespace %s < %t.dump
+// RUN: %FileCheck --strict-whitespace %s < %t.dump
 
 // REQUIRES: OS=macosx
 
diff --git a/test/Sema/availability_versions.swift b/test/Sema/availability_versions.swift
index 894147e..59a2a90 100644
--- a/test/Sema/availability_versions.swift
+++ b/test/Sema/availability_versions.swift
@@ -1,8 +1,8 @@
 // RUN: %target-parse-verify-swift -target x86_64-apple-macosx10.50 -disable-objc-attr-requires-foundation-module
-// RUN: not %target-swift-frontend -target x86_64-apple-macosx10.50 -disable-objc-attr-requires-foundation-module -parse %s 2>&1 | FileCheck %s '--implicit-check-not=<unknown>:0'
+// RUN: not %target-swift-frontend -target x86_64-apple-macosx10.50 -disable-objc-attr-requires-foundation-module -parse %s 2>&1 | %FileCheck %s '--implicit-check-not=<unknown>:0'
 
 // Make sure we do not emit availability errors or warnings when -disable-availability-checking is passed
-// RUN: not %target-swift-frontend -target x86_64-apple-macosx10.50 -parse -disable-objc-attr-requires-foundation-module -disable-availability-checking %s 2>&1 | FileCheck %s '--implicit-check-not=error:' '--implicit-check-not=warning:'
+// RUN: not %target-swift-frontend -target x86_64-apple-macosx10.50 -parse -disable-objc-attr-requires-foundation-module -disable-availability-checking %s 2>&1 | %FileCheck %s '--implicit-check-not=error:' '--implicit-check-not=warning:'
 
 // REQUIRES: OS=macosx
 
@@ -1068,15 +1068,12 @@
 
     localFuncAvailableOn10_51() // no-warning
 
-    // We still want to error on references to explicitly unavailable symbols
-    // CHECK:error: 'explicitlyUnavailable()' is unavailable
     explicitlyUnavailable() // expected-error {{'explicitlyUnavailable()' is unavailable}}
   }
 
   guard #available(iOS 8.0, *) else {
     _ = globalFuncAvailableOn10_51() // no-warning
 
-    // CHECK:error: 'explicitlyUnavailable()' is unavailable
     explicitlyUnavailable() // expected-error {{'explicitlyUnavailable()' is unavailable}}
   }
 }
@@ -1624,6 +1621,5 @@
       // expected-note@-1 {{add @available attribute to enclosing global function}}
       // expected-note@-2 {{add 'if #available' version check}}
 
-    // CHECK:error: 'unavailableWins()' is unavailable
   unavailableWins() // expected-error {{'unavailableWins()' is unavailable}}
 }
diff --git a/test/Sema/availability_versions_objc_api.swift b/test/Sema/availability_versions_objc_api.swift
index 0682130..1fae441 100644
--- a/test/Sema/availability_versions_objc_api.swift
+++ b/test/Sema/availability_versions_objc_api.swift
@@ -1,5 +1,5 @@
 // RUN: %target-parse-verify-swift %clang-importer-sdk -I %S/Inputs/custom-modules
-// RUN: not %target-swift-frontend -parse %clang-importer-sdk -I %S/Inputs/custom-modules %s 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -parse %clang-importer-sdk -I %S/Inputs/custom-modules %s 2>&1 | %FileCheck %s
 
 // REQUIRES: OS=macosx
 // REQUIRES: objc_interop
diff --git a/test/Sema/check_unnecessary_typecheck.swift b/test/Sema/check_unnecessary_typecheck.swift
index de9c4ae..73cdcb0 100644
--- a/test/Sema/check_unnecessary_typecheck.swift
+++ b/test/Sema/check_unnecessary_typecheck.swift
@@ -1,6 +1,6 @@
 // This test will crash if we end up doing unnecessary typechecking from the secondary file.
 
-// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-sil -primary-file %s %S/Inputs/forbid_typecheck_2.swift -debug-forbid-typecheck-prefix NOTYPECHECK | FileCheck %s
+// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -emit-sil -primary-file %s %S/Inputs/forbid_typecheck_2.swift -debug-forbid-typecheck-prefix NOTYPECHECK | %FileCheck %s
 
 // CHECK: check_unnecessary_typecheck.globalPrim
 let globalPrim = globalSec
diff --git a/test/Sema/complex_expressions.swift b/test/Sema/complex_expressions.swift
new file mode 100644
index 0000000..c7bc2a6
--- /dev/null
+++ b/test/Sema/complex_expressions.swift
@@ -0,0 +1,79 @@
+// RUN: %target-parse-verify-swift
+
+// SR-139:
+// Infinite recursion parsing bitwise operators
+let x = UInt32(0x1FF)&0xFF << 24 | UInt32(0x1FF)&0xFF << 16 | UInt32(0x1FF)&0xFF << 8 | (UInt32(0x1FF)&0xFF);
+
+// SR-838:
+// expression test_seconds() was too complex to be solved in reasonable time
+struct Nano : CustomStringConvertible {
+  var value: Int64 = 0
+  init(_ x: Int64) { self.value = x }
+  var description: String { return "\(self.value)" }
+}
+
+func *(lhs: Nano, rhs: Int) -> Nano { return Nano(lhs.value * Int64(rhs)); }
+func *(lhs: Int, rhs: Nano) -> Nano { return Nano(Int64(lhs) * rhs.value); }
+func +(lhs: Nano, rhs: String) -> String { return lhs.description + rhs; }
+func +(lhs: String, rhs: Nano) -> String { return lhs + rhs.description; }
+func +(lhs: Nano, rhs: Nano) -> Nano { return Nano(lhs.value + rhs.value); }
+
+let u_nano = Nano(1)
+let u_second = Nano(1_000_000_00)
+let u_minute = u_second * 60
+
+extension Int {
+  var ns: Nano { return Nano(Int64(self)) }
+  var s: Nano { return self * u_second }
+  var i: Nano { return self * u_minute }
+}
+
+func test_seconds() {
+  print("Testing second operations:\n")
+  print(u_minute + u_second + Nano(500) + " = " + 1.i + 1.s + 500.ns)
+  print((u_minute + u_second + Nano(500)) + " = " + (1.i + 1.s + 500.ns))
+}
+
+// SR-2102:
+// DictionaryExpr was too complex to be solved in resonable time
+
+let M_PI: Double = 3.1415926535897931
+let M_E : Double = 2.7182818284590451
+
+func sqrt(degrees: Int) -> Double {
+  return 0
+}
+
+func sqrt(degrees: Float) -> Double {
+  return 0
+}
+
+func sqrt(degrees: Double) -> Double {
+  return 0
+}
+
+enum Operation {
+  case constant(Double)
+  case unaryOperation((Double) -> Double)
+  case binaryOperation((Double, Double) -> Double)
+  case equals
+}
+
+var operations: Dictionary<String, Operation> = [
+  "π": .constant(M_PI),
+  "e": .constant(M_E),
+  "√": .unaryOperation(sqrt),
+  "×": .binaryOperation({ (op1: Double, op2: Double) in
+    return op1 * op2
+  }),
+  "÷": .binaryOperation({ (op1, op2) in
+    return op1 / op2
+  }),
+  "+": .binaryOperation({ (op1: Double, op2: Double) in
+    return op1 + op2
+  }),
+  "−": .binaryOperation({ (op1, op2) in
+    return op1 - op2
+  }),
+  "=": .equals,
+]
diff --git a/test/Sema/deprecation_osx.swift b/test/Sema/deprecation_osx.swift
index abe19ad..3b50e6f 100644
--- a/test/Sema/deprecation_osx.swift
+++ b/test/Sema/deprecation_osx.swift
@@ -1,5 +1,5 @@
 // RUN: %swift -parse -parse-as-library -target x86_64-apple-macosx10.51 %clang-importer-sdk -I %S/Inputs/custom-modules %s -verify
-// RUN: %swift -parse -parse-as-library -target x86_64-apple-macosx10.51 %clang-importer-sdk -I %S/Inputs/custom-modules %s 2>&1 | FileCheck %s '--implicit-check-not=<unknown>:0'
+// RUN: %swift -parse -parse-as-library -target x86_64-apple-macosx10.51 %clang-importer-sdk -I %S/Inputs/custom-modules %s 2>&1 | %FileCheck %s '--implicit-check-not=<unknown>:0'
 //
 // This test requires a target of OS X 10.51 or later to test deprecation
 // diagnostics because (1) we only emit deprecation warnings if a symbol is
diff --git a/test/Sema/enum_raw_representable.swift b/test/Sema/enum_raw_representable.swift
index e1d5f64..4abcf69 100644
--- a/test/Sema/enum_raw_representable.swift
+++ b/test/Sema/enum_raw_representable.swift
@@ -47,7 +47,7 @@
 var bars: [Bar] = deserialize([1.2, 3.4, 5.6])
 
 // Infer RawValue from witnesses.
-enum Color : Int, RawRepresentable {
+enum Color : Int {
   case red
   case blue
 
@@ -61,3 +61,9 @@
 }
 
 var colorRaw: Color.RawValue = 7.5
+
+// Mismatched case types
+
+enum BadPlain : UInt { // expected-error {{'BadPlain' declares raw type 'UInt', but does not conform to RawRepresentable and conformance could not be synthesized}}
+    case a = "hello"   // expected-error {{cannot convert value of type 'String' to raw type 'UInt'}}
+}
diff --git a/test/Sema/enum_raw_representable_generic.swift b/test/Sema/enum_raw_representable_generic.swift
new file mode 100644
index 0000000..7ca5cb1
--- /dev/null
+++ b/test/Sema/enum_raw_representable_generic.swift
@@ -0,0 +1,39 @@
+// RUN: %target-run-simple-swift
+
+// REQUIRES: executable-test
+
+enum Foo<T : ExpressibleByIntegerLiteral> : T where T:Equatable {
+  case a = 1
+  case b = 10
+  case c = 42
+  case d // = 43 by auto-incrementing
+}
+
+struct MyNumber : ExpressibleByIntegerLiteral, Equatable {
+  typealias IntegerLiteralType = Int
+  let _storage : Int
+  init(integerLiteral: Int) {
+    _storage = integerLiteral
+  }
+  static func ==(lhs: MyNumber, rhs: MyNumber) -> Bool {
+    return lhs._storage == rhs._storage
+  }
+}
+
+let _ : Int8  = Foo.a.rawValue
+let _ : Int16 = Foo.a.rawValue
+let _ : Int32 = Foo.a.rawValue
+let _ : Int64 = Foo.a.rawValue
+let _ : UInt8  = Foo.a.rawValue
+let _ : UInt16 = Foo.a.rawValue
+let _ : UInt32 = Foo.a.rawValue
+let _ : UInt64 = Foo.a.rawValue
+let _ : MyNumber = Foo.a.rawValue
+
+guard case .c = Foo(rawValue: UInt8(42))!  else { fatalError() }
+guard case .c = Foo(rawValue: UInt16(42))! else { fatalError() }
+guard case .c = Foo(rawValue: UInt32(42))! else { fatalError() }
+guard case .c = Foo(rawValue: UInt64(42))! else { fatalError() }
+guard case .c = Foo(rawValue: MyNumber(integerLiteral: 42))! else { fatalError() }
+
+guard case .d = Foo(rawValue: MyNumber(integerLiteral: 43))! else { fatalError() }
diff --git a/test/Sema/omit_needless_words.swift b/test/Sema/omit_needless_words.swift
deleted file mode 100644
index c0b0cf5..0000000
--- a/test/Sema/omit_needless_words.swift
+++ /dev/null
@@ -1,34 +0,0 @@
-// RUN: %target-parse-verify-swift -Womit-needless-words
-
-class C1 {
-  init(tasteString: String) { } // expected-warning{{'init(tasteString:)' could be named 'init(taste:)'}}{{8-8=taste }}
-  func processWithString(_ string: String, toInt: Int) { } // expected-warning{{'processWithString(_:toInt:)' could be named 'process(with:to:)'}}{{8-25=process}} {{26-27=with}} {{44-44=to }}
-  func processWithInt(_ value: Int) { } // expected-warning{{'processWithInt' could be named 'process(with:)'}}{{8-22=process}}
-}
-
-extension String {
-  static var randomString: String { return "" } // expected-warning{{'randomString' could be named 'random'}}{{14-26=random}}
-  var wonkycasedString: String { return self } // expected-warning{{'wonkycasedString' could be named 'wonkycased'}}{{7-23=wonkycased}}
-}
-
-func callSites(_ s: String) {
-  let c1 = C1(tasteString: "blah") // expected-warning{{'init(tasteString:)' could be named 'init(taste:)'}}{{15-26=taste}}
-  c1.processWithString("a", toInt: 1) // expected-warning{{'processWithString(_:toInt:)' could be named 'process(with:to:)'}}{{6-23=process}}{{29-34=to}}
-  c1.processWithInt(5) // expected-warning{{'processWithInt' could be named 'process(with:)'}}{{6-20=process}}
-  _ = String.randomString // expected-warning{{'randomString' could be named 'random'}}{{14-26=random}}
-  _ = s.wonkycasedString // expected-warning{{'wonkycasedString' could be named 'wonkycased'}}{{9-25=wonkycased}}
-}
-
-struct MagicNameString { }
-
-extension String {
-  func appendStrings(_ strings: [String]) { } // expected-warning{{'appendStrings' could be named 'append'}}{{8-21=append}}
-  func appendObjects(_ objects: [AnyObject]) { } // expected-warning{{'appendObjects' could be named 'append'}}{{8-21=append}}
-  func appendMagicNameStrings(_ strings: [MagicNameString]) { } // expected-warning{{'appendMagicNameStrings' could be named 'append'}}{{8-30=append}}
-}
-
-class NSArray {
-  func arrayByAddingObject(_ x: AnyObject) -> NSArray { return NSArray() } // expected-warning{{'arrayByAddingObject' could be named 'adding' [-Womit-needless-words]}}{{8-27=adding}}
-}
-
-func emptyFirstParamName(_: Int) { }
diff --git a/test/Sema/suppress-argument-labels-in-types.swift b/test/Sema/suppress-argument-labels-in-types.swift
index 3a5c1a1..e5ad872 100644
--- a/test/Sema/suppress-argument-labels-in-types.swift
+++ b/test/Sema/suppress-argument-labels-in-types.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -module-name TestModule -parse -verify -suppress-argument-labels-in-types %s
+// RUN: %target-swift-frontend -module-name TestModule -parse -verify %s
 
 // Test non-overloaded global function references.
 func f1(a: Int, b: Int) -> Int { }
diff --git a/test/Serialization/Inputs/def_class.swift b/test/Serialization/Inputs/def_class.swift
index 6b56b4c..cd8a875 100644
--- a/test/Serialization/Inputs/def_class.swift
+++ b/test/Serialization/Inputs/def_class.swift
@@ -1,6 +1,5 @@
 open class Empty {}
 
-@swift3_migration(renamed: "DosInts", message: "because I can")
 open class TwoInts {
   open var x, y : Int
   
@@ -11,7 +10,6 @@
 }
 
 open class ComputedProperty {
-  @swift3_migration(renamed: "theValue", message: "because I can")
   open var value : Int {
     get {
       var result = 0
@@ -22,7 +20,6 @@
     }
   }
 
-  @swift3_migration(message: "something else")
   open var readOnly : Int {
     return 42
   }
diff --git a/test/Serialization/Inputs/def_enum_derived.swift b/test/Serialization/Inputs/def_enum_derived.swift
index 4f5c4e6..7079606 100644
--- a/test/Serialization/Inputs/def_enum_derived.swift
+++ b/test/Serialization/Inputs/def_enum_derived.swift
@@ -1,3 +1 @@
-extension Breakfast : RawRepresentable {}
-
 extension Breakfast : Error {}
diff --git a/test/Serialization/alignment.swift b/test/Serialization/alignment.swift
index 193e445..4b58774 100644
--- a/test/Serialization/alignment.swift
+++ b/test/Serialization/alignment.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend %s -emit-module -parse-as-library -o %t
-// RUN: %target-sil-opt -enable-sil-verify-all %t/alignment.swiftmodule -o - | FileCheck %s
+// RUN: %target-sil-opt -enable-sil-verify-all %t/alignment.swiftmodule -o - | %FileCheck %s
 
 //CHECK: @_alignment(16) struct Foo {
 @_alignment(16) struct Foo {}
diff --git a/test/Serialization/always_inline.swift b/test/Serialization/always_inline.swift
index 4816fda..fb8a030 100644
--- a/test/Serialization/always_inline.swift
+++ b/test/Serialization/always_inline.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -sil-serialize-all -o %t %S/Inputs/def_always_inline.swift
-// RUN: llvm-bcanalyzer %t/def_always_inline.swiftmodule | FileCheck %s
-// RUN: %target-swift-frontend -emit-silgen -sil-link-all -I %t %s | FileCheck %s -check-prefix=SIL
+// RUN: llvm-bcanalyzer %t/def_always_inline.swiftmodule | %FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sil-link-all -I %t %s | %FileCheck %s -check-prefix=SIL
 
 // CHECK-NOT: UnknownCode
 
diff --git a/test/Serialization/array.swift b/test/Serialization/array.swift
index b87fb8e..b1a7117 100644
--- a/test/Serialization/array.swift
+++ b/test/Serialization/array.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/has_array.swift
-// RUN: llvm-bcanalyzer %t/has_array.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/has_array.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -emit-silgen -I %t %s -o /dev/null
 // XFAIL: *
 
diff --git a/test/Serialization/autolinking.swift b/test/Serialization/autolinking.swift
index 8a67b8f..fb664c0 100644
--- a/test/Serialization/autolinking.swift
+++ b/test/Serialization/autolinking.swift
@@ -2,23 +2,23 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -parse-stdlib -o %t -module-name someModule -module-link-name module %S/../Inputs/empty.swift
 // RUN: %target-swift-frontend -emit-ir -lmagic %s -I %t > %t/out.txt
-// RUN: FileCheck %s < %t/out.txt
-// RUN: FileCheck -check-prefix=NO-FORCE-LOAD %s < %t/out.txt
+// RUN: %FileCheck %s < %t/out.txt
+// RUN: %FileCheck -check-prefix=NO-FORCE-LOAD %s < %t/out.txt
 
 // RUN: mkdir -p %t/someModule.framework/Modules/someModule.swiftmodule/
 // RUN: mv %t/someModule.swiftmodule %t/someModule.framework/Modules/someModule.swiftmodule/%target-swiftmodule-name
 // RUN: %target-swift-frontend -emit-ir -lmagic %s -F %t > %t/framework.txt
-// RUN: FileCheck -check-prefix=FRAMEWORK %s < %t/framework.txt
-// RUN: FileCheck -check-prefix=NO-FORCE-LOAD %s < %t/framework.txt
+// RUN: %FileCheck -check-prefix=FRAMEWORK %s < %t/framework.txt
+// RUN: %FileCheck -check-prefix=NO-FORCE-LOAD %s < %t/framework.txt
 
 // RUN: %target-swift-frontend -emit-module -parse-stdlib -o %t -module-name someModule -module-link-name module %S/../Inputs/empty.swift -autolink-force-load
 // RUN: %target-swift-frontend -emit-ir -lmagic %s -I %t > %t/force-load.txt
-// RUN: FileCheck %s < %t/force-load.txt
-// RUN: FileCheck -check-prefix=FORCE-LOAD-CLIENT %s < %t/force-load.txt
+// RUN: %FileCheck %s < %t/force-load.txt
+// RUN: %FileCheck -check-prefix=FORCE-LOAD-CLIENT %s < %t/force-load.txt
 
-// RUN: %target-swift-frontend -emit-ir -parse-stdlib -module-name someModule -module-link-name module %S/../Inputs/empty.swift | FileCheck --check-prefix=NO-FORCE-LOAD %s
-// RUN: %target-swift-frontend -emit-ir -parse-stdlib -module-name someModule -module-link-name module %S/../Inputs/empty.swift -autolink-force-load | FileCheck --check-prefix=FORCE-LOAD %s
-// RUN: %target-swift-frontend -emit-ir -parse-stdlib -module-name someModule -module-link-name 0module %S/../Inputs/empty.swift -autolink-force-load | FileCheck --check-prefix=FORCE-LOAD-HEX %s
+// RUN: %target-swift-frontend -emit-ir -parse-stdlib -module-name someModule -module-link-name module %S/../Inputs/empty.swift | %FileCheck --check-prefix=NO-FORCE-LOAD %s
+// RUN: %target-swift-frontend -emit-ir -parse-stdlib -module-name someModule -module-link-name module %S/../Inputs/empty.swift -autolink-force-load | %FileCheck --check-prefix=FORCE-LOAD %s
+// RUN: %target-swift-frontend -emit-ir -parse-stdlib -module-name someModule -module-link-name 0module %S/../Inputs/empty.swift -autolink-force-load | %FileCheck --check-prefix=FORCE-LOAD-HEX %s
 
 // Linux uses a different autolinking mechanism, based on
 // swift-autolink-extract. This file tests the Darwin mechanism.
diff --git a/test/Serialization/basic_sil.swift b/test/Serialization/basic_sil.swift
index 3d10937..f51e95b 100644
--- a/test/Serialization/basic_sil.swift
+++ b/test/Serialization/basic_sil.swift
@@ -1,13 +1,13 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-build-swift -emit-module -Xfrontend -disable-diagnostic-passes -Xfrontend -sil-serialize-all -force-single-frontend-invocation -o %t/def_basic.swiftmodule %S/Inputs/def_basic.sil
-// RUN: llvm-bcanalyzer %t/def_basic.swiftmodule | FileCheck %s
-// RUN: %target-build-swift -emit-silgen -Xfrontend -sil-link-all -I %t %s | FileCheck %S/Inputs/def_basic.sil
+// RUN: llvm-bcanalyzer %t/def_basic.swiftmodule | %FileCheck %s
+// RUN: %target-build-swift -emit-silgen -Xfrontend -sil-link-all -I %t %s | %FileCheck %S/Inputs/def_basic.sil
 
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-build-swift -emit-module -Xfrontend -disable-diagnostic-passes -force-single-frontend-invocation -Xfrontend -sil-serialize-all -o %t/def_basic.swiftmodule %S/Inputs/def_basic.sil
-// RUN: %target-build-swift -emit-silgen -Xfrontend -sil-link-all -I %t %s | FileCheck -check-prefix=CHECK_DECL %S/Inputs/def_basic.sil
+// RUN: %target-build-swift -emit-silgen -Xfrontend -sil-link-all -I %t %s | %FileCheck -check-prefix=CHECK_DECL %S/Inputs/def_basic.sil
 
 // This test currently is written such that no optimizations are assumed.
 // REQUIRES: swift_test_mode_optimize_none
diff --git a/test/Serialization/basic_sil_objc.swift b/test/Serialization/basic_sil_objc.swift
index 998f110..36afc62 100644
--- a/test/Serialization/basic_sil_objc.swift
+++ b/test/Serialization/basic_sil_objc.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-build-swift -Xfrontend %clang-importer-sdk -I %S/../Inputs/clang-importer-sdk/swift-modules -emit-module -Xfrontend -disable-diagnostic-passes -Xfrontend -sil-serialize-all -force-single-frontend-invocation -o %t/def_basic_objc.swiftmodule %S/Inputs/def_basic_objc.sil
-// RUN: llvm-bcanalyzer %t/def_basic_objc.swiftmodule | FileCheck %s
-// RUN: %target-build-swift -Xfrontend %clang-importer-sdk -emit-silgen -Xfrontend -sil-link-all -I %t %s | FileCheck %S/Inputs/def_basic_objc.sil
+// RUN: llvm-bcanalyzer %t/def_basic_objc.swiftmodule | %FileCheck %s
+// RUN: %target-build-swift -Xfrontend %clang-importer-sdk -emit-silgen -Xfrontend -sil-link-all -I %t %s | %FileCheck %S/Inputs/def_basic_objc.sil
 
 // This test currently is written such that no optimizations are assumed.
 // REQUIRES: swift_test_mode_optimize_none
diff --git a/test/Serialization/builtin.swift b/test/Serialization/builtin.swift
index 51bd5cb..44f94a8 100644
--- a/test/Serialization/builtin.swift
+++ b/test/Serialization/builtin.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -parse-stdlib -o %t %S/Inputs/alias_builtin.swift
-// RUN: llvm-bcanalyzer %t/alias_builtin.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/alias_builtin.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -I %t -parse %s -verify
 
 // CHECK-NOT: UnknownCode
diff --git a/test/Serialization/class-roundtrip-module.swift b/test/Serialization/class-roundtrip-module.swift
index 2351c85..186f23d 100644
--- a/test/Serialization/class-roundtrip-module.swift
+++ b/test/Serialization/class-roundtrip-module.swift
@@ -2,6 +2,6 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -module-name def_class -o %t/stage1.swiftmodule %S/Inputs/def_class.swift -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend -emit-module -parse-as-library -o %t/def_class.swiftmodule %t/stage1.swiftmodule
-// RUN: %target-swift-frontend -emit-sil -Xllvm -sil-disable-pass="External Defs To Decls" -sil-debug-serialization -I %t %S/class.swift | FileCheck %s -check-prefix=SIL
+// RUN: %target-swift-frontend -emit-sil -Xllvm -sil-disable-pass="External Defs To Decls" -sil-debug-serialization -I %t %S/class.swift | %FileCheck %s -check-prefix=SIL
 
 // SIL-LABEL: sil public_external [transparent] [fragile] @_TFsoi1pFTSiSi_Si : $@convention(thin) (Int, Int) -> Int {
diff --git a/test/Serialization/class.swift b/test/Serialization/class.swift
index 49ce16a..e2a09ca 100644
--- a/test/Serialization/class.swift
+++ b/test/Serialization/class.swift
@@ -1,9 +1,9 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-object -emit-module -o %t %S/Inputs/def_class.swift -disable-objc-attr-requires-foundation-module
-// RUN: llvm-bcanalyzer %t/def_class.swiftmodule | FileCheck %s
-// RUN: %target-swift-frontend -emit-sil -Xllvm -sil-disable-pass="External Defs To Decls" -sil-debug-serialization -I %t %s | FileCheck %s -check-prefix=SIL
-// RUN: echo "import def_class; struct A : ClassProto {}" | not %target-swift-frontend -parse -I %t - 2>&1 | FileCheck %s -check-prefix=CHECK-STRUCT
+// RUN: llvm-bcanalyzer %t/def_class.swiftmodule | %FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -Xllvm -sil-disable-pass="External Defs To Decls" -sil-debug-serialization -I %t %s | %FileCheck %s -check-prefix=SIL
+// RUN: echo "import def_class; struct A : ClassProto {}" | not %target-swift-frontend -parse -I %t - 2>&1 | %FileCheck %s -check-prefix=CHECK-STRUCT
 
 // CHECK-NOT: UnknownCode
 // CHECK-STRUCT: non-class type 'A' cannot conform to class protocol 'ClassProto'
diff --git a/test/Serialization/comments-framework.swift b/test/Serialization/comments-framework.swift
index ba254ba..1bbf3fc 100644
--- a/test/Serialization/comments-framework.swift
+++ b/test/Serialization/comments-framework.swift
@@ -2,10 +2,10 @@
 // RUN: mkdir -p %t/comments.framework/Modules/comments.swiftmodule/
 
 // RUN: %target-swift-frontend -module-name comments -emit-module -emit-module-path %t/comments.framework/Modules/comments.swiftmodule/%target-swiftmodule-name -emit-module-doc-path %t/comments.framework/Modules/comments.swiftmodule/%target-swiftdoc-name %s
-// RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -F %t | FileCheck %s
+// RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -F %t | %FileCheck %s
 
 // RUN: cp -r %t/comments.framework/Modules/comments.swiftmodule %t/comments.swiftmodule
-// RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -I %t | FileCheck %s
+// RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -I %t | %FileCheck %s
 
 // XFAIL: linux
 
diff --git a/test/Serialization/comments-hidden.swift b/test/Serialization/comments-hidden.swift
index e5d045c..04b01a3 100644
--- a/test/Serialization/comments-hidden.swift
+++ b/test/Serialization/comments-hidden.swift
@@ -4,8 +4,8 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -module-name comments -emit-module -emit-module-path %t/comments.swiftmodule -emit-module-doc -emit-module-doc-path %t/comments.swiftdoc %s
 // RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -I %t > %t.normal.txt
-// RUN: FileCheck %s -check-prefix=NORMAL < %t.normal.txt
-// RUN: FileCheck %s -check-prefix=NORMAL-NEGATIVE < %t.normal.txt
+// RUN: %FileCheck %s -check-prefix=NORMAL < %t.normal.txt
+// RUN: %FileCheck %s -check-prefix=NORMAL-NEGATIVE < %t.normal.txt
 
 // Test the case when we compile with -enable-testing
 //
@@ -13,8 +13,8 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -enable-testing -module-name comments -emit-module -emit-module-path %t/comments.swiftmodule -emit-module-doc -emit-module-doc-path %t/comments.swiftdoc %s
 // RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -I %t > %t.testing.txt
-// RUN: FileCheck %s -check-prefix=TESTING < %t.testing.txt
-// RUN: FileCheck %s -check-prefix=TESTING-NEGATIVE < %t.testing.txt
+// RUN: %FileCheck %s -check-prefix=TESTING < %t.testing.txt
+// RUN: %FileCheck %s -check-prefix=TESTING-NEGATIVE < %t.testing.txt
 
 /// PublicClass Documentation
 public class PublicClass {
diff --git a/test/Serialization/comments.swift b/test/Serialization/comments.swift
index f4fb601..6430235 100644
--- a/test/Serialization/comments.swift
+++ b/test/Serialization/comments.swift
@@ -3,9 +3,9 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -module-name comments -emit-module -emit-module-path %t/comments.swiftmodule -emit-module-doc -emit-module-doc-path %t/comments.swiftdoc %s
-// RUN: llvm-bcanalyzer %t/comments.swiftmodule | FileCheck %s -check-prefix=BCANALYZER
-// RUN: llvm-bcanalyzer %t/comments.swiftdoc | FileCheck %s -check-prefix=BCANALYZER
-// RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -I %t | FileCheck %s -check-prefix=FIRST
+// RUN: llvm-bcanalyzer %t/comments.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER
+// RUN: llvm-bcanalyzer %t/comments.swiftdoc | %FileCheck %s -check-prefix=BCANALYZER
+// RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -I %t | %FileCheck %s -check-prefix=FIRST
 
 // Test the case when we have a multiple files in a module.
 //
@@ -14,11 +14,11 @@
 // RUN: %target-swift-frontend -module-name comments -emit-module -emit-module-path %t/first.swiftmodule -emit-module-doc -emit-module-doc-path %t/first.swiftdoc -primary-file %s %S/Inputs/def_comments.swift
 // RUN: %target-swift-frontend -module-name comments -emit-module -emit-module-path %t/second.swiftmodule -emit-module-doc -emit-module-doc-path %t/second.swiftdoc %s -primary-file %S/Inputs/def_comments.swift
 // RUN: %target-swift-frontend -module-name comments -emit-module -emit-module-path %t/comments.swiftmodule -emit-module-doc -emit-module-doc-path %t/comments.swiftdoc %t/first.swiftmodule %t/second.swiftmodule
-// RUN: llvm-bcanalyzer %t/comments.swiftmodule | FileCheck %s -check-prefix=BCANALYZER
-// RUN: llvm-bcanalyzer %t/comments.swiftdoc | FileCheck %s -check-prefix=BCANALYZER
+// RUN: llvm-bcanalyzer %t/comments.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER
+// RUN: llvm-bcanalyzer %t/comments.swiftdoc | %FileCheck %s -check-prefix=BCANALYZER
 // RUN: %target-swift-ide-test -print-module-comments -module-to-print=comments -source-filename %s -I %t > %t.printed.txt
-// RUN: FileCheck %s -check-prefix=FIRST < %t.printed.txt
-// RUN: FileCheck %s -check-prefix=SECOND < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=FIRST < %t.printed.txt
+// RUN: %FileCheck %s -check-prefix=SECOND < %t.printed.txt
 
 // BCANALYZER-NOT: UnknownCode
 
diff --git a/test/Serialization/default_silfunction_deserializationfrom_stdlib.swift b/test/Serialization/default_silfunction_deserializationfrom_stdlib.swift
index 15b53fb..5f5debe 100644
--- a/test/Serialization/default_silfunction_deserializationfrom_stdlib.swift
+++ b/test/Serialization/default_silfunction_deserializationfrom_stdlib.swift
@@ -1,6 +1,6 @@
 // FIXME: depends on brittle stdlib implementation details
 // XFAIL: *
-// RUN: %target-swift-frontend %s -emit-sil -O -o - -sil-debug-serialization | FileCheck %s
+// RUN: %target-swift-frontend %s -emit-sil -O -o - -sil-debug-serialization | %FileCheck %s
 
 // CHECK-DAG: sil public_external [transparent] @_TFsoi1pU__FT3lhsGVs13UnsafeMutablePointerQ__3rhsSi_GS_Q__ : $@convention(thin) <T> (UnsafeMutablePointer<T>, Int) -> UnsafeMutablePointer<T> {
 // CHECK-DAG: sil public_external @_TFVs13UnsafeMutablePointerCU__fMGS_Q__FT5valueBp_GS_Q__ : $@convention(thin) <T> (Builtin.RawPointer, @thin UnsafeMutablePointer<T>.Type) -> UnsafeMutablePointer<T> {
diff --git a/test/Serialization/empty.swift b/test/Serialization/empty.swift
index 8892a8a..299b242 100644
--- a/test/Serialization/empty.swift
+++ b/test/Serialization/empty.swift
@@ -2,8 +2,8 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -parse-stdlib -o %t %s
 // RUN: llvm-bcanalyzer -dump %t/empty.swiftmodule > %t/empty.dump.txt
-// RUN: FileCheck %s < %t/empty.dump.txt
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t/empty.dump.txt
+// RUN: %FileCheck %s < %t/empty.dump.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/empty.dump.txt
 
 // CHECK: <MODULE_BLOCK {{.*}}>
 // CHECK: <MODULE_NAME abbrevid={{[0-9]+}}/> blob data = 'empty'
diff --git a/test/Serialization/enum.swift b/test/Serialization/enum.swift
index f006129..58511dc 100644
--- a/test/Serialization/enum.swift
+++ b/test/Serialization/enum.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -module-name def_enum -o %t %S/Inputs/def_enum.swift %S/Inputs/def_enum_derived.swift
-// RUN: llvm-bcanalyzer %t/def_enum.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/def_enum.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -parse -I %t %s -o /dev/null
 // RUN: %target-swift-frontend -emit-sil -I %t %s -o /dev/null
 
diff --git a/test/Serialization/function.swift b/test/Serialization/function.swift
index 5316fe9..6c7a8d8 100644
--- a/test/Serialization/function.swift
+++ b/test/Serialization/function.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_func.swift
-// RUN: llvm-bcanalyzer %t/def_func.swiftmodule | FileCheck %s
-// RUN: %target-swift-frontend -emit-silgen -I %t %s | FileCheck %s -check-prefix=SIL
+// RUN: llvm-bcanalyzer %t/def_func.swiftmodule | %FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -I %t %s | %FileCheck %s -check-prefix=SIL
 
 // CHECK-NOT: FALL_BACK_TO_TRANSLATION_UNIT
 // CHECK-NOT: UnknownCode
diff --git a/test/Serialization/generic_extension.swift b/test/Serialization/generic_extension.swift
index 160e35d..be4aab5 100644
--- a/test/Serialization/generic_extension.swift
+++ b/test/Serialization/generic_extension.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/generic_extension_1.swift
-// RUN: %target-swift-frontend -emit-sil -I %t %s | FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -I %t %s | %FileCheck %s
 
 // We have to perform IRGen to actually check that the generic substitutions
 // are being used.
diff --git a/test/Serialization/generic_witness.swift b/test/Serialization/generic_witness.swift
index ea8f2db..b2e2b9d 100644
--- a/test/Serialization/generic_witness.swift
+++ b/test/Serialization/generic_witness.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/has_generic_witness.swift
-// RUN: llvm-bcanalyzer %t/has_generic_witness.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/has_generic_witness.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -emit-ir -I %t %s -o /dev/null
 
 // We have to perform IRGen to actually check that the generic substitutions
diff --git a/test/Serialization/global_init.swift b/test/Serialization/global_init.swift
index 062e6eb..a059efb 100644
--- a/test/Serialization/global_init.swift
+++ b/test/Serialization/global_init.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -parse-as-library -sil-serialize-all -o %t %s
-// RUN: llvm-bcanalyzer %t/global_init.swiftmodule | FileCheck %s -check-prefix=BCANALYZER
-// RUN: %target-sil-opt -enable-sil-verify-all %t/global_init.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/global_init.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER
+// RUN: %target-sil-opt -enable-sil-verify-all %t/global_init.swiftmodule | %FileCheck %s
 
 // BCANALYZER-NOT: UnknownCode
 
diff --git a/test/Serialization/import_source.swift b/test/Serialization/import_source.swift
index af834ae..7f506a1 100644
--- a/test/Serialization/import_source.swift
+++ b/test/Serialization/import_source.swift
@@ -1,6 +1,6 @@
 // RUN: not %target-swift-frontend -parse -I %S/Inputs %s 2>%t.txt
-// RUN: FileCheck %s < %t.txt
-// RUN: FileCheck %s -check-prefix=NEGATIVE < %t.txt
+// RUN: %FileCheck %s < %t.txt
+// RUN: %FileCheck %s -check-prefix=NEGATIVE < %t.txt
 
 // FIXME: We need to type-check transparent functions if they are used.
 // XFAIL: *
diff --git a/test/Serialization/load-wrong-name.swift b/test/Serialization/load-wrong-name.swift
index 007a3f6..d587c65 100644
--- a/test/Serialization/load-wrong-name.swift
+++ b/test/Serialization/load-wrong-name.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_func.swift -module-name new_module
-// RUN: not %target-swift-frontend %s -parse -I %t -show-diagnostics-after-fatal 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend %s -parse -I %t -show-diagnostics-after-fatal 2>&1 | %FileCheck %s
 
 import swift // CHECK: error: {{cannot load module 'Swift' as 'swift'|no such module 'swift'}}
 import NEW_MODULE // CHECK: error: {{cannot load module 'new_module' as 'NEW_MODULE'|no such module 'NEW_MODULE'}}
diff --git a/test/Serialization/multi-file.swift b/test/Serialization/multi-file.swift
index 8a60b8a..460b439 100644
--- a/test/Serialization/multi-file.swift
+++ b/test/Serialization/multi-file.swift
@@ -3,14 +3,14 @@
 // RUN: %target-swift-frontend -emit-module -module-name Multi -o %t/multi-file.swiftmodule -primary-file %s %S/Inputs/multi-file-2.swift
 // RUN: %target-swift-frontend -emit-module -module-name Multi -o %t/multi-file-2.swiftmodule %s -primary-file %S/Inputs/multi-file-2.swift
 
-// RUN: llvm-bcanalyzer %t/multi-file.swiftmodule | FileCheck %s -check-prefix=THIS-FILE
-// RUN: llvm-bcanalyzer %t/multi-file.swiftmodule | FileCheck %s -check-prefix=THIS-FILE-NEG
-// RUN: llvm-bcanalyzer %t/multi-file-2.swiftmodule | FileCheck %s -check-prefix=OTHER-FILE
-// RUN: llvm-bcanalyzer %t/multi-file-2.swiftmodule | FileCheck %s -check-prefix=OTHER-FILE-NEG
+// RUN: llvm-bcanalyzer %t/multi-file.swiftmodule | %FileCheck %s -check-prefix=THIS-FILE
+// RUN: llvm-bcanalyzer %t/multi-file.swiftmodule | %FileCheck %s -check-prefix=THIS-FILE-NEG
+// RUN: llvm-bcanalyzer %t/multi-file-2.swiftmodule | %FileCheck %s -check-prefix=OTHER-FILE
+// RUN: llvm-bcanalyzer %t/multi-file-2.swiftmodule | %FileCheck %s -check-prefix=OTHER-FILE-NEG
 
 // RUN: %target-swift-frontend -emit-module -module-name Multi %t/multi-file.swiftmodule %t/multi-file-2.swiftmodule -o %t
-// RUN: llvm-bcanalyzer %t/Multi.swiftmodule | FileCheck %s -check-prefix=THIS-FILE
-// RUN: llvm-bcanalyzer %t/Multi.swiftmodule | FileCheck %s -check-prefix=OTHER-FILE
+// RUN: llvm-bcanalyzer %t/Multi.swiftmodule | %FileCheck %s -check-prefix=THIS-FILE
+// RUN: llvm-bcanalyzer %t/Multi.swiftmodule | %FileCheck %s -check-prefix=OTHER-FILE
 
 // Do not put any enums in this file. It's part of the test that no enums
 // get serialized here.
diff --git a/test/Serialization/noinline.swift b/test/Serialization/noinline.swift
index 4b582b2..cc8ae96 100644
--- a/test/Serialization/noinline.swift
+++ b/test/Serialization/noinline.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -sil-serialize-all -o %t %S/Inputs/def_noinline.swift
-// RUN: llvm-bcanalyzer %t/def_noinline.swiftmodule | FileCheck %s
-// RUN: %target-swift-frontend -emit-silgen -sil-link-all -I %t %s | FileCheck %s -check-prefix=SIL
+// RUN: llvm-bcanalyzer %t/def_noinline.swiftmodule | %FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sil-link-all -I %t %s | %FileCheck %s -check-prefix=SIL
 
 // CHECK-NOT: UnknownCode
 
diff --git a/test/Serialization/objc.swift b/test/Serialization/objc.swift
index 5cc360a..1fe5cc5 100644
--- a/test/Serialization/objc.swift
+++ b/test/Serialization/objc.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_objc.swift -disable-objc-attr-requires-foundation-module
-// RUN: llvm-bcanalyzer %t/def_objc.swiftmodule | FileCheck %s
-// RUN: %target-swift-frontend -emit-silgen -I %t %s -o - | FileCheck %s -check-prefix=SIL
+// RUN: llvm-bcanalyzer %t/def_objc.swiftmodule | %FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -I %t %s -o - | %FileCheck %s -check-prefix=SIL
 
 // CHECK-NOT: UnknownCode
 
diff --git a/test/Serialization/objc_method_table.swift b/test/Serialization/objc_method_table.swift
index e38495e..6eec2ea 100644
--- a/test/Serialization/objc_method_table.swift
+++ b/test/Serialization/objc_method_table.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -disable-objc-attr-requires-foundation-module -o %t %S/Inputs/objc_method_decls.swift
-// RUN: llvm-bcanalyzer %t/objc_method_decls.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/objc_method_decls.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -parse -disable-objc-attr-requires-foundation-module -I %t %s -verify
 
 // REQUIRES: objc_interop
diff --git a/test/Serialization/operator.swift b/test/Serialization/operator.swift
index 1b284c5..17e882b 100644
--- a/test/Serialization/operator.swift
+++ b/test/Serialization/operator.swift
@@ -1,9 +1,9 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_operator.swift
-// RUN: llvm-bcanalyzer %t/def_operator.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/def_operator.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -parse -I%t %s
-// RUN: %target-swift-frontend -interpret -I %t -DINTERP %s | FileCheck --check-prefix=OUTPUT %s
+// RUN: %target-swift-frontend -interpret -I %t -DINTERP %s | %FileCheck --check-prefix=OUTPUT %s
 
 // REQUIRES: swift_interpreter
 
diff --git a/test/Serialization/override.swift b/test/Serialization/override.swift
index d9ad1a2..320345b 100644
--- a/test/Serialization/override.swift
+++ b/test/Serialization/override.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_class.swift -disable-objc-attr-requires-foundation-module
 // RUN: %target-swift-frontend -emit-module -o %t -I %t %S/Inputs/def_override.swift
-// RUN: llvm-bcanalyzer %t/def_override.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/def_override.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -parse -I %t %s -verify
 
 // CHECK-NOT: UnknownCode
diff --git a/test/Serialization/print.swift b/test/Serialization/print.swift
index f329ff7..92f63de 100644
--- a/test/Serialization/print.swift
+++ b/test/Serialization/print.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=false -module-to-print=print -I %t -source-filename=%s | FileCheck %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -skip-deinit=false -module-to-print=print -I %t -source-filename=%s | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/Serialization/resilience.swift b/test/Serialization/resilience.swift
index e690e4b..d01e5f5 100644
--- a/test/Serialization/resilience.swift
+++ b/test/Serialization/resilience.swift
@@ -5,17 +5,17 @@
 
 // RUN: %target-swift-frontend -emit-module -o %t %s
 // RUN: llvm-bcanalyzer -dump %t/resilience.swiftmodule > %t/resilience.dump.txt
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=DEFAULT %s < %t/resilience.dump.txt
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=DEFAULT %s < %t/resilience.dump.txt
 
 // RUN: %target-swift-frontend -emit-module -o %t -enable-resilience %s
 // RUN: llvm-bcanalyzer -dump %t/resilience.swiftmodule > %t/resilience2.dump.txt
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=RESILIENCE %s < %t/resilience2.dump.txt
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=RESILIENCE %s < %t/resilience2.dump.txt
 
 // RUN: %target-swift-frontend -emit-module -o %t -sil-serialize-all %s
 // RUN: llvm-bcanalyzer -dump %t/resilience.swiftmodule > %t/resilience3.dump.txt
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=FRAGILE %s < %t/resilience3.dump.txt
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=FRAGILE %s < %t/resilience3.dump.txt
 
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t/resilience2.dump.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/resilience2.dump.txt
 
 // CHECK: <MODULE_BLOCK {{.*}}>
 // RESILIENCE: <RESILIENCE_STRATEGY abbrevid={{[0-9]+}} op0=1/>
diff --git a/test/Serialization/search-paths-relative.swift b/test/Serialization/search-paths-relative.swift
index b0b9421..fccf2bf 100644
--- a/test/Serialization/search-paths-relative.swift
+++ b/test/Serialization/search-paths-relative.swift
@@ -8,8 +8,8 @@
 
 // Check the actual serialized search paths.
 // RUN: llvm-bcanalyzer -dump %t/has_xref.swiftmodule > %t/has_xref.swiftmodule.txt
-// RUN: FileCheck %s < %t/has_xref.swiftmodule.txt
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t/has_xref.swiftmodule.txt
+// RUN: %FileCheck %s < %t/has_xref.swiftmodule.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/has_xref.swiftmodule.txt
 
 // XFAIL: linux
 
diff --git a/test/Serialization/search-paths.swift b/test/Serialization/search-paths.swift
index cb102cf..7211c05 100644
--- a/test/Serialization/search-paths.swift
+++ b/test/Serialization/search-paths.swift
@@ -19,10 +19,10 @@
 // Make sure we don't end up with duplicate search paths.
 // RUN: %target-swiftc_driver -emit-module -o %t/has_xref.swiftmodule -I %t/secret -F %t/Frameworks -parse-as-library %S/Inputs/has_xref.swift %S/../Inputs/empty.swift -Xfrontend -serialize-debugging-options
 // RUN: %target-swift-frontend %s -parse -I %t
-// RUN: llvm-bcanalyzer -dump %t/has_xref.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer -dump %t/has_xref.swiftmodule | %FileCheck %s
 
 // RUN: %target-swift-frontend %s -emit-module -o %t/main.swiftmodule -I %t -I %t/secret -F %t/Frameworks
-// RUN: llvm-bcanalyzer -dump %t/main.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer -dump %t/main.swiftmodule | %FileCheck %s
 
 // XFAIL: linux
 
diff --git a/test/Serialization/serialize_attr.swift b/test/Serialization/serialize_attr.swift
index 5cb18cb..e7cba59 100644
--- a/test/Serialization/serialize_attr.swift
+++ b/test/Serialization/serialize_attr.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -parse-as-library -sil-serialize-all -o %t %s
-// RUN: llvm-bcanalyzer %t/serialize_attr.swiftmodule | FileCheck %s -check-prefix=BCANALYZER
-// RUN: %target-sil-opt -enable-sil-verify-all %t/serialize_attr.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/serialize_attr.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER
+// RUN: %target-sil-opt -enable-sil-verify-all %t/serialize_attr.swiftmodule | %FileCheck %s
 
 // BCANALYZER-NOT: UnknownCode
 
diff --git a/test/Serialization/struct.swift b/test/Serialization/struct.swift
index 73f3474..eb6c073 100644
--- a/test/Serialization/struct.swift
+++ b/test/Serialization/struct.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_struct.swift
-// RUN: llvm-bcanalyzer %t/def_struct.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/def_struct.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -emit-silgen -I %t %s -o /dev/null
 
 // CHECK-NOT: UnknownCode
diff --git a/test/Serialization/target-incompatible.swift b/test/Serialization/target-incompatible.swift
index faaeb4b..6f306c7 100644
--- a/test/Serialization/target-incompatible.swift
+++ b/test/Serialization/target-incompatible.swift
@@ -2,11 +2,11 @@
 
 // RUN: %swift -target x86_64-unknown-darwin14 -o %t/mips-template.swiftmodule -parse-stdlib -emit-module -module-name mips %S/../Inputs/empty.swift
 // RUN: %S/Inputs/binary_sub.py x86_64-unknown-darwin14 mips64-unknown-darwin14 < %t/mips-template.swiftmodule > %t/mips.swiftmodule
-// RUN: not %target-swift-frontend -I %t -parse -parse-stdlib %s -DMIPS 2>&1 | FileCheck -check-prefix=CHECK-MIPS %s
+// RUN: not %target-swift-frontend -I %t -parse -parse-stdlib %s -DMIPS 2>&1 | %FileCheck -check-prefix=CHECK-MIPS %s
 
 // RUN: %swift -target x86_64-unknown-darwin14 -o %t/solaris-template.swiftmodule -parse-stdlib -emit-module -module-name solaris %S/../Inputs/empty.swift
 // RUN: %S/Inputs/binary_sub.py x86_64-unknown-darwin14 x86_64-unknown-solaris8 < %t/solaris-template.swiftmodule > %t/solaris.swiftmodule
-// RUN: not %target-swift-frontend -I %t -parse -parse-stdlib %s -DSOLARIS 2>&1 | FileCheck -check-prefix=CHECK-SOLARIS %s
+// RUN: not %target-swift-frontend -I %t -parse -parse-stdlib %s -DSOLARIS 2>&1 | %FileCheck -check-prefix=CHECK-SOLARIS %s
 
 #if MIPS
 // CHECK-MIPS: :[[@LINE+1]]:8: error: module file was created for incompatible target mips64-unknown-darwin14: {{.*}}mips.swiftmodule{{$}}
diff --git a/test/Serialization/target-too-new.swift b/test/Serialization/target-too-new.swift
index afdae95..17e4d68 100644
--- a/test/Serialization/target-too-new.swift
+++ b/test/Serialization/target-too-new.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-swift-frontend -target x86_64-apple-macosx10.50 -emit-module -parse-stdlib %S/../Inputs/empty.swift -o %t
-// RUN: not %target-swift-frontend -I %t -parse %s 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -I %t -parse %s 2>&1 | %FileCheck %s
 // RUN: %target-swift-frontend -I %t -parse %s -disable-target-os-checking
 // RUN: %target-swift-frontend -target x86_64-apple-macosx10.50 -I %t -parse %s
 // RUN: %target-swift-frontend -target x86_64-apple-macosx10.50.1 -I %t -parse %s
diff --git a/test/Serialization/testability.swift b/test/Serialization/testability.swift
index f57b82d..e39e51a 100644
--- a/test/Serialization/testability.swift
+++ b/test/Serialization/testability.swift
@@ -5,12 +5,12 @@
 
 // RUN: %target-swift-frontend -emit-module -DBASE -o %t %s
 // RUN: llvm-bcanalyzer -dump %t/testability.swiftmodule > %t/testability.dump.txt
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=NO-TESTING %s < %t/testability.dump.txt
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=NO-TESTING %s < %t/testability.dump.txt
 
 // RUN: %target-swift-frontend -emit-module -DBASE -o %t -enable-testing %s
 // RUN: llvm-bcanalyzer -dump %t/testability.swiftmodule > %t/testability2.dump.txt
-// RUN: FileCheck -check-prefix=CHECK -check-prefix=TESTING %s < %t/testability2.dump.txt
-// RUN: FileCheck -check-prefix=NEGATIVE %s < %t/testability2.dump.txt
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=TESTING %s < %t/testability2.dump.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/testability2.dump.txt
 
 // ...but the second block checks that a module that /depends/ on a testable
 // module can still be loaded. This is what happens when debugging a unit test.
diff --git a/test/Serialization/top-level-code.swift b/test/Serialization/top-level-code.swift
index 443e28d..d15fd83 100644
--- a/test/Serialization/top-level-code.swift
+++ b/test/Serialization/top-level-code.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-swift-frontend -emit-module -o %t %s -module-name Test
-// RUN: llvm-bcanalyzer %t/Test.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/Test.swiftmodule | %FileCheck %s
 
 // RUN: cp %s %t/main.swift
 // RUN: %target-swift-frontend -parse -verify %t/main.swift -primary-file %S/Inputs/top-level-code-other.swift
diff --git a/test/Serialization/transparent-std.swift b/test/Serialization/transparent-std.swift
index 09f755e..1cea520 100644
--- a/test/Serialization/transparent-std.swift
+++ b/test/Serialization/transparent-std.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -parse-stdlib -o %t %S/Inputs/def_transparent_std.swift
-// RUN: llvm-bcanalyzer %t/def_transparent_std.swiftmodule | FileCheck %s
-// RUN: %target-swift-frontend -emit-sil -Xllvm -sil-disable-pass="External Defs To Decls" -sil-debug-serialization -parse-stdlib -I %t %s | FileCheck %s -check-prefix=SIL
+// RUN: llvm-bcanalyzer %t/def_transparent_std.swiftmodule | %FileCheck %s
+// RUN: %target-swift-frontend -emit-sil -Xllvm -sil-disable-pass="External Defs To Decls" -sil-debug-serialization -parse-stdlib -I %t %s | %FileCheck %s -check-prefix=SIL
 
 // CHECK-NOT: UnknownCode
 
diff --git a/test/Serialization/transparent.swift b/test/Serialization/transparent.swift
index e3f0dd3..6b16c41 100644
--- a/test/Serialization/transparent.swift
+++ b/test/Serialization/transparent.swift
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-swift-frontend -emit-module -sil-serialize-all -o %t %S/Inputs/def_transparent.swift
-// RUN: llvm-bcanalyzer %t/def_transparent.swiftmodule | FileCheck %s
-// RUN: %target-swift-frontend -emit-silgen -sil-link-all -I %t %s | FileCheck %s -check-prefix=SIL
+// RUN: llvm-bcanalyzer %t/def_transparent.swiftmodule | %FileCheck %s
+// RUN: %target-swift-frontend -emit-silgen -sil-link-all -I %t %s | %FileCheck %s -check-prefix=SIL
 
 // CHECK-NOT: UnknownCode
 
diff --git a/test/Serialization/typealias.swift b/test/Serialization/typealias.swift
index 5337f7e..f4218ff 100644
--- a/test/Serialization/typealias.swift
+++ b/test/Serialization/typealias.swift
@@ -1,9 +1,9 @@
 // RUN: rm -rf %t
 // RUN: mkdir %t
 // RUN: %target-build-swift -module-name alias -emit-module -o %t %S/Inputs/alias.swift
-// RUN: llvm-bcanalyzer %t/alias.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/alias.swiftmodule | %FileCheck %s
 // RUN: %target-build-swift -I %t %s -o %t/a.out
-// RUN: %target-run %t/a.out | FileCheck -check-prefix=OUTPUT %s
+// RUN: %target-run %t/a.out | %FileCheck -check-prefix=OUTPUT %s
 // REQUIRES: executable_test
 
 // CHECK-NOT: UnknownCode
diff --git a/test/Serialization/version-mismatches.swift b/test/Serialization/version-mismatches.swift
index 933a80e..49ada56 100644
--- a/test/Serialization/version-mismatches.swift
+++ b/test/Serialization/version-mismatches.swift
@@ -1,7 +1,7 @@
-// RUN: not %target-swift-frontend %s -parse -I %S/Inputs/too-old/ -show-diagnostics-after-fatal 2>&1 | FileCheck -check-prefix CHECK -check-prefix TOO-OLD %s
-// RUN: not %target-swift-frontend %s -parse -I %S/Inputs/too-new/ -show-diagnostics-after-fatal 2>&1 | FileCheck -check-prefix CHECK -check-prefix TOO-NEW %s
-// RUN: not %target-swift-frontend %s -parse -I %S/Inputs/too-old-language/ -show-diagnostics-after-fatal 2>&1 | FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
-// RUN: not %target-swift-frontend %s -parse -I %S/Inputs/too-new-language/ -show-diagnostics-after-fatal 2>&1 | FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
+// RUN: not %target-swift-frontend %s -parse -I %S/Inputs/too-old/ -show-diagnostics-after-fatal 2>&1 | %FileCheck -check-prefix CHECK -check-prefix TOO-OLD %s
+// RUN: not %target-swift-frontend %s -parse -I %S/Inputs/too-new/ -show-diagnostics-after-fatal 2>&1 | %FileCheck -check-prefix CHECK -check-prefix TOO-NEW %s
+// RUN: not %target-swift-frontend %s -parse -I %S/Inputs/too-old-language/ -show-diagnostics-after-fatal 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
+// RUN: not %target-swift-frontend %s -parse -I %S/Inputs/too-new-language/ -show-diagnostics-after-fatal 2>&1 | %FileCheck -check-prefix CHECK -check-prefix LANGUAGE %s
 
 import Library
 // TOO-OLD: :[[@LINE-1]]:8: error: module file was created by an older version of the compiler; rebuild 'Library' and try again: {{.*}}too-old/Library.swiftmodule{{$}}
diff --git a/test/Serialization/xref-multi-file.swift b/test/Serialization/xref-multi-file.swift
index 16b79e9..e6df4b3 100644
--- a/test/Serialization/xref-multi-file.swift
+++ b/test/Serialization/xref-multi-file.swift
@@ -2,7 +2,7 @@
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/struct_with_operators.swift
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/alias.swift -module-name has_alias
 // RUN: %target-swift-frontend -emit-module -o %t -I %t %S/Inputs/has_xref.swift
-// RUN: llvm-bcanalyzer %t/has_xref.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/has_xref.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -emit-silgen -I %t -primary-file %s %S/Inputs/xref-multi-file-other.swift -module-name main > /dev/null
 
 // CHECK-NOT: UnknownCode
diff --git a/test/Serialization/xref.swift b/test/Serialization/xref.swift
index a313331..bd9f893 100644
--- a/test/Serialization/xref.swift
+++ b/test/Serialization/xref.swift
@@ -4,7 +4,7 @@
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/alias.swift -module-name has_alias
 // RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/xref_distraction.swift
 // RUN: %target-swift-frontend -emit-module -o %t -I %t %S/Inputs/has_xref.swift
-// RUN: llvm-bcanalyzer %t/has_xref.swiftmodule | FileCheck %s
+// RUN: llvm-bcanalyzer %t/has_xref.swiftmodule | %FileCheck %s
 // RUN: %target-swift-frontend -emit-silgen -I %t %s > /dev/null
 
 // CHECK-NOT: UnknownCode
diff --git a/test/SourceKit/CodeComplete/complete_big_array.swift b/test/SourceKit/CodeComplete/complete_big_array.swift
index 65af851..a28b308 100644
--- a/test/SourceKit/CodeComplete/complete_big_array.swift
+++ b/test/SourceKit/CodeComplete/complete_big_array.swift
@@ -1,4 +1,4 @@
-// RUN: %sourcekitd-test -req=complete -pos=45:1 %S/../Inputs/big_array.swift -- %S/../Inputs/big_array.swift | FileCheck %s
+// RUN: %sourcekitd-test -req=complete -pos=45:1 %S/../Inputs/big_array.swift -- %S/../Inputs/big_array.swift | %FileCheck %s
 // CHECK: key.kind: source.lang.swift.decl.var.global
 // CHECK: key.name: "gCubeVertexData"
 // CHECK: key.sourcetext: "gCubeVertexData"
diff --git a/test/SourceKit/CodeComplete/complete_cache.swift b/test/SourceKit/CodeComplete/complete_cache.swift
index 97ade8e..8601fbb 100644
--- a/test/SourceKit/CodeComplete/complete_cache.swift
+++ b/test/SourceKit/CodeComplete/complete_cache.swift
@@ -12,13 +12,13 @@
 // RUN:     -req=complete -pos=2:1 %s -- %s -F %S/../Inputs/libIDE-mock-sdk > %t.completions2
 
 // Sanity check the results
-// RUN: FileCheck %s < %t.completions1
-// RUN: FileCheck %s < %t.completions2
+// RUN: %FileCheck %s < %t.completions1
+// RUN: %FileCheck %s < %t.completions2
 // CHECK: key.name: "FooStruct
 
-// RUN: %complete-test -raw -tok=VOID_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=VOID_1
-// RUN: %complete-test -raw -tok=VOID_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=VOID_1
-// RUN: %complete-test -raw -tok=VOID_3 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=VOID_3
+// RUN: %complete-test -raw -tok=VOID_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=VOID_1
+// RUN: %complete-test -raw -tok=VOID_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=VOID_1
+// RUN: %complete-test -raw -tok=VOID_3 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=VOID_3
 func test1() {
   _ = #^VOID_1,fooFunc^#
 }
diff --git a/test/SourceKit/CodeComplete/complete_custom.swift b/test/SourceKit/CodeComplete/complete_custom.swift
index e3cbb9a..f358925 100644
--- a/test/SourceKit/CodeComplete/complete_custom.swift
+++ b/test/SourceKit/CodeComplete/complete_custom.swift
@@ -6,31 +6,31 @@
 
 // ===--- Errors
 
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error1.json | FileCheck %s -check-prefix=ERROR-MISSING-RESULTS
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error2.json | FileCheck %s -check-prefix=ERROR-MISSING-RESULTS
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error1.json | %FileCheck %s -check-prefix=ERROR-MISSING-RESULTS
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error2.json | %FileCheck %s -check-prefix=ERROR-MISSING-RESULTS
 // ERROR-MISSING-RESULTS: missing 'key.results'
 
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error3.json | FileCheck %s -check-prefix=ERROR-MISSING-NAME
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error4.json | FileCheck %s -check-prefix=ERROR-MISSING-NAME
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error3.json | %FileCheck %s -check-prefix=ERROR-MISSING-NAME
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error4.json | %FileCheck %s -check-prefix=ERROR-MISSING-NAME
 // ERROR-MISSING-NAME: missing 'key.name'
 
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error5.json | FileCheck %s -check-prefix=ERROR-MISSING-KIND
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error6.json | FileCheck %s -check-prefix=ERROR-MISSING-KIND
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error5.json | %FileCheck %s -check-prefix=ERROR-MISSING-KIND
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error6.json | %FileCheck %s -check-prefix=ERROR-MISSING-KIND
 // ERROR-MISSING-KIND: missing 'key.kind'
 
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error7.json | FileCheck %s -check-prefix=ERROR-MISSING-CONTEXT
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error8.json | FileCheck %s -check-prefix=ERROR-MISSING-CONTEXT
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error9.json | FileCheck %s -check-prefix=ERROR-MISSING-CONTEXT
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error7.json | %FileCheck %s -check-prefix=ERROR-MISSING-CONTEXT
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error8.json | %FileCheck %s -check-prefix=ERROR-MISSING-CONTEXT
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error9.json | %FileCheck %s -check-prefix=ERROR-MISSING-CONTEXT
 // ERROR-MISSING-CONTEXT: missing 'key.context'
 
-// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error10.json | FileCheck %s -check-prefix=ERROR-INVALID-CONTEXT
+// RUN: not %sourcekitd-test -json-request-path %S/Inputs/custom-completion/error10.json | %FileCheck %s -check-prefix=ERROR-INVALID-CONTEXT
 // ERROR-INVALID-CONTEXT: invalid value for 'key.context'
 
 
 // ===--- Custom completions
 
 // RUN: %sourcekitd-test -json-request-path %S/Inputs/custom-completion/custom.json == \
-// RUN:     -req=complete.open -pos=2:1 %s -- %s | FileCheck %s -check-prefix=STMT
+// RUN:     -req=complete.open -pos=2:1 %s -- %s | %FileCheck %s -check-prefix=STMT
 
 // STMT-NOT: myuid
 // STMT: key.kind: myuid.customExprOrStmtOrType
@@ -41,7 +41,7 @@
 // STMT-NOT: myuid
 
 // RUN: %sourcekitd-test -json-request-path %S/Inputs/custom-completion/custom.json == \
-// RUN:     -req=complete.open -pos=3:4 %s -- %s | FileCheck %s -check-prefix=EXPR
+// RUN:     -req=complete.open -pos=3:4 %s -- %s | %FileCheck %s -check-prefix=EXPR
 
 // EXPR-NOT: myuid
 // EXPR: key.kind: myuid.customExpr
@@ -52,7 +52,7 @@
 // EXPR-NOT: myuid
 
 // RUN: %sourcekitd-test -json-request-path %S/Inputs/custom-completion/custom.json == \
-// RUN:     -req=complete.open -pos=4:12 %s -- %s | FileCheck %s -check-prefix=TYPE
+// RUN:     -req=complete.open -pos=4:12 %s -- %s | %FileCheck %s -check-prefix=TYPE
 
 // TYPE-NOT: myuid
 // TYPE: key.kind: myuid.customExprOrStmtOrType
@@ -65,8 +65,8 @@
 // ===--- Filtering.
 
 // RUN: %sourcekitd-test -json-request-path %S/Inputs/custom-completion/custom.json == \
-// RUN:     -req=complete.open -pos=3:4 %s -req-opts=filtertext=custExp -- %s | FileCheck %s -check-prefix=EXPR
+// RUN:     -req=complete.open -pos=3:4 %s -req-opts=filtertext=custExp -- %s | %FileCheck %s -check-prefix=EXPR
 
 // RUN: %sourcekitd-test -json-request-path %S/Inputs/custom-completion/custom.json == \
-// RUN:     -req=complete.open -pos=3:4 %s -req-opts=filtertext=asdffdsa -- %s | FileCheck %s -check-prefix=NOCUSTOM
+// RUN:     -req=complete.open -pos=3:4 %s -req-opts=filtertext=asdffdsa -- %s | %FileCheck %s -check-prefix=NOCUSTOM
 // NOCUSTOM-NOT: myuid
diff --git a/test/SourceKit/CodeComplete/complete_filter.swift b/test/SourceKit/CodeComplete/complete_filter.swift
index e61b7fa..3836c23 100644
--- a/test/SourceKit/CodeComplete/complete_filter.swift
+++ b/test/SourceKit/CodeComplete/complete_filter.swift
@@ -13,7 +13,7 @@
 
 // XFAIL: broken_std_regex
 // RUN: %sourcekitd-test -req=complete.open -pos=11:5 %s -- %s > %t.all
-// FileCheck -check-prefix=CHECK-ALL %s < %t.all
+// RUN: %FileCheck -check-prefix=CHECK-ALL %s < %t.all
 // CHECK-ALL: key.name: "aaa
 // CHECK-ALL: key.name: "aab
 // CHECK-ALL: key.name: "abc
@@ -22,7 +22,7 @@
 
 // RUN: %sourcekitd-test -req=complete.open -pos=11:5 \
 // RUN:   -req-opts=filtertext=a %s -- %s > %t.a
-// RUN: FileCheck -check-prefix=CHECKA %s < %t.a
+// RUN: %FileCheck -check-prefix=CHECKA %s < %t.a
 
 // CHECKA-NOT: key.name
 // CHECKA: key.name: "aaa
@@ -38,7 +38,7 @@
 
 // RUN: %sourcekitd-test -req=complete.open -pos=11:5 \
 // RUN:   -req-opts=filtertext=b %s -- %s > %t.b
-// RUN: FileCheck -check-prefix=CHECKB %s < %t.b
+// RUN: %FileCheck -check-prefix=CHECKB %s < %t.b
 
 // CHECKB-NOT: key.name
 // CHECKB: key.name: "b
@@ -46,14 +46,14 @@
 
 // RUN: %sourcekitd-test -req=complete.open -pos=11:5 \
 // RUN:   -req-opts=filtertext=c %s -- %s > %t.c
-// RUN: FileCheck -check-prefix=CHECKC %s < %t.c
+// RUN: %FileCheck -check-prefix=CHECKC %s < %t.c
 
 // CHECKC-NOT: key.name
 // CHECKC: key.name: "c
 
 // RUN: %sourcekitd-test -req=complete.open -pos=11:5 \
 // RUN:   -req-opts=filtertext=d %s -- %s > %t.d
-// RUN: FileCheck -check-prefix=CHECKD %s < %t.d
+// RUN: %FileCheck -check-prefix=CHECKD %s < %t.d
 
 // CHECKD-NOT: key.name
 // CHECKD: ],
@@ -63,7 +63,7 @@
 // CHECKD-NEXT: }
 
 
-// RUN: %complete-test -tok=FOO %s | FileCheck %s
+// RUN: %complete-test -tok=FOO %s | %FileCheck %s
 // CHECK-LABEL: Results for filterText: [
 // CHECK-NEXT:   aaa()
 // CHECK-NEXT:   aab()
@@ -95,7 +95,7 @@
   #^OVER,over,overload,overloadp^#
 }
 // Don't create empty groups, or groups with one element
-// RUN: %complete-test -group=overloads -tok=OVER %s | FileCheck -check-prefix=GROUP %s
+// RUN: %complete-test -group=overloads -tok=OVER %s | %FileCheck -check-prefix=GROUP %s
 // GROUP-LABEL: Results for filterText: over [
 // GROUP: overload:
 // GROUP-NEXT:   overload()
@@ -115,7 +115,7 @@
   }
 }
 
-// RUN: %complete-test -tok=UNNAMED_ARGS_0 %s | FileCheck %s -check-prefix=UNNAMED_ARGS_0
+// RUN: %complete-test -tok=UNNAMED_ARGS_0 %s | %FileCheck %s -check-prefix=UNNAMED_ARGS_0
 // UNNAMED_ARGS_0: Results for filterText: dont [
 // UNNAMED_ARGS_0-NEXT:   dontMatchAgainst(unnamed: Int, arguments: Int, unnamed2: Int)
 // UNNAMED_ARGS_0-NEXT: ]
diff --git a/test/SourceKit/CodeComplete/complete_filter_rules.swift b/test/SourceKit/CodeComplete/complete_filter_rules.swift
index 645a14d..9e65fdb 100644
--- a/test/SourceKit/CodeComplete/complete_filter_rules.swift
+++ b/test/SourceKit/CodeComplete/complete_filter_rules.swift
@@ -12,12 +12,12 @@
 
 // REQUIRES: objc_interop
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideNames.json -tok=HIDE_NAMES_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_NAMES
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideNames.json -tok=HIDE_NAMES_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_NAMES
   func testHideName01() {
     #^HIDE_NAMES_1,hidethis^#
   }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideNames.json -tok=HIDE_NAMES_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_NAMES
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideNames.json -tok=HIDE_NAMES_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_NAMES
   func testHideName02() {
     self.#^HIDE_NAMES_2,hidethis^#
   }
@@ -26,7 +26,7 @@
 // HIDE_NAMES-NEXT: ]
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideKeywords.json -tok=HIDE_KEYWORDS_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_LET
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideKeywords.json -tok=HIDE_KEYWORDS_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_LET
 func testHideKeyword01() {
   #^HIDE_KEYWORDS_1^#
 // HIDE_LET-NOT: let
@@ -34,7 +34,7 @@
 // HIDE_LET-NOT: let
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showKeywords.json -tok=HIDE_KEYWORDS_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=SHOW_FUNC
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showKeywords.json -tok=HIDE_KEYWORDS_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=SHOW_FUNC
 func testHideKeyword02() {
   #^HIDE_KEYWORDS_2^#
 // SHOW_FUNC-NOT: let
@@ -44,7 +44,7 @@
 // SHOW_FUNC-NOT: let
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideLiterals.json -tok=HIDE_LITERALS_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_NIL
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideLiterals.json -tok=HIDE_LITERALS_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_NIL
 func testHideLiteral01() {
   let x = #^HIDE_LITERALS_1^#
 // HIDE_NIL-NOT: nil
@@ -52,7 +52,7 @@
 // HIDE_NIL-NOT: nil
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showLiterals.json -tok=HIDE_LITERALS_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=SHOW_STRING
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showLiterals.json -tok=HIDE_LITERALS_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=SHOW_STRING
 func testHideLiteral02() {
   let x = #^HIDE_LITERALS_2^#
 // SHOW_STRING-NOT: [
@@ -64,7 +64,7 @@
 
 // FIXME: custom completions
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideModules.json -tok=HIDE_MODULES_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_FOO
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideModules.json -tok=HIDE_MODULES_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_FOO
 func testHideModule01() {
   let x: #^HIDE_MODULES_1^#
 // FIXME: submodules
@@ -79,7 +79,7 @@
 func myFunFunction1() {}
 func myFunFunction2() {}
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showSpecific.json -tok=SHOW_SPECIFIC_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=SHOW_SPECIFIC_1
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showSpecific.json -tok=SHOW_SPECIFIC_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=SHOW_SPECIFIC_1
 func testShowSpecific01() {
   #^SHOW_SPECIFIC_1,fun^#
 // SHOW_SPECIFIC_1-LABEL: Results for filterText: fun [
@@ -88,7 +88,7 @@
 // SHOW_SPECIFIC_1-NEXT: ]
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showSpecific.json -tok=HIDE_OP_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showSpecific.json -tok=HIDE_OP_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP
 func testHideOp1() {
   var local = 1
   #^HIDE_OP_1,local^#
@@ -96,13 +96,13 @@
 // HIDE_OP-NOT: .
 // HIDE_OP-NOT: =
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showSpecific.json -tok=HIDE_OP_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP -allow-empty
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showSpecific.json -tok=HIDE_OP_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP -allow-empty
 func testHideOp2() {
   var local = 1
   local#^HIDE_OP_2^#
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=SHOW_OP_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=SHOW_OP_1
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=SHOW_OP_1 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=SHOW_OP_1
 func testShowOp1() {
   var local = 1
   #^SHOW_OP_1,local^#
@@ -110,7 +110,7 @@
 // SHOW_OP_1: local.{{$}}
 // SHOW_OP_1: local={{$}}
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=SHOW_OP_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=SHOW_OP_2
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=SHOW_OP_2 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=SHOW_OP_2
 func testShowOp2() {
   var local = 1
   local#^SHOW_OP_2^#
@@ -118,31 +118,31 @@
 // SHOW_OP_2: {{^}}.{{$}}
 // SHOW_OP_2: {{^}}={{$}}
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=HIDE_OP_3 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=HIDE_OP_3 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP
 func testHideOp3() {
   let local = TestHideName()
   // Implicitly hidden because we hide all the members.
   #^HIDE_OP_3,local^#
 }
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=HIDE_OP_4 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP -allow-empty
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=HIDE_OP_4 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP -allow-empty
 func testHideOp4() {
   let local = TestHideName()
   // Implicitly hidden because we hide all the members.
   local#^HIDE_OP_4^#
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=SHOW_OP_3 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=SHOW_OP_1
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=SHOW_OP_3 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=SHOW_OP_1
 func testShowOp3() {
   var local = 1
   #^SHOW_OP_3,local^#
 }
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=SHOW_OP_4 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=SHOW_OP_2
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/showOp.json -tok=SHOW_OP_4 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=SHOW_OP_2
 func testShowOp4() {
   var local = 1
   local#^SHOW_OP_4^#
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_5 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP_5 -allow-empty
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_5 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP_5 -allow-empty
 func testHideOp5() {
   var local = 1
   #^HIDE_OP_5,local^#
@@ -151,19 +151,19 @@
 // HIDE_OP_5-NOT: local?.
 // HIDE_OP_5-NOT: local(
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_6 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP_5 -allow-empty
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_6 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP_5 -allow-empty
 func testHideOp6() {
   var local: Int? = 1
   #^HIDE_OP_6,local^#
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_7 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP_5 -allow-empty
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_7 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP_5 -allow-empty
 func testHideOp7() {
   struct local {}
   #^HIDE_OP_7,local^#
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_8 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP_8 -allow-empty
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_8 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP_8 -allow-empty
 func testHideOp8() {
   var local = 1
   local#^HIDE_OP_8^#
@@ -172,13 +172,13 @@
 // HIDE_OP_8-NOT: {{^}}?.
 // HIDE_OP_8-NOT: {{^}}(
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_9 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP_8 -allow-empty
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_9 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP_8 -allow-empty
 func testHideOp9() {
   var local: Int? = 1
   local#^HIDE_OP_9^#
 }
 
-// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_10 %s -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=HIDE_OP_8 -allow-empty
+// RUN: %complete-test -filter-rules=%S/Inputs/filter-rules/hideInnerOp.json -tok=HIDE_OP_10 %s -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=HIDE_OP_8 -allow-empty
 func testHideOp10() {
   struct local {}
   local#^HIDE_OP_10^#
diff --git a/test/SourceKit/CodeComplete/complete_forbid_typecheck.swift b/test/SourceKit/CodeComplete/complete_forbid_typecheck.swift
index d9692de..d3db8f7 100644
--- a/test/SourceKit/CodeComplete/complete_forbid_typecheck.swift
+++ b/test/SourceKit/CodeComplete/complete_forbid_typecheck.swift
@@ -1,4 +1,4 @@
-// RUN: %sourcekitd-test -req=complete -pos=4:1 %S/Inputs/forbid_typecheck_primary.swift -- -Xfrontend -debug-forbid-typecheck-prefix -Xfrontend NOTYPECHECK %S/Inputs/forbid_typecheck_2.swift %S/Inputs/forbid_typecheck_primary.swift | FileCheck %s
+// RUN: %sourcekitd-test -req=complete -pos=4:1 %S/Inputs/forbid_typecheck_primary.swift -- -Xfrontend -debug-forbid-typecheck-prefix -Xfrontend NOTYPECHECK %S/Inputs/forbid_typecheck_2.swift %S/Inputs/forbid_typecheck_primary.swift | %FileCheck %s
 
 // CHECK-DAG: key.name: "globalPrim"
 // CHECK-DAG: key.name: "globalSec"
@@ -6,6 +6,6 @@
 // CHECK-DAG: key.name: "SSec"
 // CHECK-DAG: key.name: "primFn()"
 
-// RUN: %sourcekitd-test -req=complete -pos=5:20 %S/Inputs/forbid_typecheck_primary.swift -- -Xfrontend -debug-forbid-typecheck-prefix -Xfrontend NOTYPECHECK %S/Inputs/forbid_typecheck_2.swift %S/Inputs/forbid_typecheck_primary.swift | FileCheck %s -check-prefix=MEMBER
+// RUN: %sourcekitd-test -req=complete -pos=5:20 %S/Inputs/forbid_typecheck_primary.swift -- -Xfrontend -debug-forbid-typecheck-prefix -Xfrontend NOTYPECHECK %S/Inputs/forbid_typecheck_2.swift %S/Inputs/forbid_typecheck_primary.swift | %FileCheck %s -check-prefix=MEMBER
 
 // MEMBER: key.name: "member"
diff --git a/test/SourceKit/CodeComplete/complete_from_clang_module.swift b/test/SourceKit/CodeComplete/complete_from_clang_module.swift
index 12db290..f366089 100644
--- a/test/SourceKit/CodeComplete/complete_from_clang_module.swift
+++ b/test/SourceKit/CodeComplete/complete_from_clang_module.swift
@@ -1,7 +1,7 @@
 import Foo
 
 // REQUIRES: objc_interop
-// RUN: %sourcekitd-test -req=complete -pos=2:1 %s -- %mcp_opt -F %S/../Inputs/libIDE-mock-sdk %s | FileCheck %s
+// RUN: %sourcekitd-test -req=complete -pos=2:1 %s -- %mcp_opt -F %S/../Inputs/libIDE-mock-sdk %s | %FileCheck %s
 
 // CHECK-LABEL:      key.name: "fooIntVar",
 // CHECK-NEXT:       key.sourcetext: "fooIntVar",
diff --git a/test/SourceKit/CodeComplete/complete_fuzzy.swift b/test/SourceKit/CodeComplete/complete_fuzzy.swift
index 013c113..5b93ae8 100644
--- a/test/SourceKit/CodeComplete/complete_fuzzy.swift
+++ b/test/SourceKit/CodeComplete/complete_fuzzy.swift
@@ -11,8 +11,8 @@
 
 // XFAIL: broken_std_regex
 
-// RUN: %complete-test %s -group=stems -tok=TOP_LEVEL_NO_FILTER | FileCheck %s -check-prefix=TOP_LEVEL_NO_FILTER
-// RUN: %complete-test %s -group=stems -fuzz -tok=TOP_LEVEL_NO_FILTER | FileCheck %s -check-prefix=TOP_LEVEL_NO_FILTER
+// RUN: %complete-test %s -group=stems -tok=TOP_LEVEL_NO_FILTER | %FileCheck %s -check-prefix=TOP_LEVEL_NO_FILTER
+// RUN: %complete-test %s -group=stems -fuzz -tok=TOP_LEVEL_NO_FILTER | %FileCheck %s -check-prefix=TOP_LEVEL_NO_FILTER
 func test1() {
   #^TOP_LEVEL_NO_FILTER^#
 // TOP_LEVEL_NO_FILTER: fooBar:
@@ -20,8 +20,8 @@
 // TOP_LEVEL_NO_FILTER:   fooBarTastic()
 // TOP_LEVEL_NO_FILTER: footastic()
 }
-// RUN: %complete-test %s -group=stems -tok=S1_QUAL_NO_FILTER | FileCheck %s -check-prefix=S1_QUAL_NO_FILTER
-// RUN: %complete-test %s -group=stems -fuzz -tok=S1_QUAL_NO_FILTER | FileCheck %s -check-prefix=S1_QUAL_NO_FILTER
+// RUN: %complete-test %s -group=stems -tok=S1_QUAL_NO_FILTER | %FileCheck %s -check-prefix=S1_QUAL_NO_FILTER
+// RUN: %complete-test %s -group=stems -fuzz -tok=S1_QUAL_NO_FILTER | %FileCheck %s -check-prefix=S1_QUAL_NO_FILTER
 func test2(x: S1) {
   x.#^S1_QUAL_NO_FILTER^#
 // Without a filter, we group.
@@ -32,9 +32,9 @@
 }
 
 // ===- Basic filter checks.
-// RUN: %complete-test %s -no-fuzz -group=stems -tok=TOP_LEVEL_1 | FileCheck %s -check-prefix=TOP_LEVEL_1_PREFIX
-// RUN: %complete-test %s -fuzz -group=stems -tok=TOP_LEVEL_1 | FileCheck %s -check-prefix=TOP_LEVEL_1_FUZZ
-// RUN: %complete-test %s -fuzz -group=none -tok=TOP_LEVEL_1 | FileCheck %s -check-prefix=TOP_LEVEL_1_FUZZ_NO_GROUP
+// RUN: %complete-test %s -no-fuzz -group=stems -tok=TOP_LEVEL_1 | %FileCheck %s -check-prefix=TOP_LEVEL_1_PREFIX
+// RUN: %complete-test %s -fuzz -group=stems -tok=TOP_LEVEL_1 | %FileCheck %s -check-prefix=TOP_LEVEL_1_FUZZ
+// RUN: %complete-test %s -fuzz -group=none -tok=TOP_LEVEL_1 | %FileCheck %s -check-prefix=TOP_LEVEL_1_FUZZ_NO_GROUP
 func test3() {
   #^TOP_LEVEL_1,bar^#
 // TOP_LEVEL_1_PREFIX-NOT: foo
@@ -48,8 +48,8 @@
 // TOP_LEVEL_1_FUZZ_NO_GROUP-NOT: footastic
 }
 
-// RUN: %complete-test %s -group=stems -no-fuzz -tok=S1_QUAL_1 | FileCheck %s -check-prefix=S1_QUAL_1_PREFIX
-// RUN: %complete-test %s -group=stems -fuzz -tok=S1_QUAL_1 | FileCheck %s -check-prefix=S1_QUAL_1_FUZZ
+// RUN: %complete-test %s -group=stems -no-fuzz -tok=S1_QUAL_1 | %FileCheck %s -check-prefix=S1_QUAL_1_PREFIX
+// RUN: %complete-test %s -group=stems -fuzz -tok=S1_QUAL_1 | %FileCheck %s -check-prefix=S1_QUAL_1_FUZZ
 func test3() {
   #^S1_QUAL_1,foo,bar,tast,footast^#
 // S1_QUAL_1_PREFIX-LABEL: Results for filterText: foo [
@@ -89,10 +89,10 @@
 // S1_QUAL_1_FUZZ: ]
 }
 
-// RUN: %complete-test %s -fuzz -tok=CONTEXT_SORT_1 | FileCheck %s -check-prefix=CONTEXT_SORT_1
-// RUN: %complete-test %s -fuzz -fuzzy-weight=1 -tok=CONTEXT_SORT_1 | FileCheck %s -check-prefix=CONTEXT_SORT_4
-// RUN: %complete-test %s -fuzz -fuzzy-weight=100 -tok=CONTEXT_SORT_1 | FileCheck %s -check-prefix=CONTEXT_SORT_2
-// RUN: %complete-test %s -fuzz -fuzzy-weight=10000 -no-inner-results -tok=CONTEXT_SORT_1 | FileCheck %s -check-prefix=CONTEXT_SORT_3
+// RUN: %complete-test %s -fuzz -tok=CONTEXT_SORT_1 | %FileCheck %s -check-prefix=CONTEXT_SORT_1
+// RUN: %complete-test %s -fuzz -fuzzy-weight=1 -tok=CONTEXT_SORT_1 | %FileCheck %s -check-prefix=CONTEXT_SORT_4
+// RUN: %complete-test %s -fuzz -fuzzy-weight=100 -tok=CONTEXT_SORT_1 | %FileCheck %s -check-prefix=CONTEXT_SORT_2
+// RUN: %complete-test %s -fuzz -fuzzy-weight=10000 -no-inner-results -tok=CONTEXT_SORT_1 | %FileCheck %s -check-prefix=CONTEXT_SORT_3
 let myVar = 1
 struct Test4 {
   let myVarTest4 = 2
@@ -122,7 +122,7 @@
   }
 }
 
-// RUN: %complete-test %s -fuzz -tok=DONT_FILTER_TYPES_1 | FileCheck %s -check-prefix=DONT_FILTER_TYPES_1
+// RUN: %complete-test %s -fuzz -tok=DONT_FILTER_TYPES_1 | %FileCheck %s -check-prefix=DONT_FILTER_TYPES_1
 struct Test5 {
   func dontFilterTypes(a: Int, b: Int, ccc: String) {}
   func dontFilterTypes(a: Int, b: Int, ddd: Float) {}
@@ -141,7 +141,7 @@
 // DONT_FILTER_TYPES_1-LABEL: Results for filterText: flo [
 // DONT_FILTER_TYPES_1-NEXT: ]
 
-// RUN: %complete-test %s -fuzz -tok=MIN_LENGTH_1 | FileCheck %s -check-prefix=MIN_LENGTH_1
+// RUN: %complete-test %s -fuzz -tok=MIN_LENGTH_1 | %FileCheck %s -check-prefix=MIN_LENGTH_1
 func test6(x: S1) {
   x.#^MIN_LENGTH_1,f,o,b^#
 }
@@ -155,7 +155,7 @@
 // MIN_LENGTH_1-LABEL: Results for filterText: b [
 // MIN_LENGTH_1-NEXT: ]
 
-// RUN: %complete-test %s -fuzz -tok=MAP | FileCheck %s -check-prefix=MAP
+// RUN: %complete-test %s -fuzz -tok=MAP | %FileCheck %s -check-prefix=MAP
 protocol P {
   func map()
 }
diff --git a/test/SourceKit/CodeComplete/complete_group_overloads.swift b/test/SourceKit/CodeComplete/complete_group_overloads.swift
index 80eca0a..a3414a0 100644
--- a/test/SourceKit/CodeComplete/complete_group_overloads.swift
+++ b/test/SourceKit/CodeComplete/complete_group_overloads.swift
@@ -13,7 +13,7 @@
 func test001() {
   #^TOP_LEVEL_0,aa^#
 }
-// RUN: %complete-test -group=overloads -tok=TOP_LEVEL_0 %s | FileCheck -check-prefix=TOP_LEVEL_0 %s
+// RUN: %complete-test -group=overloads -tok=TOP_LEVEL_0 %s | %FileCheck -check-prefix=TOP_LEVEL_0 %s
 // TOP_LEVEL_0-LABEL: aaa:
 // TOP_LEVEL_0-NEXT:   aaa()
 // TOP_LEVEL_0-NEXT:   aaa(x: A)
@@ -36,7 +36,7 @@
 func test002() {
   Foo().#^FOO_INSTANCE_0^#
 }
-// RUN: %complete-test -group=overloads -tok=FOO_INSTANCE_0 %s | FileCheck -check-prefix=FOO_INSTANCE_0 %s
+// RUN: %complete-test -group=overloads -tok=FOO_INSTANCE_0 %s | %FileCheck -check-prefix=FOO_INSTANCE_0 %s
 // FOO_INSTANCE_0-LABEL: aaa:
 // FOO_INSTANCE_0-NEXT:   aaa()
 // FOO_INSTANCE_0-NEXT:   aaa(x: A)
@@ -55,7 +55,7 @@
 func test003() {
   Foo.#^FOO_QUAL_0^#
 }
-// RUN: %complete-test -group=overloads -tok=FOO_QUAL_0 %s | FileCheck -check-prefix=FOO_QUAL_0 %s
+// RUN: %complete-test -group=overloads -tok=FOO_QUAL_0 %s | %FileCheck -check-prefix=FOO_QUAL_0 %s
 // FOO_QUAL_0-LABEL: bbb:
 // FOO_QUAL_0-NEXT:   bbb()
 // FOO_QUAL_0-NEXT:   bbb(x: A)
@@ -69,7 +69,7 @@
 func test004() {
   Foo()#^FOO_SUBSCRIPT_0^#
 }
-// RUN: %complete-test -group=overloads -tok=FOO_SUBSCRIPT_0 %s | FileCheck -check-prefix=FOO_SUBSCRIPT_0 %s
+// RUN: %complete-test -group=overloads -tok=FOO_SUBSCRIPT_0 %s | %FileCheck -check-prefix=FOO_SUBSCRIPT_0 %s
 // FOO_SUBSCRIPT_0-LABEL: [:
 // FOO_SUBSCRIPT_0-NEXT:   [A]
 // FOO_SUBSCRIPT_0-NEXT:   [B]
@@ -84,7 +84,7 @@
   Bar#^BAR_INIT_0^#
 }
 // Inline a lonely group
-// RUN: %complete-test -group=overloads -add-inner-results -no-inner-operators -tok=BAR_INIT_0 %s | FileCheck -check-prefix=BAR_INIT_0 %s
+// RUN: %complete-test -group=overloads -add-inner-results -no-inner-operators -tok=BAR_INIT_0 %s | %FileCheck -check-prefix=BAR_INIT_0 %s
 // BAR_INIT_0-NOT: (:
 // BAR_INIT_0: ()
 // BAR_INIT_0-NEXT: (x: A)
@@ -97,7 +97,7 @@
 func test006() {
   Bar#^BAR_INIT_1^#
 }
-// RUN: %complete-test -group=overloads -add-inner-results -no-inner-operators -tok=BAR_INIT_1 %s | FileCheck -check-prefix=BAR_INIT_1 %s
+// RUN: %complete-test -group=overloads -add-inner-results -no-inner-operators -tok=BAR_INIT_1 %s | %FileCheck -check-prefix=BAR_INIT_1 %s
 // BAR_INIT_1-LABEL: (:
 // BAR_INIT_1-NEXT:   ()
 // BAR_INIT_1-NEXT:   (x: A)
@@ -106,7 +106,7 @@
 
 func test007() {
   #^BAR_INIT_2^#
-// RUN: %complete-test -add-inits-to-top-level -group=overloads -tok=BAR_INIT_2 %s | FileCheck -check-prefix=BAR_INIT_2 %s
+// RUN: %complete-test -add-inits-to-top-level -group=overloads -tok=BAR_INIT_2 %s | %FileCheck -check-prefix=BAR_INIT_2 %s
 // BAR_INIT_2-LABEL: Bar:
 // BAR_INIT_2-NEXT:   Bar
 // BAR_INIT_2-NEXT:   Bar()
diff --git a/test/SourceKit/CodeComplete/complete_hide_low_priority.swift b/test/SourceKit/CodeComplete/complete_hide_low_priority.swift
index 1b1bf17..b80b89d 100644
--- a/test/SourceKit/CodeComplete/complete_hide_low_priority.swift
+++ b/test/SourceKit/CodeComplete/complete_hide_low_priority.swift
@@ -2,11 +2,11 @@
 // RUN: %complete-test -hide-low-priority=1 -tok=TOP_LEVEL_0 %s -- -I %S/Inputs > %t.on
 // RUN: %complete-test -hide-low-priority=0 -tok=TOP_LEVEL_0 %s -- -I %S/Inputs > %t.off
 
-// RUN: FileCheck %s -check-prefix=HIDE < %t.on
-// RUN: FileCheck %s -check-prefix=NOHIDE < %t.off
+// RUN: %FileCheck %s -check-prefix=HIDE < %t.on
+// RUN: %FileCheck %s -check-prefix=NOHIDE < %t.off
 
-// RUN: %complete-test -hide-by-name=1 -hide-low-priority=1 -tok=TOP_LEVEL_TYPE_0 %s -- -I %S/Inputs | FileCheck %s -check-prefix=TYPES-HIDENAME
-// RUN: %complete-test -hide-by-name=0 -hide-low-priority=1 -tok=TOP_LEVEL_TYPE_0 %s -- -I %S/Inputs | FileCheck %s -check-prefix=TYPES-NOHIDENAME
+// RUN: %complete-test -hide-by-name=1 -hide-low-priority=1 -tok=TOP_LEVEL_TYPE_0 %s -- -I %S/Inputs | %FileCheck %s -check-prefix=TYPES-HIDENAME
+// RUN: %complete-test -hide-by-name=0 -hide-low-priority=1 -tok=TOP_LEVEL_TYPE_0 %s -- -I %S/Inputs | %FileCheck %s -check-prefix=TYPES-NOHIDENAME
 import PopularAPI
 
 let x = 1
diff --git a/test/SourceKit/CodeComplete/complete_import_module_flag.swift b/test/SourceKit/CodeComplete/complete_import_module_flag.swift
index ab907b6..48c80db 100644
--- a/test/SourceKit/CodeComplete/complete_import_module_flag.swift
+++ b/test/SourceKit/CodeComplete/complete_import_module_flag.swift
@@ -1,8 +1,8 @@
 // XFAIL: broken_std_regex
 // RUN: mkdir -p %t
 // RUN: %swift -Xcc -I%S/Inputs -emit-module -o %t/auxiliary_file.swiftmodule %S/Inputs/auxiliary_file.swift
-// RUN: %complete-test -group=none -hide-none -raw -tok=TOP_LEVEL_0 %s -- -import-module auxiliary_file  -I %t -I %S/Inputs | FileCheck %s
-// RUN: %complete-test -group=none -tok=TOP_LEVEL_0 %s -- -import-module auxiliary_file  -I %t -I %S/Inputs | FileCheck %s -check-prefix=WITH_HIDING
+// RUN: %complete-test -group=none -hide-none -raw -tok=TOP_LEVEL_0 %s -- -import-module auxiliary_file  -I %t -I %S/Inputs | %FileCheck %s
+// RUN: %complete-test -group=none -tok=TOP_LEVEL_0 %s -- -import-module auxiliary_file  -I %t -I %S/Inputs | %FileCheck %s -check-prefix=WITH_HIDING
 
 func fromMainModule() {}
 func test() {
diff --git a/test/SourceKit/CodeComplete/complete_inner.swift b/test/SourceKit/CodeComplete/complete_inner.swift
index aa88157..aca4e5e 100644
--- a/test/SourceKit/CodeComplete/complete_inner.swift
+++ b/test/SourceKit/CodeComplete/complete_inner.swift
@@ -17,7 +17,7 @@
 func test001() {
   #^TOP_LEVEL_0,fo,foo,foob,foobar^#
 }
-// RUN: %complete-test %s -no-fuzz -group=none -add-inner-results -tok=TOP_LEVEL_0 | FileCheck %s -check-prefix=TOP_LEVEL_0
+// RUN: %complete-test %s -no-fuzz -group=none -add-inner-results -tok=TOP_LEVEL_0 | %FileCheck %s -check-prefix=TOP_LEVEL_0
 // TOP_LEVEL_0-LABEL: Results for filterText: fo [
 // TOP_LEVEL_0-NEXT:   for
 // TOP_LEVEL_0-NEXT:   Foo
@@ -48,7 +48,7 @@
 func test002(abc: FooBar, abd: Base) {
   #^TOP_LEVEL_1,ab,abc,abd^#
 }
-// RUN: %complete-test %s -no-fuzz -group=none -add-inner-results -tok=TOP_LEVEL_1 | FileCheck %s -check-prefix=TOP_LEVEL_1
+// RUN: %complete-test %s -no-fuzz -group=none -add-inner-results -tok=TOP_LEVEL_1 | %FileCheck %s -check-prefix=TOP_LEVEL_1
 // TOP_LEVEL_1-LABEL: Results for filterText: ab [
 // TOP_LEVEL_1-NEXT:   abc
 // TOP_LEVEL_1-NEXT:   abd
@@ -74,7 +74,7 @@
 func test003(x: FooBar) {
   x.#^FOOBAR_QUALIFIED,pro,prop,prop.^#
 }
-// RUN: %complete-test %s -group=none -add-inner-results -tok=FOOBAR_QUALIFIED | FileCheck %s -check-prefix=FOOBAR_QUALIFIED
+// RUN: %complete-test %s -group=none -add-inner-results -tok=FOOBAR_QUALIFIED | %FileCheck %s -check-prefix=FOOBAR_QUALIFIED
 // FOOBAR_QUALIFIED-LABEL: Results for filterText: pro [
 // FOOBAR_QUALIFIED-NEXT:   prop
 // FOOBAR_QUALIFIED-NEXT: ]
@@ -90,7 +90,7 @@
 // FOOBAR_QUALIFIED-LABEL: Results for filterText: prop. [
 // FOOBAR_QUALIFIED-NEXT: ]
 
-// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=FOOBAR_QUALIFIED | FileCheck %s -check-prefix=FOOBAR_QUALIFIED_OP
+// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=FOOBAR_QUALIFIED | %FileCheck %s -check-prefix=FOOBAR_QUALIFIED_OP
 // FOOBAR_QUALIFIED_OP-LABEL: Results for filterText: pro [
 // FOOBAR_QUALIFIED_OP-NEXT:   prop
 // FOOBAR_QUALIFIED_OP-NEXT: ]
@@ -99,7 +99,7 @@
 // FOOBAR_QUALIFIED_OP-NEXT:   prop.
 // FOOBAR_QUALIFIED_OP: ]
 
-// RUN: %complete-test %s -group=none -add-inner-results -no-inner-operators -tok=FOOBAR_QUALIFIED | FileCheck %s -check-prefix=FOOBAR_QUALIFIED_NOOP
+// RUN: %complete-test %s -group=none -add-inner-results -no-inner-operators -tok=FOOBAR_QUALIFIED | %FileCheck %s -check-prefix=FOOBAR_QUALIFIED_NOOP
 // FOOBAR_QUALIFIED_NOOP-LABEL: Results for filterText: pro [
 // FOOBAR_QUALIFIED_NOOP-NEXT:   prop
 // FOOBAR_QUALIFIED_NOOP-NEXT: ]
@@ -109,7 +109,7 @@
 // FOOBAR_QUALIFIED_NOOP-NEXT:   prop.prop
 // FOOBAR_QUALIFIED_NOOP-NEXT: ]
 
-// RUN: %complete-test %s -group=none -no-include-exact-match -add-inner-results -no-inner-operators -tok=FOOBAR_QUALIFIED | FileCheck %s -check-prefix=FOOBAR_QUALIFIED_NOEXACT
+// RUN: %complete-test %s -group=none -no-include-exact-match -add-inner-results -no-inner-operators -tok=FOOBAR_QUALIFIED | %FileCheck %s -check-prefix=FOOBAR_QUALIFIED_NOEXACT
 // FOOBAR_QUALIFIED_NOEXACT-LABEL: Results for filterText: prop [
 // FOOBAR_QUALIFIED_NOEXACT-NEXT:   prop.method()
 // FOOBAR_QUALIFIED_NOEXACT-NEXT:   prop.prop
@@ -118,14 +118,14 @@
 func test004() {
   FooBar#^FOOBAR_POSTFIX^#
 }
-// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=FOOBAR_POSTFIX | FileCheck %s -check-prefix=FOOBAR_POSTFIX_OP
+// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=FOOBAR_POSTFIX | %FileCheck %s -check-prefix=FOOBAR_POSTFIX_OP
 // FOOBAR_POSTFIX_OP: {{^}}.{{$}}
 // FOOBAR_POSTFIX_OP: {{^}}({{$}}
 
 func test005(x: FooBar) {
   x#^FOOBAR_INSTANCE_POSTFIX^#
 }
-// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=FOOBAR_INSTANCE_POSTFIX | FileCheck %s -check-prefix=FOOBAR_INSTANCE_POSTFIX_OP
+// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=FOOBAR_INSTANCE_POSTFIX | %FileCheck %s -check-prefix=FOOBAR_INSTANCE_POSTFIX_OP
 // FOOBAR_INSTANCE_POSTFIX_OP: .
 // FIXME: We should probably just have '[' here - rdar://22702955
 // FOOBAR_INSTANCE_POSTFIX_OP: [Foo]
@@ -133,11 +133,11 @@
 func test005(x: Base?) {
   x#^OPTIONAL_POSTFIX^#
 }
-// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=OPTIONAL_POSTFIX | FileCheck %s -check-prefix=OPTIONAL_POSTFIX_OP
+// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=OPTIONAL_POSTFIX | %FileCheck %s -check-prefix=OPTIONAL_POSTFIX_OP
 // OPTIONAL_POSTFIX_OP: .
 // OPTIONAL_POSTFIX_OP: ?.
 
-// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=KEYWORD_0 | FileCheck %s -check-prefix=KEYWORD_0
+// RUN: %complete-test %s -group=none -no-inner-results -inner-operators -tok=KEYWORD_0 | %FileCheck %s -check-prefix=KEYWORD_0
 func test006() {
   #^KEYWORD_0,for^#
 }
diff --git a/test/SourceKit/CodeComplete/complete_literals.swift b/test/SourceKit/CodeComplete/complete_literals.swift
index 177f026..f2ca730 100644
--- a/test/SourceKit/CodeComplete/complete_literals.swift
+++ b/test/SourceKit/CodeComplete/complete_literals.swift
@@ -2,9 +2,9 @@
 let var1 = 1
 let var2: Int = 1
 // XFAIL: broken_std_regex
-// RUN: %sourcekitd-test -req=complete -pos=1:2 %s -- %s | FileCheck %s -check-prefix=COMPLETE_1
-// RUN: %sourcekitd-test -req=complete -pos=2:12 %s -- %s | FileCheck %s -check-prefix=COMPLETE_1
-// RUN: %sourcekitd-test -req=complete -pos=3:17 %s -- %s | FileCheck %s -check-prefix=COMPLETE_2
+// RUN: %sourcekitd-test -req=complete -pos=1:2 %s -- %s | %FileCheck %s -check-prefix=COMPLETE_1
+// RUN: %sourcekitd-test -req=complete -pos=2:12 %s -- %s | %FileCheck %s -check-prefix=COMPLETE_1
+// RUN: %sourcekitd-test -req=complete -pos=3:17 %s -- %s | %FileCheck %s -check-prefix=COMPLETE_2
 
 // COMPLETE_1-NOT: source.lang.swift.literal
 // COMPLETE_1: source.lang.swift.literal.color
@@ -17,7 +17,7 @@
 // COMPLETE_2: key.name: "nil"
 // COMPLETE_2-NOT: source.lang.swift.literal
 
-// RUN: %sourcekitd-test -req=complete.open -pos=1:2 %s -- %s | FileCheck %s -check-prefix=LITERALS
+// RUN: %sourcekitd-test -req=complete.open -pos=1:2 %s -- %s | %FileCheck %s -check-prefix=LITERALS
 // LITERALS: key.kind: source.lang.swift.literal.string
 // LITERALS: key.sourcetext: "\"<#{{.*}}#>\""
 // LITERALS: key.kind: source.lang.swift.literal.boolean
@@ -29,9 +29,9 @@
 // LITERALS: key.sourcetext: "(<#{{.*}}#>)"
 // LITERALS: key.kind: source.lang.swift.literal.nil
 
-// RUN: %complete-test -tok=STMT1 %s -raw | FileCheck %s -check-prefix=STMT
-// RUN: %complete-test -tok=STMT2 %s -raw | FileCheck %s -check-prefix=STMT
-// RUN: %complete-test -tok=STMT3 %s -raw | FileCheck %s -check-prefix=STMT
+// RUN: %complete-test -tok=STMT1 %s -raw | %FileCheck %s -check-prefix=STMT
+// RUN: %complete-test -tok=STMT2 %s -raw | %FileCheck %s -check-prefix=STMT
+// RUN: %complete-test -tok=STMT3 %s -raw | %FileCheck %s -check-prefix=STMT
 // STMT-NOT: source.lang.swift.literal
 
 #^STMT1^#
@@ -43,26 +43,26 @@
   #^STMT3^#
 }
 
-// RUN: %complete-test -tok=EXPR1 %s -raw | FileCheck %s -check-prefix=LITERALS
-// RUN: %complete-test -tok=EXPR2 %s -raw | FileCheck %s -check-prefix=LITERALS
-// RUN: %complete-test -tok=EXPR3 %s -raw | FileCheck %s -check-prefix=LITERALS
+// RUN: %complete-test -tok=EXPR1 %s -raw | %FileCheck %s -check-prefix=LITERALS
+// RUN: %complete-test -tok=EXPR2 %s -raw | %FileCheck %s -check-prefix=LITERALS
+// RUN: %complete-test -tok=EXPR3 %s -raw | %FileCheck %s -check-prefix=LITERALS
 let x1 = #^EXPR1^#
 x1 + #^EXPR2^#
 if #^EXPR3^# { }
 
-// RUN: %complete-test -tok=EXPR4 %s -raw | FileCheck %s -check-prefix=LITERAL_INT
+// RUN: %complete-test -tok=EXPR4 %s -raw | %FileCheck %s -check-prefix=LITERAL_INT
 foo(#^EXPR4^#)
 // LITERAL_INT-NOT: source.lang.swift.literal
 // LITERAL_INT: key.kind: source.lang.swift.literal.integer
 // LITERAL_INT-NOT: source.lang.swift.literal
 
-// RUN: %complete-test -tok=EXPR5 %s -raw | FileCheck %s -check-prefix=LITERAL_TUPLE
+// RUN: %complete-test -tok=EXPR5 %s -raw | %FileCheck %s -check-prefix=LITERAL_TUPLE
 let x2: (String, Int) = #^EXPR5^#
 // LITERAL_TUPLE-NOT: source.lang.swift.literal
 // LITERAL_TUPLE: key.kind: source.lang.swift.literal.tuple
 // LITERAL_TUPLE-NOT: source.lang.swift.literal
 
-// RUN: %complete-test -tok=EXPR6 %s -raw | FileCheck %s -check-prefix=LITERAL_NO_TYPE
+// RUN: %complete-test -tok=EXPR6 %s -raw | %FileCheck %s -check-prefix=LITERAL_NO_TYPE
 // When there is a type context that doesn't match, we should see no literals
 // except the keywords and they should be prioritized like keywords not
 // literals.
diff --git a/test/SourceKit/CodeComplete/complete_member.swift b/test/SourceKit/CodeComplete/complete_member.swift
index ad55791..5610737 100644
--- a/test/SourceKit/CodeComplete/complete_member.swift
+++ b/test/SourceKit/CodeComplete/complete_member.swift
@@ -42,8 +42,8 @@
 // RUN: %sourcekitd-test -req=complete -pos=15:5 %s -- %s > %t.response
 // RUN: diff -u %s.response %t.response
 //
-// RUN: %sourcekitd-test -req=complete -pos=19:5 %s -- %s | FileCheck %s -check-prefix=CHECK-OPTIONAL
-// RUN: %sourcekitd-test -req=complete.open -pos=19:5 %s -- %s | FileCheck %s -check-prefix=CHECK-OPTIONAL-OPEN
+// RUN: %sourcekitd-test -req=complete -pos=19:5 %s -- %s | %FileCheck %s -check-prefix=CHECK-OPTIONAL
+// RUN: %sourcekitd-test -req=complete.open -pos=19:5 %s -- %s | %FileCheck %s -check-prefix=CHECK-OPTIONAL-OPEN
 // CHECK-OPTIONAL:     {
 // CHECK-OPTIONAL:       key.kind: source.lang.swift.decl.function.method.instance,
 // CHECK-OPTIONAL:       key.name: "fooInstanceFunc0()",
@@ -56,15 +56,15 @@
 // CHECK-OPTIONAL-NEXT:       key.modulename: "complete_member"
 // CHECK-OPTIONAL-NEXT:     },
 
-// RUN: %sourcekitd-test -req=complete.open -pos=19:5 %s -- %s | FileCheck %s -check-prefix=CHECK-OPTIONAL-OPEN
+// RUN: %sourcekitd-test -req=complete.open -pos=19:5 %s -- %s | %FileCheck %s -check-prefix=CHECK-OPTIONAL-OPEN
 // CHECK-OPTIONAL-OPEN-NOT:       key.description: "fooInstanceFunc1
 // CHECK-OPTIONAL-OPEN:       key.description: "?.fooInstanceFunc1(a: Int)",
 // CHECK-OPTIONAL-OPEN-NOT:       key.description: "fooInstanceFunc1
 
-// RUN: %sourcekitd-test -req=complete -pos=27:5 %s -- %s | FileCheck %s -check-prefix=CHECK-UNAVAIL
+// RUN: %sourcekitd-test -req=complete -pos=27:5 %s -- %s | %FileCheck %s -check-prefix=CHECK-UNAVAIL
 // CHECK-UNAVAIL-NOT: key.name: "unavail()",
 
-// RUN: %sourcekitd-test -req=complete -pos=39:15 %s -- %s | FileCheck %s -check-prefix=CHECK-OVERRIDE_USR
+// RUN: %sourcekitd-test -req=complete -pos=39:15 %s -- %s | %FileCheck %s -check-prefix=CHECK-OVERRIDE_USR
 // CHECK-OVERRIDE_USR:      {
 // CHECK-OVERRIDE_USR:          key.kind: source.lang.swift.decl.function.method.instance,
 // CHECK-OVERRIDE_USR-NEXT:     key.name: "foo()",
diff --git a/test/SourceKit/CodeComplete/complete_moduleimportdepth.swift b/test/SourceKit/CodeComplete/complete_moduleimportdepth.swift
index ec17525..a4184ac 100644
--- a/test/SourceKit/CodeComplete/complete_moduleimportdepth.swift
+++ b/test/SourceKit/CodeComplete/complete_moduleimportdepth.swift
@@ -7,7 +7,7 @@
 
 // XFAIL: broken_std_regex
 // RUN: %complete-test -hide-none -group=none -tok=A %s -raw -- -I %S/Inputs -F %S/../Inputs/libIDE-mock-sdk > %t
-// RUN: FileCheck %s < %t
+// RUN: %FileCheck %s < %t
 
 // Swift == 1
 // CHECK-LABEL:  key.name: "abs(:)",
diff --git a/test/SourceKit/CodeComplete/complete_name.swift b/test/SourceKit/CodeComplete/complete_name.swift
index 9eaaf79..40927a9 100644
--- a/test/SourceKit/CodeComplete/complete_name.swift
+++ b/test/SourceKit/CodeComplete/complete_name.swift
@@ -1,6 +1,6 @@
 // XFAIL: broken_std_regex
-// RUN: %complete-test -raw -tok=INIT_NAME %s | FileCheck %s -check-prefix=INIT_NAME
-// RUN: %complete-test -raw -tok=METHOD_NAME %s | FileCheck %s -check-prefix=METHOD_NAME
+// RUN: %complete-test -raw -tok=INIT_NAME %s | %FileCheck %s -check-prefix=INIT_NAME
+// RUN: %complete-test -raw -tok=METHOD_NAME %s | %FileCheck %s -check-prefix=METHOD_NAME
 
 struct S {
   init(a: Int, b: Int, _ c: Int) {}
diff --git a/test/SourceKit/CodeComplete/complete_open.swift b/test/SourceKit/CodeComplete/complete_open.swift
index 67de57b..97c3ba1 100644
--- a/test/SourceKit/CodeComplete/complete_open.swift
+++ b/test/SourceKit/CodeComplete/complete_open.swift
@@ -9,7 +9,7 @@
   // in comment
 }
 
-// RUN: %sourcekitd-test -req=complete.open -pos=8:5 %s -- %s | FileCheck %s
+// RUN: %sourcekitd-test -req=complete.open -pos=8:5 %s -- %s | %FileCheck %s
 // CHECK: key.results: [
 // CHECK:   key.name: "advancedFeatures
 // ...
@@ -22,45 +22,45 @@
 // RUN:   == -req=complete.close -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.open -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.close -pos=8:5 %s -- %s > %t.close
-// RUN: FileCheck -check-prefix=CLOSE %s < %t.close
+// RUN: %FileCheck -check-prefix=CLOSE %s < %t.close
 // CLOSE:   key.name: "advancedFeatures
 // CLOSE:   key.name: "advancedFeatures
 
 // RUN: %sourcekitd-test -req=complete.open -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.open -pos=7:1 %s -- %s > %t.open2diff
-// RUN: FileCheck -check-prefix=OPEN2DIFF %s < %t.open2diff
+// RUN: %FileCheck -check-prefix=OPEN2DIFF %s < %t.open2diff
 // OPEN2DIFF: key.name: "advancedFeatures
 // OPEN2DIFF: key.name: "foo()
 // OPEN2DIFF-NOT: key.name: "advancedFeatures
 
 // RUN: not %sourcekitd-test -req=complete.open -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.open -pos=8:5 %s -- %s 2> %t.open2
-// RUN: FileCheck -check-prefix=OPEN2 %s < %t.open2
+// RUN: %FileCheck -check-prefix=OPEN2 %s < %t.open2
 // OPEN2: error response (Request Failed): codecomplete.open: code completion session for '{{.*}}', {{.*}} already exists
 
 // RUN: not %sourcekitd-test -req=complete.close -pos=7:1 %s -- %s 2> %t.closefail1
-// RUN: FileCheck -check-prefix=CLOSEFAIL %s < %t.closefail1
+// RUN: %FileCheck -check-prefix=CLOSEFAIL %s < %t.closefail1
 // RUN: not %sourcekitd-test -req=complete.open -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.close -pos=7:1 %s -- %s 2> %t.closefail2
-// RUN: FileCheck -check-prefix=CLOSEFAIL %s < %t.closefail2
+// RUN: %FileCheck -check-prefix=CLOSEFAIL %s < %t.closefail2
 // RUN: not %sourcekitd-test -req=complete.open -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.close -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.close -pos=8:5 %s -- %s 2> %t.closefail3
-// RUN: FileCheck -check-prefix=CLOSEFAIL %s < %t.closefail3
+// RUN: %FileCheck -check-prefix=CLOSEFAIL %s < %t.closefail3
 // CLOSEFAIL: error response (Request Failed): codecomplete.close: no code completion session for '{{.*}}'
 
 // RUN: not %sourcekitd-test -req=complete.update -pos=7:1 %s -- %s 2> %t.updatefail1
-// RUN: FileCheck -check-prefix=UPDATEFAIL %s < %t.updatefail1
+// RUN: %FileCheck -check-prefix=UPDATEFAIL %s < %t.updatefail1
 // RUN: not %sourcekitd-test -req=complete.open -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.update -pos=7:1 %s -- %s 2> %t.updatefail2
-// RUN: FileCheck -check-prefix=UPDATEFAIL %s < %t.updatefail2
+// RUN: %FileCheck -check-prefix=UPDATEFAIL %s < %t.updatefail2
 // RUN: not %sourcekitd-test -req=complete.open -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.close -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.update -pos=8:5 %s -- %s 2> %t.updatefail3
-// RUN: FileCheck -check-prefix=UPDATEFAIL %s < %t.updatefail3
+// RUN: %FileCheck -check-prefix=UPDATEFAIL %s < %t.updatefail3
 // UPDATEFAIL: error response (Request Failed): codecomplete.update: no code completion session for '{{.*}}'
 
-// RUN: %sourcekitd-test -req=complete.open -pos=9:9 %s -- %s | FileCheck %s -check-prefix=EMPTY
+// RUN: %sourcekitd-test -req=complete.open -pos=9:9 %s -- %s | %FileCheck %s -check-prefix=EMPTY
 // EMPTY: key.results: [
 // EMPTY-NEXT: ],
 // EMPTY-NEXT: key.kind: source.lang.swift.codecomplete.group
diff --git a/test/SourceKit/CodeComplete/complete_operators.swift b/test/SourceKit/CodeComplete/complete_operators.swift
index fb29050..ea4d173 100644
--- a/test/SourceKit/CodeComplete/complete_operators.swift
+++ b/test/SourceKit/CodeComplete/complete_operators.swift
@@ -1,11 +1,11 @@
 // XFAIL: broken_std_regex
-// RUN: %complete-test -tok=INT_OPERATORS %s | FileCheck %s
-// RUN: %complete-test -add-inner-results -tok=INT_OPERATORS_INNER %s | FileCheck %s -check-prefix=INNER
-// RUN: %complete-test -raw -hide-none -tok=INT_OPERATORS %s | FileCheck %s -check-prefix=RAW
-// RUN: %complete-test -tok=BOOL_OPERATORS %s | FileCheck %s -check-prefix=BOOL
-// RUN: %complete-test -tok=OPT_OPERATORS %s | FileCheck %s -check-prefix=OPT
-// RUN: %complete-test -tok=KNOWN_OPERATORS_1 %s | FileCheck %s -check-prefix=KNOWN
-// RUN: %complete-test -tok=KNOWN_OPERATORS_2 %s | FileCheck %s -check-prefix=KNOWN
+// RUN: %complete-test -tok=INT_OPERATORS %s | %FileCheck %s
+// RUN: %complete-test -add-inner-results -tok=INT_OPERATORS_INNER %s | %FileCheck %s -check-prefix=INNER
+// RUN: %complete-test -raw -hide-none -tok=INT_OPERATORS %s | %FileCheck %s -check-prefix=RAW
+// RUN: %complete-test -tok=BOOL_OPERATORS %s | %FileCheck %s -check-prefix=BOOL
+// RUN: %complete-test -tok=OPT_OPERATORS %s | %FileCheck %s -check-prefix=OPT
+// RUN: %complete-test -tok=KNOWN_OPERATORS_1 %s | %FileCheck %s -check-prefix=KNOWN
+// RUN: %complete-test -tok=KNOWN_OPERATORS_2 %s | %FileCheck %s -check-prefix=KNOWN
 
 struct MyInt {
   var bigPowers: Int { return 1 }
diff --git a/test/SourceKit/CodeComplete/complete_playground_symlink.swift b/test/SourceKit/CodeComplete/complete_playground_symlink.swift
index f7b2bdb..5c44e86 100644
--- a/test/SourceKit/CodeComplete/complete_playground_symlink.swift
+++ b/test/SourceKit/CodeComplete/complete_playground_symlink.swift
@@ -3,7 +3,7 @@
 // RUN: echo "let foo_blah = 0" > %t.dir/input.swift
 // RUN: echo "" >> %t.dir/input.swift
 // RUN: ln -s %t.dir/test.playground %t.dir/linked.playground
-// RUN: %sourcekitd-test -req=complete -pos=2:1 -text-input %t.dir/input.swift %t.dir/test.playground -- %t.dir/test.playground | FileCheck %s
-// RUN: %sourcekitd-test -req=complete -pos=2:1 -text-input %t.dir/input.swift %t.dir/linked.playground -- %t.dir/linked.playground | FileCheck %s
+// RUN: %sourcekitd-test -req=complete -pos=2:1 -text-input %t.dir/input.swift %t.dir/test.playground -- %t.dir/test.playground | %FileCheck %s
+// RUN: %sourcekitd-test -req=complete -pos=2:1 -text-input %t.dir/input.swift %t.dir/linked.playground -- %t.dir/linked.playground | %FileCheck %s
 
 // CHECK: key.name: "foo_blah"
diff --git a/test/SourceKit/CodeComplete/complete_popular_api.swift b/test/SourceKit/CodeComplete/complete_popular_api.swift
index ed8cfef..c89db57 100644
--- a/test/SourceKit/CodeComplete/complete_popular_api.swift
+++ b/test/SourceKit/CodeComplete/complete_popular_api.swift
@@ -20,15 +20,15 @@
 // REQUIRES: objc_interop
 // RUN: %sourcekitd-test -req=complete.open -pos=2:1 -req-opts=hidelowpriority=0 %s -- %s > %t.nopopular.top
 // RUN: %sourcekitd-test -req=complete.open -pos=3:5 %s -- %s > %t.nopopular.foo
-// RUN: FileCheck %s -check-prefix=NOPOP_TOP < %t.nopopular.top
-// RUN: FileCheck %s -check-prefix=NOPOP_FOO < %t.nopopular.foo
+// RUN: %FileCheck %s -check-prefix=NOPOP_TOP < %t.nopopular.top
+// RUN: %FileCheck %s -check-prefix=NOPOP_FOO < %t.nopopular.foo
 
 // RUN: %sourcekitd-test -req=complete.setpopularapi -req-opts=popular=%s.popular,unpopular=%s.unpopular \
 // RUN:               == -req=complete.open -req-opts=hidelowpriority=0 -pos=2:1 %s -- %s > %t.popular.top
 // RUN: %sourcekitd-test -req=complete.setpopularapi -req-opts=popular=%s.popular,unpopular=%s.unpopular \
 // RUN:               == -req=complete.open -pos=3:5 %s -- %s > %t.popular.foo
-// RUN: FileCheck %s -check-prefix=POP_TOP < %t.popular.top
-// RUN: FileCheck %s -check-prefix=POP_FOO < %t.popular.foo
+// RUN: %FileCheck %s -check-prefix=POP_TOP < %t.popular.top
+// RUN: %FileCheck %s -check-prefix=POP_FOO < %t.popular.foo
 
 // NOPOP_TOP: key.name: "bad()
 // NOPOP_TOP: key.name: "good()
@@ -56,7 +56,7 @@
 
 
 // RUN: %complete-test -hide-none -fuzz -group=none -popular="%s.popular" -unpopular="%s.unpopular" -tok=POPULAR_STMT_0 %s -- -I %S/Inputs > %t.popular.stmt.0
-// RUN: FileCheck %s -check-prefix=POPULAR_STMT_0 < %t.popular.stmt.0
+// RUN: %FileCheck %s -check-prefix=POPULAR_STMT_0 < %t.popular.stmt.0
 
 import PopularAPI
 var globalColor = 0
@@ -116,7 +116,7 @@
   struct ABFont {}
 }
 
-// RUN: %complete-test -hide-none -fuzz -group=none -popular="%s.popular" -unpopular="%s.unpopular" -tok=POPULAR_VS_PREFIX_1 %s -- -I %S/Inputs | FileCheck %s -check-prefix=POPULAR_VS_PREFIX_1
+// RUN: %complete-test -hide-none -fuzz -group=none -popular="%s.popular" -unpopular="%s.unpopular" -tok=POPULAR_VS_PREFIX_1 %s -- -I %S/Inputs | %FileCheck %s -check-prefix=POPULAR_VS_PREFIX_1
 func testPopularityVsPrefixMatch1() {
   let x: Outer.#^POPULAR_VS_PREFIX_1,,AB,ABT^#
 }
diff --git a/test/SourceKit/CodeComplete/complete_requestlimit.swift b/test/SourceKit/CodeComplete/complete_requestlimit.swift
index 6dc7d83..ce191b4 100644
--- a/test/SourceKit/CodeComplete/complete_requestlimit.swift
+++ b/test/SourceKit/CodeComplete/complete_requestlimit.swift
@@ -7,13 +7,13 @@
   let c: A
 }
 
-// RUN: %complete-test -tok=TOP_LEVEL_0 %s | FileCheck -check-prefix=TOP_LEVEL_0_ALL %s
-// RUN: %complete-test -tok=TOP_LEVEL_0 %s -limit=0 | FileCheck -check-prefix=TOP_LEVEL_0_ALL %s
-// RUN: %complete-test -tok=TOP_LEVEL_0 %s -limit=3 | FileCheck -check-prefix=TOP_LEVEL_0_3 %s
-// RUN: %complete-test -tok=TOP_LEVEL_0 %s -limit=1 | FileCheck -check-prefix=TOP_LEVEL_0_1 %s
-// RUN: %complete-test -tok=TOP_LEVEL_0 %s -start=1 -limit=1 | FileCheck -check-prefix=TOP_LEVEL_0_11 %s
-// RUN: %complete-test -tok=TOP_LEVEL_0 %s -start=2 -limit=1 | FileCheck -check-prefix=TOP_LEVEL_0_12 %s
-// RUN: %complete-test -tok=TOP_LEVEL_0 %s -raw -start=100000 -limit=1 | FileCheck -check-prefix=TOP_LEVEL_0_NONE %s
+// RUN: %complete-test -tok=TOP_LEVEL_0 %s | %FileCheck -check-prefix=TOP_LEVEL_0_ALL %s
+// RUN: %complete-test -tok=TOP_LEVEL_0 %s -limit=0 | %FileCheck -check-prefix=TOP_LEVEL_0_ALL %s
+// RUN: %complete-test -tok=TOP_LEVEL_0 %s -limit=3 | %FileCheck -check-prefix=TOP_LEVEL_0_3 %s
+// RUN: %complete-test -tok=TOP_LEVEL_0 %s -limit=1 | %FileCheck -check-prefix=TOP_LEVEL_0_1 %s
+// RUN: %complete-test -tok=TOP_LEVEL_0 %s -start=1 -limit=1 | %FileCheck -check-prefix=TOP_LEVEL_0_11 %s
+// RUN: %complete-test -tok=TOP_LEVEL_0 %s -start=2 -limit=1 | %FileCheck -check-prefix=TOP_LEVEL_0_12 %s
+// RUN: %complete-test -tok=TOP_LEVEL_0 %s -raw -start=100000 -limit=1 | %FileCheck -check-prefix=TOP_LEVEL_0_NONE %s
 func test001() {
   let x: B
   let y: B
@@ -55,8 +55,8 @@
 // TOP_LEVEL_0_NONE: ]
 }
 
-// RUN: %complete-test -tok=B_INSTANCE_0 %s | FileCheck -check-prefix=B_INSTANCE_0_ALL %s
-// RUN: %complete-test -tok=B_INSTANCE_0 %s -limit=1 | FileCheck -check-prefix=B_INSTANCE_0_1 %s
+// RUN: %complete-test -tok=B_INSTANCE_0 %s | %FileCheck -check-prefix=B_INSTANCE_0_ALL %s
+// RUN: %complete-test -tok=B_INSTANCE_0 %s -limit=1 | %FileCheck -check-prefix=B_INSTANCE_0_1 %s
 func test002(x: B) {
   x.#^B_INSTANCE_0^#
 
@@ -77,8 +77,8 @@
   let abc: A
 }
 
-// RUN: %complete-test -tok=C_INSTANCE_0 %s | FileCheck -check-prefix=C_INSTANCE_0_ALL %s
-// RUN: %complete-test -tok=C_INSTANCE_0 %s -limit=1 | FileCheck -check-prefix=C_INSTANCE_0_1 %s
+// RUN: %complete-test -tok=C_INSTANCE_0 %s | %FileCheck -check-prefix=C_INSTANCE_0_ALL %s
+// RUN: %complete-test -tok=C_INSTANCE_0 %s -limit=1 | %FileCheck -check-prefix=C_INSTANCE_0_1 %s
 func test003(x: C) {
   x.#^C_INSTANCE_0,aa^#
 
@@ -97,9 +97,9 @@
   func aab() {}
 }
 
-// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s | FileCheck -check-prefix=OVERLOADS_ALL %s
-// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -limit=1 | FileCheck -check-prefix=OVERLOADS_1 %s
-// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -start=1 -limit=1 | FileCheck -check-prefix=OVERLOADS_11 %s
+// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s | %FileCheck -check-prefix=OVERLOADS_ALL %s
+// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -limit=1 | %FileCheck -check-prefix=OVERLOADS_1 %s
+// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -start=1 -limit=1 | %FileCheck -check-prefix=OVERLOADS_11 %s
 func test003(x: D) {
   x.#^D_INSTANCE_0^#
 
@@ -119,14 +119,14 @@
 }
 
 // If we return all the results, nextrequeststart == 0
-// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw | FileCheck -check-prefix=NEXT-END %s
-// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw -limit=5 | FileCheck -check-prefix=NEXT-END %s
-// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw -limit=2 | FileCheck -check-prefix=NEXT-END %s
+// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw | %FileCheck -check-prefix=NEXT-END %s
+// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw -limit=5 | %FileCheck -check-prefix=NEXT-END %s
+// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw -limit=2 | %FileCheck -check-prefix=NEXT-END %s
 // NEXT-END: key.nextrequeststart: 0
 
 // If we return the last result, nextrequeststart == 0
-// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw -start=1 -limit=1 | FileCheck -check-prefix=NEXT-END %s
+// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw -start=1 -limit=1 | %FileCheck -check-prefix=NEXT-END %s
 
 // Otherwise, it's the next result
-// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw -limit=1 | FileCheck -check-prefix=NEXT1 %s
+// RUN: %complete-test -group=overloads -tok=D_INSTANCE_0 %s -raw -limit=1 | %FileCheck -check-prefix=NEXT1 %s
 // NEXT1: key.nextrequeststart: 1
diff --git a/test/SourceKit/CodeComplete/complete_sort_order.swift b/test/SourceKit/CodeComplete/complete_sort_order.swift
index 284e0da..5ffd80d 100644
--- a/test/SourceKit/CodeComplete/complete_sort_order.swift
+++ b/test/SourceKit/CodeComplete/complete_sort_order.swift
@@ -9,7 +9,7 @@
 
 // XFAIL: broken_std_regex
 // RUN: %sourcekitd-test -req=complete -req-opts=hidelowpriority=0 -pos=7:1 %s -- %s > %t.orig
-// RUN: FileCheck -check-prefix=NAME %s < %t.orig
+// RUN: %FileCheck -check-prefix=NAME %s < %t.orig
 // Make sure the order is as below, foo(Int) should come before foo(String).
 
 // NAME: key.description: "#column"
@@ -25,11 +25,11 @@
 // RUN: %sourcekitd-test -req=complete.open -pos=7:1 -req-opts=hidelowpriority=0,hideunderscores=0 %s -- %s > %t.default
 // RUN: %sourcekitd-test -req=complete.open -pos=7:1 -req-opts=sort.byname=0,hidelowpriority=0,hideunderscores=0 %s -- %s > %t.on
 // RUN: %sourcekitd-test -req=complete.open -pos=7:1 -req-opts=sort.byname=1,hidelowpriority=0,hideunderscores=0 %s -- %s > %t.off
-// RUN: FileCheck -check-prefix=CONTEXT %s < %t.default
-// RUN: FileCheck -check-prefix=NAME %s < %t.off
+// RUN: %FileCheck -check-prefix=CONTEXT %s < %t.default
+// RUN: %FileCheck -check-prefix=NAME %s < %t.off
 // FIXME: rdar://problem/20109989 non-deterministic sort order
 // RUN-disabled: diff %t.on %t.default
-// RUN: FileCheck -check-prefix=CONTEXT %s < %t.on
+// RUN: %FileCheck -check-prefix=CONTEXT %s < %t.on
 
 // CONTEXT: key.kind: source.lang.swift.decl
 // CONTEXT-NEXT: key.name: "x"
@@ -44,7 +44,7 @@
 // CONTEXT: key.name: "#column"
 // CONTEXT: key.name: "AbsoluteValuable"
 
-// RUN: %complete-test -tok=STMT_0 %s | FileCheck %s -check-prefix=STMT
+// RUN: %complete-test -tok=STMT_0 %s | %FileCheck %s -check-prefix=STMT
 func test1() {
   #^STMT_0^#
 }
@@ -57,7 +57,7 @@
 // STMT: func
 // STMT: foo(a: Int)
 
-// RUN: %complete-test -tok=STMT_1 %s | FileCheck %s -check-prefix=STMT_1
+// RUN: %complete-test -tok=STMT_1 %s | %FileCheck %s -check-prefix=STMT_1
 func test5() {
   var retLocal: Int
   #^STMT_1,r,ret,retur,return^#
@@ -80,7 +80,7 @@
 // STMT_1-NEXT:    return
 // STMT_1: ]
 
-// RUN: %complete-test -top=0 -tok=EXPR_0 %s | FileCheck %s -check-prefix=EXPR
+// RUN: %complete-test -top=0 -tok=EXPR_0 %s | %FileCheck %s -check-prefix=EXPR
 func test2() {
   (#^EXPR_0^#)
 }
@@ -97,7 +97,7 @@
 // EXPR: foo(a: Int)
 
 // Top 1
-// RUN: %complete-test -top=1 -tok=EXPR_1 %s | FileCheck %s -check-prefix=EXPR_TOP_1
+// RUN: %complete-test -top=1 -tok=EXPR_1 %s | %FileCheck %s -check-prefix=EXPR_TOP_1
 func test3(x: Int) {
   let y = x
   let z = x
@@ -120,7 +120,7 @@
 // EXPR_TOP_1: zzz
 
 // Test where there are fewer results than 'top'.
-// RUN: %complete-test -top=1000 -tok=FEW_1 %s | FileCheck %s -check-prefix=FEW_1
+// RUN: %complete-test -top=1000 -tok=FEW_1 %s | %FileCheck %s -check-prefix=FEW_1
 func test3b() -> Int {
   return #^FEW_1^#
 }
@@ -129,7 +129,7 @@
 // FEW_1: 0
 
 // Top 3
-// RUN: %complete-test -top=3 -tok=EXPR_2 %s | FileCheck %s -check-prefix=EXPR_TOP_3
+// RUN: %complete-test -top=3 -tok=EXPR_2 %s | %FileCheck %s -check-prefix=EXPR_TOP_3
 func test4(x: Int) {
   let y = x
   let z = x
@@ -152,7 +152,7 @@
 // EXPR_TOP_3: zzz
 
 // Top 3 with type matching
-// RUN: %complete-test -top=3 -tok=EXPR_3 %s | FileCheck %s -check-prefix=EXPR_TOP_3_TYPE_MATCH
+// RUN: %complete-test -top=3 -tok=EXPR_3 %s | %FileCheck %s -check-prefix=EXPR_TOP_3_TYPE_MATCH
 func test4(x: Int) {
   let y: String = ""
   let z: String = y
@@ -165,8 +165,8 @@
 // EXPR_TOP_3_TYPE_MATCH: y
 // EXPR_TOP_3_TYPE_MATCH: z
 
-// RUN: %complete-test -tok=VOID_1 %s | FileCheck %s -check-prefix=VOID_1
-// RUN: %complete-test -tok=VOID_1 %s -raw | FileCheck %s -check-prefix=VOID_1_RAW
+// RUN: %complete-test -tok=VOID_1 %s | %FileCheck %s -check-prefix=VOID_1
+// RUN: %complete-test -tok=VOID_1 %s -raw | %FileCheck %s -check-prefix=VOID_1_RAW
 func test6() {
   func foo1() {}
   func foo2() -> Int {}
@@ -197,7 +197,7 @@
 
 
 
-// RUN: %complete-test -tok=CASE_0 %s | FileCheck %s -check-prefix=CASE_0
+// RUN: %complete-test -tok=CASE_0 %s | %FileCheck %s -check-prefix=CASE_0
 func test7() {
   struct CaseSensitiveCheck {
     var member: Int = 0
diff --git a/test/SourceKit/CodeComplete/complete_stems.swift b/test/SourceKit/CodeComplete/complete_stems.swift
index 06e12a8..fc5fbb3 100644
--- a/test/SourceKit/CodeComplete/complete_stems.swift
+++ b/test/SourceKit/CodeComplete/complete_stems.swift
@@ -20,7 +20,7 @@
 func test001() {
   #^GLOBAL_FUNC_0,a,aaaC,abc,def,hij^#
 }
-// RUN: %complete-test %s -no-fuzz -group=stems -tok=GLOBAL_FUNC_0 | FileCheck %s -check-prefix=GLOBAL_FUNC_0
+// RUN: %complete-test %s -no-fuzz -group=stems -tok=GLOBAL_FUNC_0 | %FileCheck %s -check-prefix=GLOBAL_FUNC_0
 // GLOBAL_FUNC_0-LABEL: Results for filterText: a [
 // GLOBAL_FUNC_0-NEXT: aaa:
 // GLOBAL_FUNC_0-NEXT:     aaaBbb()
@@ -91,7 +91,7 @@
 func test002(x: S) {
   x.#^S_QUALIFIED_0^#
 }
-// RUN: %complete-test %s -no-fuzz -group=stems -tok=S_QUALIFIED_0 | FileCheck %s -check-prefix=S_QUALIFIED_0
+// RUN: %complete-test %s -no-fuzz -group=stems -tok=S_QUALIFIED_0 | %FileCheck %s -check-prefix=S_QUALIFIED_0
 // S_QUALIFIED_0:      aaa:
 // S_QUALIFIED_0-NEXT:     aaaBbb()
 // S_QUALIFIED_0-NEXT:     aaaCcc:
@@ -127,7 +127,7 @@
   subscript(x_y x: Int) -> Int {}
   subscript(x_y_z x: Int) -> Int {}
 }
-// RUN: %complete-test %s -no-fuzz -add-inner-results -no-inner-operators -group=stems -tok=T_POSTFIX_0 | FileCheck %s -check-prefix=T_POSTFIX_0
+// RUN: %complete-test %s -no-fuzz -add-inner-results -no-inner-operators -group=stems -tok=T_POSTFIX_0 | %FileCheck %s -check-prefix=T_POSTFIX_0
 func test003() {
   T#^T_POSTFIX_0^#
 }
@@ -140,7 +140,7 @@
 // T_POSTFIX_0-NEXT:           (abcDefGhi: Int)
 // T_POSTFIX_0-NEXT: foo(self: T)
 
-// RUN: %complete-test %s -no-fuzz -add-inner-results -no-inner-operators -group=stems -tok=T_POSTFIX_1 | FileCheck %s -check-prefix=T_POSTFIX_1
+// RUN: %complete-test %s -no-fuzz -add-inner-results -no-inner-operators -group=stems -tok=T_POSTFIX_1 | %FileCheck %s -check-prefix=T_POSTFIX_1
 func test004(x: T) {
   x#^T_POSTFIX_1^#
 }
@@ -159,7 +159,7 @@
 struct MyAnyGenerationalGarbageCollector {}
 
 // There is only one Any group rdar://problem/21550130
-// RUN: %complete-test %s -no-fuzz -group=stems -tok=GLOBAL_FUNC_1 | FileCheck %s -check-prefix=GLOBAL_FUNC_1
+// RUN: %complete-test %s -no-fuzz -group=stems -tok=GLOBAL_FUNC_1 | %FileCheck %s -check-prefix=GLOBAL_FUNC_1
 func test005() {
   #^GLOBAL_FUNC_1,my^#
 }
diff --git a/test/SourceKit/CodeComplete/complete_structure.swift b/test/SourceKit/CodeComplete/complete_structure.swift
index d29a439..e3aa463 100644
--- a/test/SourceKit/CodeComplete/complete_structure.swift
+++ b/test/SourceKit/CodeComplete/complete_structure.swift
@@ -1,14 +1,14 @@
 // XFAIL: broken_std_regex
-// RUN: %complete-test %s -group=none -fuzz -structure -tok=S1_DOT | FileCheck %s -check-prefix=S1_DOT
-// RUN: %complete-test %s -group=none -add-inner-results -fuzz -structure -tok=S1_POSTFIX | FileCheck %s -check-prefix=S1_POSTFIX
-// RUN: %complete-test %s -group=none -add-inner-results -fuzz -structure -tok=S1_POSTFIX_INIT | FileCheck %s -check-prefix=S1_INIT
-// RUN: %complete-test %s -group=none -fuzz -structure -tok=S1_PAREN_INIT | FileCheck %s -check-prefix=S1_INIT
-// RUN: %complete-test %s -group=none -hide-none -fuzz -structure -tok=STMT_0 | FileCheck %s -check-prefix=STMT_0
-// RUN: %complete-test %s -group=none -fuzz -structure -tok=ENUM_0 | FileCheck %s -check-prefix=ENUM_0
-// RUN: %complete-test %s -group=none -fuzz -structure -tok=OVERRIDE_0 | FileCheck %s -check-prefix=OVERRIDE_0
-// RUN: %complete-test %s -group=none -fuzz -structure -tok=S1_INNER_0 | FileCheck %s -check-prefix=S1_INNER_0
-// RUN: %complete-test %s -group=none -fuzz -structure -tok=INT_INNER_0 | FileCheck %s -check-prefix=INT_INNER_0
-// RUN: %complete-test %s -group=none -fuzz -structure -tok=ASSOCIATED_TYPE_1 | FileCheck %s -check-prefix=ASSOCIATED_TYPE_1
+// RUN: %complete-test %s -group=none -fuzz -structure -tok=S1_DOT | %FileCheck %s -check-prefix=S1_DOT
+// RUN: %complete-test %s -group=none -add-inner-results -fuzz -structure -tok=S1_POSTFIX | %FileCheck %s -check-prefix=S1_POSTFIX
+// RUN: %complete-test %s -group=none -add-inner-results -fuzz -structure -tok=S1_POSTFIX_INIT | %FileCheck %s -check-prefix=S1_INIT
+// RUN: %complete-test %s -group=none -fuzz -structure -tok=S1_PAREN_INIT | %FileCheck %s -check-prefix=S1_INIT
+// RUN: %complete-test %s -group=none -hide-none -fuzz -structure -tok=STMT_0 | %FileCheck %s -check-prefix=STMT_0
+// RUN: %complete-test %s -group=none -fuzz -structure -tok=ENUM_0 | %FileCheck %s -check-prefix=ENUM_0
+// RUN: %complete-test %s -group=none -fuzz -structure -tok=OVERRIDE_0 | %FileCheck %s -check-prefix=OVERRIDE_0
+// RUN: %complete-test %s -group=none -fuzz -structure -tok=S1_INNER_0 | %FileCheck %s -check-prefix=S1_INNER_0
+// RUN: %complete-test %s -group=none -fuzz -structure -tok=INT_INNER_0 | %FileCheck %s -check-prefix=INT_INNER_0
+// RUN: %complete-test %s -group=none -fuzz -structure -tok=ASSOCIATED_TYPE_1 | %FileCheck %s -check-prefix=ASSOCIATED_TYPE_1
 
 struct S1 {
   func method1() {}
diff --git a/test/SourceKit/CodeComplete/complete_test.swift b/test/SourceKit/CodeComplete/complete_test.swift
index 51a43fa..d28999a 100644
--- a/test/SourceKit/CodeComplete/complete_test.swift
+++ b/test/SourceKit/CodeComplete/complete_test.swift
@@ -1,15 +1,15 @@
-// RUN: not %complete-test 2>&1 | FileCheck -check-prefix=MISSING-ALL %s
+// RUN: not %complete-test 2>&1 | %FileCheck -check-prefix=MISSING-ALL %s
 // MISSING-ALL: usage: complete-test -tok=A file
 // MISSING-ALL: missing <source-file>
 
-// RUN: not %complete-test %s 2>&1 | FileCheck -check-prefix=MISSING-TOK %s
+// RUN: not %complete-test %s 2>&1 | %FileCheck -check-prefix=MISSING-TOK %s
 // MISSING-TOK: missing -tok=
 
-// RUN: not %complete-test -tok=NOPE %s 2>&1 | FileCheck -check-prefix=MISSING-TOK-IN %s
+// RUN: not %complete-test -tok=NOPE %s 2>&1 | %FileCheck -check-prefix=MISSING-TOK-IN %s
 // MISSING-TOK-IN: cannot find code completion token in source file
 
-// RUN: %complete-test -tok=INT_DOT %s | FileCheck -check-prefix=INT_DOT %s -strict-whitespace
-// RUN: %complete-test -tok=ALL %s | FileCheck -check-prefix=ALL %s
+// RUN: %complete-test -tok=INT_DOT %s | %FileCheck -check-prefix=INT_DOT %s -strict-whitespace
+// RUN: %complete-test -tok=ALL %s | %FileCheck -check-prefix=ALL %s
 // RUN: %complete-test -tok=DIFF -raw %s > %t.complete-test
 // RUN: %sourcekitd-test -req=complete.open -pos=49:5  %s -- %s > %t.sourcekitd-test
 // RUN: diff %t.complete-test %t.sourcekitd-test
diff --git a/test/SourceKit/CodeComplete/complete_type_match.swift b/test/SourceKit/CodeComplete/complete_type_match.swift
index 8c3a3a5..09d3ff9 100644
--- a/test/SourceKit/CodeComplete/complete_type_match.swift
+++ b/test/SourceKit/CodeComplete/complete_type_match.swift
@@ -1,10 +1,10 @@
 // XFAIL: broken_std_regex
-// RUN: %complete-test -top=0 -tok=TOP_LEVEL_0 %s | FileCheck %s -check-prefix=TOP_LEVEL_0
-// RUN: %complete-test -top=0 -tok=TOP_LEVEL_1 %s | FileCheck %s -check-prefix=TOP_LEVEL_1
-// RUN: %complete-test -top=0 -tok=TOP_LEVEL_2 %s | FileCheck %s -check-prefix=TOP_LEVEL_2
-// RUN: %complete-test -top=0 -tok=TOP_LEVEL_3 %s | FileCheck %s -check-prefix=TOP_LEVEL_3
-// RUN: %complete-test -top=0 -group=none -tok=CROSS_CONTEXT_0 %s | FileCheck %s -check-prefix=CROSS_CONTEXT_0
-// RUN: %complete-test -top=0 -group=none -tok=FROM_METHOD_0 %s | FileCheck %s -check-prefix=FROM_METHOD_0
+// RUN: %complete-test -top=0 -tok=TOP_LEVEL_0 %s | %FileCheck %s -check-prefix=TOP_LEVEL_0
+// RUN: %complete-test -top=0 -tok=TOP_LEVEL_1 %s | %FileCheck %s -check-prefix=TOP_LEVEL_1
+// RUN: %complete-test -top=0 -tok=TOP_LEVEL_2 %s | %FileCheck %s -check-prefix=TOP_LEVEL_2
+// RUN: %complete-test -top=0 -tok=TOP_LEVEL_3 %s | %FileCheck %s -check-prefix=TOP_LEVEL_3
+// RUN: %complete-test -top=0 -group=none -tok=CROSS_CONTEXT_0 %s | %FileCheck %s -check-prefix=CROSS_CONTEXT_0
+// RUN: %complete-test -top=0 -group=none -tok=FROM_METHOD_0 %s | %FileCheck %s -check-prefix=FROM_METHOD_0
 
 let valueA = [0]
 let valueS = ""
diff --git a/test/SourceKit/CodeComplete/complete_typealias_different_file.swift b/test/SourceKit/CodeComplete/complete_typealias_different_file.swift
index ec235e9..7216962 100644
--- a/test/SourceKit/CodeComplete/complete_typealias_different_file.swift
+++ b/test/SourceKit/CodeComplete/complete_typealias_different_file.swift
@@ -5,5 +5,5 @@
 }
 
 
-// RUN: %sourcekitd-test -req=complete -pos=6:1 %s -- %s %S/Inputs/complete_typealias_different_file_2.swift | FileCheck %s
+// RUN: %sourcekitd-test -req=complete -pos=6:1 %s -- %s %S/Inputs/complete_typealias_different_file_2.swift | %FileCheck %s
 // CHECK: "Foo"
diff --git a/test/SourceKit/CodeComplete/complete_underscores.swift b/test/SourceKit/CodeComplete/complete_underscores.swift
index 899e170..0db0975 100644
--- a/test/SourceKit/CodeComplete/complete_underscores.swift
+++ b/test/SourceKit/CodeComplete/complete_underscores.swift
@@ -33,7 +33,7 @@
   #^TOP_LEVEL_0,,_^#
 }
 // REQUIRES: objc_interop
-// RUN: %complete-test %s -hide-none -tok=TOP_LEVEL_0  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=TOP_LEVEL_0
+// RUN: %complete-test %s -hide-none -tok=TOP_LEVEL_0  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=TOP_LEVEL_0
 // TOP_LEVEL_0-LABEL: Results for filterText: [
 // TOP_LEVEL_0-DAG: Foo
 // TOP_LEVEL_0-DAG: FooStruct
@@ -48,7 +48,7 @@
 // TOP_LEVEL_0-DAG: _internalTopLevelFunc()
 // TOP_LEVEL_0-DAG: _InternalStruct
 // TOP_LEVEL_0: ]
-// RUN: %complete-test %s -hide-none -tok=TOP_LEVEL_0  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=NEGATIVE_TOP_LEVEL_0
+// RUN: %complete-test %s -hide-none -tok=TOP_LEVEL_0  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=NEGATIVE_TOP_LEVEL_0
 // NEGATIVE_TOP_LEVEL_0-LABEL: Results for filterText: [
 // NEGATIVE_TOP_LEVEL_0-NOT: _internalTopLevelFunc()
 // NEGATIVE_TOP_LEVEL_0-NOT: _InternalStruct
@@ -57,7 +57,7 @@
 func test002(x: Foo) {
   x.#^FOO_QUALIFIED_0,,^#
 }
-// RUN: %complete-test %s -tok=FOO_QUALIFIED_0  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=FOO_QUALIFIED_0
+// RUN: %complete-test %s -tok=FOO_QUALIFIED_0  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=FOO_QUALIFIED_0
 // FOO_QUALIFIED_0: Results for filterText: [
 // FOO_QUALIFIED_0-DAG:   foo()
 // FOO_QUALIFIED_0-DAG:   extFoo()
@@ -68,7 +68,7 @@
 func test003(x: _Bar) {
   x.#^BAR_QUALIFIED_0,,_^#
 }
-// RUN: %complete-test %s -tok=BAR_QUALIFIED_0  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=BAR_QUALIFIED_0
+// RUN: %complete-test %s -tok=BAR_QUALIFIED_0  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=BAR_QUALIFIED_0
 // BAR_QUALIFIED_0: Results for filterText: [
 // BAR_QUALIFIED_0-DAG:   bar()
 // BAR_QUALIFIED_0-DAG:   _bar()
@@ -80,7 +80,7 @@
 // BAR_QUALIFIED_0-DAG:   _foo()
 // BAR_QUALIFIED_0-DAG:   _extFoo()
 // BAR_QUALIFIED_0: ]
-// RUN: %complete-test %s -tok=BAR_QUALIFIED_0  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=NEGATIVE_BAR_QUALIFIED_0
+// RUN: %complete-test %s -tok=BAR_QUALIFIED_0  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=NEGATIVE_BAR_QUALIFIED_0
 // NEGATIVE_BAR_QUALIFIED_0: Results for filterText: [
 // NEGATIVE_BAR_QUALIFIED_0-NOT:   _foo()
 // NEGATIVE_BAR_QUALIFIED_0-NOT:   _extFoo()
@@ -89,7 +89,7 @@
 func test004(x: Baz) {
   x.#^BAZ_QUALIFIED_0,,^#
 }
-// RUN: %complete-test %s -tok=BAZ_QUALIFIED_0  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=BAZ_QUALIFIED_0
+// RUN: %complete-test %s -tok=BAZ_QUALIFIED_0  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=BAZ_QUALIFIED_0
 // BAZ_QUALIFIED_0: Results for filterText: [
 // BAZ_QUALIFIED_0-DAG:   baz()
 // BAZ_QUALIFIED_0-DAG:   _baz()
@@ -98,11 +98,11 @@
 func test005(x: SBaz) {
   x.#^BAZ_QUALIFIED_1,,^#
 }
-// RUN: %complete-test %s -tok=BAZ_QUALIFIED_1  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=BAZ_QUALIFIED_1
+// RUN: %complete-test %s -tok=BAZ_QUALIFIED_1  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=BAZ_QUALIFIED_1
 // BAZ_QUALIFIED_1: Results for filterText: [
 // BAZ_QUALIFIED_1-DAG:   baz()
 // BAZ_QUALIFIED_1: ]
-// RUN: %complete-test %s -tok=BAZ_QUALIFIED_1  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=NEGATIVE_BAZ_QUALIFIED_1
+// RUN: %complete-test %s -tok=BAZ_QUALIFIED_1  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=NEGATIVE_BAZ_QUALIFIED_1
 // NEGATIVE_BAZ_QUALIFIED_1: Results for filterText: [
 // NEGATIVE_BAZ_QUALIFIED_1-NOT:   _baz()
 // NEGATIVE_BAZ_QUALIFIED_1: ]
@@ -110,7 +110,7 @@
 func test006() {
   Norf.#^NORF_QUALIFIED_0,,^#
 }
-// RUN: %complete-test %s -tok=NORF_QUALIFIED_0 -hide-low-priority=0 -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=NORF_QUALIFIED_0
+// RUN: %complete-test %s -tok=NORF_QUALIFIED_0 -hide-low-priority=0 -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=NORF_QUALIFIED_0
 // NORF_QUALIFIED_0: Results for filterText: [
 // NORF_QUALIFIED_0-DAG:  _A
 // NORF_QUALIFIED_0-DAG:  B
@@ -120,13 +120,13 @@
 func test007() {
   #^NO_UNDERSCORES^#
 }
-// RUN: %complete-test %s -tok=NO_UNDERSCORES -hide-low-priority=0 -hide-underscores=2  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=NO_UNDERSCORES
+// RUN: %complete-test %s -tok=NO_UNDERSCORES -hide-low-priority=0 -hide-underscores=2  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=NO_UNDERSCORES
 // NO_UNDERSCORES-NOT: {{^\s*}}_
 
 func test010() {
   #^ALL_UNDERSCORES^#
 }
-// RUN: %complete-test %s -tok=ALL_UNDERSCORES -hide-low-priority=0 -hide-underscores=0  -- -F %S/../Inputs/libIDE-mock-sdk | FileCheck %s -check-prefix=ALL_UNDERSCORES
+// RUN: %complete-test %s -tok=ALL_UNDERSCORES -hide-low-priority=0 -hide-underscores=0  -- -F %S/../Inputs/libIDE-mock-sdk | %FileCheck %s -check-prefix=ALL_UNDERSCORES
 // ALL_UNDERSCORES: _Bar
 // ALL_UNDERSCORES: _quux
 // ALL_UNDERSCORES: _InternalStruct
diff --git a/test/SourceKit/CodeComplete/complete_update.swift b/test/SourceKit/CodeComplete/complete_update.swift
index 01e8184..ebcfd5f 100644
--- a/test/SourceKit/CodeComplete/complete_update.swift
+++ b/test/SourceKit/CodeComplete/complete_update.swift
@@ -13,7 +13,7 @@
 // RUN: %sourcekitd-test -req=complete.open -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.update -pos=8:5 %s -- %s \
 // RUN:   == -req=complete.update -pos=8:5 %s -- %s > %t.update
-// RUN: FileCheck %s < %t.update
+// RUN: %FileCheck %s < %t.update
 // CHECK:   key.name: "advancedFeatures
 // CHECK: key.kind: source.lang.swift.codecomplete.group
 // CHECK:   key.name: "advancedFeatures
@@ -38,7 +38,7 @@
 // RUN: %sourcekitd-test -req=complete.open -pos=34:5 -req-opts=group.stems=0,group.overloads=0 %s -- %s \
 // RUN:   == -req=complete.update -pos=34:5 -req-opts=group.stems=1 %s -- %s \
 // RUN:   == -req=complete.update -pos=34:5 -req-opts=group.stems=0,group.overloads=0 %s -- %s > %t.update.groupings
-// RUN: FileCheck %s -check-prefix=ONE_GROUP < %t.update.groupings
+// RUN: %FileCheck %s -check-prefix=ONE_GROUP < %t.update.groupings
 // ONE_GROUP-NOT: key.name: "aaa"
 // ONE_GROUP: key.kind: source.lang.swift.codecomplete.group,
 // ONE_GROUP-NEXT: key.name: ""
diff --git a/test/SourceKit/CodeComplete/complete_with_closure_param.swift b/test/SourceKit/CodeComplete/complete_with_closure_param.swift
index 4e7c151..906e12c 100644
--- a/test/SourceKit/CodeComplete/complete_with_closure_param.swift
+++ b/test/SourceKit/CodeComplete/complete_with_closure_param.swift
@@ -1,4 +1,4 @@
-typealias MyFnTy = Int ->Int
+typealias MyFnTy = Int -> Int
 class C {
   func foo(_ x: Int ->Int) {}
   func foo2(_ x: MyFnTy) {}
@@ -6,7 +6,7 @@
 
 C().
 
-// RUN: %sourcekitd-test -req=complete -pos=7:5 %s -- %s | FileCheck %s
+// RUN: %sourcekitd-test -req=complete -pos=7:5 %s -- %s | %FileCheck %s
 
 // CHECK:      key.kind: source.lang.swift.decl.function.method.instance,
 // CHECK-NEXT: key.name: "foo(:)",
@@ -16,5 +16,5 @@
 
 // CHECK:      key.kind: source.lang.swift.decl.function.method.instance,
 // CHECK-NEXT: key.name: "foo2(:)",
-// CHECK-NEXT: key.sourcetext: "foo2(<#T##x: MyFnTy##MyFnTy##(Int) -> Int#>)",
-// CHECK-NEXT: key.description: "foo2(x: MyFnTy)",
+// CHECK-NEXT: key.sourcetext: "foo2(<#T##x: (Int) -> Int##(Int) -> Int#>)",
+// CHECK-NEXT: key.description: "foo2(x: (Int) -> Int)",
diff --git a/test/SourceKit/CodeExpand/code-expand.swift b/test/SourceKit/CodeExpand/code-expand.swift
index d0ee809..a3f229c 100644
--- a/test/SourceKit/CodeExpand/code-expand.swift
+++ b/test/SourceKit/CodeExpand/code-expand.swift
@@ -1,4 +1,4 @@
-// RUN: %sourcekitd-test -req=expand-placeholder %s | FileCheck %s
+// RUN: %sourcekitd-test -req=expand-placeholder %s | %FileCheck %s
 
 foo(x: <#T##() -> Void#>)
 // CHECK:      foo {
diff --git a/test/SourceKit/CodeFormat/indent-basic.swift b/test/SourceKit/CodeFormat/indent-basic.swift
index b926ded..85cfe28 100644
--- a/test/SourceKit/CodeFormat/indent-basic.swift
+++ b/test/SourceKit/CodeFormat/indent-basic.swift
@@ -28,7 +28,7 @@
 // RUN: %sourcekitd-test -req=format -line=9 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=13 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=17 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "class Foo {"
 // CHECK: key.sourcetext: "    "
diff --git a/test/SourceKit/CodeFormat/indent-bracestmt.swift b/test/SourceKit/CodeFormat/indent-bracestmt.swift
index 63da271..74c8d85 100644
--- a/test/SourceKit/CodeFormat/indent-bracestmt.swift
+++ b/test/SourceKit/CodeFormat/indent-bracestmt.swift
@@ -28,7 +28,7 @@
 // RUN: %sourcekitd-test -req=format -line=9 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=16 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=22 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "    if xyz == 2 {"
 // CHECK: key.sourcetext: "        xyz = 1"
diff --git a/test/SourceKit/CodeFormat/indent-bracestmt2.swift b/test/SourceKit/CodeFormat/indent-bracestmt2.swift
index b204886..98296ac 100644
--- a/test/SourceKit/CodeFormat/indent-bracestmt2.swift
+++ b/test/SourceKit/CodeFormat/indent-bracestmt2.swift
@@ -17,7 +17,7 @@
 // RUN: %sourcekitd-test -req=format -line=7 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=8 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=9 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "class Foo"
 // CHECK: key.sourcetext: "{"
diff --git a/test/SourceKit/CodeFormat/indent-bracestmt3-if-else.swift b/test/SourceKit/CodeFormat/indent-bracestmt3-if-else.swift
index 040a183..6b26f8c 100644
--- a/test/SourceKit/CodeFormat/indent-bracestmt3-if-else.swift
+++ b/test/SourceKit/CodeFormat/indent-bracestmt3-if-else.swift
@@ -27,7 +27,7 @@
 // RUN: %sourcekitd-test -req=format -line=14 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=15 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=16 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "    if abc == 1 {"
 // CHECK: key.sourcetext: "        abc = 2"
diff --git a/test/SourceKit/CodeFormat/indent-closure.swift b/test/SourceKit/CodeFormat/indent-closure.swift
index 87710b8..e3b9117 100644
--- a/test/SourceKit/CodeFormat/indent-closure.swift
+++ b/test/SourceKit/CodeFormat/indent-closure.swift
@@ -46,7 +46,7 @@
 // RUN: %sourcekitd-test -req=format -line=30 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=31 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=32 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "        var abc = 1"
 // CHECK: key.sourcetext: "        let a: String = {"
diff --git a/test/SourceKit/CodeFormat/indent-comment.swift b/test/SourceKit/CodeFormat/indent-comment.swift
index 5f2c67f..e272edb 100644
--- a/test/SourceKit/CodeFormat/indent-comment.swift
+++ b/test/SourceKit/CodeFormat/indent-comment.swift
@@ -21,7 +21,7 @@
 // RUN: %sourcekitd-test -req=format -line=12 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=38 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=39 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "/**"
 // CHECK: key.sourcetext: " * Foo Comment"
diff --git a/test/SourceKit/CodeFormat/indent-computed-property.swift b/test/SourceKit/CodeFormat/indent-computed-property.swift
index 4614d6a..27e3332 100644
--- a/test/SourceKit/CodeFormat/indent-computed-property.swift
+++ b/test/SourceKit/CodeFormat/indent-computed-property.swift
@@ -47,7 +47,7 @@
 // RUN: %sourcekitd-test -req=format -line=16 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=21 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=30 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "class Foo {"
 // CHECK: key.sourcetext: "    var test: Int {"
diff --git a/test/SourceKit/CodeFormat/indent-do-catch.swift b/test/SourceKit/CodeFormat/indent-do-catch.swift
index 679d577..5fca56c 100644
--- a/test/SourceKit/CodeFormat/indent-do-catch.swift
+++ b/test/SourceKit/CodeFormat/indent-do-catch.swift
@@ -31,7 +31,7 @@
 // RUN: %sourcekitd-test -req=format -line=14 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=15 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=16 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "    do {"
 // CHECK: key.sourcetext: "        foo()"
diff --git a/test/SourceKit/CodeFormat/indent-extension.swift b/test/SourceKit/CodeFormat/indent-extension.swift
index d7bd774..75ac3cf 100644
--- a/test/SourceKit/CodeFormat/indent-extension.swift
+++ b/test/SourceKit/CodeFormat/indent-extension.swift
@@ -19,7 +19,7 @@
 // RUN: %sourcekitd-test -req=format -line=9 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=10 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=11 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "extension Foo {"
 // CHECK: key.sourcetext: "    "
diff --git a/test/SourceKit/CodeFormat/indent-ibaction.swift b/test/SourceKit/CodeFormat/indent-ibaction.swift
index c39fbc9..4c13bea 100644
--- a/test/SourceKit/CodeFormat/indent-ibaction.swift
+++ b/test/SourceKit/CodeFormat/indent-ibaction.swift
@@ -3,6 +3,6 @@
 }
 
 // RUN: %sourcekitd-test -req=format -line=2 -length=1 %s >%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "    var xyz : Int"
diff --git a/test/SourceKit/CodeFormat/indent-implicit-getter.swift b/test/SourceKit/CodeFormat/indent-implicit-getter.swift
index 01389f2..548febf 100644
--- a/test/SourceKit/CodeFormat/indent-implicit-getter.swift
+++ b/test/SourceKit/CodeFormat/indent-implicit-getter.swift
@@ -47,7 +47,7 @@
 // RUN: %sourcekitd-test -req=format -line=20 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=23 -length=1 %s >>%t.response
 
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "class Foo {"
 // CHECK: key.sourcetext: "    var test: Int {"
diff --git a/test/SourceKit/CodeFormat/indent-lazy-property.swift b/test/SourceKit/CodeFormat/indent-lazy-property.swift
index 1ee43da..8a4e306 100644
--- a/test/SourceKit/CodeFormat/indent-lazy-property.swift
+++ b/test/SourceKit/CodeFormat/indent-lazy-property.swift
@@ -16,7 +16,7 @@
 // RUN: %sourcekitd-test -req=format -line=4 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=5 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=8 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "class Foo {"
 // CHECK: key.sourcetext: "    lazy var test: () -> Int = {"
diff --git a/test/SourceKit/CodeFormat/indent-parenexpr.swift b/test/SourceKit/CodeFormat/indent-parenexpr.swift
index be5f515..8a5dce3 100644
--- a/test/SourceKit/CodeFormat/indent-parenexpr.swift
+++ b/test/SourceKit/CodeFormat/indent-parenexpr.swift
@@ -43,7 +43,7 @@
 // RUN: %sourcekitd-test -req=format -line=20 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=21 -length=1 %s >>%t.response
 
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "    bar("
 // CHECK: key.sourcetext: "        "
diff --git a/test/SourceKit/CodeFormat/indent-pound-if.swift b/test/SourceKit/CodeFormat/indent-pound-if.swift
index 79f2166..8416f7b 100644
--- a/test/SourceKit/CodeFormat/indent-pound-if.swift
+++ b/test/SourceKit/CodeFormat/indent-pound-if.swift
@@ -32,7 +32,7 @@
 // RUN: %sourcekitd-test -req=format -line=16 -length=1 %s -- -target x86_64-apple-macosx10.9 >> %t.response
 // RUN: %sourcekitd-test -req=format -line=20 -length=1 %s -- -target x86_64-apple-macosx10.9 >> %t.response
 // RUN: %sourcekitd-test -req=format -line=22 -length=1 %s -- -target x86_64-apple-macosx10.9 >> %t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "#else"
 // CHECK: key.sourcetext: "        let i = 3"
diff --git a/test/SourceKit/CodeFormat/indent-repeat.swift b/test/SourceKit/CodeFormat/indent-repeat.swift
index 6c79baf..58ca61d 100644
--- a/test/SourceKit/CodeFormat/indent-repeat.swift
+++ b/test/SourceKit/CodeFormat/indent-repeat.swift
@@ -8,7 +8,7 @@
 // RUN: %sourcekitd-test -req=format -line=2 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=3 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=4 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "class Foo {"
 // CHECK: key.sourcetext: "    func Bar() {"
diff --git a/test/SourceKit/CodeFormat/indent-sibling.swift b/test/SourceKit/CodeFormat/indent-sibling.swift
index f56a0ac..1226bcb 100644
--- a/test/SourceKit/CodeFormat/indent-sibling.swift
+++ b/test/SourceKit/CodeFormat/indent-sibling.swift
@@ -99,7 +99,7 @@
 // RUN: %sourcekitd-test -req=format -line=65 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=67 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=69 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 //                        "  func foo(Value1 : Int,"
 // CHECK: key.sourcetext: "           Value2 : Int) {"
diff --git a/test/SourceKit/CodeFormat/indent-sibling2.swift b/test/SourceKit/CodeFormat/indent-sibling2.swift
index 0a9ec49..6dbc7e5 100644
--- a/test/SourceKit/CodeFormat/indent-sibling2.swift
+++ b/test/SourceKit/CodeFormat/indent-sibling2.swift
@@ -57,7 +57,7 @@
 // RUN: %sourcekitd-test -req=format -line=41 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=42 -length=1 %s >>%t.response
 
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 //                        "foo(0,"
 // CHECK: key.sourcetext: "    bar: 1,"
diff --git a/test/SourceKit/CodeFormat/indent-switch.swift b/test/SourceKit/CodeFormat/indent-switch.swift
index 7204197..3eedfdf 100644
--- a/test/SourceKit/CodeFormat/indent-switch.swift
+++ b/test/SourceKit/CodeFormat/indent-switch.swift
@@ -76,7 +76,7 @@
 // RUN: %sourcekitd-test -req=format -line=41 -length=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=42 -length=1 %s >>%t.response
 
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "    switch (test) {"
 // CHECK: key.sourcetext: "    case 0:"
diff --git a/test/SourceKit/CodeFormat/indent-toplevel.swift b/test/SourceKit/CodeFormat/indent-toplevel.swift
index b9209b2..0fbbcb8 100644
--- a/test/SourceKit/CodeFormat/indent-toplevel.swift
+++ b/test/SourceKit/CodeFormat/indent-toplevel.swift
@@ -3,7 +3,7 @@
 
 // RUN: %sourcekitd-test -req=format -line=1 -length=1 %s >%t.response
 // RUN: %sourcekitd-test -req=format -line=2 -length=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "for i in 0...5 {"
 // CHECK: key.sourcetext: "}"
diff --git a/test/SourceKit/CodeFormat/indent-width2.swift b/test/SourceKit/CodeFormat/indent-width2.swift
index 9e5dfd1..2747425 100644
--- a/test/SourceKit/CodeFormat/indent-width2.swift
+++ b/test/SourceKit/CodeFormat/indent-width2.swift
@@ -17,7 +17,7 @@
 // RUN: %sourcekitd-test -req=format -line=7 -length=1 -req-opts=indentwidth=2 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=8 -length=1 -req-opts=indentwidth=2 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=9 -length=1 -req-opts=indentwidth=2 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "class Foo {"
 // CHECK: key.sourcetext: "  "
diff --git a/test/SourceKit/CodeFormat/indent-with-cr.swift b/test/SourceKit/CodeFormat/indent-with-cr.swift
index e6daddb..b53609e 100644
--- a/test/SourceKit/CodeFormat/indent-with-cr.swift
+++ b/test/SourceKit/CodeFormat/indent-with-cr.swift
Binary files differ
diff --git a/test/SourceKit/CodeFormat/indent-with-tab.swift b/test/SourceKit/CodeFormat/indent-with-tab.swift
index 34c6206..02ac41a 100644
--- a/test/SourceKit/CodeFormat/indent-with-tab.swift
+++ b/test/SourceKit/CodeFormat/indent-with-tab.swift
@@ -17,7 +17,7 @@
 // RUN: %sourcekitd-test -req=format -line=7 -length=1 -req-opts=usetabs=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=8 -length=1 -req-opts=usetabs=1 %s >>%t.response
 // RUN: %sourcekitd-test -req=format -line=9 -length=1 -req-opts=usetabs=1 %s >>%t.response
-// RUN: FileCheck --strict-whitespace %s <%t.response
+// RUN: %FileCheck --strict-whitespace %s <%t.response
 
 // CHECK: key.sourcetext: "class Foo {"
 // CHECK: key.sourcetext: "\t"
diff --git a/test/SourceKit/CursorInfo/crash1.swift b/test/SourceKit/CursorInfo/crash1.swift
index 2a68975..bcf7d7f 100644
--- a/test/SourceKit/CursorInfo/crash1.swift
+++ b/test/SourceKit/CursorInfo/crash1.swift
@@ -6,8 +6,8 @@
 }
 
 // rdar://24133008
-// RUN: %sourcekitd-test -req=cursor -pos=4:16 %s -- %s | FileCheck %s -check-prefix=CASE1
-// RUN: %sourcekitd-test -req=cursor -pos=4:24 %s -- %s | FileCheck %s -check-prefix=CASE2
+// RUN: %sourcekitd-test -req=cursor -pos=4:16 %s -- %s | %FileCheck %s -check-prefix=CASE1
+// RUN: %sourcekitd-test -req=cursor -pos=4:24 %s -- %s | %FileCheck %s -check-prefix=CASE2
 
 // CASE1: source.lang.swift.ref.var.instance (2:9-2:13)
 // CASE2: source.lang.swift.ref.var.local (3:10-3:15)
diff --git a/test/SourceKit/CursorInfo/cursor_big_array.swift b/test/SourceKit/CursorInfo/cursor_big_array.swift
index b34f69e..f893e89 100644
--- a/test/SourceKit/CursorInfo/cursor_big_array.swift
+++ b/test/SourceKit/CursorInfo/cursor_big_array.swift
@@ -1,4 +1,4 @@
-// RUN: %sourcekitd-test -req=cursor -pos=1:10 %S/../Inputs/big_array.swift -- %S/../Inputs/big_array.swift | FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=1:10 %S/../Inputs/big_array.swift -- %S/../Inputs/big_array.swift | %FileCheck %s
 // CHECK: source.lang.swift.decl.var.global (1:5-1:20)
 // CHECK: gCubeVertexData
 // CHECK: s:v9big_array15gCubeVertexDataGSaSf_
diff --git a/test/SourceKit/CursorInfo/cursor_callargs.swift b/test/SourceKit/CursorInfo/cursor_callargs.swift
index dcec9a8..d0a91cb 100644
--- a/test/SourceKit/CursorInfo/cursor_callargs.swift
+++ b/test/SourceKit/CursorInfo/cursor_callargs.swift
@@ -6,18 +6,18 @@
 var c1 = C1(passInt: 0, andThis: 0)
 c1.meth(0, passFloat: 0)
 
-// RUN: %sourcekitd-test -req=cursor -pos=6:11 %s -- %s | FileCheck -check-prefix=CHECK-CLASS %s
+// RUN: %sourcekitd-test -req=cursor -pos=6:11 %s -- %s | %FileCheck -check-prefix=CHECK-CLASS %s
 // CHECK-CLASS: source.lang.swift.ref.class (2:7-2:9)
 
-// RUN: %sourcekitd-test -req=cursor -pos=6:17 %s -- %s | FileCheck -check-prefix=CHECK-INIT %s
-// RUN: %sourcekitd-test -req=cursor -pos=6:31 %s -- %s | FileCheck -check-prefix=CHECK-INIT %s
+// RUN: %sourcekitd-test -req=cursor -pos=6:17 %s -- %s | %FileCheck -check-prefix=CHECK-INIT %s
+// RUN: %sourcekitd-test -req=cursor -pos=6:31 %s -- %s | %FileCheck -check-prefix=CHECK-INIT %s
 // CHECK-INIT: source.lang.swift.ref.function.constructor (3:3-3:37)
 
-// RUN: %sourcekitd-test -req=cursor -pos=7:6 %s -- %s | FileCheck -check-prefix=CHECK-METH %s
-// RUN: %sourcekitd-test -req=cursor -pos=7:14 %s -- %s | FileCheck -check-prefix=CHECK-METH %s
+// RUN: %sourcekitd-test -req=cursor -pos=7:6 %s -- %s | %FileCheck -check-prefix=CHECK-METH %s
+// RUN: %sourcekitd-test -req=cursor -pos=7:14 %s -- %s | %FileCheck -check-prefix=CHECK-METH %s
 // CHECK-METH: source.lang.swift.ref.function.method.instance (4:8-4:40)
 
 // Make sure we don't highlight all "meth" occurrences when pointing at "withFloat:".
-// RUN: %sourcekitd-test -req=related-idents -pos=7:15 %s -- %s | FileCheck -check-prefix=CHECK-IDS %s
+// RUN: %sourcekitd-test -req=related-idents -pos=7:15 %s -- %s | %FileCheck -check-prefix=CHECK-IDS %s
 // CHECK-IDS:      START RANGES
 // CHECK-IDS-NEXT: END RANGES
diff --git a/test/SourceKit/CursorInfo/cursor_forbid_typecheck.swift b/test/SourceKit/CursorInfo/cursor_forbid_typecheck.swift
index 49ecbda..156514a 100644
--- a/test/SourceKit/CursorInfo/cursor_forbid_typecheck.swift
+++ b/test/SourceKit/CursorInfo/cursor_forbid_typecheck.swift
@@ -1,13 +1,13 @@
 // RUN: %sourcekitd-test -req=cursor -pos=1:10 %S/../Inputs/forbid_typecheck_primary.swift -- \
 // RUN:     -Xfrontend -debug-forbid-typecheck-prefix -Xfrontend NOTYPECHECK -module-name forbid \
-// RUN:     %S/../Inputs/forbid_typecheck_2.swift %S/../Inputs/forbid_typecheck_primary.swift | FileCheck -check-prefix=CHECK1 %s
+// RUN:     %S/../Inputs/forbid_typecheck_2.swift %S/../Inputs/forbid_typecheck_primary.swift | %FileCheck -check-prefix=CHECK1 %s
 
 // CHECK1: source.lang.swift.decl.var.global (1:5-1:15)
 // CHECK1: globalPrim
 
 // RUN: %sourcekitd-test -req=cursor -pos=5:20 %S/../Inputs/forbid_typecheck_primary.swift -- \
 // RUN:     -Xfrontend -debug-forbid-typecheck-prefix -Xfrontend NOTYPECHECK -module-name forbid \
-// RUN:     %S/../Inputs/forbid_typecheck_2.swift %S/../Inputs/forbid_typecheck_primary.swift | FileCheck -check-prefix=CHECK2 %s
+// RUN:     %S/../Inputs/forbid_typecheck_2.swift %S/../Inputs/forbid_typecheck_primary.swift | %FileCheck -check-prefix=CHECK2 %s
 
 // CHECK2: source.lang.swift.ref.var.instance ({{.*}}forbid_typecheck_2.swift:10:7-10:13)
 // CHECK2: member
diff --git a/test/SourceKit/CursorInfo/cursor_generic_enum.swift b/test/SourceKit/CursorInfo/cursor_generic_enum.swift
index c7acef1..ea3bf57 100644
--- a/test/SourceKit/CursorInfo/cursor_generic_enum.swift
+++ b/test/SourceKit/CursorInfo/cursor_generic_enum.swift
@@ -1,5 +1,5 @@
 // Checks that SourceKit does not crash for enum patterns in generics.
-// RUN: %sourcekitd-test -req cursor -pos 18:15 %s -- %s | FileCheck %s
+// RUN: %sourcekitd-test -req cursor -pos 18:15 %s -- %s | %FileCheck %s
 // CHECK: source.lang.swift.ref.enumelement (12:10-12:17)
 
 public protocol MyErrorType {
diff --git a/test/SourceKit/CursorInfo/cursor_generics.swift b/test/SourceKit/CursorInfo/cursor_generics.swift
index ece627b..6f10353 100644
--- a/test/SourceKit/CursorInfo/cursor_generics.swift
+++ b/test/SourceKit/CursorInfo/cursor_generics.swift
@@ -9,13 +9,13 @@
     fatalError()
 }
 
-// RUN: %sourcekitd-test -req=cursor -pos=1:10 %s -- %s | FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=1:10 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
 // CHECK1: <Declaration>func testGenerics&lt;T&gt;(x: <Type usr="s:tF15cursor_generics12testGenericsurFT1xx_T_L_1TMx">T</Type>)</Declaration>
 
-// RUN: %sourcekitd-test -req=cursor -pos=5:10 %s -- %s | FileCheck -check-prefix=CHECK2 %s
+// RUN: %sourcekitd-test -req=cursor -pos=5:10 %s -- %s | %FileCheck -check-prefix=CHECK2 %s
 // CHECK2: <Function
 // CHECK2: <Declaration>func testGenericsWithComment&lt;T&gt;(x: T)</Declaration>
 
-// RUN: %sourcekitd-test -req=cursor -pos=8:16 %s -- %s | FileCheck -check-prefix=CHECK3 %s
+// RUN: %sourcekitd-test -req=cursor -pos=8:16 %s -- %s | %FileCheck -check-prefix=CHECK3 %s
 // CHECK3: source.lang.swift.decl.generic_type_param
 // CHECK3: <Declaration>A</Declaration>
diff --git a/test/SourceKit/CursorInfo/cursor_getter.swift b/test/SourceKit/CursorInfo/cursor_getter.swift
index dcc7b36..20bfe43 100644
--- a/test/SourceKit/CursorInfo/cursor_getter.swift
+++ b/test/SourceKit/CursorInfo/cursor_getter.swift
@@ -7,18 +7,18 @@
 }
 
 // Checks that we don't crash.
-// RUN: %sourcekitd-test -req=cursor -pos=1:15 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=1:17 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=2:15 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=2:17 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=2:21 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=2:23 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=3:15 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=3:17 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=3:21 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=3:23 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=3:37 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=3:41 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=6:29 %s -- %s | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=6:31 %s -- %s | FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=1:15 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=1:17 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=2:15 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=2:17 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=2:21 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=2:23 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=3:15 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=3:17 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=3:21 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=3:23 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=3:37 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=3:41 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=6:29 %s -- %s | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=6:31 %s -- %s | %FileCheck %s
 // CHECK: <empty cursor info>
diff --git a/test/SourceKit/CursorInfo/cursor_implicit_init.swift b/test/SourceKit/CursorInfo/cursor_implicit_init.swift
index d15edb8..e18167a 100644
--- a/test/SourceKit/CursorInfo/cursor_implicit_init.swift
+++ b/test/SourceKit/CursorInfo/cursor_implicit_init.swift
@@ -11,8 +11,8 @@
   MySubClass(abc:1)
 }
 
-// RUN: %sourcekitd-test -req=cursor -pos=10:12 %s -- %s | FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=10:12 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
 // CHECK1: <Declaration>init(abc: <Type usr="s:Si">Int</Type>)</Declaration>
 
-// RUN: %sourcekitd-test -req=cursor -pos=11:16 %s -- %s | FileCheck -check-prefix=CHECK2 %s
+// RUN: %sourcekitd-test -req=cursor -pos=11:16 %s -- %s | %FileCheck -check-prefix=CHECK2 %s
 // CHECK2: <Declaration>init(abc: <Type usr="s:Si">Int</Type>)</Declaration>
diff --git a/test/SourceKit/CursorInfo/cursor_info.swift b/test/SourceKit/CursorInfo/cursor_info.swift
index e5098e8..9351fdb 100644
--- a/test/SourceKit/CursorInfo/cursor_info.swift
+++ b/test/SourceKit/CursorInfo/cursor_info.swift
@@ -201,13 +201,13 @@
 // RUN: rm -rf %t.tmp
 // RUN: mkdir %t.tmp
 // RUN: %swiftc_driver -emit-module -o %t.tmp/FooSwiftModule.swiftmodule %S/Inputs/FooSwiftModule.swift
-// RUN: %sourcekitd-test -req=cursor -pos=9:8 %s -- -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=9:8 %s -- -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck -check-prefix=CHECK1 %s
 // CHECK1:      source.lang.swift.ref.var.global (4:5-4:9)
 // CHECK1-NEXT: glob
 // CHECK1-NEXT: s:v11cursor_info4globSi{{$}}
 // CHECK1-NEXT: Int
 
-// RUN: %sourcekitd-test -req=cursor -pos=9:11 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK2 %s
+// RUN: %sourcekitd-test -req=cursor -pos=9:11 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
 // CHECK2:      source.lang.swift.ref.function.operator.infix ()
 // CHECK2-NEXT: +
 // CHECK2-NEXT: s:Fsoi1pFTSiSi_Si
@@ -219,7 +219,7 @@
 // CHECK2-NEXT: <Declaration>func +(lhs: <Type usr="s:Si">Int</Type>, rhs: <Type usr="s:Si">Int</Type>) -&gt; <Type usr="s:Si">Int</Type></Declaration>
 // CHECK2-NEXT: <decl.function.operator.infix><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>+</decl.name>(<decl.var.parameter><decl.var.parameter.name>lhs</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>, <decl.var.parameter><decl.var.parameter.name>rhs</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype></decl.function.operator.infix>
 
-// RUN: %sourcekitd-test -req=cursor -pos=9:12 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK3 %s
+// RUN: %sourcekitd-test -req=cursor -pos=9:12 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK3 %s
 // CHECK3:      source.lang.swift.ref.var.local (8:12-8:13)
 // CHECK3-NEXT: x{{$}}
 // CHECK3-NEXT: s:vF11cursor_info3gooFSiT_L_1xSi{{$}}
@@ -228,7 +228,7 @@
 // CHECK3-NEXT: <Declaration>let x: <Type usr="s:Si">Int</Type></Declaration>
 // CHECK3-NEXT: <decl.var.parameter><syntaxtype.keyword>let</syntaxtype.keyword> <decl.var.parameter.name>x</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>
 
-// RUN: %sourcekitd-test -req=cursor -pos=9:18 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK4 %s
+// RUN: %sourcekitd-test -req=cursor -pos=9:18 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK4 %s
 // CHECK4:      source.lang.swift.ref.var.global ({{.*}}Foo.framework/Headers/Foo.h:62:12-62:21)
 // CHECK4-NEXT: fooIntVar{{$}}
 // CHECK4-NEXT: c:@fooIntVar{{$}}
@@ -239,13 +239,13 @@
 // CHECK4-NEXT: <decl.var.global><syntaxtype.keyword>var</syntaxtype.keyword> <decl.name>fooIntVar</decl.name>: <decl.var.type><ref.struct usr="s:Vs5Int32">Int32</ref.struct></decl.var.type></decl.var.global>
 // CHECK4-NEXT: <Variable file="{{[^"]+}}Foo.h" line="{{[0-9]+}}" column="{{[0-9]+}}"><Name>fooIntVar</Name><USR>c:@fooIntVar</USR><Declaration>var fooIntVar: Int32</Declaration><Abstract><Para> Aaa. fooIntVar. Bbb.</Para></Abstract></Variable>
 
-// RUN: %sourcekitd-test -req=cursor -pos=8:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK5 %s
+// RUN: %sourcekitd-test -req=cursor -pos=8:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK5 %s
 // CHECK5:      source.lang.swift.decl.function.free (8:6-8:19)
 // CHECK5-NEXT: goo(_:){{$}}
 // CHECK5-NEXT: s:F11cursor_info3gooFSiT_{{$}}
 // CHECK5-NEXT: (Int) -> (){{$}}
 
-// RUN: %sourcekitd-test -req=cursor -pos=9:32 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK6 %s
+// RUN: %sourcekitd-test -req=cursor -pos=9:32 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK6 %s
 // CHECK6:      source.lang.swift.ref.function.free ()
 // CHECK6-NEXT: fooSwiftFunc
 // CHECK6-NEXT: s:F14FooSwiftModule12fooSwiftFuncFT_Si
@@ -256,7 +256,7 @@
 // CHECK6-NEXT: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>fooSwiftFunc</decl.name>() -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype></decl.function.free>
 // CHECK6-NEXT: {{^}}<Function><Name>fooSwiftFunc()</Name><USR>s:F14FooSwiftModule12fooSwiftFuncFT_Si</USR><Declaration>func fooSwiftFunc() -&gt; Int</Declaration><Abstract><Para>This is ‘fooSwiftFunc’ from ‘FooSwiftModule’.</Para></Abstract></Function>{{$}}
 
-// RUN: %sourcekitd-test -req=cursor -pos=14:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK7 %s
+// RUN: %sourcekitd-test -req=cursor -pos=14:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK7 %s
 // CHECK7:      source.lang.swift.ref.struct (13:8-13:10)
 // CHECK7-NEXT: S1
 // CHECK7-NEXT: s:V11cursor_info2S1
@@ -266,7 +266,7 @@
 // CHECK7-NEXT: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>S1</decl.name></decl.struct>
 // CHECK7-NEXT: <Class file="{{[^"]+}}cursor_info.swift" line="13" column="8"><Name>S1</Name><USR>s:V11cursor_info2S1</USR><Declaration>struct S1</Declaration><Abstract><Para>Aaa.  S1.  Bbb.</Para></Abstract></Class>
 
-// RUN: %sourcekitd-test -req=cursor -pos=19:12 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK8 %s
+// RUN: %sourcekitd-test -req=cursor -pos=19:12 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK8 %s
 // CHECK8:      source.lang.swift.ref.function.constructor (18:3-18:15)
 // CHECK8-NEXT: init
 // CHECK8-NEXT: s:FC11cursor_info2CCcFT1xSi_S0_
@@ -276,38 +276,38 @@
 // CHECK8-NEXT: <Declaration>convenience init(x: <Type usr="s:Si">Int</Type>)</Declaration>
 // CHECK8-NEXT: <decl.function.constructor><syntaxtype.keyword>convenience</syntaxtype.keyword> <syntaxtype.keyword>init</syntaxtype.keyword>(<decl.var.parameter><decl.var.parameter.argument_label>x</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>)</decl.function.constructor>
 
-// RUN: %sourcekitd-test -req=cursor -pos=23:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK9 %s
+// RUN: %sourcekitd-test -req=cursor -pos=23:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK9 %s
 // CHECK9:      source.lang.swift.decl.var.global (23:5-23:15)
 // CHECK9: <Declaration>var testString: <Type usr="s:SS">String</Type></Declaration>
 // CHECK9: <decl.var.global><syntaxtype.keyword>var</syntaxtype.keyword> <decl.name>testString</decl.name>: <decl.var.type><ref.struct usr="s:SS">String</ref.struct></decl.var.type></decl.var.global>
 
-// RUN: %sourcekitd-test -req=cursor -pos=24:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK10 %s
+// RUN: %sourcekitd-test -req=cursor -pos=24:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK10 %s
 // CHECK10: source.lang.swift.decl.var.global (24:5-24:18)
 // CHECK10: <Declaration>let testLetString: <Type usr="s:SS">String</Type></Declaration>
 // CHECK10: <decl.var.global><syntaxtype.keyword>let</syntaxtype.keyword> <decl.name>testLetString</decl.name>: <decl.var.type><ref.struct usr="s:SS">String</ref.struct></decl.var.type></decl.var.global>
 
-// RUN: %sourcekitd-test -req=cursor -pos=26:20 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK11 %s
+// RUN: %sourcekitd-test -req=cursor -pos=26:20 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK11 %s
 // CHECK11: source.lang.swift.decl.var.parameter (26:19-26:23)
 // CHECK11: <Declaration>let arg1: <Type usr="s:Si">Int</Type></Declaration>
 // CHECK11: <decl.var.parameter><syntaxtype.keyword>let</syntaxtype.keyword> <decl.var.parameter.name>arg1</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>
 
-// RUN: %sourcekitd-test -req=cursor -pos=28:24 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK12 %s
+// RUN: %sourcekitd-test -req=cursor -pos=28:24 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK12 %s
 // CHECK12: source.lang.swift.decl.var.parameter (28:21-28:25)
 // CHECK12: <Declaration>var arg1: inout <Type usr="s:Si">Int</Type></Declaration>
 // CHECK12: <decl.var.parameter><syntaxtype.keyword>var</syntaxtype.keyword> <decl.var.parameter.name>arg1</decl.var.parameter.name>: <decl.var.parameter.type><syntaxtype.keyword>inout</syntaxtype.keyword> <ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>
 
-// RUN: %sourcekitd-test -req=cursor -pos=31:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK13 %s
+// RUN: %sourcekitd-test -req=cursor -pos=31:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK13 %s
 // CHECK13: source.lang.swift.decl.function.free (31:6-31:37)
 // CHECK13: <Declaration>func testDefaultParam(arg1: <Type usr="s:Si">Int</Type> = default)</Declaration>
 // CHECK13: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>testDefaultParam</decl.name>(<decl.var.parameter><decl.var.parameter.argument_label>arg1</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type> = <syntaxtype.keyword>default</syntaxtype.keyword></decl.var.parameter>)</decl.function.free>
 
-// RUN: %sourcekitd-test -req=cursor -pos=34:4 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK14 %s
+// RUN: %sourcekitd-test -req=cursor -pos=34:4 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK14 %s
 // CHECK14: source.lang.swift.ref.function.free ({{.*}}Foo.framework/Frameworks/FooSub.framework/Headers/FooSub.h:4:5-4:16)
 // CHECK14: fooSubFunc1
 // CHECK14: c:@F@fooSubFunc1
 // CHECK14: Foo.FooSub{{$}}
 
-// RUN: %sourcekitd-test -req=cursor -pos=38:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK15 %s
+// RUN: %sourcekitd-test -req=cursor -pos=38:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK15 %s
 // CHECK15: source.lang.swift.decl.function.free (38:6-38:40)
 // CHECK15: myFunc
 // CHECK15: <Declaration>func myFunc(arg1: <Type usr="s:SS">String</Type>, options: <Type usr="s:Si">Int</Type>)</Declaration>
@@ -316,63 +316,63 @@
 // CHECK15-NEXT: <RelatedName usr="s:F11cursor_info6myFuncFT4arg1SS_T_">myFunc(arg1:)</RelatedName>
 // CHECK15-NEXT: RELATED END
 
-// RUN: %sourcekitd-test -req=cursor -pos=41:26 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK16 %s
+// RUN: %sourcekitd-test -req=cursor -pos=41:26 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK16 %s
 // CHECK16:      source.lang.swift.ref.class ({{.*}}Foo.framework/Headers/Foo.h:157:12-157:27)
 // CHECK16-NEXT: FooClassDerived
 // CHECK16-NEXT: c:objc(cs)FooClassDerived
 // CHECK16: <Declaration>class FooClassDerived : <Type usr="c:objc(cs)FooClassBase">FooClassBase</Type>, <Type usr="c:objc(pl)FooProtocolDerived">FooProtocolDerived</Type></Declaration>
 // CHECK16-NEXT: <decl.class><syntaxtype.keyword>class</syntaxtype.keyword> <decl.name>FooClassDerived</decl.name> : <ref.class usr="c:objc(cs)FooClassBase">FooClassBase</ref.class>, <ref.protocol usr="c:objc(pl)FooProtocolDerived">FooProtocolDerived</ref.protocol></decl.class>
 
-// RUN: %sourcekitd-test -req=cursor -pos=1:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK17 %s
+// RUN: %sourcekitd-test -req=cursor -pos=1:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK17 %s
 // CHECK17:      source.lang.swift.ref.module ()
 // CHECK17-NEXT: Foo{{$}}
 
-// RUN: %sourcekitd-test -req=cursor -pos=44:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK18 %s
+// RUN: %sourcekitd-test -req=cursor -pos=44:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK18 %s
 // CHECK18: source.lang.swift.ref.typealias (43:11-43:16)
 // CHECK18: <Declaration>typealias MyInt = <Type usr="s:Si">Int</Type></Declaration>
 // CHECK18: <decl.typealias><syntaxtype.keyword>typealias</syntaxtype.keyword> <decl.name>MyInt</decl.name> = <ref.struct usr="s:Si">Int</ref.struct></decl.typealias>
 
-// RUN: %sourcekitd-test -req=cursor -pos=46:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK19 %s
+// RUN: %sourcekitd-test -req=cursor -pos=46:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK19 %s
 // CHECK19:      source.lang.swift.ref.module ()
 // CHECK19-NEXT: FooHelper{{$}}
 
-// RUN: %sourcekitd-test -req=cursor -pos=46:25 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK20 %s
+// RUN: %sourcekitd-test -req=cursor -pos=46:25 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK20 %s
 // CHECK20:      source.lang.swift.ref.module ()
 // CHECK20-NEXT: FooHelperSub{{$}}
 
-// RUN: %sourcekitd-test -req=cursor -pos=50:12 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK21 %s
+// RUN: %sourcekitd-test -req=cursor -pos=50:12 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK21 %s
 // CHECK21:      source.lang.swift.ref.var.global (44:5-44:6)
 // CHECK21-NEXT:  {{^}}x{{$}}
 
-// RUN: %sourcekitd-test -req=cursor -pos=55:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK22 %s
+// RUN: %sourcekitd-test -req=cursor -pos=55:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK22 %s
 // CHECK22: <Declaration>func availabilityIntroduced()</Declaration>
 // CHECK22: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>availabilityIntroduced</decl.name>()</decl.function.method.instance>
 
-// RUN: %sourcekitd-test -req=cursor -pos=56:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK23 %s
+// RUN: %sourcekitd-test -req=cursor -pos=56:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK23 %s
 // CHECK23-NOT: <Declaration>func swiftUnavailable()</Declaration>
 // CHECK23-NOT: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>swiftUnavailable</decl.name>()</decl.function.method.instance>
 
-// RUN: %sourcekitd-test -req=cursor -pos=57:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK24 %s
+// RUN: %sourcekitd-test -req=cursor -pos=57:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK24 %s
 // CHECK24-NOT: <Declaration>func unavailable()</Declaration>
 // CHECK24-NOT: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>unavailable</decl.name>()</decl.function.method.instance>
 
-// RUN: %sourcekitd-test -req=cursor -pos=58:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK25 %s
+// RUN: %sourcekitd-test -req=cursor -pos=58:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK25 %s
 // CHECK25: <Declaration>func availabilityIntroducedMsg()</Declaration>
 // CHECK25: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>availabilityIntroducedMsg</decl.name>()</decl.function.method.instance>
 
-// RUN: %sourcekitd-test -req=cursor -pos=59:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK26 %s
+// RUN: %sourcekitd-test -req=cursor -pos=59:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK26 %s
 // CHECK26-NOT: <Declaration>func availabilityDeprecated()</Declaration>
 // CHECK26-NOT: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>availabilityDeprecated</decl.name>()</decl.function.method.instance>
 
-// RUN: %sourcekitd-test -req=cursor -pos=69:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK27 %s
+// RUN: %sourcekitd-test -req=cursor -pos=69:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK27 %s
 // CHECK27: <Declaration>public subscript(i: <Type usr="s:Si">Int</Type>) -&gt; <Type usr="s:Si">Int</Type> { get }</Declaration>
 // CHECK27: <decl.function.subscript><syntaxtype.keyword>public</syntaxtype.keyword> <syntaxtype.keyword>subscript</syntaxtype.keyword>(<decl.var.parameter><decl.var.parameter.name>i</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype> { <syntaxtype.keyword>get</syntaxtype.keyword> }</decl.function.subscript>
 
-// RUN: %sourcekitd-test -req=cursor -pos=69:19 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK28 %s
+// RUN: %sourcekitd-test -req=cursor -pos=69:19 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK28 %s
 // CHECK28: <Declaration>public subscript(i: <Type usr="s:Si">Int</Type>) -&gt; <Type usr="s:Si">Int</Type> { get }</Declaration>
 // CHECK28: <decl.function.subscript><syntaxtype.keyword>public</syntaxtype.keyword> <syntaxtype.keyword>subscript</syntaxtype.keyword>(<decl.var.parameter><decl.var.parameter.name>i</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype> { <syntaxtype.keyword>get</syntaxtype.keyword> }</decl.function.subscript>
 
-// RUN: %sourcekitd-test -req=cursor -pos=74:3 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK29
+// RUN: %sourcekitd-test -req=cursor -pos=74:3 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK29
 // CHECK29: source.lang.swift.decl.function.destructor (74:3-74:9)
 // CHECK29-NEXT: deinit
 // CHECK29-NEXT: s:FC11cursor_info2C3d
@@ -381,7 +381,7 @@
 // CHECK29-NEXT: <Declaration>deinit</Declaration>
 // CHECK29-NEXT: <decl.function.destructor><syntaxtype.keyword>deinit</syntaxtype.keyword></decl.function.destructor>
 
-// RUN: %sourcekitd-test -req=cursor -pos=75:3 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK30
+// RUN: %sourcekitd-test -req=cursor -pos=75:3 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK30
 // CHECK30: source.lang.swift.decl.function.constructor (75:3-75:16)
 // CHECK30-NEXT: init(x:)
 // CHECK30-NEXT: s:FC11cursor_info2C3cFT1xSi_GSQS0__
@@ -390,7 +390,7 @@
 // CHECK30-NEXT: <Declaration>init!(x: <Type usr="s:Si">Int</Type>)</Declaration>
 // CHECK30-NEXT: <decl.function.constructor><syntaxtype.keyword>init</syntaxtype.keyword>!(<decl.var.parameter><decl.var.parameter.argument_label>x</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>)</decl.function.constructor>
 
-// RUN: %sourcekitd-test -req=cursor -pos=76:3 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK31
+// RUN: %sourcekitd-test -req=cursor -pos=76:3 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK31
 // CHECK31: source.lang.swift.decl.function.constructor (76:3-76:16)
 // CHECK31-NEXT: init(y:)
 // CHECK31-NEXT: s:FC11cursor_info2C3cFT1ySi_GSqS0__
@@ -399,7 +399,7 @@
 // CHECK31-NEXT: <Declaration>init?(y: <Type usr="s:Si">Int</Type>)</Declaration>
 // CHECK31-NEXT: <decl.function.constructor><syntaxtype.keyword>init</syntaxtype.keyword>?(<decl.var.parameter><decl.var.parameter.argument_label>y</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>)</decl.function.constructor>
 
-// RUN: %sourcekitd-test -req=cursor -pos=77:3 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK32
+// RUN: %sourcekitd-test -req=cursor -pos=77:3 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK32
 // CHECK32: source.lang.swift.decl.function.constructor (77:3-77:15)
 // CHECK32-NEXT: init(z:)
 // CHECK32-NEXT: s:FC11cursor_info2C3cFzT1zSi_S0_
@@ -408,7 +408,7 @@
 // CHECK32-NEXT: <Declaration>init(z: <Type usr="s:Si">Int</Type>) throws</Declaration>
 // CHECK32-NEXT: <decl.function.constructor><syntaxtype.keyword>init</syntaxtype.keyword>(<decl.var.parameter><decl.var.parameter.argument_label>z</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>) <syntaxtype.keyword>throws</syntaxtype.keyword></decl.function.constructor>
 
-// RUN: %sourcekitd-test -req=cursor -pos=80:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK33
+// RUN: %sourcekitd-test -req=cursor -pos=80:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK33
 // CHECK33: source.lang.swift.decl.struct (80:8-80:10)
 // CHECK33-NEXT: S2
 // CHECK33-NEXT: s:V11cursor_info2S2
@@ -416,7 +416,7 @@
 // CHECK33: <Declaration>struct S2&lt;T, U&gt;</Declaration>
 // CHECK33-NEXT: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>S2</decl.name>&lt;<decl.generic_type_param usr="s:tV11cursor_info2S21TMx"><decl.generic_type_param.name>T</decl.generic_type_param.name></decl.generic_type_param>, <decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>U</decl.generic_type_param.name></decl.generic_type_param>&gt;</decl.struct>
 
-// RUN: %sourcekitd-test -req=cursor -pos=81:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK34
+// RUN: %sourcekitd-test -req=cursor -pos=81:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK34
 // CHECK34: source.lang.swift.decl.function.method.instance (81:8-81:50)
 // CHECK34-NEXT: foo(_:)
 // CHECK34-NEXT: s:FV11cursor_info2S23foou0_rFFT_T_FT_T_
@@ -424,7 +424,7 @@
 // CHECK34: <Declaration>func foo&lt;V, W&gt;(_ closure: () -&gt; ()) -&gt; () -&gt; ()</Declaration>
 // CHECK34-NEXT: <decl.function.method.instance><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>foo</decl.name>&lt;<decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>V</decl.generic_type_param.name></decl.generic_type_param>, <decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>W</decl.generic_type_param.name></decl.generic_type_param>&gt;(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>closure</decl.var.parameter.name>: <decl.var.parameter.type>() -&gt; <decl.function.returntype><tuple>()</tuple></decl.function.returntype></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype>() -&gt; <decl.function.returntype><tuple>()</tuple></decl.function.returntype></decl.function.returntype></decl.function.method.instance>
 
-// RUN: %sourcekitd-test -req=cursor -pos=83:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK35
+// RUN: %sourcekitd-test -req=cursor -pos=83:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK35
 // CHECK35: source.lang.swift.decl.class (83:7-83:9)
 // CHECK35-NEXT: C4
 // CHECK35-NEXT: s:C11cursor_info2C4
@@ -432,7 +432,7 @@
 // CHECK35: <Declaration>class C4&lt;T, U&gt;</Declaration>
 // CHECK35-NEXT: <decl.class><syntaxtype.keyword>class</syntaxtype.keyword> <decl.name>C4</decl.name>&lt;<decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>T</decl.generic_type_param.name></decl.generic_type_param>, <decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>U</decl.generic_type_param.name></decl.generic_type_param>&gt;</decl.class>
 
-// RUN: %sourcekitd-test -req=cursor -pos=84:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK36
+// RUN: %sourcekitd-test -req=cursor -pos=84:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK36
 // CHECK36: source.lang.swift.decl.enum (84:6-84:8)
 // CHECK36-NEXT: E1
 // CHECK36-NEXT: s:O11cursor_info2E1
@@ -440,7 +440,7 @@
 // CHECK36: <Declaration>enum E1&lt;T, U&gt;</Declaration>
 // CHECK36-NEXT: <decl.enum><syntaxtype.keyword>enum</syntaxtype.keyword> <decl.name>E1</decl.name>&lt;<decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>T</decl.generic_type_param.name></decl.generic_type_param>, <decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>U</decl.generic_type_param.name></decl.generic_type_param>&gt;</decl.enum>
 
-// RUN: %sourcekitd-test -req=cursor -pos=86:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK37
+// RUN: %sourcekitd-test -req=cursor -pos=86:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK37
 // CHECK37: source.lang.swift.decl.function.free (86:6-86:111)
 // CHECK37-NEXT: nonDefaultArgNames(external1:_:external3:external4:_:)
 // CHECK37-NEXT: s:F11cursor_info18nonDefaultArgNamesFT9external1SiSi9external3Si9external4SiSi_T_
@@ -448,10 +448,10 @@
 // CHECK37: <Declaration>func nonDefaultArgNames(external1 local1: <Type usr="s:Si">Int</Type>, _ local2: <Type usr="s:Si">Int</Type>, external3 local3: <Type usr="s:Si">Int</Type>, external4 _: <Type usr="s:Si">Int</Type>, _: <Type usr="s:Si">Int</Type>)</Declaration>
 // CHECK37-NEXT: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>nonDefaultArgNames</decl.name>(<decl.var.parameter><decl.var.parameter.argument_label>external1</decl.var.parameter.argument_label> <decl.var.parameter.name>local1</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>, <decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>local2</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>, <decl.var.parameter><decl.var.parameter.argument_label>external3</decl.var.parameter.argument_label> <decl.var.parameter.name>local3</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>, <decl.var.parameter><decl.var.parameter.argument_label>external4</decl.var.parameter.argument_label> <decl.var.parameter.name>_</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>, <decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>)</decl.function.free>
 
-// RUN: %sourcekitd-test -req=cursor -pos=88:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK38
+// RUN: %sourcekitd-test -req=cursor -pos=88:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK38
 // CHECK38: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>nestedFunctionType</decl.name>(<decl.var.parameter><decl.var.parameter.argument_label>closure</decl.var.parameter.argument_label>: <decl.var.parameter.type>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>y</decl.var.parameter.name>: <decl.var.parameter.type>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>z</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>y</decl.var.parameter.name>: <decl.var.parameter.type>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>z</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype></decl.function.returntype></decl.function.free>
 
-// RUN: %sourcekitd-test -req=cursor -pos=91:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK39
+// RUN: %sourcekitd-test -req=cursor -pos=91:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK39
 // CHECK39: source.lang.swift.decl.enumelement (91:8-91:10)
 // CHECK39-NEXT: C1
 // CHECK39-NEXT: s:FO11cursor_info2E22C1FMS0_S0_
@@ -459,7 +459,7 @@
 // CHECK39: <Declaration>case C1</Declaration>
 // CHECK39-NEXT: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>C1</decl.name></decl.enumelement>
 
-// RUN: %sourcekitd-test -req=cursor -pos=92:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK40
+// RUN: %sourcekitd-test -req=cursor -pos=92:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK40
 // CHECK40: source.lang.swift.decl.enumelement (92:8-92:10)
 // CHECK40-NEXT: C2
 // CHECK40-NEXT: s:FO11cursor_info2E22C2FMS0_FT1xSi1ySS_S0_
@@ -467,7 +467,7 @@
 // CHECK40: <Declaration>case C2(x: <Type usr="s:Si">Int</Type>, y: <Type usr="s:SS">String</Type>)</Declaration>
 // CHECK40-NEXT: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>C2</decl.name><tuple>(<tuple.element><tuple.element.argument_label>x</tuple.element.argument_label>: <tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>, <tuple.element><tuple.element.argument_label>y</tuple.element.argument_label>: <tuple.element.type><ref.struct usr="s:SS">String</ref.struct></tuple.element.type></tuple.element>)</tuple></decl.enumelement>
 
-// RUN: %sourcekitd-test -req=cursor -pos=92:31 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK41
+// RUN: %sourcekitd-test -req=cursor -pos=92:31 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK41
 // CHECK41: source.lang.swift.decl.enumelement (92:31-92:33)
 // CHECK41-NEXT: C3
 // CHECK41-NEXT: s:FO11cursor_info2E22C3FMS0_FSiS0_
@@ -476,7 +476,7 @@
 // CHECK41-NEXT: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>C3</decl.name>(<ref.struct usr="s:Si">Int</ref.struct>)</decl.enumelement>
 // FIXME: Wrap parameters in <decl.var.parameter>
 
-// RUN: %sourcekitd-test -req=cursor -pos=96:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK42
+// RUN: %sourcekitd-test -req=cursor -pos=96:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK42
 // CHECK42: source.lang.swift.decl.enumelement (96:8-96:9)
 // CHECK42-NEXT: C
 // CHECK42-NEXT: s:FO11cursor_info2E31CFMS0_S0_
@@ -484,31 +484,31 @@
 // CHECK42: <Declaration>case C = &quot;a&quot;</Declaration>
 // CHECK42-NEXT: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>C</decl.name> = <syntaxtype.string>&quot;a&quot;</syntaxtype.string></decl.enumelement>
 
-// RUN: %sourcekitd-test -req=cursor -pos=100:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK43
+// RUN: %sourcekitd-test -req=cursor -pos=100:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK43
 // CHECK43: source.lang.swift.ref.enumelement (91:8-91:10)
 // CHECK43-NEXT: C1
 // CHECK43: <Declaration>case C1</Declaration>
 // CHECK43-NEXT: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>C1</decl.name></decl.enumelement>
 
-// RUN: %sourcekitd-test -req=cursor -pos=101:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK44
+// RUN: %sourcekitd-test -req=cursor -pos=101:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK44
 // CHECK44: source.lang.swift.ref.enumelement (92:8-92:10)
 // CHECK44-NEXT: C2
 // CHECK44: <Declaration>case C2(x: <Type usr="s:Si">Int</Type>, y: <Type usr="s:SS">String</Type>)</Declaration>
 // CHECK44-NEXT: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>C2</decl.name><tuple>(<tuple.element><tuple.element.argument_label>x</tuple.element.argument_label>: <tuple.element.type><ref
 
-// RUN: %sourcekitd-test -req=cursor -pos=102:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK45
+// RUN: %sourcekitd-test -req=cursor -pos=102:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK45
 // CHECK45: source.lang.swift.ref.enumelement (92:8-92:10)
 // CHECK45-NEXT: C2
 // CHECK45: <Declaration>case C2(x: <Type usr="s:Si">Int</Type>, y: <Type usr="s:SS">String</Type>)</Declaration>
 // CHECK45-NEXT: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>C2</decl.name><tuple>(<tuple.element><tuple.element.argument_label>x
 
-// RUN: %sourcekitd-test -req=cursor -pos=103:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK46
+// RUN: %sourcekitd-test -req=cursor -pos=103:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK46
 // CHECK46: source.lang.swift.ref.enumelement (96:8-96:9)
 // CHECK46-NEXT: C
 // CHECK46: <Declaration>case C = &quot;a&quot;</Declaration>
 // CHECK46-NEXT: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>C</decl.name> = <syntaxtype.string>&quot;a&quot;</syntaxtype.string></decl.enumelement>
 
-// RUN: %sourcekitd-test -req=cursor -pos=80:11 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK47
+// RUN: %sourcekitd-test -req=cursor -pos=80:11 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK47
 // CHECK47: source.lang.swift.decl.generic_type_param (80:11-80:12)
 // CHECK47-NEXT: T
 // CHECK47-NEXT: s:tV11cursor_info2S21TMx
@@ -516,75 +516,75 @@
 // CHECK47: <Declaration>T</Declaration>
 // CHECK47-NEXT: <decl.generic_type_param><decl.generic_type_param.name>T</decl.generic_type_param.name></decl.generic_type_param>
 
-// RUN: %sourcekitd-test -req=cursor -pos=107:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK48
+// RUN: %sourcekitd-test -req=cursor -pos=107:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK48
 // CHECK48: source.lang.swift.decl.var.static (107:14-107:16)
 // CHECK48: <decl.var.static><syntaxtype.keyword>static</syntaxtype.keyword> <syntaxtype.keyword>var</syntaxtype.keyword>
 
-// RUN: %sourcekitd-test -req=cursor -pos=108:19 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK49
+// RUN: %sourcekitd-test -req=cursor -pos=108:19 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK49
 // CHECK49: source.lang.swift.decl.var.class (108:19-108:21)
 // CHECK49: <decl.var.class><syntaxtype.keyword>final</syntaxtype.keyword> <syntaxtype.keyword>class</syntaxtype.keyword> <syntaxtype.keyword>var</syntaxtype.keyword>
 
-// RUN: %sourcekitd-test -req=cursor -pos=109:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK50
+// RUN: %sourcekitd-test -req=cursor -pos=109:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK50
 // CHECK50: source.lang.swift.decl.function.method.static (109:15-109:19)
 // CHECK50: <decl.function.method.static><syntaxtype.keyword>static</syntaxtype.keyword> <syntaxtype.keyword>func</syntaxtype.keyword>
 
-// RUN: %sourcekitd-test -req=cursor -pos=110:20 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK51
+// RUN: %sourcekitd-test -req=cursor -pos=110:20 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK51
 // CHECK51: source.lang.swift.decl.function.method.class (110:20-110:24)
 // CHECK51: <decl.function.method.class><syntaxtype.keyword>final</syntaxtype.keyword> <syntaxtype.keyword>class</syntaxtype.keyword> <syntaxtype.keyword>func</syntaxtype.keyword>
 
-// RUN: %sourcekitd-test -req=cursor -pos=117:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK52
+// RUN: %sourcekitd-test -req=cursor -pos=117:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK52
 // CHECK52: source.lang.swift.decl.function.free (117:6-117:51)
 // CHECK52: <U, V : P1 where V.T == U> (U, v: V) -> ()
 // CHECK52: &lt;<decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>U</decl.generic_type_param.name></decl.generic_type_param>, <decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>V</decl.generic_type_param.name> : <decl.generic_type_param.constraint><ref.protocol usr="{{.*}}">P1</ref.protocol></decl.generic_type_param.constraint></decl.generic_type_param> <syntaxtype.keyword>where</syntaxtype.keyword> <decl.generic_type_requirement><ref.generic_type_param usr="{{.*}}">V</ref.generic_type_param>.<ref.associatedtype usr="{{.*}}">T</ref.associatedtype> == <ref.generic_type_param usr="{{.*}}">U</ref.generic_type_param></decl.generic_type_requirement>&gt;
 
-// RUN: %sourcekitd-test -req=cursor -pos=117:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK53
+// RUN: %sourcekitd-test -req=cursor -pos=117:16 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK53
 // CHECK53: source.lang.swift.decl.generic_type_param (117:16-117:17)
 // CHECK53: <decl.generic_type_param><decl.generic_type_param.name>V</decl.generic_type_param.name> : <decl.generic_type_param.constraint><ref.protocol usr="{{.*}}">P1</ref.protocol></decl.generic_type_param.constraint></decl.generic_type_param>
 
-// RUN: %sourcekitd-test -req=cursor -pos=119:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK54
+// RUN: %sourcekitd-test -req=cursor -pos=119:13 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK54
 // CHECK54: source.lang.swift.decl.class (119:13-119:15)
 // CHECK54: <decl.class><syntaxtype.attribute.builtin><syntaxtype.attribute.name>@objc</syntaxtype.attribute.name></syntaxtype.attribute.builtin> <syntaxtype.keyword>class
 
-// RUN: %sourcekitd-test -req=cursor -pos=122:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK55
+// RUN: %sourcekitd-test -req=cursor -pos=122:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK55
 // CHECK55: source.lang.swift.decl.function.method.instance (122:8-122:12)
 // CHECK55: <decl.function.method.instance><syntaxtype.attribute.builtin><syntaxtype.attribute.name>@objc</syntaxtype.attribute.name>(mmm1)</syntaxtype.attribute.builtin> <syntaxtype.keyword>func
 
-// RUN: %sourcekitd-test -req=cursor -pos=126:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK56
+// RUN: %sourcekitd-test -req=cursor -pos=126:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK56
 // CHECK56: source.lang.swift.decl.var.instance (126:7-126:9)
 // CHECK56: <decl.var.instance><syntaxtype.keyword>private</syntaxtype.keyword>(set) <syntaxtype.keyword>public</syntaxtype.keyword> <syntaxtype.keyword>var
 
-// RUN: %sourcekitd-test -req=cursor -pos=129:5 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK57
+// RUN: %sourcekitd-test -req=cursor -pos=129:5 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK57
 // CHECK57: source.lang.swift.decl.var.global (129:5-129:14)
 // CHECK57: <decl.var.global><syntaxtype.keyword>let</syntaxtype.keyword> <decl.name>tupleVar1</decl.name>: <decl.var.type><tuple>(<tuple.element><tuple.element.type><tuple>(<tuple.element><tuple.element.type><tuple>(<tuple.element><tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>)</tuple></tuple.element.type></tuple.element>, <tuple.element><tuple.element.argument_label>y</tuple.element.argument_label>: <tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>)</tuple></tuple.element.type></tuple.element>, <tuple.element><tuple.element.argument_label>z</tuple.element.argument_label>: <tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>)</tuple></decl.var.type></decl.var.global>
 
-// RUN: %sourcekitd-test -req=cursor -pos=130:5 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK58
+// RUN: %sourcekitd-test -req=cursor -pos=130:5 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK58
 // CHECK58: source.lang.swift.decl.var.global (130:5-130:14)
 // CHECK58: <decl.var.global><syntaxtype.keyword>let</syntaxtype.keyword> <decl.name>tupleVar2</decl.name>: <decl.var.type><tuple>(<tuple.element><tuple.element.argument_label>f</tuple.element.argument_label>: <tuple.element.type>() -&gt; <decl.function.returntype><tuple>()</tuple></decl.function.returntype></tuple.element.type></tuple.element>, <tuple.element><tuple.element.argument_label>g</tuple.element.argument_label>: <tuple.element.type>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>x</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype></tuple.element.type></tuple.element>)</tuple></decl.var.type></decl.var.global>
 
-// RUN: %sourcekitd-test -req=cursor -pos=131:5 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK59
+// RUN: %sourcekitd-test -req=cursor -pos=131:5 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK59
 // CHECK59: source.lang.swift.decl.var.global (131:5-131:14)
 // CHECK59: <decl.var.global><syntaxtype.keyword>let</syntaxtype.keyword> <decl.name>tupleVar3</decl.name>: <decl.var.type><tuple>(<tuple.element><tuple.element.argument_label>f</tuple.element.argument_label>: <tuple.element.type>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>x</decl.var.parameter.name>: <decl.var.parameter.type><syntaxtype.keyword>inout</syntaxtype.keyword> <tuple>(<tuple.element><tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>)</tuple></decl.var.parameter.type></decl.var.parameter>) <syntaxtype.keyword>throws</syntaxtype.keyword> -&gt; <decl.function.returntype><tuple>()</tuple></decl.function.returntype></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>)</tuple></decl.var.type></decl.var.global>
 
-// RUN: %sourcekitd-test -req=cursor -pos=134:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK60
+// RUN: %sourcekitd-test -req=cursor -pos=134:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK60
 // CHECK60: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>A</decl.name> = <syntaxtype.number>-1</syntaxtype.number></decl.enumelement>
-// RUN: %sourcekitd-test -req=cursor -pos=135:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK61
+// RUN: %sourcekitd-test -req=cursor -pos=135:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK61
 // CHECK61: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>B</decl.name> = <syntaxtype.number>0</syntaxtype.number></decl.enumelement>
-// RUN: %sourcekitd-test -req=cursor -pos=136:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK62
+// RUN: %sourcekitd-test -req=cursor -pos=136:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK62
 // CHECK62: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>C</decl.name> = <syntaxtype.number>1</syntaxtype.number></decl.enumelement>
 
-// RUN: %sourcekitd-test -req=cursor -pos=142:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK63
+// RUN: %sourcekitd-test -req=cursor -pos=142:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK63
 // CHECK63: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>A</decl.name> = <syntaxtype.number>-0.0</syntaxtype.number></decl.enumelement>
-// RUN: %sourcekitd-test -req=cursor -pos=143:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK64
+// RUN: %sourcekitd-test -req=cursor -pos=143:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK64
 // CHECK64: <decl.enumelement><syntaxtype.keyword>case</syntaxtype.keyword> <decl.name>B</decl.name> = <syntaxtype.number>1e10</syntaxtype.number></decl.enumelement>
 
-// RUN: %sourcekitd-test -req=cursor -pos=146:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK65
+// RUN: %sourcekitd-test -req=cursor -pos=146:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK65
 // CHECK65: <decl.class><syntaxtype.keyword>class</syntaxtype.keyword> <decl.name>C6</decl.name> : C4, <ref.protocol usr="s:P11cursor_info2P1">P1</ref.protocol></decl.class>
 // FIXME: ref.class - rdar://problem/25014968
 
-// RUN: %sourcekitd-test -req=cursor -pos=150:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK66
+// RUN: %sourcekitd-test -req=cursor -pos=150:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK66
 // CHECK66: <decl.protocol><syntaxtype.keyword>protocol</syntaxtype.keyword> <decl.name>P2</decl.name> :  <syntaxtype.keyword>class</syntaxtype.keyword>, <ref.protocol usr="s:P11cursor_info2P1">P1</ref.protocol></decl.protocol>
 
-// RUN: %sourcekitd-test -req=cursor -pos=114:18 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK67
+// RUN: %sourcekitd-test -req=cursor -pos=114:18 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK67
 // CHECK67: source.lang.swift.decl.associatedtype (114:18-114:19)
 // CHECK67-NEXT: T
 // CHECK67-NEXT: s:P11cursor_info2P11T
@@ -592,7 +592,7 @@
 // CHECK67: <Declaration>associatedtype T</Declaration>
 // CHECK67-NEXT: <decl.associatedtype><syntaxtype.keyword>associatedtype</syntaxtype.keyword> <decl.name>T</decl.name></decl.associatedtype>
 
-// RUN: %sourcekitd-test -req=cursor -pos=152:11 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK68
+// RUN: %sourcekitd-test -req=cursor -pos=152:11 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK68
 // CHECK68: source.lang.swift.decl.typealias (152:11-152:18)
 // CHECK68-NEXT: MyAlias
 // CHECK68-NEXT: s:11cursor_info7MyAlias
@@ -600,7 +600,7 @@
 // CHECK68: <Declaration>typealias MyAlias&lt;T, U&gt; = (<Type usr="{{.*}}">T</Type>, <Type usr="{{.*}}">U</Type>, <Type usr="{{.*}}">T</Type>, <Type usr="{{.*}}">U</Type>)</Declaration>
 // CHECK68-NEXT: <decl.typealias><syntaxtype.keyword>typealias</syntaxtype.keyword> <decl.name>MyAlias</decl.name>&lt;<decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>T</decl.generic_type_param.name></decl.generic_type_param>, <decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>U</decl.generic_type_param.name></decl.generic_type_param>&gt; = <tuple>(<tuple.element><tuple.element.type><ref.generic_type_param usr="{{.*}}">T</ref.generic_type_param></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.generic_type_param usr="{{.*}}">U</ref.generic_type_param></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.generic_type_param usr="{{.*}}">T</ref.generic_type_param></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.generic_type_param usr="{{.*}}">U</ref.generic_type_param></tuple.element.type></tuple.element>)</tuple></decl.typealias>
 
-// RUN: %sourcekitd-test -req=cursor -pos=153:28 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK69
+// RUN: %sourcekitd-test -req=cursor -pos=153:28 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK69
 // CHECK69: source.lang.swift.ref.typealias (152:11-152:18)
 // CHECK69-NEXT: MyAlias
 // CHECK69-NEXT: s:11cursor_info7MyAlias
@@ -608,16 +608,16 @@
 // CHECK69: <Declaration>typealias MyAlias&lt;T, U&gt; = (<Type usr="{{.*}}">T</Type>, <Type usr="{{.*}}">U</Type>, <Type usr="{{.*}}">T</Type>, <Type usr="{{.*}}">U</Type>)</Declaration>
 // CHECK69-NEXT: <decl.typealias><syntaxtype.keyword>typealias</syntaxtype.keyword> <decl.name>MyAlias</decl.name>&lt;<decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>T</decl.generic_type_param.name></decl.generic_type_param>, <decl.generic_type_param usr="{{.*}}"><decl.generic_type_param.name>U</decl.generic_type_param.name></decl.generic_type_param>&gt; = <tuple>(<tuple.element><tuple.element.type><ref.generic_type_param usr="{{.*}}">T</ref.generic_type_param></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.generic_type_param usr="{{.*}}">U</ref.generic_type_param></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.generic_type_param usr="{{.*}}">T</ref.generic_type_param></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.generic_type_param usr="{{.*}}">U</ref.generic_type_param></tuple.element.type></tuple.element>)</tuple></decl.typealias>
 
-// RUN: %sourcekitd-test -req=cursor -pos=155:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK70
+// RUN: %sourcekitd-test -req=cursor -pos=155:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK70
 // CHECK70: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>paramAutoclosureNoescape1</decl.name>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>msg</decl.var.parameter.name>: <decl.var.parameter.type>() -&gt; <decl.function.returntype><ref.struct usr="s:SS">String</ref.struct></decl.function.returntype></decl.var.parameter.type></decl.var.parameter>)</decl.function.free>
 
-// RUN: %sourcekitd-test -req=cursor -pos=156:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK71
+// RUN: %sourcekitd-test -req=cursor -pos=156:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK71
 // CHECK71: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>paramAutoclosureNoescape2</decl.name>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>msg</decl.var.parameter.name>: <decl.var.parameter.type><syntaxtype.attribute.name>@autoclosure</syntaxtype.attribute.name> () -&gt; <decl.function.returntype><ref.struct usr="s:SS">String</ref.struct></decl.function.returntype></decl.var.parameter.type></decl.var.parameter>)</decl.function.free>
 
-// RUN: %sourcekitd-test -req=cursor -pos=157:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK72
+// RUN: %sourcekitd-test -req=cursor -pos=157:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK72
 // CHECK72: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>paramAutoclosureNoescape3</decl.name>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>msg</decl.var.parameter.name>: <decl.var.parameter.type><syntaxtype.attribute.name>@autoclosure</syntaxtype.attribute.name> <syntaxtype.attribute.name>@escaping</syntaxtype.attribute.name> () -&gt; <decl.function.returntype><ref.struct usr="s:SS">String</ref.struct></decl.function.returntype></decl.var.parameter.type></decl.var.parameter>)</decl.function.free>
 
-// RUN: %sourcekitd-test -req=cursor -pos=159:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK73
+// RUN: %sourcekitd-test -req=cursor -pos=159:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK73
 // CHECK73: <decl.function.free>
 // CHECK73-SAME: = <syntaxtype.keyword>#function</syntaxtype.keyword>
 // CHECK73-SAME: = <syntaxtype.keyword>#file</syntaxtype.keyword>
@@ -631,14 +631,14 @@
 // CHECK73-SAME: = <syntaxtype.keyword>default</syntaxtype.keyword>
 // CHECK73-SAME: = <syntaxtype.keyword>default</syntaxtype.keyword>
 
-// RUN: %sourcekitd-test -req=cursor -pos=162:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK74
+// RUN: %sourcekitd-test -req=cursor -pos=162:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK74
 // CHECK74: source.lang.swift.decl.function.method.instance (162:8-162:20)
 // CHECK74: <Self : P3> (Self) -> (Self) -> Self
 // CHECK74: <Declaration>func f(_ s: <Type usr="s:tP11cursor_info2P34SelfMx">Self</Type>) -&gt; <Type usr="s:tP11cursor_info2P34SelfMx">Self</Type></Declaration>
 // CHECK74: <decl.var.parameter.type><ref.generic_type_param usr="s:tP11cursor_info2P34SelfMx">Self</ref.generic_type_param></decl.var.parameter.type>
 // CHECK74-SAME: <decl.function.returntype><ref.generic_type_param usr="s:tP11cursor_info2P34SelfMx">Self</ref.generic_type_param></decl.function.returntype>
 
-// RUN: %sourcekitd-test -req=cursor -pos=165:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK75
+// RUN: %sourcekitd-test -req=cursor -pos=165:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK75
 // CHECK75: source.lang.swift.decl.function.method.instance (165:8-165:20)
 // CHECK75: <Self : P3> (Self) -> (Self) -> Self
 // CHECK75: <Declaration>func f(_ s: <Type usr="s:tE11cursor_infoPS_2P34SelfMx">Self</Type>) -&gt; <Type usr="s:tP11cursor_info2P34SelfMx">Self</Type></Declaration>
@@ -646,41 +646,41 @@
 // CHECK75-SAME: <decl.function.returntype><ref.generic_type_param usr="s:tP11cursor_info2P34SelfMx">Self</ref.generic_type_param></decl.function.returntype>
 // FIXME: the return type gets the USR for the original protocol, rather than the extension.
 
-// RUN: %sourcekitd-test -req=cursor -pos=169:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck %s -check-prefix=CHECK76
+// RUN: %sourcekitd-test -req=cursor -pos=169:8 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck %s -check-prefix=CHECK76
 // CHECK76: source.lang.swift.decl.function.method.instance (169:8-169:11)
 // CHECK76: (Self) -> () -> Self
 // CHECK76: <Declaration>func f() -&gt; <Type usr="s:C11cursor_info2C7">Self</Type></Declaration>
 // CHECK76: <decl.function.returntype><ref.class usr="s:C11cursor_info2C7">Self</ref.class></decl.function.returntype>
 
-// RUN: %sourcekitd-test -req=cursor -pos=188:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK77 %s
-// RUN: %sourcekitd-test -req=cursor -pos=189:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK78 %s
+// RUN: %sourcekitd-test -req=cursor -pos=188:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK77 %s
+// RUN: %sourcekitd-test -req=cursor -pos=189:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK78 %s
 
 // CHECK77: foo1 comment from P4
 // CHECK78: foo2 comment from C1
 
-// RUN: %sourcekitd-test -req=cursor -pos=192:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK79 %s
+// RUN: %sourcekitd-test -req=cursor -pos=192:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK79 %s
 // CHECK79: <decl.var.parameter><decl.var.parameter.argument_label>t</decl.var.parameter.argument_label>:
 // CHECK79-SAME: <decl.var.parameter.type><tuple>(
 // CHECK79-SAME:   <tuple.element><tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>,
 // CHECK79-SAME:   <tuple.element><tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>
 // CHECK79-SAME: )</tuple></decl.var.parameter.type></decl.var.parameter>
 
-// RUN: %sourcekitd-test -req=cursor -pos=193:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK80 %s
+// RUN: %sourcekitd-test -req=cursor -pos=193:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK80 %s
 // CHECK80: <decl.var.parameter.type><tuple>()</tuple>
 
-// RUN: %sourcekitd-test -req=cursor -pos=194:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK81 %s
+// RUN: %sourcekitd-test -req=cursor -pos=194:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK81 %s
 // CHECK81: <decl.var.parameter.type>() -&gt; <decl.function.returntype><tuple>()</tuple></decl.function.returntype></decl.var.parameter.type>
 
-// RUN: %sourcekitd-test -req=cursor -pos=195:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK82 %s
+// RUN: %sourcekitd-test -req=cursor -pos=195:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK82 %s
 // CHECK82: <decl.function.returntype><tuple>(<tuple.element><tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>, <tuple.element><tuple.element.type><ref.struct usr="s:Si">Int</ref.struct></tuple.element.type></tuple.element>)</tuple>
 
-// RUN: %sourcekitd-test -req=cursor -pos=196:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK83 %s
+// RUN: %sourcekitd-test -req=cursor -pos=196:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK83 %s
 // CHECK83: <decl.var.parameter.type>() -&gt; <decl.function.returntype><ref.typealias usr="s:s4Void">Void</ref.typealias>
 
-// RUN: %sourcekitd-test -req=cursor -pos=197:11 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK84 %s
+// RUN: %sourcekitd-test -req=cursor -pos=197:11 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK84 %s
 // CHECK84: <decl.typealias><syntaxtype.keyword>typealias</syntaxtype.keyword> <decl.name>MyVoid</decl.name> = <tuple>()</tuple></decl.typealias>
 
-// RUN: %sourcekitd-test -req=cursor -pos=199:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK85 %s
+// RUN: %sourcekitd-test -req=cursor -pos=199:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | %FileCheck -check-prefix=CHECK85 %s
 // CHECK85-NOT: @rethrows
 // CHECK85: <Declaration>func rethrowingFunction1({{.*}}) rethrows</Declaration>
 // CHECK85-NOT: @rethrows
diff --git a/test/SourceKit/CursorInfo/cursor_info_async.swift b/test/SourceKit/CursorInfo/cursor_info_async.swift
index 29b34c1..902b0c5 100644
--- a/test/SourceKit/CursorInfo/cursor_info_async.swift
+++ b/test/SourceKit/CursorInfo/cursor_info_async.swift
@@ -14,7 +14,7 @@
 // RUN:   == -async -dont-print-request -req=cursor -pos=60:15 \
 // RUN:   == -async -dont-print-request -req=cursor -pos=60:15 \
 // RUN:   == -async -dont-print-request -req=cursor -pos=60:15 \
-// RUN:   == -async -dont-print-request -req=cursor -pos=60:15 | FileCheck %s -check-prefix=CHECK-FOO
+// RUN:   == -async -dont-print-request -req=cursor -pos=60:15 | %FileCheck %s -check-prefix=CHECK-FOO
 
 // CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions
 // CHECK-FOO: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>FooRuncingOptions
diff --git a/test/SourceKit/CursorInfo/cursor_info_container.swift b/test/SourceKit/CursorInfo/cursor_info_container.swift
index 7e17c6b..c6570f4 100644
--- a/test/SourceKit/CursorInfo/cursor_info_container.swift
+++ b/test/SourceKit/CursorInfo/cursor_info_container.swift
@@ -39,30 +39,30 @@
 
 func SArrayGen() -> [S] { return [] }
 
-// RUN: %sourcekitd-test -req=cursor -pos=24:12 %s -- %s | FileCheck -check-prefix=CHECK1 %s
-// RUN: %sourcekitd-test -req=cursor -pos=25:12 %s -- %s | FileCheck -check-prefix=CHECK1 %s
-// RUN: %sourcekitd-test -req=cursor -pos=34:19 %s -- %s | FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=24:12 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=25:12 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=34:19 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
 // CHECK1: <Container>_TtV21cursor_info_container1S</Container>
 
-// RUN: %sourcekitd-test -req=cursor -pos=26:12 %s -- %s | FileCheck -check-prefix=CHECK2 %s
+// RUN: %sourcekitd-test -req=cursor -pos=26:12 %s -- %s | %FileCheck -check-prefix=CHECK2 %s
 // CHECK2: <Container>_TtMV21cursor_info_container1S</Container>
 
-// RUN: %sourcekitd-test -req=cursor -pos=27:12 %s -- %s | FileCheck -check-prefix=CHECK3 %s
-// RUN: %sourcekitd-test -req=cursor -pos=28:12 %s -- %s | FileCheck -check-prefix=CHECK3 %s
-// RUN: %sourcekitd-test -req=cursor -pos=35:19 %s -- %s | FileCheck -check-prefix=CHECK3 %s
+// RUN: %sourcekitd-test -req=cursor -pos=27:12 %s -- %s | %FileCheck -check-prefix=CHECK3 %s
+// RUN: %sourcekitd-test -req=cursor -pos=28:12 %s -- %s | %FileCheck -check-prefix=CHECK3 %s
+// RUN: %sourcekitd-test -req=cursor -pos=35:19 %s -- %s | %FileCheck -check-prefix=CHECK3 %s
 // CHECK3: <Container>_TtC21cursor_info_container1C</Container>
 
-// RUN: %sourcekitd-test -req=cursor -pos=29:12 %s -- %s | FileCheck -check-prefix=CHECK4 %s
+// RUN: %sourcekitd-test -req=cursor -pos=29:12 %s -- %s | %FileCheck -check-prefix=CHECK4 %s
 // CHECK4: <Container>_TtMC21cursor_info_container1C</Container>
 
-// RUN: %sourcekitd-test -req=cursor -pos=30:12 %s -- %s | FileCheck -check-prefix=CHECK5 %s
-// RUN: %sourcekitd-test -req=cursor -pos=31:12 %s -- %s | FileCheck -check-prefix=CHECK5 %s
-// RUN: %sourcekitd-test -req=cursor -pos=36:19 %s -- %s | FileCheck -check-prefix=CHECK5 %s
+// RUN: %sourcekitd-test -req=cursor -pos=30:12 %s -- %s | %FileCheck -check-prefix=CHECK5 %s
+// RUN: %sourcekitd-test -req=cursor -pos=31:12 %s -- %s | %FileCheck -check-prefix=CHECK5 %s
+// RUN: %sourcekitd-test -req=cursor -pos=36:19 %s -- %s | %FileCheck -check-prefix=CHECK5 %s
 // CHECK5: <Container>_TtO21cursor_info_container1E</Container>
 
-// RUN: %sourcekitd-test -req=cursor -pos=32:12 %s -- %s | FileCheck -check-prefix=CHECK6 %s
-// RUN: %sourcekitd-test -req=cursor -pos=33:12 %s -- %s | FileCheck -check-prefix=CHECK6 %s
+// RUN: %sourcekitd-test -req=cursor -pos=32:12 %s -- %s | %FileCheck -check-prefix=CHECK6 %s
+// RUN: %sourcekitd-test -req=cursor -pos=33:12 %s -- %s | %FileCheck -check-prefix=CHECK6 %s
 // CHECK6: <Container>_TtMO21cursor_info_container1E</Container>
 
-// RUN: %sourcekitd-test -req=cursor -pos=37:22 %s -- %s | FileCheck -check-prefix=CHECK7 %s
+// RUN: %sourcekitd-test -req=cursor -pos=37:22 %s -- %s | %FileCheck -check-prefix=CHECK7 %s
 // CHECK7: <Container>_TtGSaV21cursor_info_container1S_</Container>
diff --git a/test/SourceKit/CursorInfo/cursor_invalid.swift b/test/SourceKit/CursorInfo/cursor_invalid.swift
index fb8b716..846d55a 100644
--- a/test/SourceKit/CursorInfo/cursor_invalid.swift
+++ b/test/SourceKit/CursorInfo/cursor_invalid.swift
@@ -22,40 +22,40 @@
 
 func resyncParser2() {}
 
-// RUN: %sourcekitd-test -req=cursor -pos=4:13 %s -- %s | FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=4:13 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
 // CHECK1: source.lang.swift.decl.var.local (4:13-4:14)
 // CHECK1: c
 // CHECK1: <Declaration>let c</Declaration>
 // CHECK1: OVERRIDES BEGIN
 // CHECK1: OVERRIDES END
 
-// RUN: %sourcekitd-test -req=cursor -pos=13:10 %s -- %s | FileCheck -check-prefix=CHECK2 %s
+// RUN: %sourcekitd-test -req=cursor -pos=13:10 %s -- %s | %FileCheck -check-prefix=CHECK2 %s
 // CHECK2: source.lang.swift.decl.class (13:9-13:20)
 // CHECK2: MyCoolClass
 // CHECK2: <Declaration>class MyCoolClass : Undeclared</Declaration>
 
-// RUN: %sourcekitd-test -req=cursor -pos=7:7 %s -- %s | FileCheck -check-prefix=CHECK3 %s
+// RUN: %sourcekitd-test -req=cursor -pos=7:7 %s -- %s | %FileCheck -check-prefix=CHECK3 %s
 // CHECK3: source.lang.swift.decl.var.instance (7:7-7:11)
 // CHECK3: over
 // CHECK3: <Declaration>var over{{.*}}</Declaration>
 
-// RUN: %sourcekitd-test -req=cursor -pos=8:7 %s -- %s | FileCheck -check-prefix=CHECK4 %s
+// RUN: %sourcekitd-test -req=cursor -pos=8:7 %s -- %s | %FileCheck -check-prefix=CHECK4 %s
 // CHECK4: source.lang.swift.decl.var.instance (8:7-8:10)
 // CHECK4: bad
 // CHECK4: <Declaration>var bad: IDontExist</Declaration>
 
-// RUN: %sourcekitd-test -req=cursor -pos=7:12 %s -- %s | FileCheck -check-prefix=EMPTY %s
-// RUN: %sourcekitd-test -req=cursor -pos=9:7 %s -- %s | FileCheck -check-prefix=EMPTY %s
+// RUN: %sourcekitd-test -req=cursor -pos=7:12 %s -- %s | %FileCheck -check-prefix=EMPTY %s
+// RUN: %sourcekitd-test -req=cursor -pos=9:7 %s -- %s | %FileCheck -check-prefix=EMPTY %s
 // EMPTY: <empty cursor info>
 
-// RUN: %sourcekitd-test -req=cursor -pos=18:6 %s -- %s | FileCheck -check-prefix=EQEQ1 %s
-// RUN: %sourcekitd-test -req=cursor -pos=19:6 %s -- %s | FileCheck -check-prefix=EQEQ1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=18:6 %s -- %s | %FileCheck -check-prefix=EQEQ1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=19:6 %s -- %s | %FileCheck -check-prefix=EQEQ1 %s
 // Note: we can't find the operator decl so the decl kind is a fallback.
 // EQEQ1: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>==</decl.name>()
 
-// RUN: %sourcekitd-test -req=cursor -pos=20:6 %s -- %s | FileCheck -check-prefix=EQEQ2 %s
+// RUN: %sourcekitd-test -req=cursor -pos=20:6 %s -- %s | %FileCheck -check-prefix=EQEQ2 %s
 // Note: we can't find the operator decl so the decl kind is a fallback.
 // EQEQ2: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>==</decl.name>(<decl.var.parameter><decl.var.parameter.name>x</decl.var.parameter.name>: <decl.var.parameter.type><ref.class usr="s:C14cursor_invalid1C">C</ref.class></decl.var.parameter.type></decl.var.parameter>)</decl.function.free>
 
-// RUN: %sourcekitd-test -req=cursor -pos=21:6 %s -- %s | FileCheck -check-prefix=EQEQ3 %s
+// RUN: %sourcekitd-test -req=cursor -pos=21:6 %s -- %s | %FileCheck -check-prefix=EQEQ3 %s
 // EQEQ3: <decl.function.operator.infix><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>==</decl.name>(<decl.var.parameter><decl.var.parameter.name>x</decl.var.parameter.name>: <decl.var.parameter.type><ref.class usr="s:C14cursor_invalid1C">C</ref.class></decl.var.parameter.type></decl.var.parameter>, <decl.var.parameter><decl.var.parameter.name>y</decl.var.parameter.name>: <decl.var.parameter.type><ref.class usr="s:C14cursor_invalid1C">C</ref.class></decl.var.parameter.type></decl.var.parameter>)</decl.function.operator.infix>
diff --git a/test/SourceKit/CursorInfo/cursor_overrides.swift b/test/SourceKit/CursorInfo/cursor_overrides.swift
index b74c559..600a7f6 100644
--- a/test/SourceKit/CursorInfo/cursor_overrides.swift
+++ b/test/SourceKit/CursorInfo/cursor_overrides.swift
@@ -17,7 +17,7 @@
 }
 
 // REQUIRES: objc_interop
-// RUN: %sourcekitd-test -req=cursor -pos=16:7 %s -- -embed-bitcode -I %S/Inputs/cursor-overrides %mcp_opt %s | FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=16:7 %s -- -embed-bitcode -I %S/Inputs/cursor-overrides %mcp_opt %s | %FileCheck -check-prefix=CHECK1 %s
 // CHECK1: source.lang.swift.ref.function.method.instance (12:8-12:14)
 // CHECK1: s:FC16cursor_overrides6SubCls4methFT_T_
 // CHECK1: (SubCls) -> () -> ()
diff --git a/test/SourceKit/CursorInfo/cursor_stdlib.swift b/test/SourceKit/CursorInfo/cursor_stdlib.swift
index 4e1bafa..f2da082 100644
--- a/test/SourceKit/CursorInfo/cursor_stdlib.swift
+++ b/test/SourceKit/CursorInfo/cursor_stdlib.swift
@@ -21,7 +21,7 @@
 import Swift
 func foo3(a: Float, b: Bool) {}
 
-// RUN: %sourcekitd-test -req=cursor -pos=3:18 %s -- %s %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-OVERLAY %s
+// RUN: %sourcekitd-test -req=cursor -pos=3:18 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-OVERLAY %s
 // CHECK-OVERLAY:      source.lang.swift.ref.var.global
 // CHECK-OVERLAY-NEXT: NSUTF8StringEncoding
 // CHECK-OVERLAY-NEXT: s:v10Foundation20NSUTF8StringEncodingSu
@@ -29,11 +29,11 @@
 // CHECK-OVERLAY-NEXT: _TtSu
 // CHECK-OVERLAY-NEXT: <Declaration>public let NSUTF8StringEncoding: <Type usr="s:Su">UInt</Type></Declaration>
 
-// RUN: %sourcekitd-test -req=cursor -pos=5:13 %s -- %s %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-ITERATOR %s
+// RUN: %sourcekitd-test -req=cursor -pos=5:13 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-ITERATOR %s
 // CHECK-ITERATOR-NOT: _AnyIteratorBase
 // CHECK-ITERATOR: <Group>Collection/Type-erased</Group>
 
-// RUN: %sourcekitd-test -req=cursor -pos=8:10 %s -- %s %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-REPLACEMENT1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=8:10 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-REPLACEMENT1 %s
 // CHECK-REPLACEMENT1: <Group>Collection/Array</Group>
 // CHECK-REPLACEMENT1: <Declaration>func sorted() -&gt; [<Type usr="s:Si">Int</Type>]</Declaration>
 // CHECK-REPLACEMENT1: RELATED BEGIN
@@ -42,30 +42,30 @@
 // CHECK-REPLACEMENT1: sorted(by: (Int, Int) -&gt; Bool) -&gt; [Int]</RelatedName>
 // CHECK-REPLACEMENT1: RELATED END
 
-// RUN: %sourcekitd-test -req=cursor -pos=9:8 %s -- %s %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-REPLACEMENT2 %s
+// RUN: %sourcekitd-test -req=cursor -pos=9:8 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-REPLACEMENT2 %s
 // CHECK-REPLACEMENT2: <Group>Collection/Array</Group>
 // CHECK-REPLACEMENT2: <Declaration>mutating func append(_ newElement: <Type usr="s:Si">Int</Type>)</Declaration>
 
-// RUN: %sourcekitd-test -req=cursor -pos=15:10 %s -- %s %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-REPLACEMENT3 %s
+// RUN: %sourcekitd-test -req=cursor -pos=15:10 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-REPLACEMENT3 %s
 // CHECK-REPLACEMENT3: <Group>Collection/Array</Group>
 // CHECK-REPLACEMENT3: func sorted(by areInIncreasingOrder: (<Type usr="s:V13cursor_stdlib2S1">S1</Type>
 // CHECK-REPLACEMENT3: sorted() -&gt; [S1]</RelatedName>
 // CHECK-REPLACEMENT3: sorted() -&gt; [S1]</RelatedName>
 // CHECK-REPLACEMENT3: sorted(by: (S1, S1) -&gt; Bool) -&gt; [S1]</RelatedName>
 
-// RUN: %sourcekitd-test -req=cursor -pos=18:8 %s -- %s %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-REPLACEMENT4 %s
+// RUN: %sourcekitd-test -req=cursor -pos=18:8 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-REPLACEMENT4 %s
 // CHECK-REPLACEMENT4: <Group>Collection/Array</Group>
 // CHECK-REPLACEMENT4: <Declaration>mutating func append(_ newElement: <Type usr="s:V13cursor_stdlib2S1">S1</Type>)</Declaration>
 
-// RUN: %sourcekitd-test -req=cursor -pos=21:10 %s -- %s %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-MODULE-GROUP1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=21:10 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-MODULE-GROUP1 %s
 // CHECK-MODULE-GROUP1: MODULE GROUPS BEGIN
 // CHECK-MODULE-GROUP1-DAG: Math
 // CHECK-MODULE-GROUP1-DAG: Collection
 // CHECK-MODULE-GROUP1-DAG: Collection/Array
 // CHECK-MODULE-GROUP1: MODULE GROUPS END
 
-// RUN: %sourcekitd-test -req=cursor -pos=22:17 %s -- %s %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-FLOAT1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=22:17 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-FLOAT1 %s
 // CHECK-FLOAT1: s:Sf
 
-// RUN: %sourcekitd-test -req=cursor -pos=22:25 %s -- %s %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-BOOL1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=22:25 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-BOOL1 %s
 // CHECK-BOOL1: s:Sb
diff --git a/test/SourceKit/CursorInfo/cursor_symlink.swift b/test/SourceKit/CursorInfo/cursor_symlink.swift
index 936b65a..5bd17a4 100644
--- a/test/SourceKit/CursorInfo/cursor_symlink.swift
+++ b/test/SourceKit/CursorInfo/cursor_symlink.swift
@@ -2,8 +2,8 @@
 // RUN: mkdir %t.dir
 // RUN: echo "let foo = 0" > %t.dir/real.swift
 // RUN: ln -s %t.dir/real.swift %t.dir/linked.swift
-// RUN: %sourcekitd-test -req=cursor -pos=1:5 %t.dir/linked.swift -- %t.dir/real.swift | FileCheck %s
-// RUN: %sourcekitd-test -req=cursor -pos=1:5 %t.dir/real.swift -- %t.dir/linked.swift | FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=1:5 %t.dir/linked.swift -- %t.dir/real.swift | %FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=1:5 %t.dir/real.swift -- %t.dir/linked.swift | %FileCheck %s
 
 // CHECK: source.lang.swift.decl.var.global (1:5-1:8)
 // CHECK: foo
diff --git a/test/SourceKit/CursorInfo/cursor_unavailable.swift b/test/SourceKit/CursorInfo/cursor_unavailable.swift
index d63e6e3..7bbf539 100644
--- a/test/SourceKit/CursorInfo/cursor_unavailable.swift
+++ b/test/SourceKit/CursorInfo/cursor_unavailable.swift
@@ -1,8 +1,8 @@
 print("")
 find([1,2,3],1)
 
-// RUN: %sourcekitd-test -req=cursor -pos=1:1 %s -- %s | FileCheck -check-prefix=CHECK1 %s
-// RUN: %sourcekitd-test -req=cursor -pos=2:1 %s -- %s | FileCheck -check-prefix=CHECK2 %s
+// RUN: %sourcekitd-test -req=cursor -pos=1:1 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=cursor -pos=2:1 %s -- %s | %FileCheck -check-prefix=CHECK2 %s
 
 // CHECK1: source.lang.swift.ref.function.free
 // CHECK2-NOT: source.lang.swift.ref.function.free
diff --git a/test/SourceKit/CursorInfo/cursor_usr.swift b/test/SourceKit/CursorInfo/cursor_usr.swift
index 70f2def..018a96a 100644
--- a/test/SourceKit/CursorInfo/cursor_usr.swift
+++ b/test/SourceKit/CursorInfo/cursor_usr.swift
@@ -15,8 +15,8 @@
 // Sanity check that we have identical responses when things work.
 // RUN: %sourcekitd-test -req=cursor -pos=5:5 %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s > %t.from_offset.txt
 // RUN: %sourcekitd-test -req=cursor -usr "s:v10cursor_usr6globalSi" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s > %t.from_usr.txt
-// RUN: FileCheck %s -check-prefix=CHECK_SANITY1 < %t.from_offset.txt
-// RUN: FileCheck %s -check-prefix=CHECK_SANITY1 < %t.from_usr.txt
+// RUN: %FileCheck %s -check-prefix=CHECK_SANITY1 < %t.from_offset.txt
+// RUN: %FileCheck %s -check-prefix=CHECK_SANITY1 < %t.from_usr.txt
 // RUN: diff -u %t.from_usr.txt %t.from_offset.txt
 // CHECK_SANITY1: source.lang.swift.decl.var.global (5:5-5:11)
 // CHECK_SANITY1-NEXT: global
@@ -27,31 +27,31 @@
 // CHECK_SANITY1-NEXT: <decl.var.global><syntaxtype.keyword>var</syntaxtype.keyword> <decl.name>global</decl.name>: <decl.var.type><ref.struct usr="s:Si">Int</ref.struct></decl.var.type></decl.var.global>
 
 // Bogus USR.
-// RUN: %sourcekitd-test -req=cursor -usr "s:blahblahblah" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | FileCheck %s -check-prefix=EMPTY
+// RUN: %sourcekitd-test -req=cursor -usr "s:blahblahblah" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=EMPTY
 // Missing s: prefix.
-// RUN: %sourcekitd-test -req=cursor -usr "v10cursor_usr6globalSi" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | FileCheck %s -check-prefix=EMPTY
+// RUN: %sourcekitd-test -req=cursor -usr "v10cursor_usr6globalSi" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=EMPTY
 // FIXME: no support for clang USRs.
-// RUN: %sourcekitd-test -req=cursor -usr "c:@S@FooStruct1" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | FileCheck %s -check-prefix=EMPTY
+// RUN: %sourcekitd-test -req=cursor -usr "c:@S@FooStruct1" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=EMPTY
 // EMPTY: <empty cursor info>
 
 // FIXME: missing symbol shows up as some other part of the USR (the type here).
-// RUN: %sourcekitd-test -req=cursor -usr "s:v10cursor_usr11global_noneSi" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | FileCheck %s -check-prefix=SHOULD_BE_EMPTY
+// RUN: %sourcekitd-test -req=cursor -usr "s:v10cursor_usr11global_noneSi" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=SHOULD_BE_EMPTY
 // SHOULD_BE_EMPTY: source.lang.swift.decl.struct ()
 // SHOULD_BE_EMPTY: Int
 
-// RUN: %sourcekitd-test -req=cursor -usr "s:V10cursor_usr2S1" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | FileCheck %s -check-prefix=CHECK1
+// RUN: %sourcekitd-test -req=cursor -usr "s:V10cursor_usr2S1" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=CHECK1
 // CHECK1: source.lang.swift.decl.struct (7:8-7:10)
 // CHECK1: S1
 // CHECK1: <decl.struct><syntaxtype.keyword>struct</syntaxtype.keyword> <decl.name>S1</decl.name></decl.struct>
 
-// RUN: %sourcekitd-test -req=cursor -usr "s:F14FooSwiftModule12fooSwiftFuncFT_Si" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | FileCheck %s -check-prefix=CHECK2
+// RUN: %sourcekitd-test -req=cursor -usr "s:F14FooSwiftModule12fooSwiftFuncFT_Si" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=CHECK2
 // CHECK2: source.lang.swift.decl.function.free ()
 // CHECK2: fooSwiftFunc()
 // CHECK2: () -> Int
 // CHECK2: FooSwiftModule
 // CHECK2: <decl.function.free><syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>fooSwiftFunc</decl.name>() -&gt; <decl.function.returntype><ref.struct usr="s:Si">Int</ref.struct></decl.function.returntype></decl.function.free>
 
-// RUN: %sourcekitd-test -req=cursor -usr "s:F10cursor_usr3fooFVSC10FooStruct1VS_2S1" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | FileCheck %s -check-prefix=CHECK3
+// RUN: %sourcekitd-test -req=cursor -usr "s:F10cursor_usr3fooFVSC10FooStruct1VS_2S1" %s -- -I %t -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %s | %FileCheck %s -check-prefix=CHECK3
 // CHECK3: source.lang.swift.decl.function.free (9:6-9:24)
 // CHECK3: foo(x:)
 // CHECK3: (FooStruct1) -> S1
diff --git a/test/SourceKit/CursorInfo/multiple_ast.swift b/test/SourceKit/CursorInfo/multiple_ast.swift
index c6598dc..7b09d49 100644
--- a/test/SourceKit/CursorInfo/multiple_ast.swift
+++ b/test/SourceKit/CursorInfo/multiple_ast.swift
@@ -1,5 +1,5 @@
 // RUN: %sourcekitd-test -req=cursor -pos=1:8 %S/Inputs/multiple_ast1.swift -- %S/Inputs/multiple_ast1.swift == \
-// RUN:       -req=cursor -pos=1:8 %S/Inputs/multiple_ast2.swift -- %S/Inputs/multiple_ast2.swift | FileCheck -check-prefix=CHECK %s
+// RUN:       -req=cursor -pos=1:8 %S/Inputs/multiple_ast2.swift -- %S/Inputs/multiple_ast2.swift | %FileCheck -check-prefix=CHECK %s
 
 // CHECK:      source.lang.swift.decl.function.free (1:6-1:20)
 // CHECK-NEXT: foo1
diff --git a/test/SourceKit/CursorInfo/rdar_18677108-1.swift b/test/SourceKit/CursorInfo/rdar_18677108-1.swift
index 32ca765..9be3449 100644
--- a/test/SourceKit/CursorInfo/rdar_18677108-1.swift
+++ b/test/SourceKit/CursorInfo/rdar_18677108-1.swift
@@ -1,5 +1,5 @@
 // Checks that we don't crash.
-// RUN: %sourcekitd-test -req=cursor -pos=7:5 %s -- %s | FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=7:5 %s -- %s | %FileCheck %s
 // CHECK: <empty cursor info>
 
 class CameraViewController
diff --git a/test/SourceKit/CursorInfo/rdar_21657000.swift b/test/SourceKit/CursorInfo/rdar_21657000.swift
index 0d129d8..d6e987b 100644
--- a/test/SourceKit/CursorInfo/rdar_21657000.swift
+++ b/test/SourceKit/CursorInfo/rdar_21657000.swift
@@ -3,6 +3,6 @@
   }
 }
 
-// RUN: %sourcekitd-test -req=cursor -pos=2:15 %s -- %s | FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=2:15 %s -- %s | %FileCheck %s
 // CHECK: source.lang.swift.decl.function.method.instance (2:15-2:20)
 // CHECK: foo() 
diff --git a/test/SourceKit/CursorInfo/rdar_21859941.swift b/test/SourceKit/CursorInfo/rdar_21859941.swift
index a4aacb09..a433896 100644
--- a/test/SourceKit/CursorInfo/rdar_21859941.swift
+++ b/test/SourceKit/CursorInfo/rdar_21859941.swift
@@ -1,5 +1,5 @@
 // Checks that we don't crash.
-// RUN: %sourcekitd-test -req=cursor -pos=8:19 %s -- %s | FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=8:19 %s -- %s | %FileCheck %s
 // CHECK: source.lang.swift.decl.function.method.instance
 
 public extension AnyIterator {
diff --git a/test/SourceKit/Demangle/demangle.swift b/test/SourceKit/Demangle/demangle.swift
index 10a1ce2..4e87cef 100644
--- a/test/SourceKit/Demangle/demangle.swift
+++ b/test/SourceKit/Demangle/demangle.swift
@@ -1,18 +1,18 @@
-// RUN: %sourcekitd-test -req=demangle unmangled _TtBf80_  _TtP3foo3bar_ | FileCheck %s
+// RUN: %sourcekitd-test -req=demangle unmangled _TtBf80_  _TtP3foo3bar_ | %FileCheck %s
 // CHECK:      START DEMANGLE
 // CHECK-NEXT: <empty>
 // CHECK-NEXT: Builtin.Float80
 // CHECK-NEXT: foo.bar
 // CHECK-NEXT: END DEMANGLE
 
-// RUN: %sourcekitd-test -req=demangle unmangled _TtBf80_  _TtP3foo3bar_ -simplified-demangling | FileCheck %s -check-prefix=SIMPLIFIED
+// RUN: %sourcekitd-test -req=demangle unmangled _TtBf80_  _TtP3foo3bar_ -simplified-demangling | %FileCheck %s -check-prefix=SIMPLIFIED
 // SIMPLIFIED:      START DEMANGLE
 // SIMPLIFIED-NEXT: <empty>
 // SIMPLIFIED-NEXT: Builtin.Float80
 // SIMPLIFIED-NEXT: bar
 // SIMPLIFIED-NEXT: END DEMANGLE
 
-// RUN: %sourcekitd-test -req=mangle Foo.Baru Swift.Beer | FileCheck %s -check-prefix=MANGLED
+// RUN: %sourcekitd-test -req=mangle Foo.Baru Swift.Beer | %FileCheck %s -check-prefix=MANGLED
 // MANGLED:      START MANGLE
 // MANGLED-NEXT: _TtC3Foo4Baru
 // MANGLED-NEXT: _TtCs4Beer
diff --git a/test/SourceKit/DocSupport/doc_clang_module.swift.response b/test/SourceKit/DocSupport/doc_clang_module.swift.response
index 9819fb9..c568268 100644
--- a/test/SourceKit/DocSupport/doc_clang_module.swift.response
+++ b/test/SourceKit/DocSupport/doc_clang_module.swift.response
@@ -5487,7 +5487,7 @@
         key.name: "insert(_:)",
         key.usr: "s:FesRxs9OptionSetxzwx7ElementrS_6insertFwxS0_T8insertedSb17memberAfterInsertwxS0__::SYNTHESIZED::c:@E@FooRuncingOptions",
         key.original_usr: "s:FesRxs9OptionSetxzwx7ElementrS_6insertFwxS0_T8insertedSb17memberAfterInsertwxS0__",
-        key.doc.full_as_xml: "<Function><Name>insert(_:)</Name><USR>s:FesRxs9OptionSetxzwx7ElementrS_6insertFwxS0_T8insertedSb17memberAfterInsertwxS0__</USR><Declaration>mutating func insert(_ newMember: Self) -&gt; (inserted: Bool, memberAfterInsert: Self)</Declaration><Abstract><Para>Adds the given element to the option set if it is not already a member.</Para></Abstract><Parameters><Parameter><Name>newMember</Name><Direction isExplicit=\"0\">in</Direction><Discussion><Para>The element to insert.</Para></Discussion></Parameter></Parameters><ResultDiscussion><Para><codeVoice>(true, newMember)</codeVoice> if <codeVoice>newMember</codeVoice> was not contained in <codeVoice>self</codeVoice>. Otherwise, returns <codeVoice>(false, oldMember)</codeVoice>, where <codeVoice>oldMember</codeVoice> is the member of the set equal to <codeVoice>newMember</codeVoice>.</Para></ResultDiscussion><Discussion><Para>In the following example, the <codeVoice>.secondDay</codeVoice> shipping option is added to the <codeVoice>freeOptions</codeVoice> option set if <codeVoice>purchasePrice</codeVoice> is greating than 50. For the <codeVoice>ShippingOptions</codeVoice> declaration, see the <codeVoice>OptionSet</codeVoice> protocol discussion.</Para><CodeListing language=\"swift\"><zCodeLineNumbered><![CDATA[let purchasePrice = 87.55]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered><zCodeLineNumbered><![CDATA[var freeOptions: ShippingOptions = [.standard, .priority]]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[if purchasePrice > 50 {]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[    freeOptions.insert(.secondDay)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[}]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(freeOptions.contains(.secondDay))]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"true\"]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered></CodeListing></Discussion></Function>",
+        key.doc.full_as_xml: "<Function><Name>insert(_:)</Name><USR>s:FesRxs9OptionSetxzwx7ElementrS_6insertFwxS0_T8insertedSb17memberAfterInsertwxS0__</USR><Declaration>mutating func insert(_ newMember: Self) -&gt; (inserted: Bool, memberAfterInsert: Self)</Declaration><Abstract><Para>Adds the given element to the option set if it is not already a member.</Para></Abstract><Parameters><Parameter><Name>newMember</Name><Direction isExplicit=\"0\">in</Direction><Discussion><Para>The element to insert.</Para></Discussion></Parameter></Parameters><ResultDiscussion><Para><codeVoice>(true, newMember)</codeVoice> if <codeVoice>newMember</codeVoice> was not contained in <codeVoice>self</codeVoice>. Otherwise, returns <codeVoice>(false, oldMember)</codeVoice>, where <codeVoice>oldMember</codeVoice> is the member of the set equal to <codeVoice>newMember</codeVoice>.</Para></ResultDiscussion><Discussion><Para>In the following example, the <codeVoice>.secondDay</codeVoice> shipping option is added to the <codeVoice>freeOptions</codeVoice> option set if <codeVoice>purchasePrice</codeVoice> is greater than 50.0. For the <codeVoice>ShippingOptions</codeVoice> declaration, see the <codeVoice>OptionSet</codeVoice> protocol discussion.</Para><CodeListing language=\"swift\"><zCodeLineNumbered><![CDATA[let purchasePrice = 87.55]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered><zCodeLineNumbered><![CDATA[var freeOptions: ShippingOptions = [.standard, .priority]]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[if purchasePrice > 50 {]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[    freeOptions.insert(.secondDay)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[}]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(freeOptions.contains(.secondDay))]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"true\"]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered></CodeListing></Discussion></Function>",
         key.offset: 1962,
         key.length: 110,
         key.fully_annotated_decl: "<decl.function.method.instance><syntaxtype.attribute.builtin><syntaxtype.attribute.name>@discardableResult</syntaxtype.attribute.name></syntaxtype.attribute.builtin> <syntaxtype.keyword>mutating</syntaxtype.keyword> <syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>insert</decl.name>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>newMember</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr=\"c:@E@FooRuncingOptions\">FooRuncingOptions</ref.struct></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><tuple>(<tuple.element><tuple.element.argument_label>inserted</tuple.element.argument_label>: <tuple.element.type><ref.struct usr=\"s:Sb\">Bool</ref.struct></tuple.element.type></tuple.element>, <tuple.element><tuple.element.argument_label>memberAfterInsert</tuple.element.argument_label>: <tuple.element.type><ref.struct usr=\"c:@E@FooRuncingOptions\">FooRuncingOptions</ref.struct></tuple.element.type></tuple.element>)</tuple></decl.function.returntype></decl.function.method.instance>",
@@ -5506,7 +5506,7 @@
         key.name: "remove(_:)",
         key.usr: "s:FesRxs9OptionSetxzwx7ElementrS_6removeFwxS0_GSqwxS0__::SYNTHESIZED::c:@E@FooRuncingOptions",
         key.original_usr: "s:FesRxs9OptionSetxzwx7ElementrS_6removeFwxS0_GSqwxS0__",
-        key.doc.full_as_xml: "<Function><Name>remove(_:)</Name><USR>s:FesRxs9OptionSetxzwx7ElementrS_6removeFwxS0_GSqwxS0__</USR><Declaration>mutating func remove(_ member: Self) -&gt; Self?</Declaration><Abstract><Para>Removes the given element and all elements subsumed by the given element.</Para></Abstract><Parameters><Parameter><Name>member</Name><Direction isExplicit=\"0\">in</Direction><Discussion><Para>The element of the set to remove.</Para></Discussion></Parameter></Parameters><ResultDiscussion><Para>The intersection of <codeVoice>[member]</codeVoice> and the set if the intersection was nonempty; otherwise, <codeVoice>nil</codeVoice>.</Para></ResultDiscussion><Discussion><Para>In the following example, the <codeVoice>.priority</codeVoice> shipping option is removed from the <codeVoice>options</codeVoice> option set. Attempting to remove the same shipping option a second time results in <codeVoice>nil</codeVoice>, because <codeVoice>options</codeVoice> no longer contains <codeVoice>.priority</codeVoice> as a member.</Para><CodeListing language=\"swift\"><zCodeLineNumbered><![CDATA[var options: ShippingOptions = [.secondDay, .priority]]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[let priorityOption = options.remove(.priority)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(priorityOption == .priority)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"true\"]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(options.remove(.priority))]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"nil\"]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered></CodeListing><Para>In the next example, the <codeVoice>.express</codeVoice> element is passed to <codeVoice>remove(_:)</codeVoice>. Although <codeVoice>.express</codeVoice> is not a member of <codeVoice>options</codeVoice>, <codeVoice>.express</codeVoice> subsumes the remaining <codeVoice>.secondDay</codeVoice> element of the option set. Therefore, <codeVoice>options</codeVoice> is emptied and the intersection between <codeVoice>.express</codeVoice> and <codeVoice>options</codeVoice> is returned.</Para><CodeListing language=\"swift\"><zCodeLineNumbered><![CDATA[let expressOption = options.remove(.express)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(expressOption == .express)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"false\"]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(expressOption == .secondDay)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"true\"]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered></CodeListing></Discussion></Function>",
+        key.doc.full_as_xml: "<Function><Name>remove(_:)</Name><USR>s:FesRxs9OptionSetxzwx7ElementrS_6removeFwxS0_GSqwxS0__</USR><Declaration>mutating func remove(_ member: Self) -&gt; Self?</Declaration><Abstract><Para>Removes the given element and all elements subsumed by it.</Para></Abstract><Parameters><Parameter><Name>member</Name><Direction isExplicit=\"0\">in</Direction><Discussion><Para>The element of the set to remove.</Para></Discussion></Parameter></Parameters><ResultDiscussion><Para>The intersection of <codeVoice>[member]</codeVoice> and the set, if the intersection was nonempty; otherwise, <codeVoice>nil</codeVoice>.</Para></ResultDiscussion><Discussion><Para>In the following example, the <codeVoice>.priority</codeVoice> shipping option is removed from the <codeVoice>options</codeVoice> option set. Attempting to remove the same shipping option a second time results in <codeVoice>nil</codeVoice>, because <codeVoice>options</codeVoice> no longer contains <codeVoice>.priority</codeVoice> as a member.</Para><CodeListing language=\"swift\"><zCodeLineNumbered><![CDATA[var options: ShippingOptions = [.secondDay, .priority]]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[let priorityOption = options.remove(.priority)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(priorityOption == .priority)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"true\"]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(options.remove(.priority))]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"nil\"]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered></CodeListing><Para>In the next example, the <codeVoice>.express</codeVoice> element is passed to <codeVoice>remove(_:)</codeVoice>. Although <codeVoice>.express</codeVoice> is not a member of <codeVoice>options</codeVoice>, <codeVoice>.express</codeVoice> subsumes the remaining <codeVoice>.secondDay</codeVoice> element of the option set. Therefore, <codeVoice>options</codeVoice> is emptied and the intersection between <codeVoice>.express</codeVoice> and <codeVoice>options</codeVoice> is returned.</Para><CodeListing language=\"swift\"><zCodeLineNumbered><![CDATA[let expressOption = options.remove(.express)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(expressOption == .express)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"false\"]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[print(expressOption == .secondDay)]]></zCodeLineNumbered><zCodeLineNumbered><![CDATA[// Prints \"true\"]]></zCodeLineNumbered><zCodeLineNumbered></zCodeLineNumbered></CodeListing></Discussion></Function>",
         key.offset: 2078,
         key.length: 71,
         key.fully_annotated_decl: "<decl.function.method.instance><syntaxtype.attribute.builtin><syntaxtype.attribute.name>@discardableResult</syntaxtype.attribute.name></syntaxtype.attribute.builtin> <syntaxtype.keyword>mutating</syntaxtype.keyword> <syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>remove</decl.name>(<decl.var.parameter><decl.var.parameter.argument_label>_</decl.var.parameter.argument_label> <decl.var.parameter.name>member</decl.var.parameter.name>: <decl.var.parameter.type><ref.struct usr=\"c:@E@FooRuncingOptions\">FooRuncingOptions</ref.struct></decl.var.parameter.type></decl.var.parameter>) -&gt; <decl.function.returntype><ref.struct usr=\"c:@E@FooRuncingOptions\">FooRuncingOptions</ref.struct>?</decl.function.returntype></decl.function.method.instance>",
diff --git a/test/SourceKit/DocSupport/doc_error_domain.swift b/test/SourceKit/DocSupport/doc_error_domain.swift
index 4c46fd8..39f7bfe 100644
--- a/test/SourceKit/DocSupport/doc_error_domain.swift
+++ b/test/SourceKit/DocSupport/doc_error_domain.swift
@@ -1,7 +1,7 @@
 // REQUIRES: OS=macosx
 // RUN: %sourcekitd-test -req=doc-info -module MyError -- -I %S/Inputs \
 // RUN:         %mcp_opt -sdk %sdk | %sed_clean > %t.response
-// RUN: FileCheck -input-file=%t.response %s
+// RUN: %FileCheck -input-file=%t.response %s
 
 // CHECK: struct MyError {
 // CHECK:     enum Code : Int32 {
diff --git a/test/SourceKit/Indexing/index_module_missing_depend.swift b/test/SourceKit/Indexing/index_module_missing_depend.swift
index 985d7a5..0a33289 100644
--- a/test/SourceKit/Indexing/index_module_missing_depend.swift
+++ b/test/SourceKit/Indexing/index_module_missing_depend.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir -p %t
 // RUN: %swift -emit-module -o %t %S/Inputs/cycle-depend/A.swift -I %S/Inputs/cycle-depend -enable-source-import
 
-// RUN: not %sourcekitd-test -req=index %t/A.swiftmodule -- %t/A.swiftmodule 2>&1 | FileCheck %s
+// RUN: not %sourcekitd-test -req=index %t/A.swiftmodule -- %t/A.swiftmodule 2>&1 | %FileCheck %s
 
 // FIXME: Report the reason we couldn't load a module.
 // CHECK-DISABLED: error response (Request Failed): missing module dependency
diff --git a/test/SourceKit/Indexing/index_swift_lib.swift b/test/SourceKit/Indexing/index_swift_lib.swift
index 648a8d4..16f52a2 100644
--- a/test/SourceKit/Indexing/index_swift_lib.swift
+++ b/test/SourceKit/Indexing/index_swift_lib.swift
@@ -1,14 +1,14 @@
 // REQUIRES: FIXME
 
 // RUN: %sourcekitd-test -req=index %swiftlib_dir/macosx/x86_64/Swift.swiftmodule -- %mcp_opt > %t.txt
-// RUN: FileCheck %s -input-file %t.txt
+// RUN: %FileCheck %s -input-file %t.txt
 
 // CHECK:      key.name: "Dictionary",
 // CHECK-NEXT: key.usr: "s:Vs10Dictionary",
 
-// RUN: FileCheck %s -input-file %t.txt -check-prefix=CHECK-INTERNAL
+// RUN: %FileCheck %s -input-file %t.txt -check-prefix=CHECK-INTERNAL
 // RUN: %sourcekitd-test -req=index %swiftlib_dir/macosx/x86_64/Foundation.swiftmodule -- %clang-importer-sdk %mcp_opt > %t.foundation.txt
-// RUN: FileCheck %s -input-file %t.foundation.txt -check-prefix=CHECK-FOUNDATION
+// RUN: %FileCheck %s -input-file %t.foundation.txt -check-prefix=CHECK-FOUNDATION
 
 // CHECK-INTERNAL-NOT: key.name: "_bridgeToObjectiveCUnconditional",
 
diff --git a/test/SourceKit/Indexing/index_with_clang_module.swift b/test/SourceKit/Indexing/index_with_clang_module.swift
index 7f11b8f..3a84154 100644
--- a/test/SourceKit/Indexing/index_with_clang_module.swift
+++ b/test/SourceKit/Indexing/index_with_clang_module.swift
@@ -1,6 +1,6 @@
 // REQUIRES: objc_interop
 // RUN: %sourcekitd-test -req=index %s -- %s -F %S/../Inputs/libIDE-mock-sdk \
-// RUN:         %mcp_opt %clang-importer-sdk | FileCheck %s
+// RUN:         %mcp_opt %clang-importer-sdk | %FileCheck %s
 
 import Foo
 
diff --git a/test/SourceKit/Indexing/index_with_swift_module.swift b/test/SourceKit/Indexing/index_with_swift_module.swift
index 368209b..0921f35 100644
--- a/test/SourceKit/Indexing/index_with_swift_module.swift
+++ b/test/SourceKit/Indexing/index_with_swift_module.swift
@@ -2,7 +2,7 @@
 // RUN: mkdir -p %t
 // RUN: %swift -emit-module -o %t/test_module.swiftmodule %S/Inputs/test_module.swift
 
-// RUN: %sourcekitd-test -req=index %s -- %s -I %t | FileCheck %s
+// RUN: %sourcekitd-test -req=index %s -- %s -I %t | %FileCheck %s
 
 // RUN: %sourcekitd-test -req=index %t/test_module.swiftmodule | %sed_clean > %t.response
 // RUN: diff -u %S/Inputs/test_module.index.response %t.response
@@ -26,6 +26,6 @@
 // CHECK-NEXT: key.name: "TwoInts"
 // CHECK-NEXT: key.usr: "s:C11test_module7TwoInts"
 
-// RUN: %sourcekitd-test -req=index %S/Inputs/Swift.swiftmodule | FileCheck %s -check-prefix=CHECK-SWIFT1
+// RUN: %sourcekitd-test -req=index %S/Inputs/Swift.swiftmodule | %FileCheck %s -check-prefix=CHECK-SWIFT1
 // CHECK-SWIFT1-DAG: key.groupname: "Bool"
 // CHECK-SWIFT1-DAG: key.groupname: "Collection"
diff --git a/test/SourceKit/InterfaceGen/gen_clang_module.swift b/test/SourceKit/InterfaceGen/gen_clang_module.swift
index 8ebe8fb..d51b91b 100644
--- a/test/SourceKit/InterfaceGen/gen_clang_module.swift
+++ b/test/SourceKit/InterfaceGen/gen_clang_module.swift
@@ -27,13 +27,13 @@
 
 // RUN: %sourcekitd-test -req=interface-gen-open -module Foo -- -I %t.overlays -F %S/../Inputs/libIDE-mock-sdk \
 // RUN:         %mcp_opt %clang-importer-sdk \
-// RUN:      == -req=cursor -pos=203:67 | FileCheck -check-prefix=CHECK1 %s
+// RUN:      == -req=cursor -pos=203:67 | %FileCheck -check-prefix=CHECK1 %s
 // The cursor points to 'FooClassBase' inside the list of base classes, see 'gen_clang_module.swift.response'
 
 // RUN: %sourcekitd-test -req=interface-gen-open -module Foo -- -I %t.overlays -F %S/../Inputs/libIDE-mock-sdk \
 // RUN:         %mcp_opt %clang-importer-sdk \
 // RUN:   == -req=cursor -pos=3:11 %s -- %s -I %t.overlays -F %S/../Inputs/libIDE-mock-sdk \
-// RUN:         %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK1 %s
+// RUN:         %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK1 %s
 
 // CHECK1: source.lang.swift.ref.class ({{.*}}Foo.framework/Headers/Foo.h:146:12-146:24)
 // CHECK1: FooClassBase
@@ -43,7 +43,7 @@
 
 // RUN: %sourcekitd-test -req=interface-gen-open -module Foo -- -I %t.overlays -F %S/../Inputs/libIDE-mock-sdk \
 // RUN:         %mcp_opt %clang-importer-sdk \
-// RUN:      == -req=cursor -pos=230:20 | FileCheck -check-prefix=CHECK2 %s
+// RUN:      == -req=cursor -pos=230:20 | %FileCheck -check-prefix=CHECK2 %s
 // The cursor points inside the interface, see 'gen_clang_module.swift.response'
 
 // CHECK2: source.lang.swift.decl.function.method.instance ({{.*}}Foo.framework/Headers/Foo.h:169:10-169:27)
@@ -54,7 +54,7 @@
 
 // RUN: %sourcekitd-test -req=interface-gen-open -module Foo -- -I %t.overlays -F %S/../Inputs/libIDE-mock-sdk \
 // RUN:         %mcp_opt %clang-importer-sdk \
-// RUN:      == -req=find-usr -usr "c:objc(cs)FooClassDerived(im)fooInstanceFunc0" | FileCheck -check-prefix=CHECK-USR %s
+// RUN:      == -req=find-usr -usr "c:objc(cs)FooClassDerived(im)fooInstanceFunc0" | %FileCheck -check-prefix=CHECK-USR %s
 // The returned line:col points inside the interface, see 'gen_clang_module.swift.response'
 
 // CHECK-USR: (230:15-230:33)
@@ -62,7 +62,7 @@
 // RUN: %sourcekitd-test -req=interface-gen-open -module Foo -- -I %t.overlays -F %S/../Inputs/libIDE-mock-sdk \
 // RUN:         %mcp_opt %clang-importer-sdk \
 // RUN:   == -req=find-interface -module Foo -- %s -I %t.overlays -F %S/../Inputs/libIDE-mock-sdk \
-// RUN:         %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK-IFACE %s
+// RUN:         %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-IFACE %s
 
 // CHECK-IFACE: DOC: (/<interface-gen>)
 // CHECK-IFACE: ARGS: [-target x86_64-{{.*}} -sdk {{.*}} -F {{.*}}/libIDE-mock-sdk -I {{.*}}.overlays {{.*}} -module-cache-path {{.*}} ]
@@ -71,7 +71,7 @@
 // RUN:         %mcp_opt %clang-importer-sdk \
 // RUN:      == -req=cursor -pos=1:8 == -req=cursor -pos=1:12 \
 // RUN:      == -req=cursor -pos=2:10 \
-// RUN:      == -req=cursor -pos=3:10 | FileCheck -check-prefix=CHECK-IMPORT %s
+// RUN:      == -req=cursor -pos=3:10 | %FileCheck -check-prefix=CHECK-IMPORT %s
 // The cursors point to module names inside the imports, see 'gen_clang_module.swift.response'
 
 // CHECK-IMPORT: 	  source.lang.swift.ref.module ()
diff --git a/test/SourceKit/InterfaceGen/gen_mixed_module.swift b/test/SourceKit/InterfaceGen/gen_mixed_module.swift
index 986e777..ff6c0e9 100644
--- a/test/SourceKit/InterfaceGen/gen_mixed_module.swift
+++ b/test/SourceKit/InterfaceGen/gen_mixed_module.swift
@@ -5,6 +5,6 @@
 // RUN: mkdir %t.overlays
 
 // RUN: %swift -emit-module -o %t.overlays -F %S/../Inputs/libIDE-mock-sdk %S/../Inputs/libIDE-mock-sdk/Mixed.swift -import-underlying-module -module-name Mixed -disable-objc-attr-requires-foundation-module
-// RUN: %sourcekitd-test -req=interface-gen -module Mixed -- -I %t.overlays -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %clang-importer-sdk | FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=interface-gen -module Mixed -- -I %t.overlays -F %S/../Inputs/libIDE-mock-sdk %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK1 %s
 
 // CHECK1: PureSwiftClass
diff --git a/test/SourceKit/InterfaceGen/gen_objc.swift b/test/SourceKit/InterfaceGen/gen_objc.swift
index 38d04b2..c117285 100644
--- a/test/SourceKit/InterfaceGen/gen_objc.swift
+++ b/test/SourceKit/InterfaceGen/gen_objc.swift
@@ -1,6 +1,6 @@
 // REQUIRES: FIXME
 
 // RUN: %sourcekitd-test -req=interface-gen -module ObjectiveC.NSObject -- %mcp_opt %clang-importer-sdk > %t.response
-// RUN: FileCheck -check-prefix=CHECK-DESCRIPTION -input-file %t.response %s
+// RUN: %FileCheck -check-prefix=CHECK-DESCRIPTION -input-file %t.response %s
 
 // CHECK-DESCRIPTION: var description: String
diff --git a/test/SourceKit/InterfaceGen/gen_stdlib.swift b/test/SourceKit/InterfaceGen/gen_stdlib.swift
index 96825d1..bbb1803 100644
--- a/test/SourceKit/InterfaceGen/gen_stdlib.swift
+++ b/test/SourceKit/InterfaceGen/gen_stdlib.swift
@@ -2,9 +2,9 @@
 var x: Int
 
 // RUN: %sourcekitd-test -req=interface-gen -module Swift > %t.response
-// RUN: FileCheck -check-prefix=CHECK-STDLIB -input-file %t.response %s
-// RUN: FileCheck -check-prefix=CHECK-MUTATING-ATTR -input-file %t.response %s
-// RUN: FileCheck -check-prefix=CHECK-HIDE-ATTR -input-file %t.response %s
+// RUN: %FileCheck -check-prefix=CHECK-STDLIB -input-file %t.response %s
+// RUN: %FileCheck -check-prefix=CHECK-MUTATING-ATTR -input-file %t.response %s
+// RUN: %FileCheck -check-prefix=CHECK-HIDE-ATTR -input-file %t.response %s
 
 // Just check a small part, mainly to make sure we can print the interface of the stdlib.
 // CHECK-STDLIB-NOT: extension _SwiftNSOperatingSystemVersion
@@ -16,8 +16,8 @@
 // Check that extensions of nested decls are showing up.
 // CHECK-STDLIB-LABEL: extension String.UTF16View.Index {
 // CHECK-STDLIB: func samePosition(in utf8: String.UTF8View) -> String.UTF8View.Index?
-// CHECK-STDLIB: func samePosition(in unicodeScalars: String.UnicodeScalarView) -> UnicodeScalarIndex?
-// CHECK-STDLIB: func samePosition(in characters: String) -> Index?
+// CHECK-STDLIB: func samePosition(in unicodeScalars: String.UnicodeScalarView) -> String.UnicodeScalarIndex?
+// CHECK-STDLIB: func samePosition(in characters: String) -> String.Index?
 // CHECK-STDLIB-NEXT: }
 
 // CHECK-MUTATING-ATTR: mutating func
@@ -27,7 +27,7 @@
 // CHECK-HIDE-ATTR-NOT: @inline
 
 // RUN: %sourcekitd-test -req=interface-gen-open -module Swift \
-// RUN:   == -req=cursor -pos=2:8 %s -- %s | FileCheck -check-prefix=CHECK1 %s
+// RUN:   == -req=cursor -pos=2:8 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
 
 // CHECK1:      source.lang.swift.ref.struct ()
 // CHECK1-NEXT: Int
@@ -40,13 +40,13 @@
 // CHECK1-NEXT: SYSTEM
 // CHECK1-NEXT: <Declaration>struct Int : <Type usr="s:Ps13SignedInteger">SignedInteger</Type>{{.*}}{{.*}}<Type usr="s:Ps10Comparable">Comparable</Type>{{.*}}<Type usr="s:Ps9Equatable">Equatable</Type>{{.*}}</Declaration>
 
-// RUN: %sourcekitd-test -req=module-groups -module Swift | FileCheck -check-prefix=GROUP1 %s
+// RUN: %sourcekitd-test -req=module-groups -module Swift | %FileCheck -check-prefix=GROUP1 %s
 // GROUP1: <GROUPS>
 // GROUP1-NOT: <NULL>
 // GROUP1: <\GROUPS>
 
 // RUN: %sourcekitd-test -req=interface-gen -module Swift -group-name Bool > %t.Bool.response
-// RUN: FileCheck -check-prefix=CHECK-BOOL -input-file %t.Bool.response %s
+// RUN: %FileCheck -check-prefix=CHECK-BOOL -input-file %t.Bool.response %s
 // CHECK-BOOL-DAG: extension Bool : ExpressibleByBooleanLiteral {
 
 // These are not in the bool group:
@@ -57,10 +57,10 @@
 // CHECK-BOOL-NOT: extension String
 
 // RUN: %sourcekitd-test -req=interface-gen -module Swift -interested-usr s:Sb > %t.Bool.response
-// RUN: FileCheck -check-prefix=CHECK-BOOL -input-file %t.Bool.response %s
+// RUN: %FileCheck -check-prefix=CHECK-BOOL -input-file %t.Bool.response %s
 
 // RUN: %sourcekitd-test -req=interface-gen -module Swift -interested-usr s:Si > %t.Int.response
-// RUN: FileCheck -check-prefix=CHECK-INT -input-file %t.Int.response %s
+// RUN: %FileCheck -check-prefix=CHECK-INT -input-file %t.Int.response %s
 
 // CHECK-INT: struct Int
 // CHECK-INT: extension Int
@@ -70,7 +70,7 @@
 // CHECK-INT-NOT: struct Float
 
 // RUN: %sourcekitd-test -req=interface-gen -module Swift -interested-usr s:Sf > %t.Float.response
-// RUN: FileCheck -check-prefix=CHECK-FLOAT -input-file %t.Float.response %s
+// RUN: %FileCheck -check-prefix=CHECK-FLOAT -input-file %t.Float.response %s
 
 // CHECK-FLOAT: struct Float
 // CHECK-FLOAT-NOT: Zip2Iterator
diff --git a/test/SourceKit/InterfaceGen/gen_swift_module.swift b/test/SourceKit/InterfaceGen/gen_swift_module.swift
index 69eeebe..6d03824 100644
--- a/test/SourceKit/InterfaceGen/gen_swift_module.swift
+++ b/test/SourceKit/InterfaceGen/gen_swift_module.swift
@@ -10,18 +10,18 @@
 // RUN: %sourcekitd-test -req=interface-gen -module swift_mod -- -I %t.mod > %t.response
 // RUN: diff -u %s.response %t.response
 
-// RUN: %sourcekitd-test -req=module-groups -module swift_mod -- -I %t.mod | FileCheck -check-prefix=GROUP-EMPTY %s
+// RUN: %sourcekitd-test -req=module-groups -module swift_mod -- -I %t.mod | %FileCheck -check-prefix=GROUP-EMPTY %s
 // GROUP-EMPTY: <GROUPS>
 // GROUP-EMPTY-NEXT: <\GROUPS>
 
 // RUN: %swift -emit-module -o %t.mod/swift_mod_syn.swiftmodule %S/Inputs/swift_mod_syn.swift -parse-as-library
-// RUN: %sourcekitd-test -req=interface-gen-open -module swift_mod_syn -- -I %t.mod == -req=cursor -pos=4:7 %s -- %s -I %t.mod | FileCheck -check-prefix=SYNTHESIZED-USR1 %s
+// RUN: %sourcekitd-test -req=interface-gen-open -module swift_mod_syn -- -I %t.mod == -req=cursor -pos=4:7 %s -- %s -I %t.mod | %FileCheck -check-prefix=SYNTHESIZED-USR1 %s
 // SYNTHESIZED-USR1: s:FesRxs17MutableCollectionxs22RandomAccessCollectionWxPs10Collection8Iterator7Element_s10ComparablerS_4sortFT_T_::SYNTHESIZED::s:Sa
 
 // RUN: %sourcekitd-test -req=interface-gen-open -module Swift -synthesized-extension \
-// RUN: 	== -req=find-usr -usr "s:FesRxs17MutableCollectionxs22RandomAccessCollectionWxPs10Collection8Iterator7Element_s10ComparablerS_4sortFT_T_::SYNTHESIZED::s:Sa" | FileCheck -check-prefix=SYNTHESIZED-USR2 %s
+// RUN: 	== -req=find-usr -usr "s:FesRxs17MutableCollectionxs22RandomAccessCollectionWxPs10Collection8Iterator7Element_s10ComparablerS_4sortFT_T_::SYNTHESIZED::s:Sa" | %FileCheck -check-prefix=SYNTHESIZED-USR2 %s
 // SYNTHESIZED-USR2-NOT: USR NOT FOUND
 
 // RUN: %sourcekitd-test -req=interface-gen-open -module Swift \
-// RUN: 	== -req=find-usr -usr "s:FesRxs17MutableCollectionxs22RandomAccessCollectionWxPs10Collection8Iterator7Element_s10ComparablerS_4sortFT_T_::SYNTHESIZED::USRDOESNOTEXIST" | FileCheck -check-prefix=SYNTHESIZED-USR3 %s
+// RUN: 	== -req=find-usr -usr "s:FesRxs17MutableCollectionxs22RandomAccessCollectionWxPs10Collection8Iterator7Element_s10ComparablerS_4sortFT_T_::SYNTHESIZED::USRDOESNOTEXIST" | %FileCheck -check-prefix=SYNTHESIZED-USR3 %s
 // SYNTHESIZED-USR3-NOT: USR NOT FOUND
diff --git a/test/SourceKit/InterfaceGen/gen_swift_source.swift b/test/SourceKit/InterfaceGen/gen_swift_source.swift
index 3e5b4cb..56303a1 100644
--- a/test/SourceKit/InterfaceGen/gen_swift_source.swift
+++ b/test/SourceKit/InterfaceGen/gen_swift_source.swift
@@ -2,15 +2,15 @@
 // RUN: diff -u %s.response %t.response
 
 // RUN: %sourcekitd-test -req=interface-gen-open %S/Inputs/Foo2.swift -- %S/Inputs/Foo2.swift %mcp_opt %clang-importer-sdk \
-// RUN: == -req=cursor -pos=18:49 | FileCheck -check-prefix=CHECK1 %s
+// RUN: == -req=cursor -pos=18:49 | %FileCheck -check-prefix=CHECK1 %s
 // The cursor points to 'FooOverlayClassBase' inside the list of base classes, see 'gen_swift_source.swift.response'
 
 // CHECK1: FooOverlayClassBase
 // CHECK1: s:C4Foo219FooOverlayClassBase
 // CHECK1: FooOverlayClassBase.Type
 
-// RUN: %sourcekitd-test -req=interface-gen %S/Inputs/UnresolvedExtension.swift -- %S/Inputs/UnresolvedExtension.swift | FileCheck -check-prefix=CHECK2 %s
+// RUN: %sourcekitd-test -req=interface-gen %S/Inputs/UnresolvedExtension.swift -- %S/Inputs/UnresolvedExtension.swift | %FileCheck -check-prefix=CHECK2 %s
 // CHECK2: extension ET
 
-// RUN: %sourcekitd-test -req=interface-gen %S/Inputs/Foo3.swift -- %S/Inputs/Foo3.swift | FileCheck -check-prefix=CHECK3 %s
+// RUN: %sourcekitd-test -req=interface-gen %S/Inputs/Foo3.swift -- %S/Inputs/Foo3.swift | %FileCheck -check-prefix=CHECK3 %s
 // CHECK3: public class C {
diff --git a/test/SourceKit/InterfaceGen/gen_swift_type.swift b/test/SourceKit/InterfaceGen/gen_swift_type.swift
index ae27077..1422d41 100644
--- a/test/SourceKit/InterfaceGen/gen_swift_type.swift
+++ b/test/SourceKit/InterfaceGen/gen_swift_type.swift
@@ -1,9 +1,9 @@
-// RUN: %sourcekitd-test -req=interface-gen -usr _TtGSaSi_ %s -- %s | FileCheck -check-prefix=CHECK1 %s
-// RUN: %sourcekitd-test -req=interface-gen -usr _TtGSaSS_ %s -- %s | FileCheck -check-prefix=CHECK2 %s
-// RUN: %sourcekitd-test -req=interface-gen -usr _TtV14gen_swift_type1A %s -- %s | FileCheck -check-prefix=CHECK3 %s
-// RUN: %sourcekitd-test -req=interface-gen -usr _TtGSaV14gen_swift_type1A_ %s -- %s | FileCheck -check-prefix=CHECK4 %s
-// RUN: %sourcekitd-test -req=interface-gen -usr _TtGC14gen_swift_type1DCS_2T1_ %s -- %s | FileCheck -check-prefix=CHECK5 %s
-// RUN: %sourcekitd-test -req=interface-gen -usr _TtGC14gen_swift_type1DSi_ %s -- %s | FileCheck -check-prefix=CHECK6 %s
+// RUN: %sourcekitd-test -req=interface-gen -usr _TtGSaSi_ %s -- %s | %FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=interface-gen -usr _TtGSaSS_ %s -- %s | %FileCheck -check-prefix=CHECK2 %s
+// RUN: %sourcekitd-test -req=interface-gen -usr _TtV14gen_swift_type1A %s -- %s | %FileCheck -check-prefix=CHECK3 %s
+// RUN: %sourcekitd-test -req=interface-gen -usr _TtGSaV14gen_swift_type1A_ %s -- %s | %FileCheck -check-prefix=CHECK4 %s
+// RUN: %sourcekitd-test -req=interface-gen -usr _TtGC14gen_swift_type1DCS_2T1_ %s -- %s | %FileCheck -check-prefix=CHECK5 %s
+// RUN: %sourcekitd-test -req=interface-gen -usr _TtGC14gen_swift_type1DSi_ %s -- %s | %FileCheck -check-prefix=CHECK6 %s
 
 public struct A {
 	public func fa() {}
diff --git a/test/SourceKit/Misc/protocol_version.swift b/test/SourceKit/Misc/protocol_version.swift
index b952667..9093955 100644
--- a/test/SourceKit/Misc/protocol_version.swift
+++ b/test/SourceKit/Misc/protocol_version.swift
@@ -1,4 +1,4 @@
-// RUN: %sourcekitd-test -req=version | FileCheck %s
+// RUN: %sourcekitd-test -req=version | %FileCheck %s
 
 // CHECK: key.version_major: 1
 // CHECK: key.version_minor: 0
diff --git a/test/SourceKit/Mixed/cursor_mixed.swift b/test/SourceKit/Mixed/cursor_mixed.swift
index fb6c8f8..c159494 100644
--- a/test/SourceKit/Mixed/cursor_mixed.swift
+++ b/test/SourceKit/Mixed/cursor_mixed.swift
@@ -4,7 +4,7 @@
 }
 
 // REQUIRES: objc_interop
-// RUN: %sourcekitd-test -req=cursor -pos=3:7 %s -- %s %mcp_opt -F %S/Inputs -module-name Mixed -import-underlying-module | FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=3:7 %s -- %s %mcp_opt -F %S/Inputs -module-name Mixed -import-underlying-module | %FileCheck %s
 
 // CHECK: source.lang.swift.ref.function.method.instance ({{.*}}Mixed.framework/Headers/Mixed.h:5:9-5:23)
 // CHECK: doIt(_:)
diff --git a/test/SourceKit/Mixed/cursor_mixed_header.swift b/test/SourceKit/Mixed/cursor_mixed_header.swift
index 66514ea..30fde8c 100644
--- a/test/SourceKit/Mixed/cursor_mixed_header.swift
+++ b/test/SourceKit/Mixed/cursor_mixed_header.swift
@@ -5,10 +5,10 @@
 
 // REQUIRES: objc_interop
 // RUN: %swift -parse %s %mcp_opt -module-name Mixed -import-objc-header %S/Inputs/header.h 2> %t.diags
-// RUN: FileCheck -input-file %t.diags %s -check-prefix=DIAG
+// RUN: %FileCheck -input-file %t.diags %s -check-prefix=DIAG
 // DIAG: warning: using the result of an assignment
 
-// RUN: %sourcekitd-test -req=cursor -pos=3:7 %s -- %s %mcp_opt -module-name Mixed -import-objc-header %S/Inputs/header.h | FileCheck %s
+// RUN: %sourcekitd-test -req=cursor -pos=3:7 %s -- %s %mcp_opt -module-name Mixed -import-objc-header %S/Inputs/header.h | %FileCheck %s
 
 // CHECK: source.lang.swift.ref.function.method.instance ({{.*}}Inputs/header.h:4:9-4:23)
 // CHECK: doIt(_:)
diff --git a/test/SourceKit/RelatedIdents/implicit_vis.swift b/test/SourceKit/RelatedIdents/implicit_vis.swift
index cd48048..8df0c50 100644
--- a/test/SourceKit/RelatedIdents/implicit_vis.swift
+++ b/test/SourceKit/RelatedIdents/implicit_vis.swift
@@ -1,5 +1,5 @@
 // RUN: %sourcekitd-test -req=related-idents -pos=2:10 %S/Inputs/implicit-vis/a.swift \
-// RUN:     -- %S/Inputs/implicit-vis/a.swift %S/Inputs/implicit-vis/b.swift -o implicit_vis.o | FileCheck -check-prefix=CHECK1 %s
+// RUN:     -- %S/Inputs/implicit-vis/a.swift %S/Inputs/implicit-vis/b.swift -o implicit_vis.o | %FileCheck -check-prefix=CHECK1 %s
 
 // CHECK1: START RANGES
 // CHECK1: 2:10 - 1
diff --git a/test/SourceKit/RelatedIdents/related_idents.swift b/test/SourceKit/RelatedIdents/related_idents.swift
index e3eb1b5..9f70204 100644
--- a/test/SourceKit/RelatedIdents/related_idents.swift
+++ b/test/SourceKit/RelatedIdents/related_idents.swift
@@ -23,7 +23,7 @@
 	func f(t : Param) -> Param {return t}
 }
 
-// RUN: %sourcekitd-test -req=related-idents -pos=6:17 %s -- -module-name related_idents %s | FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=related-idents -pos=6:17 %s -- -module-name related_idents %s | %FileCheck -check-prefix=CHECK1 %s
 // CHECK1: START RANGES
 // CHECK1-NEXT: 1:7 - 2
 // CHECK1-NEXT: 6:11 - 2
@@ -31,23 +31,23 @@
 // CHECK1-NEXT: 9:11 - 2
 // CHECK1-NEXT: END RANGES
 
-// RUN: %sourcekitd-test -req=related-idents -pos=5:9 %s -- -module-name related_idents %s | FileCheck -check-prefix=CHECK2 %s
+// RUN: %sourcekitd-test -req=related-idents -pos=5:9 %s -- -module-name related_idents %s | %FileCheck -check-prefix=CHECK2 %s
 // CHECK2: START RANGES
 // CHECK2-NEXT: 5:6 - 5
 // CHECK2-NEXT: 11:1 - 5
 // CHECK2-NEXT: END RANGES
 
-// RUN: %sourcekitd-test -req=related-idents -pos=13:10 %s -- -module-name related_idents %s | FileCheck -check-prefix=CHECK3 %s
+// RUN: %sourcekitd-test -req=related-idents -pos=13:10 %s -- -module-name related_idents %s | %FileCheck -check-prefix=CHECK3 %s
 // CHECK3:      START RANGES
 // CHECK3-NEXT: END RANGES
 
-// RUN: %sourcekitd-test -req=related-idents -pos=18:12 %s -- -module-name related_idents %s | FileCheck -check-prefix=CHECK4 %s
+// RUN: %sourcekitd-test -req=related-idents -pos=18:12 %s -- -module-name related_idents %s | %FileCheck -check-prefix=CHECK4 %s
 // CHECK4:      START RANGES
 // CHECK4-NEXT: 17:9 - 1
 // CHECK4-NEXT: 18:12 - 1
 // CHECK4-NEXT: END RANGES
 
-// RUN: %sourcekitd-test -req=related-idents -pos=22:12 %s -- -module-name related_idents %s | FileCheck -check-prefix=CHECK5 %s
+// RUN: %sourcekitd-test -req=related-idents -pos=22:12 %s -- -module-name related_idents %s | %FileCheck -check-prefix=CHECK5 %s
 // CHECK5:      START RANGES
 // CHECK5-NEXT: 22:10 - 5
 // CHECK5-NEXT: 23:13 - 5
diff --git a/test/SourceKit/Sema/objc_attr_without_import.swift b/test/SourceKit/Sema/objc_attr_without_import.swift
index 9fd330a..25160b4 100644
--- a/test/SourceKit/Sema/objc_attr_without_import.swift
+++ b/test/SourceKit/Sema/objc_attr_without_import.swift
@@ -1,5 +1,5 @@
 // RUN: %sourcekitd-test -req=sema %s -- %s > %t.response
-// RUN: FileCheck -input-file=%t.response %s
+// RUN: %FileCheck -input-file=%t.response %s
 // This tests that we are not crashing in SILGen.
 
 // CHECK: @objc attribute used without importing module
diff --git a/test/SourceKit/Sema/sema_diag_after_edit-2.swift b/test/SourceKit/Sema/sema_diag_after_edit-2.swift
index e8099be..59857ba 100644
--- a/test/SourceKit/Sema/sema_diag_after_edit-2.swift
+++ b/test/SourceKit/Sema/sema_diag_after_edit-2.swift
@@ -1,6 +1,6 @@
 // RUN: %sourcekitd-test -req=open %s -- %s == -req=print-diags %s \
 // RUN:    == -req=edit -pos=7:1 -replace="" -length=1 %s == -req=print-diags %s \
-// RUN: | FileCheck -check-prefix=CHECK-DIAG %s
+// RUN: | %FileCheck -check-prefix=CHECK-DIAG %s
 // CHECK-DIAG-NOT: key.offset
 
 class MyClass {
diff --git a/test/SourceKit/Sema/sema_diag_after_edit.swift b/test/SourceKit/Sema/sema_diag_after_edit.swift
index c438b24..f316fb1 100644
--- a/test/SourceKit/Sema/sema_diag_after_edit.swift
+++ b/test/SourceKit/Sema/sema_diag_after_edit.swift
@@ -1,11 +1,11 @@
 let s : String = "f
 
 // RUN: %sourcekitd-test -req=open %s -- %s == \
-// RUN:    -req=print-diags %s | FileCheck -check-prefix=CHECK-DIAG %s
+// RUN:    -req=print-diags %s | %FileCheck -check-prefix=CHECK-DIAG %s
 // CHECK-DIAG: key.severity: source.diagnostic.severity.error
 
 // Make sure that the diagnostic does not 'linger' after the edit is made.
 // RUN: %sourcekitd-test -req=open %s -- %s == -req=edit -pos=1:20 -replace="\"" -length=0 %s == \
 // RUN:    -req=print-diags %s > %t
-// RUN: FileCheck -check-prefix=CHECK-NODIAG %s < %t
+// RUN: %FileCheck -check-prefix=CHECK-NODIAG %s < %t
 // CHECK-NODIAG-NOT: key.severity: source.diagnostic.severity.error
diff --git a/test/SourceKit/Sema/sema_diag_after_edit_fixit.swift b/test/SourceKit/Sema/sema_diag_after_edit_fixit.swift
index 5b97ae0..4d9f75a 100644
--- a/test/SourceKit/Sema/sema_diag_after_edit_fixit.swift
+++ b/test/SourceKit/Sema/sema_diag_after_edit_fixit.swift
@@ -5,7 +5,7 @@
 
 // RUN: %sourcekitd-test -req=open %s -- %s == -req=print-diags %s \
 // RUN:    == -req=edit -pos=2:1 -replace="_" -length=5 %s -print-raw-response \
-// RUN: | FileCheck %s
+// RUN: | %FileCheck %s
 
 // CHECK:      key.line: 2,
 // CHECK-NEXT: key.column: 5,
diff --git a/test/SourceKit/Sema/sema_module.swift b/test/SourceKit/Sema/sema_module.swift
index 50938af..cfc82d5 100644
--- a/test/SourceKit/Sema/sema_module.swift
+++ b/test/SourceKit/Sema/sema_module.swift
@@ -1,4 +1,4 @@
-// RUN: %sourcekitd-test -req=sema %s -- %s | FileCheck %s
+// RUN: %sourcekitd-test -req=sema %s -- %s | %FileCheck %s
 Swift.String
 Swift
 // CHECK: key.kind: source.lang.swift.ref.struct,
diff --git a/test/SourceKit/Sema/sema_unavailable.swift b/test/SourceKit/Sema/sema_unavailable.swift
index 22ef82d..a6f7dea 100644
--- a/test/SourceKit/Sema/sema_unavailable.swift
+++ b/test/SourceKit/Sema/sema_unavailable.swift
@@ -1,4 +1,4 @@
-// RUN: %sourcekitd-test -req=sema %s -- %s| FileCheck %s
+// RUN: %sourcekitd-test -req=sema %s -- %s| %FileCheck %s
 find([1,2,3], 1)
 
 // CHECK-NOT: source.lang.swift.ref.function.free
diff --git a/test/SourceKit/Session/info_after_open.swift b/test/SourceKit/Session/info_after_open.swift
index e867eb4..91e8245 100644
--- a/test/SourceKit/Session/info_after_open.swift
+++ b/test/SourceKit/Session/info_after_open.swift
@@ -1,5 +1,5 @@
 print("a")
 
-// RUN: %sourcekitd-test -req=syntax-map %s == -req=cursor -pos=1:2 %s -- %s | FileCheck -check-prefix=CHECK1 %s
+// RUN: %sourcekitd-test -req=syntax-map %s == -req=cursor -pos=1:2 %s -- %s | %FileCheck -check-prefix=CHECK1 %s
 // CHECK1: source.lang.swift.ref.function.free ()
 // CHECK1-NEXT: print
diff --git a/test/TypeCoercion/integer_literals.swift b/test/TypeCoercion/integer_literals.swift
index 8d652c0..ab566c7 100644
--- a/test/TypeCoercion/integer_literals.swift
+++ b/test/TypeCoercion/integer_literals.swift
@@ -47,7 +47,7 @@
 struct supermeters : ExpressibleByIntegerLiteral { // expected-error{{type 'supermeters' does not conform to protocol 'ExpressibleByIntegerLiteral'}}
   var value : meters
   
-  typealias IntegerLiteralType = meters // expected-note{{possibly intended match 'IntegerLiteralType' (aka 'meters') does not conform to '_ExpressibleByBuiltinIntegerLiteral'}}
+  typealias IntegerLiteralType = meters // expected-note{{possibly intended match 'supermeters.IntegerLiteralType' (aka 'meters') does not conform to '_ExpressibleByBuiltinIntegerLiteral'}}
   init(_integerLiteral value: meters) {
     self.value = value
   }
diff --git a/test/attr/accessibility_multifile.swift b/test/attr/accessibility_multifile.swift
new file mode 100644
index 0000000..a323bf5
--- /dev/null
+++ b/test/attr/accessibility_multifile.swift
@@ -0,0 +1,19 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: %utils/split_file.py -o %t %s
+// RUN: %target-swift-frontend -parse %t/file1.swift -primary-file %t/file2.swift -verify
+
+// BEGIN file1.swift
+private protocol P  {
+  func privMethod()
+}
+public class C : P {
+  public init() {}
+  fileprivate func privMethod() {}
+}
+
+// BEGIN file2.swift
+extension C {
+  public func someFunc() {
+    privMethod() // expected-error {{use of unresolved identifier 'privMethod'}}
+  }
+}
diff --git a/test/attr/accessibility_print.swift b/test/attr/accessibility_print.swift
index 6088332..6dcbfe3 100644
--- a/test/attr/accessibility_print.swift
+++ b/test/attr/accessibility_print.swift
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t && mkdir -p %t
-// RUN: %target-swift-ide-test -skip-deinit=false -print-ast-typechecked -print-accessibility -source-filename=%s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-SRC
+// RUN: %target-swift-ide-test -skip-deinit=false -print-ast-typechecked -print-accessibility -source-filename=%s | %FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-SRC
 // RUN: %target-swift-frontend -emit-module-path %t/accessibility_print.swiftmodule %s
-// RUN: %target-swift-ide-test -skip-deinit=false -print-module -print-accessibility -module-to-print=accessibility_print -I %t -source-filename=%s | FileCheck %s
+// RUN: %target-swift-ide-test -skip-deinit=false -print-module -print-accessibility -module-to-print=accessibility_print -I %t -source-filename=%s | %FileCheck %s
 
 // This file uses alphabetic prefixes on its declarations because swift-ide-test
 // sorts decls in a module before printing them.
@@ -122,9 +122,9 @@
 private protocol EA_PrivateProtocol {
   // CHECK: {{^}} associatedtype Foo
   associatedtype Foo
-  // CHECK: internal var Bar
+  // CHECK: fileprivate var Bar
   var Bar: Int { get }
-  // CHECK: internal func baz()
+  // CHECK: fileprivate func baz()
   func baz()
 } // CHECK: {{^[}]}}
 
diff --git a/test/attr/attr_autoclosure.swift b/test/attr/attr_autoclosure.swift
index fa71173..bc6a9e3 100644
--- a/test/attr/attr_autoclosure.swift
+++ b/test/attr/attr_autoclosure.swift
@@ -1,5 +1,5 @@
 // RUN: %target-parse-verify-swift
-// RUN: not %target-swift-frontend -parse %s 2>&1 | FileCheck %s
+// RUN: not %target-swift-frontend -parse %s 2>&1 | %FileCheck %s
 // No errors at invalid locations!
 // CHECK-NOT: <unknown>:0:
 
@@ -75,22 +75,22 @@
 // expected-note@-1{{to match this opening '('}}
 
 func func11(_: @autoclosure(escaping) @noescape () -> ()) { } // expected-error{{@escaping conflicts with @noescape}}
-  // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{17-38=@autoclosure @escaping }}
+  // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{28-38= @escaping}}
 
 class Super {
   func f1(_ x: @autoclosure(escaping) () -> ()) { }
-    // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{17-38=@autoclosure @escaping }}
+    // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{28-38= @escaping}}
   func f2(_ x: @autoclosure(escaping) () -> ()) { } // expected-note {{potential overridden instance method 'f2' here}}
-    // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{17-38=@autoclosure @escaping }}
+    // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{28-38= @escaping}}
   func f3(x: @autoclosure () -> ()) { }
 }
 
 class Sub : Super {
   override func f1(_ x: @autoclosure(escaping)() -> ()) { }
-    // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{26-47=@autoclosure @escaping }}
-  override func f2(_ x: @autoclosure () -> ()) { } // expected-error{{does not override any method}}
+    // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{37-47= @escaping }}
+  override func f2(_ x: @autoclosure () -> ()) { } // expected-error{{does not override any method}} // expected-note{{type does not match superclass instance method with type '(@autoclosure @escaping () -> ()) -> ()'}}
   override func f3(_ x: @autoclosure(escaping) () -> ()) { }  // expected-error{{does not override any method}}
-    // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{26-47=@autoclosure @escaping }}
+    // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{37-47= @escaping}}
 }
 
 func func12_sink(_ x: @escaping () -> Int) { }
@@ -101,7 +101,7 @@
   func12_sink(x) // expected-error {{passing non-escaping parameter 'x' to function expecting an @escaping closure}}
 }
 func func12b(_ x: @autoclosure(escaping) () -> Int) {
-  // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{20-41=@autoclosure @escaping }}
+  // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{31-41= @escaping}}
   func12_sink(x) // ok
 }
 func func12c(_ x: @autoclosure @escaping () -> Int) {
@@ -132,7 +132,7 @@
 
 let _ : (@autoclosure () -> ()) -> ()
 let _ : (@autoclosure(escaping) () -> ()) -> ()
-  // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{11-32=@autoclosure @escaping }}
+  // expected-warning@-1{{@autoclosure(escaping) is deprecated; use @autoclosure @escaping instead}} {{22-32= @escaping}}
 
 // escaping is the name of param type
 let _ : (@autoclosure(escaping) -> ()) -> ()  // expected-error {{use of undeclared type 'escaping'}}
diff --git a/test/attr/attr_dynamic_infer.swift b/test/attr/attr_dynamic_infer.swift
index a7cd046..fdc7b69 100644
--- a/test/attr/attr_dynamic_infer.swift
+++ b/test/attr/attr_dynamic_infer.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename=%s -print-implicit-attrs -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename=%s -print-implicit-attrs -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 @objc class Super {
   func baseFoo() {}
diff --git a/test/attr/attr_escaping.swift b/test/attr/attr_escaping.swift
index 2a095be..4559042 100644
--- a/test/attr/attr_escaping.swift
+++ b/test/attr/attr_escaping.swift
@@ -71,3 +71,39 @@
 }
 
 
+func takesEscapingGeneric<T>(_ fn: @escaping () -> T) {}
+func callEscapingGeneric<T>(_ fn: () -> T) { // expected-note {{parameter 'fn' is implicitly non-escaping}} {{35-35=@escaping }}
+  takesEscapingGeneric(fn) // expected-error {{passing non-escaping parameter 'fn' to function expecting an @escaping closure}}
+}
+
+
+class Super {}
+class Sub: Super {}
+
+func takesEscapingSuper(_ fn: @escaping () -> Super) {}
+func callEscapingSuper(_ fn: () -> Sub) { // expected-note {{parameter 'fn' is implicitly non-escaping}} {{30-30=@escaping }}
+  takesEscapingSuper(fn) // expected-error {{passing non-escaping parameter 'fn' to function expecting an @escaping closure}}
+}
+
+func takesEscapingSuperGeneric<T: Super>(_ fn: @escaping () -> T) {}
+func callEscapingSuperGeneric(_ fn: () -> Sub) { // expected-note {{parameter 'fn' is implicitly non-escaping}} {{37-37=@escaping }}
+  takesEscapingSuperGeneric(fn) // expected-error {{passing non-escaping parameter 'fn' to function expecting an @escaping closure}}
+}
+func callEscapingSuperGeneric<T: Sub>(_ fn: () -> T) { // expected-note {{parameter 'fn' is implicitly non-escaping}} {{45-45=@escaping }}
+  takesEscapingSuperGeneric(fn) // expected-error {{passing non-escaping parameter 'fn' to function expecting an @escaping closure}}
+}
+
+func testModuloOptionalness() {
+  var iuoClosure: (() -> Void)! = nil
+  func setIUOClosure(_ fn: () -> Void) { // expected-note {{parameter 'fn' is implicitly non-escaping}} {{28-28=@escaping }}
+    iuoClosure = fn // expected-error{{assigning non-escaping parameter 'fn' to an @escaping closure}}
+  }
+  var iuoClosureExplicit: ImplicitlyUnwrappedOptional<() -> Void>
+  func setExplicitIUOClosure(_ fn: () -> Void) { // expected-note {{parameter 'fn' is implicitly non-escaping}} {{36-36=@escaping }}
+    iuoClosureExplicit = fn // expected-error{{assigning non-escaping parameter 'fn' to an @escaping closure}}
+  }
+  var deepOptionalClosure: (() -> Void)???
+  func setDeepOptionalClosure(_ fn: () -> Void) { // expected-note {{parameter 'fn' is implicitly non-escaping}} {{37-37=@escaping }}
+    deepOptionalClosure = fn // expected-error{{assigning non-escaping parameter 'fn' to an @escaping closure}}
+  }
+}
diff --git a/test/attr/attr_fixed_layout.swift b/test/attr/attr_fixed_layout.swift
index 2b0a26a..868ef7b 100644
--- a/test/attr/attr_fixed_layout.swift
+++ b/test/attr/attr_fixed_layout.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -parse -dump-ast -enable-resilience %s 2>&1 | FileCheck --check-prefix=RESILIENCE-ON %s
-// RUN: %target-swift-frontend -parse -dump-ast %s 2>&1 | FileCheck --check-prefix=RESILIENCE-OFF %s
+// RUN: %target-swift-frontend -parse -dump-ast -enable-resilience %s 2>&1 | %FileCheck --check-prefix=RESILIENCE-ON %s
+// RUN: %target-swift-frontend -parse -dump-ast %s 2>&1 | %FileCheck --check-prefix=RESILIENCE-OFF %s
 
 //
 // Public types with @_fixed_layout are always fixed layout
diff --git a/test/attr/attr_ibaction.swift b/test/attr/attr_ibaction.swift
index be128f8..57edde3 100644
--- a/test/attr/attr_ibaction.swift
+++ b/test/attr/attr_ibaction.swift
@@ -63,6 +63,11 @@
   @IBAction func action5(_: AnyObject?) {}
   @IBAction func action6(_: AnyObject!) {}
 
+  // Any
+  @IBAction func action4a(_: Any) {}
+  @IBAction func action5a(_: Any?) {}
+  @IBAction func action6a(_: Any!) {}
+
   // Protocol types
   @IBAction func action7(_: P1) {} // expected-error{{argument to @IBAction method cannot have non-object type 'P1'}}
   // expected-error@-1{{method cannot be marked @IBAction because the type of the parameter cannot be represented in Objective-C}}
diff --git a/test/attr/attr_ibaction_ios.swift b/test/attr/attr_ibaction_ios.swift
index ac52557..8f21305 100644
--- a/test/attr/attr_ibaction_ios.swift
+++ b/test/attr/attr_ibaction_ios.swift
@@ -1,4 +1,4 @@
-// RUN: not %target-build-swift -parse %s 2>&1 | FileCheck -check-prefix=CHECK-%target-os -check-prefix=CHECK-BOTH %s
+// RUN: not %target-build-swift -parse %s 2>&1 | %FileCheck -check-prefix=CHECK-%target-os -check-prefix=CHECK-BOTH %s
 // REQUIRES: executable_test
 
 struct IntWrapper {
diff --git a/test/attr/attr_iboutlet.swift b/test/attr/attr_iboutlet.swift
index 9912875e..6fc0a40 100644
--- a/test/attr/attr_iboutlet.swift
+++ b/test/attr/attr_iboutlet.swift
@@ -64,6 +64,10 @@
   @IBOutlet var outlet5: AnyObject?
   @IBOutlet var outlet6: AnyObject!
 
+  // Any
+  @IBOutlet var outlet5a: Any?
+  @IBOutlet var outlet6a: Any!
+
   // Protocol types
   @IBOutlet var outlet7: P1 // expected-error{{@IBOutlet property cannot have non-'@objc' protocol type 'P1'}} {{3-13=}}
   @IBOutlet var outlet8: CP1 // expected-error{{@IBOutlet property cannot have non-'@objc' protocol type 'CP1'}} {{3-13=}}
diff --git a/test/attr/attr_noescape.swift b/test/attr/attr_noescape.swift
index cda1532..3c29df6 100644
--- a/test/attr/attr_noescape.swift
+++ b/test/attr/attr_noescape.swift
@@ -266,9 +266,18 @@
 
 // SR-824 - @noescape for Type Aliased Closures
 //
+
+// Old syntax -- @noescape is the default, and is redundant
 typealias CompletionHandlerNE = @noescape (_ success: Bool) -> () // expected-warning{{@noescape is the default and is deprecated}} {{33-43=}}
+
+// Explicit @escaping is not allowed here
+typealias CompletionHandlerE = @escaping (_ success: Bool) -> () // expected-error{{@escaping may only be applied to parameters of function type}}
+
+// No @escaping -- it's implicit from context
 typealias CompletionHandler = (_ success: Bool) -> ()
+
 var escape : CompletionHandlerNE
+var escapeOther : CompletionHandler
 func doThing1(_ completion: (_ success: Bool) -> ()) {
   // expected-note@-1{{parameter 'completion' is implicitly non-escaping}}
   // expected-error @+2 {{non-escaping value 'escape' may only be called}}
@@ -281,6 +290,15 @@
   // expected-error @+1 {{non-escaping parameter 'completion' may only be called}}
   escape = completion // expected-error {{declaration closing over non-escaping parameter 'escape' may allow it to escape}}
 }
+func doThing3(_ completion: CompletionHandler) {
+  // expected-note@-1{{parameter 'completion' is implicitly non-escaping}}
+  // expected-error @+2 {{non-escaping value 'escape' may only be called}}
+  // expected-error @+1 {{non-escaping parameter 'completion' may only be called}}
+  escape = completion // expected-error {{declaration closing over non-escaping parameter 'escape' may allow it to escape}}
+}
+func doThing4(_ completion: @escaping CompletionHandler) {
+  escapeOther = completion
+}
 
 // <rdar://problem/19997680> @noescape doesn't work on parameters of function type
 func apply<T, U>(_ f: @noescape (T) -> U, g: @noescape (@noescape (T) -> U) -> U) -> U { 
diff --git a/test/attr/attr_objc.swift b/test/attr/attr_objc.swift
index 2d458a3..535cd59 100644
--- a/test/attr/attr_objc.swift
+++ b/test/attr/attr_objc.swift
@@ -1,7 +1,7 @@
 // RUN: %target-parse-verify-swift
-// RUN: %target-swift-ide-test -skip-deinit=false -print-ast-typechecked -source-filename %s -function-definitions=true -prefer-type-repr=false -print-implicit-attrs=true -explode-pattern-binding-decls=true -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-ide-test -skip-deinit=false -print-ast-typechecked -source-filename %s -function-definitions=true -prefer-type-repr=false -print-implicit-attrs=true -explode-pattern-binding-decls=true -disable-objc-attr-requires-foundation-module | %FileCheck %s
 // RUN: not %target-swift-frontend -parse -dump-ast -disable-objc-attr-requires-foundation-module %s 2> %t.dump
-// RUN: FileCheck -check-prefix CHECK-DUMP %s < %t.dump
+// RUN: %FileCheck -check-prefix CHECK-DUMP %s < %t.dump
 // REQUIRES: objc_interop
 
 import Foundation
@@ -314,6 +314,7 @@
 }
 
 class ConcreteContext3 {
+
   func dynamicSelf1() -> Self { return self }
 
   @objc func dynamicSelf1_() -> Self { return self }
@@ -321,6 +322,38 @@
 
   @objc func genericParams<T: NSObject>() -> [T] { return [] }
   // expected-error@-1{{method cannot be marked @objc because it has generic parameters}}
+
+  @objc func returnObjCProtocolMetatype() -> NSCoding.Protocol { return NSCoding.self }
+  // expected-error@-1{{method cannot be marked @objc because its result type cannot be represented in Objective-C}}
+
+  typealias AnotherNSCoding = NSCoding
+  typealias MetaNSCoding1 = NSCoding.Protocol
+  typealias MetaNSCoding2 = AnotherNSCoding.Protocol
+
+  @objc func returnObjCAliasProtocolMetatype1() -> AnotherNSCoding.Protocol { return NSCoding.self }
+  // expected-error@-1{{method cannot be marked @objc because its result type cannot be represented in Objective-C}}
+
+  @objc func returnObjCAliasProtocolMetatype2() -> MetaNSCoding1 { return NSCoding.self }
+  // expected-error@-1{{method cannot be marked @objc because its result type cannot be represented in Objective-C}}
+
+  @objc func returnObjCAliasProtocolMetatype3() -> MetaNSCoding2 { return NSCoding.self }
+  // expected-error@-1{{method cannot be marked @objc because its result type cannot be represented in Objective-C}}
+
+  typealias Composition = NSCopying & NSCoding
+
+  @objc func returnCompositionMetatype1() -> Composition.Protocol { return Composition.self }
+  // expected-error@-1{{method cannot be marked @objc because its result type cannot be represented in Objective-C}}
+
+  @objc func returnCompositionMetatype2() -> (NSCopying & NSCoding).Protocol { return (NSCopying & NSCoding).self }
+  // expected-error@-1{{method cannot be marked @objc because its result type cannot be represented in Objective-C}}
+
+  typealias NSCodingExistential = NSCoding.Type
+
+  @objc func metatypeOfExistentialMetatypePram1(a: NSCodingExistential.Protocol) {}
+  // expected-error@-1{{method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C}}
+
+  @objc func metatypeOfExistentialMetatypePram2(a: NSCoding.Type.Protocol) {}
+  // expected-error@-1{{method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C}}
 }
 
 func genericContext1<T>(_: T) {
@@ -1953,7 +1986,7 @@
 // CHECK-DUMP-LABEL: class_decl "ImplicitClassThrows1"
 @objc class ImplicitClassThrows1 {
   // CHECK: @objc func methodReturnsVoid() throws
-  // CHECK-DUMP: func_decl "methodReturnsVoid()"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=Bool
+  // CHECK-DUMP: func_decl "methodReturnsVoid()"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
   func methodReturnsVoid() throws { }
 
   // CHECK: @objc func methodReturnsObjCClass() throws -> Class_ObjC1
@@ -1972,7 +2005,7 @@
   func methodReturnsOptionalObjCClass() throws -> Class_ObjC1? { return nil }
 
   // CHECK: @objc func methodWithTrailingClosures(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int, fn3: @escaping (Int) -> Int)
-  // CHECK-DUMP: func_decl "methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=Bool
+  // CHECK-DUMP: func_decl "methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
   func methodWithTrailingClosures(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int, fn3: @escaping (Int) -> Int) throws { }
 
   // CHECK: @objc init(degrees: Double) throws
@@ -1983,7 +2016,7 @@
 // CHECK-DUMP-LABEL: class_decl "SubclassImplicitClassThrows1"
 @objc class SubclassImplicitClassThrows1 : ImplicitClassThrows1 {
   // CHECK: @objc override func methodWithTrailingClosures(_ s: String, fn1: (@escaping (Int) -> Int), fn2: (@escaping (Int) -> Int), fn3: (@escaping (Int) -> Int))
-  // CHECK-DUMP: func_decl "methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=Bool
+  // CHECK-DUMP: func_decl "methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
   override func methodWithTrailingClosures(_ s: String, fn1: (@escaping (Int) -> Int), fn2: (@escaping (Int) -> Int), fn3: (@escaping (Int) -> Int)) throws { }
 }
 
@@ -2016,20 +2049,20 @@
 
   @objc(method7) func method7(x: Int) throws { } // expected-error{{@objc' method name provides names for 0 arguments, but method has 2 parameters (including the error parameter)}}
 
-  // CHECK-DUMP: func_decl "method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=Bool
+  // CHECK-DUMP: func_decl "method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
   @objc(method8:fn1:error:fn2:)
   func method8(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
 
-  // CHECK-DUMP: func_decl "method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=Bool
+  // CHECK-DUMP: func_decl "method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
   @objc(method9AndReturnError:s:fn1:fn2:)
   func method9(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
 }
 
 class SubclassThrowsObjCName : ThrowsObjCName {
-  // CHECK-DUMP: func_decl "method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=Bool
+  // CHECK-DUMP: func_decl "method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
   override func method8(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
 
-  // CHECK-DUMP: func_decl "method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=Bool
+  // CHECK-DUMP: func_decl "method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
   override func method9(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
 }
 
@@ -2068,3 +2101,19 @@
 func ==(lhs: ObjC_Class1, rhs: ObjC_Class1) -> Bool {
   return true
 }
+
+// CHECK-LABEL: @objc class OperatorInClass
+@objc class OperatorInClass {
+  // CHECK: {{^}} static func ==(lhs: OperatorInClass, rhs: OperatorInClass) -> Bool
+  static func ==(lhs: OperatorInClass, rhs: OperatorInClass) -> Bool {
+    return true
+  }
+  // CHECK: {{^}} @objc static func +(lhs: OperatorInClass, rhs: OperatorInClass) -> OperatorInClass
+  @objc static func +(lhs: OperatorInClass, rhs: OperatorInClass) -> OperatorInClass { // expected-error {{operator methods cannot be declared @objc}}
+    return lhs
+  }
+} // CHECK: {{^}$}}
+
+@objc protocol OperatorInProtocol {
+  static func +(lhs: Self, rhs: Self) -> Self // expected-error {{@objc protocols may not have operator requirements}}
+}
diff --git a/test/attr/attr_objc_any.swift b/test/attr/attr_objc_any.swift
index 8e1291b..8672ac2 100644
--- a/test/attr/attr_objc_any.swift
+++ b/test/attr/attr_objc_any.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -parse -verify %s -enable-id-as-any
+// RUN: %target-swift-frontend -parse -verify %s
 // REQUIRES: objc_interop
 
 import Foundation
diff --git a/test/attr/attr_objc_clang.swift b/test/attr/attr_objc_clang.swift
index 7668aa2..65f15ac 100644
--- a/test/attr/attr_objc_clang.swift
+++ b/test/attr/attr_objc_clang.swift
@@ -1,5 +1,5 @@
 // RUN: %target-parse-verify-swift -sdk %S/Inputs -I %S/Inputs/custom-modules -I %S/../Inputs/custom-modules
-// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -sdk %S/Inputs -I %S/Inputs/custom-modules -I %S/../Inputs/custom-modules -function-definitions=true -prefer-type-repr=false -print-implicit-attrs=true -explode-pattern-binding-decls=true -disable-objc-attr-requires-foundation-module  | FileCheck %s
+// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -sdk %S/Inputs -I %S/Inputs/custom-modules -I %S/../Inputs/custom-modules -function-definitions=true -prefer-type-repr=false -print-implicit-attrs=true -explode-pattern-binding-decls=true -disable-objc-attr-requires-foundation-module  | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/attr/attr_objc_foreign.swift b/test/attr/attr_objc_foreign.swift
index 0350ae7..455a3ca 100644
--- a/test/attr/attr_objc_foreign.swift
+++ b/test/attr/attr_objc_foreign.swift
@@ -1,5 +1,5 @@
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify %s
-// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-ast-typechecked -source-filename %s -function-definitions=true -prefer-type-repr=false -print-implicit-attrs=true -explode-pattern-binding-decls=true | FileCheck %s
+// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-ast-typechecked -source-filename %s -function-definitions=true -prefer-type-repr=false -print-implicit-attrs=true -explode-pattern-binding-decls=true | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/attr/attr_override.swift b/test/attr/attr_override.swift
index 42a1e65..9d43381 100644
--- a/test/attr/attr_override.swift
+++ b/test/attr/attr_override.swift
@@ -265,7 +265,7 @@
 
   func fixSeveralTypes(a: Int?, b: Int!) -> Int { return 0 }
 
-  func functionParam(x: (@escaping (Int) -> Int)?) {}
+  func functionParam(x: ((Int) -> Int)?) {}
   func tupleParam(x: (Int, Int)?) {}
 
   func nameAndTypeMismatch(label: Int?) {}
diff --git a/test/attr/attr_specialize.swift b/test/attr/attr_specialize.swift
index cab921c..69dea77 100644
--- a/test/attr/attr_specialize.swift
+++ b/test/attr/attr_specialize.swift
@@ -1,5 +1,5 @@
 // RUN: %target-parse-verify-swift
-// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename=%s -disable-objc-attr-requires-foundation-module | FileCheck %s
+// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename=%s -disable-objc-attr-requires-foundation-module | %FileCheck %s
 
 struct S<T> {}
 
@@ -66,7 +66,7 @@
   typealias Element = Float
 }
 @_specialize(FloatElement)
-@_specialize(IntElement) // expected-error{{'<T : HasElt where T.Element == Float> (T) -> ()' requires the types 'Element' (aka 'Int') and 'Float' be equivalent}}
+@_specialize(IntElement) // expected-error{{'<T : HasElt where T.Element == Float> (T) -> ()' requires the types 'IntElement.Element' (aka 'Int') and 'Float' be equivalent}}
 func sameTypeRequirement<T : HasElt>(_ t: T) where T.Element == Float {}
 
 class Base {}
diff --git a/test/attr/attr_swift3_migration.swift b/test/attr/attr_swift3_migration.swift
deleted file mode 100644
index ee65c1c..0000000
--- a/test/attr/attr_swift3_migration.swift
+++ /dev/null
@@ -1,23 +0,0 @@
-// RUN: %target-parse-verify-swift
-
-@swift3_migration(renamed: "g0(a:b:c:)", message: "it's good for you")
-func f0(x: Int, y: Int, z: Int) { }
-
-@swift3_migration(renamed: "Y0")
-struct X0 { }
-
-
-
-// Parsing diagnostics
-
-@swift3_migration(renamed) // expected-error{{expected ':' following 'renamed' argument of 'swift3_migration'}}
-func bad0() { }
-
-@swift3_migration(renamed: blah) // expected-error{{expected string literal for 'renamed' argument of 'swift3_migration'}}
-func bad1() { }
-
-@swift3_migration(unknown: "foo") // expected-warning{{expected 'renamed' or 'message' in 'swift3_migration' attribute}}
-func bad2() { }
-
-@swift3_migration(renamed: "wibble wonka(") // expected-error{{ill-formed Swift name 'wibble wonka('}}
-func bad3() { }
diff --git a/test/decl/enum/objc_enum_multi_file.swift b/test/decl/enum/objc_enum_multi_file.swift
index b130b57..ffbc04f 100644
--- a/test/decl/enum/objc_enum_multi_file.swift
+++ b/test/decl/enum/objc_enum_multi_file.swift
@@ -1,8 +1,8 @@
-// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D NO_RAW_TYPE 2>&1 | FileCheck -check-prefix=NO_RAW_TYPE %s
-// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D BAD_RAW_TYPE 2>&1 | FileCheck -check-prefix=BAD_RAW_TYPE %s
-// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D NON_INT_RAW_TYPE 2>&1 | FileCheck -check-prefix=NON_INT_RAW_TYPE %s
-// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D NO_CASES 2>&1 | FileCheck -check-prefix=NO_CASES %s
-// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D DUPLICATE_CASES 2>&1 | FileCheck -check-prefix=DUPLICATE_CASES %s
+// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D NO_RAW_TYPE 2>&1 | %FileCheck -check-prefix=NO_RAW_TYPE %s
+// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D BAD_RAW_TYPE 2>&1 | %FileCheck -check-prefix=BAD_RAW_TYPE %s
+// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D NON_INT_RAW_TYPE 2>&1 | %FileCheck -check-prefix=NON_INT_RAW_TYPE %s
+// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D NO_CASES 2>&1 | %FileCheck -check-prefix=NO_CASES %s
+// RUN: not %target-swift-frontend -module-name main %s -primary-file %S/Inputs/objc_enum_multi_file_helper.swift -parse -D DUPLICATE_CASES 2>&1 | %FileCheck -check-prefix=DUPLICATE_CASES %s
 // Note that the *other* file is the primary file in this test!
 
 #if NO_RAW_TYPE
diff --git a/test/decl/ext/protocol.swift b/test/decl/ext/protocol.swift
index 3462cfb..1ab840b 100644
--- a/test/decl/ext/protocol.swift
+++ b/test/decl/ext/protocol.swift
@@ -221,7 +221,7 @@
   s4c.extP4Int() // okay
   var b1 = s4d.extP4a() // okay, "Bool" version
   b1 = true // checks type above
-  s4d.extP4Int() // expected-error{{'Int' is not convertible to 'AssocP4' (aka 'Bool')}}
+  s4d.extP4Int() // expected-error{{'Int' is not convertible to 'S4d.AssocP4' (aka 'Bool')}}
   _ = b1
 }
 
@@ -498,7 +498,7 @@
 }
 
 func testSConforms8c() {
-  let s: SConforms8c.Assoc = "hello" // expected-error{{cannot convert value of type 'String' to specified type 'Assoc' (aka 'Int')}}
+  let s: SConforms8c.Assoc = "hello" // expected-error{{cannot convert value of type 'String' to specified type 'SConforms8c.Assoc' (aka 'Int')}}
   _ = s
   let i: SConforms8c.Assoc = 5
   _ = i
diff --git a/test/decl/func/operator.swift b/test/decl/func/operator.swift
index 4db71d6..5fcbdec 100644
--- a/test/decl/func/operator.swift
+++ b/test/decl/func/operator.swift
@@ -336,3 +336,20 @@
   // Okay: refers to P3
   static func %%%%(lhs: P3, rhs: Unrelated) -> Unrelated { }
 }
+
+// rdar://problem/27940842 - recovery with a non-static '=='.
+class C5 {
+  func == (lhs: C5, rhs: C5) -> Bool { return false } // expected-error{{operator '==' declared in type 'C5' must be 'static'}}
+
+  func test1(x: C5) {
+    _ = x == x
+  }
+}
+
+class C6 {
+  static func == (lhs: C6, rhs: C6) -> Bool { return false }
+
+  func test1(x: C6) {
+    if x == x && x = x { } // expected-error{{cannot assign to value: '&&' returns immutable value}}
+  }
+}
diff --git a/test/decl/func/throwing_functions.swift b/test/decl/func/throwing_functions.swift
index 364f7fc..ceccf36 100644
--- a/test/decl/func/throwing_functions.swift
+++ b/test/decl/func/throwing_functions.swift
@@ -105,7 +105,7 @@
 func subtypeArgument2(_ x: (_ fn: ((String) throws -> Int)) -> Int) { }
 func testSubtypeArgument2(_ x1: (_ fn: ((String) -> Int)) -> Int,
                           x2: (_ fn: ((String) throws -> Int)) -> Int) {
-  subtypeArgument2(x1) // expected-error{{cannot convert value of type '((@escaping (String) -> Int)) -> Int' to expected argument type '((@escaping (String) throws -> Int)) -> Int'}}
+  subtypeArgument2(x1) // expected-error{{cannot convert value of type '(((String) -> Int)) -> Int' to expected argument type '(((String) throws -> Int)) -> Int'}}
   subtypeArgument2(x2)
 }
 
diff --git a/test/decl/protocol/conforms/Inputs/placement_2.swift b/test/decl/protocol/conforms/Inputs/placement_2.swift
index 0e02c9e..7c201f1 100644
--- a/test/decl/protocol/conforms/Inputs/placement_2.swift
+++ b/test/decl/protocol/conforms/Inputs/placement_2.swift
@@ -39,6 +39,6 @@
 
 extension MFSynthesizedSubClass4 : AnyObjectRefinement { }
 
-enum MFSynthesizedEnum1 : Int { case a }
+enum MFSynthesizedEnum1 : Int { case a } // expected-note {{'MFSynthesizedEnum1' declares raw type 'Int', which implies RawRepresentable}}
 extension MFSynthesizedEnum2 : RawRepresentable { }
 
diff --git a/test/decl/protocol/conforms/associated_type.swift b/test/decl/protocol/conforms/associated_type.swift
index 187dc4e..c31e30b 100644
--- a/test/decl/protocol/conforms/associated_type.swift
+++ b/test/decl/protocol/conforms/associated_type.swift
@@ -6,6 +6,6 @@
   associatedtype AssocP : C
 }
 
-struct X : P { // expected-error{{'P' requires that 'AssocP' (aka 'Int') inherit from 'C'}}
+struct X : P { // expected-error{{'P' requires that 'X.AssocP' (aka 'Int') inherit from 'C'}}
   typealias AssocP = Int
 }
diff --git a/test/decl/protocol/conforms/placement.swift b/test/decl/protocol/conforms/placement.swift
index 8aceaae..ad3fbb1 100644
--- a/test/decl/protocol/conforms/placement.swift
+++ b/test/decl/protocol/conforms/placement.swift
@@ -127,10 +127,11 @@
 class SynthesizedSubClass4 : SynthesizedClass2 { }
 extension SynthesizedSubClass4 : AnyObjectRefinement { }
 
-enum SynthesizedEnum1 : Int, RawRepresentable { case none = 0 }
+enum SynthesizedEnum1 : Int, RawRepresentable { case none = 0 } // expected-error{{redundant conformance of 'SynthesizedEnum1' to protocol 'RawRepresentable'}} expected-note{{'SynthesizedEnum1' declares raw type 'Int', which implies RawRepresentable}}
 
-enum SynthesizedEnum2 : Int { case none = 0 }
-extension SynthesizedEnum2 : RawRepresentable { }
+enum SynthesizedEnum2 : Int { case none = 0 } // expected-note {{'SynthesizedEnum2' declares raw type 'Int', which implies RawRepresentable}}
+extension SynthesizedEnum2 : RawRepresentable { } // expected-error{{redundant conformance of 'SynthesizedEnum2' to protocol 'RawRepresentable'}}
+
 
 // ===========================================================================
 // Tests across different source files
@@ -143,6 +144,7 @@
 
 extension MFExplicit2 : P1 { } // expected-error{{redundant conformance of 'MFExplicit2' to protocol 'P1'}}
 
+
 // ---------------------------------------------------------------------------
 // Multiple implicit conformances, with no ambiguities
 // ---------------------------------------------------------------------------
@@ -180,7 +182,7 @@
 
 class MFSynthesizedSubClass4 : MFSynthesizedClass2 { }
 
-extension MFSynthesizedEnum1 : RawRepresentable { }
+extension MFSynthesizedEnum1 : RawRepresentable { } // expected-error{{redundant conformance of 'MFSynthesizedEnum1' to protocol 'RawRepresentable'}}
 
 enum MFSynthesizedEnum2 : Int { case none = 0 }
 
diff --git a/test/decl/protocol/protocols.swift b/test/decl/protocol/protocols.swift
index 035cf2d..bd397e3 100644
--- a/test/decl/protocol/protocols.swift
+++ b/test/decl/protocol/protocols.swift
@@ -117,7 +117,7 @@
 
 protocol StreamWithAssoc {
   associatedtype Element
-  func get() -> Element // expected-note{{protocol requires function 'get()' with type '() -> Element'}}
+  func get() -> Element // expected-note{{protocol requires function 'get()' with type '() -> NotAStreamType.Element'}}
 }
 
 struct AnRange<Int> : StreamWithAssoc {
@@ -170,7 +170,7 @@
 }
 
 struct NotSequence : SequenceViaStream { // expected-error{{type 'NotSequence' does not conform to protocol 'SequenceViaStream'}}
-  typealias SequenceStreamTypeType = Int // expected-note{{possibly intended match 'SequenceStreamTypeType' (aka 'Int') does not conform to 'IteratorProtocol'}}
+  typealias SequenceStreamTypeType = Int // expected-note{{possibly intended match 'NotSequence.SequenceStreamTypeType' (aka 'Int') does not conform to 'IteratorProtocol'}}
   func makeIterator() -> Int {}
 }
 
diff --git a/test/decl/protocol/req/func.swift b/test/decl/protocol/req/func.swift
index 5714bd3..38021b1 100644
--- a/test/decl/protocol/req/func.swift
+++ b/test/decl/protocol/req/func.swift
@@ -23,7 +23,7 @@
 protocol P2 {
   associatedtype Assoc : P1 // expected-note{{ambiguous inference of associated type 'Assoc': 'X1a' vs. 'X1b'}}
   // expected-note@-1{{protocol requires nested type 'Assoc'}}
-  func f1(_ x: Assoc) // expected-note{{protocol requires function 'f1' with type '(Assoc) -> ()'}} expected-note{{protocol requires function 'f1' with type '(Assoc) -> ()'}}
+  func f1(_ x: Assoc) // expected-note{{protocol requires function 'f1' with type '(X2w.Assoc) -> ()'}} expected-note{{protocol requires function 'f1' with type '(X2y.Assoc) -> ()'}}
 }
 
 // Exact match.
@@ -88,7 +88,7 @@
 
 protocol P3 {
   associatedtype Assoc : P1
-  static prefix func ~~(_: Self) -> Assoc // expected-note{{protocol requires function '~~' with type '(X3z) -> Assoc'}}
+  static prefix func ~~(_: Self) -> Assoc // expected-note{{protocol requires function '~~' with type '(X3z) -> X3z.Assoc'}}
 }
 
 // Global operator match
@@ -111,7 +111,7 @@
 postfix operator ~~
 protocol P4 {
   associatedtype Assoc : P1
-  static postfix func ~~ (_: Self) -> Assoc // expected-note{{protocol requires function '~~' with type '(X4z) -> Assoc'}}
+  static postfix func ~~ (_: Self) -> Assoc // expected-note{{protocol requires function '~~' with type '(X4z) -> X4z.Assoc'}}
 }
 
 // Global operator match
diff --git a/test/decl/subscript/subscripting.swift b/test/decl/subscript/subscripting.swift
index 1085f6d..eae74ab 100644
--- a/test/decl/subscript/subscripting.swift
+++ b/test/decl/subscript/subscripting.swift
@@ -254,6 +254,9 @@
   
   
   let b = s2[1, "foo"] // expected-error {{cannot convert value of type 'Int' to expected argument type 'String'}}
+
+  // rdar://problem/27449208
+  let v: (Int?, [Int]?) = (nil [17]) // expected-error {{cannot subscript a nil literal value}}
 }
 
 // sr-114 & rdar://22007370
diff --git a/test/decl/typealias/associated_types.swift b/test/decl/typealias/associated_types.swift
index f835eec..40f96c1 100644
--- a/test/decl/typealias/associated_types.swift
+++ b/test/decl/typealias/associated_types.swift
@@ -3,13 +3,17 @@
 protocol BaseProto {
   associatedtype AssocTy
 }
-var a: BaseProto.AssocTy = 4 // expected-error{{cannot use associated type 'AssocTy' outside of its protocol}}
+var a: BaseProto.AssocTy = 4
+// expected-error@-1{{associated type 'AssocTy' can only be used with a concrete type or generic parameter base}}
 
+var a = BaseProto.AssocTy.self
+// expected-error@-1{{associated type 'AssocTy' can only be used with a concrete type or generic parameter base}}
 
 protocol DerivedProto : BaseProto {
   func associated() -> AssocTy // no-warning
 
-  func existential() -> BaseProto.AssocTy // expected-error{{cannot use associated type 'AssocTy' outside of its protocol}}
+  func existential() -> BaseProto.AssocTy
+  // expected-error@-1{{associated type 'AssocTy' can only be used with a concrete type or generic parameter base}}
 }
 
 
diff --git a/test/decl/typealias/protocol.swift b/test/decl/typealias/protocol.swift
index 76e99a7..047e183 100644
--- a/test/decl/typealias/protocol.swift
+++ b/test/decl/typealias/protocol.swift
@@ -135,13 +135,18 @@
   var a: T2 { get }
 }
 
+protocol P6 {
+  typealias A = Int
+  typealias B = Self
+}
+
 struct T5 : P5 {
   // This is OK -- the typealias is fully concrete
   var a: P5.T1 // OK
 
   // Invalid -- cannot represent associated type of existential
-  var v2: P5.T2 // expected-error {{cannot use typealias 'T2' of associated type 'A' outside of its protocol}}
-  var v3: P5.X // expected-error {{cannot use typealias 'X' of associated type 'Self' outside of its protocol}}
+  var v2: P5.T2 // expected-error {{typealias 'T2' can only be used with a concrete type or generic parameter base}}
+  var v3: P5.X // expected-error {{typealias 'X' can only be used with a concrete type or generic parameter base}}
 
   // FIXME: Unqualified reference to typealias from a protocol conformance
   var v4: T1 // expected-error {{use of undeclared type 'T1'}}
@@ -150,18 +155,21 @@
   // Qualified reference
   var v6: T5.T1 // OK
   var v7: T5.T2 // OK
+
+  var v8 = P6.A.self
+  var v9 = P6.B.self // expected-error {{typealias 'B' can only be used with a concrete type or generic parameter base}}
 }
 
 // Unqualified lookup finds typealiases in protocol extensions, though
-protocol P6 {
+protocol P7 {
   associatedtype A
 }
 
-extension P6 {
+extension P7 {
   typealias Y = A
 }
 
-struct S6 : P6 {
+struct S7 : P7 {
   typealias A = Int
 
   // FIXME
diff --git a/test/expr/capture/dynamic_self.swift b/test/expr/capture/dynamic_self.swift
index ffd27a9..3761eca 100644
--- a/test/expr/capture/dynamic_self.swift
+++ b/test/expr/capture/dynamic_self.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -dump-ast %s 2>&1 | FileCheck %s
+// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s
 
 // CHECK: func_decl "clone()" type='(Self) -> () -> Self'
 
diff --git a/test/expr/capture/generic_params.swift b/test/expr/capture/generic_params.swift
index d96c563..f23545d 100644
--- a/test/expr/capture/generic_params.swift
+++ b/test/expr/capture/generic_params.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -dump-ast %s 2>&1 | FileCheck %s
+// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s
 
 func doSomething<T>(_ t: T) {}
 
diff --git a/test/expr/capture/nested.swift b/test/expr/capture/nested.swift
index 0fd289a..eee92e2 100644
--- a/test/expr/capture/nested.swift
+++ b/test/expr/capture/nested.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -dump-ast %s 2>&1 | FileCheck %s
+// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s
 
 // CHECK: func_decl "foo2(_:)"
 func foo2(_ x: Int) -> (Int) -> (Int) -> Int {
diff --git a/test/expr/capture/top-level-guard.swift b/test/expr/capture/top-level-guard.swift
index e68bbc0..cb75475 100644
--- a/test/expr/capture/top-level-guard.swift
+++ b/test/expr/capture/top-level-guard.swift
@@ -1,7 +1,7 @@
-// RUN: %target-swift-frontend -dump-ast %s 2>&1 | FileCheck %s
+// RUN: %target-swift-frontend -dump-ast %s 2>&1 | %FileCheck %s
 // RUN: %target-swift-frontend -emit-ir %s > /dev/null
 
-// RUN: %target-swift-frontend -dump-ast -DVAR %s 2>&1 | FileCheck %s
+// RUN: %target-swift-frontend -dump-ast -DVAR %s 2>&1 | %FileCheck %s
 // RUN: %target-swift-frontend -emit-ir -DVAR %s > /dev/null
 
 // CHECK: (top_level_code_decl
diff --git a/test/expr/cast/array_downcast_Foundation.swift b/test/expr/cast/array_downcast_Foundation.swift
index 9e855d5..baa5c64 100644
--- a/test/expr/cast/array_downcast_Foundation.swift
+++ b/test/expr/cast/array_downcast_Foundation.swift
@@ -6,7 +6,7 @@
 // FIXME: END -enable-source-import hackaround
 
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -parse %s -verify
-// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) %s -dump-ast -verify 2>&1 | FileCheck %s
+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) %s -dump-ast -verify 2>&1 | %FileCheck %s
 
 // REQUIRES: objc_interop
 
diff --git a/test/expr/closure/closures.swift b/test/expr/closure/closures.swift
index 1769beb..f738b08 100644
--- a/test/expr/closure/closures.swift
+++ b/test/expr/closure/closures.swift
@@ -1,6 +1,6 @@
 // RUN: %target-parse-verify-swift
 
-var func6 : (_ fn : (Int,Int) -> Int) -> ()
+var func6 : (_ fn : ((Int, Int)) -> Int) -> ()
 var func6a : ((Int, Int) -> Int) -> ()
 var func6b : (Int, (Int, Int) -> Int) -> ()
 func func6c(_ f: (Int, Int) -> Int, _ n: Int = 0) {} // expected-warning{{prior to parameters}}
@@ -65,7 +65,7 @@
   func6({a,b in 4.0 })  // expected-error {{cannot convert value of type 'Double' to closure result type 'Int'}}
   
   // TODO: This diagnostic can be improved: rdar://22128205
-  func6({(a : Float, b) in 4 }) // expected-error {{cannot convert value of type '(Float, _) -> Int' to expected argument type '(Int, Int) -> Int'}}
+  func6({(a : Float, b) in 4 }) // expected-error {{cannot convert value of type '(Float, _) -> Int' to expected argument type '((Int, Int)) -> Int'}}
 
   
   
diff --git a/test/expr/closure/default_args.swift b/test/expr/closure/default_args.swift
index 4297ac6..8211d41 100644
--- a/test/expr/closure/default_args.swift
+++ b/test/expr/closure/default_args.swift
@@ -3,8 +3,8 @@
 func simple_default_args() {
   // <rdar://problem/22753605> QoI: bad diagnostic when closure has default argument
   let _ : (Int) -> Int = {(x : Int = 1) in x+1} // expected-error{{default arguments are not allowed in closures}} {{36-39=}}
-  let _ : () -> Int = {(_ x : Int = 1) in x+1} // expected-error{{cannot convert value of type '(Int) -> Int' to specified type '() -> Int'}} expected-error {{default arguments are not allowed in closures}} {{35-38=}}
-  let _ : () -> Int = {(_ x : Int) in x+1} // expected-error{{cannot convert value of type '(Int) -> Int' to specified type '() -> Int'}}
+  let _ : () -> Int = {(_ x : Int = 1) in x+1} // expected-error{{contextual closure type '() -> Int' expects 0 arguments, but 1 was used in closure body}} expected-error {{default arguments are not allowed in closures}} {{35-38=}}
+  let _ : () -> Int = {(_ x : Int) in x+1} // expected-error{{contextual closure type '() -> Int' expects 0 arguments, but 1 was used in closure body}}
 }
 
 func func_default_args() {
diff --git a/test/expr/expressions.swift b/test/expr/expressions.swift
index 0448e8d..697efe0 100644
--- a/test/expr/expressions.swift
+++ b/test/expr/expressions.swift
@@ -113,7 +113,7 @@
 }
 
 // Error recovery.
-func testfunc2 (_: ((), Int) -> Int) -> Int {}
+func testfunc2 (_: (((), Int)) -> Int) -> Int {}
 func errorRecovery() {
   testfunc2({ $0 + 1 }) // expected-error {{binary operator '+' cannot be applied to operands of type '((), Int)' and 'Int'}} expected-note {{expected an argument list of type '(Int, Int)'}}
 
@@ -891,9 +891,5 @@
   _ = sizeof(Cse0101<P>.self) // expected-error {{'sizeof' is unavailable: use MemoryLayout<T>.size instead.}} {{7-14=MemoryLayout<}} {{24-30=>.size}} {{none}}
   _ = alignof(Cse0101<P>.T.self) // expected-error {{'alignof' is unavailable: use MemoryLayout<T>.alignment instead.}} {{7-15=MemoryLayout<}} {{27-33=>.alignment}} {{none}}
   _ = strideof(P.Type.self) // expected-error {{'strideof' is unavailable: use MemoryLayout<T>.stride instead.}} {{7-16=MemoryLayout<}} {{22-28=>.stride}} {{none}}
-  _ = sizeof(type(of: x)) // expected-error {{'sizeof' is unavailable: use MemoryLayout<T>.size instead.}} {{7-26=MemoryLayout<Cse0101<P>>.size}} {{none}}/
-
-  _ = sizeofValue(x) // expected-error {{'sizeofValue' is unavailable: use MemoryLayout<T>.size instead.}} {{7-21=MemoryLayout<Cse0101<P>>.size}} {{none}}
-  _ = alignofValue(x.val) // expected-error {{'alignofValue' is unavailable: use MemoryLayout<T>.alignment instead.}} {{7-26=MemoryLayout<P>.alignment}} {{none}}
-  _ = strideofValue(x.val.getIt()) // expected-error {{'strideofValue' is unavailable: use MemoryLayout<T>.stride instead.}} {{7-35=MemoryLayout<P.Value>.stride}} {{none}}
+  _ = sizeof(type(of: x)) // expected-error {{'sizeof' is unavailable: use MemoryLayout<T>.size instead.}} {{7-26=MemoryLayout<Cse0101<P>>.size}} {{none}}
 }
diff --git a/test/expr/unary/selector/fixits.swift b/test/expr/unary/selector/fixits.swift
index a6a34e5..c15d75c 100644
--- a/test/expr/unary/selector/fixits.swift
+++ b/test/expr/unary/selector/fixits.swift
@@ -23,7 +23,7 @@
 // RUN: %utils/apply-fixit-edits.py %t.remapping
 // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t.overlays) -parse %t.sources/fixits.swift 2> %t.result
 
-// RUN: FileCheck %s < %t.result
+// RUN: %FileCheck %s < %t.result
 // RUN: grep -c "warning:" %t.result | grep 3
 
 // CHECK: warning: no method declared with Objective-C selector 'unknownMethodWithValue:label:'
diff --git a/test/lit.cfg b/test/lit.cfg
index bf064ef..95c7053 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -26,6 +26,7 @@
 import tempfile
 import socket
 import glob
+import pipes
 
 import lit
 import lit.formats
@@ -289,6 +290,7 @@
 config.line_directive = os.path.join(config.swift_utils, 'line-directive')
 config.gyb = os.path.join(config.swift_utils, 'gyb')
 config.rth = os.path.join(config.swift_utils, 'rth') # Resilience test helper
+config.PathSanitizingFileCheck = os.path.join(config.swift_utils, 'PathSanitizingFileCheck')
 config.swift_lib_dir = os.path.join(os.path.dirname(os.path.dirname(config.swift)), 'lib')
 
 # Find the resource directory.  Assume it's near the swift compiler if not set.
@@ -413,6 +415,7 @@
 disallow('lldb-moduleimport-test')
 disallow('swift-ide-test')
 disallow('clang')
+disallow('FileCheck')
 
 config.substitutions.insert(0,
     ('%p',
@@ -998,6 +1001,14 @@
 config.substitutions.append(('%llvm-profdata', config.llvm_profdata))
 config.substitutions.append(('%llvm-cov', config.llvm_cov))
 
+config.substitutions.append(
+    ('%FileCheck',
+     '%s --sanitize \'BUILD_DIR=%s\' --sanitize \'SOURCE_DIR=%s\'' %
+      (config.PathSanitizingFileCheck,
+       pipes.quote(swift_obj_root),
+       pipes.quote(config.swift_src_root))))
+config.substitutions.append(('%raw-FileCheck', 'FileCheck'))
+
 # If static stdlib is present, enable static stdlib tests
 static_stdlib_path = os.path.join(os.path.join(config.swift_lib_dir,"swift_static"), config.target_sdk_name)
 libswiftCore_path = os.path.join(static_stdlib_path,"libswiftCore.a")
diff --git a/test/multifile/Inputs/external-protocol-conformance/A.swift b/test/multifile/Inputs/external-protocol-conformance/A.swift
index 9ebec4d..c1bdbf0 100644
--- a/test/multifile/Inputs/external-protocol-conformance/A.swift
+++ b/test/multifile/Inputs/external-protocol-conformance/A.swift
@@ -6,5 +6,5 @@
 }
 
 struct A : P { // expected-error {{type 'A' does not conform to protocol 'P'}}
-  typealias Assoc = Int // expected-note {{possibly intended match 'Assoc' (aka 'Int') does not conform to 'PHelper'}}
+  typealias Assoc = Int // expected-note {{possibly intended match 'A.Assoc' (aka 'Int') does not conform to 'PHelper'}}
 }
diff --git a/test/multifile/protocol-conformance-member.swift b/test/multifile/protocol-conformance-member.swift
index faf848b..7e69611 100644
--- a/test/multifile/protocol-conformance-member.swift
+++ b/test/multifile/protocol-conformance-member.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-build-swift -emit-library %s %S/Inputs/protocol-conformance-member-helper.swift -o %t/libTest.dylib -module-name Test
-// RUN: llvm-nm %t/libTest.dylib | FileCheck %s
+// RUN: llvm-nm %t/libTest.dylib | %FileCheck %s
 
 // CHECK: _TFV4Test10CoolStructg10coolFactorSd
 
diff --git a/test/sil-extract/basic.sil b/test/sil-extract/basic.sil
index 65b5ed7..91b9aac 100644
--- a/test/sil-extract/basic.sil
+++ b/test/sil-extract/basic.sil
@@ -1,4 +1,4 @@
-// RUN: %target-sil-extract %s -func=use_before_init | FileCheck %s
+// RUN: %target-sil-extract %s -func=use_before_init | %FileCheck %s
 
 import Builtin
 import Swift
diff --git a/test/sil-extract/basic.swift b/test/sil-extract/basic.swift
index 6891af7..75a3145 100644
--- a/test/sil-extract/basic.swift
+++ b/test/sil-extract/basic.swift
@@ -1,16 +1,16 @@
 // Passing demangled name
 
-// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="basic.foo" | FileCheck %s -check-prefix=EXTRACT-FOO
-// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="basic.X.test" | FileCheck %s -check-prefix=EXTRACT-TEST
-// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="basic.Vehicle.init" | FileCheck %s -check-prefix=EXTRACT-INIT
-// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="basic.Vehicle.now" | FileCheck %s -check-prefix=EXTRACT-NOW
+// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="basic.foo" | %FileCheck %s -check-prefix=EXTRACT-FOO
+// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="basic.X.test" | %FileCheck %s -check-prefix=EXTRACT-TEST
+// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="basic.Vehicle.init" | %FileCheck %s -check-prefix=EXTRACT-INIT
+// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="basic.Vehicle.now" | %FileCheck %s -check-prefix=EXTRACT-NOW
 
 // Passing mangled name
 
-// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="_TF5basic3fooFT_Si" | FileCheck %s -check-prefix=EXTRACT-FOO
-// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="_TFV5basic1X4testfT_T_" | FileCheck %s -check-prefix=EXTRACT-TEST
-// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="_TFC5basic7VehiclecfT1nSi_S0_" | FileCheck %s -check-prefix=EXTRACT-INIT
-// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="_TFC5basic7Vehicle3nowfT_Si" | FileCheck %s -check-prefix=EXTRACT-NOW
+// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="_TF5basic3fooFT_Si" | %FileCheck %s -check-prefix=EXTRACT-FOO
+// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="_TFV5basic1X4testfT_T_" | %FileCheck %s -check-prefix=EXTRACT-TEST
+// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="_TFC5basic7VehiclecfT1nSi_S0_" | %FileCheck %s -check-prefix=EXTRACT-INIT
+// RUN: %target-swift-frontend %s -g -module-name basic -emit-sib -o - | %target-sil-extract -module-name basic -func="_TFC5basic7Vehicle3nowfT_Si" | %FileCheck %s -check-prefix=EXTRACT-NOW
 
 
 // EXTRACT-FOO-NOT: sil hidden @_TFV5basic1X4testfT_T_ : $@convention(method) (X) -> () {
diff --git a/test/sil-extract/load-serialized-sil.swift b/test/sil-extract/load-serialized-sil.swift
index fed1773..f9133b7 100644
--- a/test/sil-extract/load-serialized-sil.swift
+++ b/test/sil-extract/load-serialized-sil.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -sil-serialize-all -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-extract -module-name="Swift" -func="_TFVs1X4testfT_T_" | FileCheck %s
-// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-extract -module-name="Swift" -func="_TFVs1X4testfT_T_" | FileCheck %s -check-prefix=SIB-CHECK
+// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -sil-serialize-all -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-extract -module-name="Swift" -func="_TFVs1X4testfT_T_" | %FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-extract -module-name="Swift" -func="_TFVs1X4testfT_T_" | %FileCheck %s -check-prefix=SIB-CHECK
 
 // CHECK: import Builtin
 // CHECK: import Swift
diff --git a/test/sil-opt/sil-opt.swift b/test/sil-opt/sil-opt.swift
index af972df..68d408e 100644
--- a/test/sil-opt/sil-opt.swift
+++ b/test/sil-opt/sil-opt.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -sil-serialize-all -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-opt -enable-sil-verify-all -module-name="Swift" | FileCheck %s
-// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-opt -enable-sil-verify-all -module-name="Swift" | FileCheck %s -check-prefix=SIB-CHECK
+// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -sil-serialize-all -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-opt -enable-sil-verify-all -module-name="Swift" | %FileCheck %s
+// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-opt -enable-sil-verify-all -module-name="Swift" | %FileCheck %s -check-prefix=SIB-CHECK
 
 // CHECK: import Builtin
 // CHECK: import Swift
diff --git a/test/stmt/foreach.swift b/test/stmt/foreach.swift
index 0a89b47..86b4619 100644
--- a/test/stmt/foreach.swift
+++ b/test/stmt/foreach.swift
@@ -27,7 +27,7 @@
 struct BadIterator1 {}
 
 struct BadContainer4 : Sequence { // expected-error{{type 'BadContainer4' does not conform to protocol 'Sequence'}}
-  typealias Iterator = BadIterator1 // expected-note{{possibly intended match 'Iterator' (aka 'BadIterator1') does not conform to 'IteratorProtocol'}}
+  typealias Iterator = BadIterator1 // expected-note{{possibly intended match 'BadContainer4.Iterator' (aka 'BadIterator1') does not conform to 'IteratorProtocol'}}
   func makeIterator() -> BadIterator1 { }
 }
 
@@ -70,7 +70,7 @@
 
   for (i, _) : (Int, Float) in gtr { sum = sum + i }
 
-  for (i, _) : (Int, Int) in gtr { sum = sum + i } // expected-error{{'Element' (aka '(Int, Float)') is not convertible to '(Int, Int)'}}
+  for (i, _) : (Int, Int) in gtr { sum = sum + i } // expected-error{{'GoodTupleIterator.Element' (aka '(Int, Float)') is not convertible to '(Int, Int)'}}
 
   for (i, f) in gtr {}
 }
diff --git a/test/stmt/if_while_var.swift b/test/stmt/if_while_var.swift
index bac9f50..acc9abc 100644
--- a/test/stmt/if_while_var.swift
+++ b/test/stmt/if_while_var.swift
@@ -1,7 +1,11 @@
 // RUN: %target-parse-verify-swift
 
+struct NonOptionalStruct {}
+enum NonOptionalEnum { case foo }
+
 func foo() -> Int? { return .none }
-func nonOptional() -> Int { return 0 }
+func nonOptionalStruct() -> NonOptionalStruct { fatalError() }
+func nonOptionalEnum() -> NonOptionalEnum { fatalError() }
 func use(_ x: Int) {}
 func modify(_ x: inout Int) {}
 
@@ -19,7 +23,14 @@
 
 use(x) // expected-error{{unresolved identifier 'x'}}
 
-if let x = nonOptional() { } // expected-error{{initializer for conditional binding must have Optional type, not 'Int'}}
+if let x = nonOptionalStruct() { } // expected-error{{initializer for conditional binding must have Optional type, not 'NonOptionalStruct'}}
+if let x = nonOptionalEnum() { } // expected-error{{initializer for conditional binding must have Optional type, not 'NonOptionalEnum'}}
+
+guard let _ = nonOptionalStruct() else { fatalError() } // expected-error{{initializer for conditional binding must have Optional type, not 'NonOptionalStruct'}}
+guard let _ = nonOptionalEnum() else { fatalError() } // expected-error{{initializer for conditional binding must have Optional type, not 'NonOptionalEnum'}}
+
+if case let x? = nonOptionalStruct() { } // expected-error{{'?' pattern cannot match values of type 'NonOptionalStruct'}}
+if case let x? = nonOptionalEnum() { } // expected-error{{'?' pattern cannot match values of type 'NonOptionalEnum'}}
 
 class B {} // expected-note * {{did you mean 'B'?}}
 class D : B {}// expected-note * {{did you mean 'D'?}}
diff --git a/test/stmt/statements.swift b/test/stmt/statements.swift
index 27a8754..d5a2464 100644
--- a/test/stmt/statements.swift
+++ b/test/stmt/statements.swift
@@ -467,6 +467,28 @@
   }
 }
 
+do {
+  guard 1 == 2 else {
+    break // expected-error {{unlabeled 'break' is only allowed inside a loop or switch, a labeled break is required to exit an if or do}}
+  }
+}
+
+func fn(a: Int) {
+  guard a < 1 else {
+    break // expected-error {{'break' is only allowed inside a loop, if, do, or switch}}
+  }
+}
+
+func fn(x: Int) {
+  if x >= 0 {
+    guard x < 1 else {
+      guard x < 2 else {
+        break // expected-error {{unlabeled 'break' is only allowed inside a loop or switch, a labeled break is required to exit an if or do}}
+      }
+      return
+    }
+  }
+}
 
 
 // Errors in case syntax
diff --git a/test/swift-format/main.swift b/test/swift-format/main.swift
index 177a4e0..659b1b1 100644
--- a/test/swift-format/main.swift
+++ b/test/swift-format/main.swift
@@ -4,7 +4,7 @@
 // RUN: diff -u %s.indent2.response %t.response
 // RUN: %swift-format -use-tabs %s >%t.response
 // RUN: diff -u %s.tabs.response %t.response
-// RUN: %swift-format -line-ranges 12:18 %s >%t.response
+// RUN: %swift-format -line-range 12:18 %s >%t.response
 // RUN: diff -u %s.lines.response %t.response
 
 import Foundation
diff --git a/test/swift-format/main.swift.indent2.response b/test/swift-format/main.swift.indent2.response
index 7774ccc..00d2236 100644
--- a/test/swift-format/main.swift.indent2.response
+++ b/test/swift-format/main.swift.indent2.response
@@ -4,7 +4,7 @@
 // RUN: diff -u %s.indent2.response %t.response
 // RUN: %swift-format -use-tabs %s >%t.response
 // RUN: diff -u %s.tabs.response %t.response
-// RUN: %swift-format -line-ranges 12:18 %s >%t.response
+// RUN: %swift-format -line-range 12:18 %s >%t.response
 // RUN: diff -u %s.lines.response %t.response
 
 import Foundation
diff --git a/test/swift-format/main.swift.lines.response b/test/swift-format/main.swift.lines.response
index d7a886c..0a40fae 100644
--- a/test/swift-format/main.swift.lines.response
+++ b/test/swift-format/main.swift.lines.response
@@ -4,7 +4,7 @@
 // RUN: diff -u %s.indent2.response %t.response
 // RUN: %swift-format -use-tabs %s >%t.response
 // RUN: diff -u %s.tabs.response %t.response
-// RUN: %swift-format -line-ranges 12:18 %s >%t.response
+// RUN: %swift-format -line-range 12:18 %s >%t.response
 // RUN: diff -u %s.lines.response %t.response
 
 import Foundation
diff --git a/test/swift-format/main.swift.response b/test/swift-format/main.swift.response
index e238cc0..190ea96 100644
--- a/test/swift-format/main.swift.response
+++ b/test/swift-format/main.swift.response
@@ -4,7 +4,7 @@
 // RUN: diff -u %s.indent2.response %t.response
 // RUN: %swift-format -use-tabs %s >%t.response
 // RUN: diff -u %s.tabs.response %t.response
-// RUN: %swift-format -line-ranges 12:18 %s >%t.response
+// RUN: %swift-format -line-range 12:18 %s >%t.response
 // RUN: diff -u %s.lines.response %t.response
 
 import Foundation
diff --git a/test/swift-format/main.swift.tabs.response b/test/swift-format/main.swift.tabs.response
index ae86f28..5ecb7cf 100644
--- a/test/swift-format/main.swift.tabs.response
+++ b/test/swift-format/main.swift.tabs.response
@@ -4,7 +4,7 @@
 // RUN: diff -u %s.indent2.response %t.response
 // RUN: %swift-format -use-tabs %s >%t.response
 // RUN: diff -u %s.tabs.response %t.response
-// RUN: %swift-format -line-ranges 12:18 %s >%t.response
+// RUN: %swift-format -line-range 12:18 %s >%t.response
 // RUN: diff -u %s.lines.response %t.response
 
 import Foundation
diff --git a/test/type/function/labels.swift b/test/type/function/labels.swift
index df2af1e..182bb80 100644
--- a/test/type/function/labels.swift
+++ b/test/type/function/labels.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -module-name TestModule -parse -verify -suppress-argument-labels-in-types %s
+// RUN: %target-swift-frontend -module-name TestModule -parse -verify %s
 
 // Function type with various forms of argument label.
 typealias Function1 = (a: Int,   // expected-error{{function types cannot have argument label 'a'; use '_' instead}}{{24-24=_ }}
diff --git a/test/type/protocol_composition.swift b/test/type/protocol_composition.swift
index 2db1102..bd83ae6 100644
--- a/test/type/protocol_composition.swift
+++ b/test/type/protocol_composition.swift
@@ -48,7 +48,7 @@
   let x4 : (_ : P2) -> ()
   x3 = x4
   _ = x3
-  
+
   // Empty protocol-conformance types are empty.
   let x5 : (_ : Any) -> ()
   let x6 : (_ : Any2) -> ()
@@ -123,7 +123,7 @@
 }
 
 // Test the parser's splitting of >= into > and =.
-var x : protocol<P5>= 17 // expected-warning {{'protocol<...>' composition syntax is deprecated and not needed here}} {{9-22=P5}}
+var x : protocol<P5>= 17 // expected-warning {{'protocol<...>' composition syntax is deprecated and not needed here}} {{9-22=(P5)=}}
 
 typealias A = protocol<> // expected-warning {{'protocol<>' syntax is deprecated; use 'Any' instead}} {{15-25=Any}}
 typealias B1 = protocol<P1,P2> // expected-warning {{'protocol<...>' composition syntax is deprecated; join the protocols using '&'}} {{16-31=P1 & P2}}
diff --git a/test/type/tuple/labels.swift b/test/type/tuple/labels.swift
index 9118d28..d20229b 100644
--- a/test/type/tuple/labels.swift
+++ b/test/type/tuple/labels.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -module-name TestModule -parse -verify -suppress-argument-labels-in-types %s
+// RUN: %target-swift-frontend -module-name TestModule -parse -verify %s
 
 typealias Tuple1 = (a: Int,
                     b _: Int, // expected-error{{tuple element cannot have two labels}}{{22-24=}}
diff --git a/test/type/types.swift b/test/type/types.swift
index 050de83..c935d81 100644
--- a/test/type/types.swift
+++ b/test/type/types.swift
@@ -158,6 +158,9 @@
 
 // SE-0066 - Standardize function type argument syntax to require parentheses
 let _ : Int -> Float // expected-error {{single argument function types require parentheses}} {{9-9=(}} {{12-12=)}}
+let _ : inout Int -> Float // expected-error {{single argument function types require parentheses}} {{9-9=(}} {{18-18=)}}
+func testNoParenFunction(x: Int -> Float) {} // expected-error {{single argument function types require parentheses}} {{29-29=(}} {{32-32=)}}
+func testNoParenFunction(x: inout Int -> Float) {} // expected-error {{single argument function types require parentheses}} {{29-29=(}} {{38-38=)}}
 
 func foo1(a : UnsafePointer<Void>) {} // expected-warning {{UnsafePointer<Void> has been replaced by UnsafeRawPointer}}{{15-34=UnsafeRawPointer}}
 func foo2(a : UnsafeMutablePointer<()>) {} // expected-warning {{UnsafeMutablePointer<Void> has been replaced by UnsafeMutableRawPointer}}{{15-39=UnsafeMutableRawPointer}}
diff --git a/tools/SourceKit/CMakeLists.txt b/tools/SourceKit/CMakeLists.txt
index b8bc596..a22f872 100644
--- a/tools/SourceKit/CMakeLists.txt
+++ b/tools/SourceKit/CMakeLists.txt
@@ -107,7 +107,7 @@
 # Usage:
 #   add_sourcekit_library(name       # Name of the library
 #     [DEPENDS dep1 ...]             # Libraries this library depends on
-#     [COMPONENT_DEPENDS comp1 ...]  # LLVM components this library depends on
+#     [LLVM_COMPONENT_DEPENDS comp1 ...]  # LLVM components this library depends on
 #     [INSTALL_IN_COMPONENT comp]    # The Swift installation component that this library belongs to.
 #     [SHARED]
 #     source1 [source2 source3 ...]) # Sources to add into this library
@@ -115,7 +115,7 @@
   cmake_parse_arguments(SOURCEKITLIB
       "SHARED"
       "INSTALL_IN_COMPONENT"
-      "DEPENDS;COMPONENT_DEPENDS"
+      "DEPENDS;LLVM_COMPONENT_DEPENDS"
       ${ARGN})
   set(srcs ${SOURCEKITLIB_UNPARSED_ARGUMENTS})
 
@@ -178,7 +178,7 @@
     target_link_libraries("${name}" INTERFACE ${SOURCEKITLIB_DEPENDS})
   endif()
 
-  swift_common_llvm_config(${name} ${SOURCEKITLIB_COMPONENT_DEPENDS})
+  swift_common_llvm_config(${name} ${SOURCEKITLIB_LLVM_COMPONENT_DEPENDS})
 
   if(SOURCEKITLIB_SHARED AND EXPORTED_SYMBOL_FILE)
     add_sourcekit_symbol_exports(${name} ${EXPORTED_SYMBOL_FILE})
@@ -212,7 +212,7 @@
 # Usage:
 #   add_sourcekit_executable(name     # Name of the executable
 #     [DEPENDS dep1 ...]              # Libraries this executable depends on
-#     [COMPONENT_DEPENDS comp1 ...]   # LLVM components this executable 
+#     [LLVM_COMPONENT_DEPENDS comp1 ...]   # LLVM components this executable 
 #                                     # depends on
 #     [EXCLUDE_FROM_ALL]              # Whether to exclude this executable from
 #                                     # the ALL_BUILD target
@@ -221,7 +221,7 @@
   cmake_parse_arguments(SOURCEKITEXE
     "EXCLUDE_FROM_ALL"
     ""
-    "DEPENDS;COMPONENT_DEPENDS"
+    "DEPENDS;LLVM_COMPONENT_DEPENDS"
     ${ARGN})
 
   if (${SOURCEKITEXE_EXCLUDE_FROM_ALL})
@@ -240,7 +240,7 @@
   endif()
 
   target_link_libraries(${name} ${SOURCEKITEXE_DEPENDS})
-  swift_common_llvm_config(${name} ${SOURCEKITEXE_COMPONENT_DEPENDS})
+  swift_common_llvm_config(${name} ${SOURCEKITEXE_LLVM_COMPONENT_DEPENDS})
   target_link_libraries(${name} ${LLVM_COMMON_LIBS})
 
   set_target_properties(${name} PROPERTIES FOLDER "SourceKit executables")
@@ -263,13 +263,13 @@
 # Usage:
 #   add_sourcekit_framework(name     # Name of the framework
 #     [DEPENDS dep1 ...]             # Libraries this framework depends on
-#     [COMPONENT_DEPENDS comp1 ...]  # LLVM components this framework depends on
+#     [LLVM_COMPONENT_DEPENDS comp1 ...]  # LLVM components this framework depends on
 #     [MODULEMAP modulemap]          # Module map file for this framework
 #     [INSTALL_IN_COMPONENT comp]    # The Swift installation component that this framework belongs to.
 #     source1 [source2 source3 ...]) # Sources to add into this framework
 macro(add_sourcekit_framework name)
   cmake_parse_arguments(SOURCEKITFW
-    "" "MODULEMAP;INSTALL_IN_COMPONENT" "DEPENDS;COMPONENT_DEPENDS" ${ARGN})
+    "" "MODULEMAP;INSTALL_IN_COMPONENT" "DEPENDS;LLVM_COMPONENT_DEPENDS" ${ARGN})
   set(srcs ${SOURCEKITFW_UNPARSED_ARGUMENTS})
 
   set(lib_dir ${SOURCEKIT_LIBRARY_OUTPUT_INTDIR})
@@ -312,7 +312,7 @@
   endif(LLVM_COMMON_DEPENDS)
 
   target_link_libraries(${name} PRIVATE ${SOURCEKITFW_DEPENDS})
-  swift_common_llvm_config(${name} ${SOURCEKITFW_COMPONENT_DEPENDS})
+  swift_common_llvm_config(${name} ${SOURCEKITFW_LLVM_COMPONENT_DEPENDS})
 
   if (EXPORTED_SYMBOL_FILE)
     add_sourcekit_symbol_exports(${name} ${EXPORTED_SYMBOL_FILE})
@@ -379,10 +379,10 @@
 # Usage:
 #   add_sourcekit_xpc_service(name    # Name of the XPC service
 #     [DEPENDS dep1 ...]              # Libraries this service depends on
-#     [COMPONENT_DEPENDS comp1 ...]   # LLVM components this service depends on
+#     [LLVM_COMPONENT_DEPENDS comp1 ...]   # LLVM components this service depends on
 #     source1 [source2 source3 ...])  # Sources to add into this service
 macro(add_sourcekit_xpc_service name framework_target)
-  cmake_parse_arguments(SOURCEKITXPC "" "" "DEPENDS;COMPONENT_DEPENDS" ${ARGN})
+  cmake_parse_arguments(SOURCEKITXPC "" "" "DEPENDS;LLVM_COMPONENT_DEPENDS" ${ARGN})
   set(srcs ${SOURCEKITXPC_UNPARSED_ARGUMENTS})
 
   set(lib_dir ${SOURCEKIT_LIBRARY_OUTPUT_INTDIR})
@@ -424,7 +424,7 @@
   endif(LLVM_COMMON_DEPENDS)
 
   target_link_libraries(${name} ${SOURCEKITXPC_DEPENDS})
-  swift_common_llvm_config(${name} ${SOURCEKITXPC_COMPONENT_DEPENDS})
+  swift_common_llvm_config(${name} ${SOURCEKITXPC_LLVM_COMPONENT_DEPENDS})
   target_link_libraries(${name} ${LLVM_COMMON_LIBS})
   
   add_dependencies(${framework_target} ${name})
diff --git a/tools/SourceKit/lib/SwiftLang/CMakeLists.txt b/tools/SourceKit/lib/SwiftLang/CMakeLists.txt
index ecaf7f0..bbb49fa 100644
--- a/tools/SourceKit/lib/SwiftLang/CMakeLists.txt
+++ b/tools/SourceKit/lib/SwiftLang/CMakeLists.txt
@@ -31,7 +31,7 @@
       clangAST
       clangAPINotes
       clangBasic
-  COMPONENT_DEPENDS ${LLVM_TARGETS_TO_BUILD}
+  LLVM_COMPONENT_DEPENDS ${LLVM_TARGETS_TO_BUILD}
       bitreader
       bitwriter
       debuginfodwarf
diff --git a/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp b/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp
index 001e718..ba89945 100644
--- a/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp
+++ b/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp
@@ -1191,7 +1191,7 @@
       case ChunkKind::CallParameterInternalName:
       case ChunkKind::CallParameterClosureType:
       case ChunkKind::CallParameterType:
-      case ChunkKind::DeclAttrParamEqual:
+      case ChunkKind::DeclAttrParamColon:
       case ChunkKind::Comma:
       case ChunkKind::Whitespace:
       case ChunkKind::Ellipsis:
diff --git a/tools/SourceKit/tools/complete-test/CMakeLists.txt b/tools/SourceKit/tools/complete-test/CMakeLists.txt
index 28e2c3e..094b54e 100644
--- a/tools/SourceKit/tools/complete-test/CMakeLists.txt
+++ b/tools/SourceKit/tools/complete-test/CMakeLists.txt
@@ -11,7 +11,7 @@
 add_sourcekit_executable(complete-test
   complete-test.cpp
   DEPENDS ${SOURCEKITD_TEST_DEPEND}
-  COMPONENT_DEPENDS support option
+  LLVM_COMPONENT_DEPENDS support option
 )
 
 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
diff --git a/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt
index 23c2541..41b72d4 100644
--- a/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt
+++ b/tools/SourceKit/tools/sourcekitd-repl/CMakeLists.txt
@@ -15,7 +15,7 @@
   add_sourcekit_executable(sourcekitd-repl
     sourcekitd-repl.cpp
     DEPENDS ${SOURCEKITD_REPL_DEPEND} edit
-    COMPONENT_DEPENDS support
+    LLVM_COMPONENT_DEPENDS support
   )
 
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
diff --git a/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt
index 08fe37d..389c65b 100644
--- a/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt
+++ b/tools/SourceKit/tools/sourcekitd-test/CMakeLists.txt
@@ -17,7 +17,7 @@
   TestOptions.cpp
   DEPENDS ${SOURCEKITD_TEST_DEPEND} SourceKitSupport
     clangRewrite clangLex clangBasic
-  COMPONENT_DEPENDS support option
+  LLVM_COMPONENT_DEPENDS support option
 )
 
 add_dependencies(sourcekitd-test sourcekitdTestOptionsTableGen)
diff --git a/tools/SourceKit/tools/sourcekitd/bin/InProc/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd/bin/InProc/CMakeLists.txt
index 0ac52bb..b4a27b2 100644
--- a/tools/SourceKit/tools/sourcekitd/bin/InProc/CMakeLists.txt
+++ b/tools/SourceKit/tools/sourcekitd/bin/InProc/CMakeLists.txt
@@ -5,7 +5,7 @@
     ${SOURCEKITD_SOURCE_DIR}/include/sourcekitd/sourcekitd.h
     sourcekitdInProc.cpp
     DEPENDS SourceKitSwiftLang sourcekitdAPI
-    COMPONENT_DEPENDS support
+    LLVM_COMPONENT_DEPENDS support
     MODULEMAP module.modulemap
     INSTALL_IN_COMPONENT sourcekit-inproc
   )
@@ -14,7 +14,7 @@
   add_sourcekit_library(sourcekitdInProc
     sourcekitdInProc.cpp
     DEPENDS SourceKitSwiftLang sourcekitdAPI
-    COMPONENT_DEPENDS support
+    LLVM_COMPONENT_DEPENDS support
     INSTALL_IN_COMPONENT sourcekit-inproc
 
     # Note that this cannot be a static library due to the way it looks for the
diff --git a/tools/SourceKit/tools/sourcekitd/bin/XPC/Client/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd/bin/XPC/Client/CMakeLists.txt
index 939cfa1..44f3103 100644
--- a/tools/SourceKit/tools/sourcekitd/bin/XPC/Client/CMakeLists.txt
+++ b/tools/SourceKit/tools/sourcekitd/bin/XPC/Client/CMakeLists.txt
@@ -11,7 +11,7 @@
   ${public_headers}
   sourcekitd.cpp tracer.cpp
   DEPENDS sourcekitdAPI
-  COMPONENT_DEPENDS support
+  LLVM_COMPONENT_DEPENDS support
   MODULEMAP module.modulemap
   INSTALL_IN_COMPONENT sourcekit-xpc-service
 )
diff --git a/tools/SourceKit/tools/sourcekitd/bin/XPC/Service/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd/bin/XPC/Service/CMakeLists.txt
index b684fdc..d0651ee 100644
--- a/tools/SourceKit/tools/sourcekitd/bin/XPC/Service/CMakeLists.txt
+++ b/tools/SourceKit/tools/sourcekitd/bin/XPC/Service/CMakeLists.txt
@@ -2,7 +2,7 @@
   add_sourcekit_xpc_service(SourceKitService sourcekitd
     XPCService.cpp XpcTracing.cpp
     DEPENDS SourceKitSwiftLang sourcekitdAPI
-    COMPONENT_DEPENDS support
+    LLVM_COMPONENT_DEPENDS support
   )
 endif()
 
diff --git a/tools/driver/swift_format_main.cpp b/tools/driver/swift_format_main.cpp
index a57d228..e30fad8 100644
--- a/tools/driver/swift_format_main.cpp
+++ b/tools/driver/swift_format_main.cpp
@@ -120,7 +120,7 @@
     if (ParsedArgs.getLastArg(OPT_use_tabs))
       UseTabs = true;
 
-    if (ParsedArgs.getLastArg(OPT_inplace))
+    if (ParsedArgs.getLastArg(OPT_in_place))
       InPlace = true;
 
     if (const Arg *A = ParsedArgs.getLastArg(OPT_tab_width))
@@ -133,7 +133,7 @@
         Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
                        A->getAsString(ParsedArgs), A->getValue());
 
-    for (const Arg *A : make_range(ParsedArgs.filtered_begin(OPT_line_ranges),
+    for (const Arg *A : make_range(ParsedArgs.filtered_begin(OPT_line_range),
                                    ParsedArgs.filtered_end()))
       LineRanges.push_back(A->getValue());
 
@@ -185,7 +185,7 @@
     }
     FormatterDocument Doc(std::move(Code));
     if (LineRanges.empty()) {
-      LineRanges.push_back("1:9999999");
+      LineRanges.push_back("1:" + std::to_string(UINT_MAX));
     }
     std::string Output = Doc.memBuffer().getBuffer();
     clang::tooling::Replacements Replacements;
diff --git a/tools/sil-extract/SILExtract.cpp b/tools/sil-extract/SILExtract.cpp
index bd91fb8..c265ee1 100644
--- a/tools/sil-extract/SILExtract.cpp
+++ b/tools/sil-extract/SILExtract.cpp
@@ -163,6 +163,7 @@
     Invocation.setRuntimeResourcePath(ResourceDir);
   Invocation.getClangImporterOptions().ModuleCachePath = ModuleCachePath;
   Invocation.setParseStdlib();
+  Invocation.getLangOptions().DisableAvailabilityChecking = true;
   Invocation.getLangOptions().EnableAccessControl = false;
   Invocation.getLangOptions().EnableObjCAttrRequiresFoundation = false;
 
diff --git a/tools/sil-opt/SILOpt.cpp b/tools/sil-opt/SILOpt.cpp
index 81fac85..eb8fde6 100644
--- a/tools/sil-opt/SILOpt.cpp
+++ b/tools/sil-opt/SILOpt.cpp
@@ -210,6 +210,7 @@
   // cache.
   Invocation.getClangImporterOptions().ModuleCachePath = ModuleCachePath;
   Invocation.setParseStdlib();
+  Invocation.getLangOptions().DisableAvailabilityChecking = true;
   Invocation.getLangOptions().EnableAccessControl = false;
   Invocation.getLangOptions().EnableObjCAttrRequiresFoundation = false;
 
diff --git a/tools/swift-demangle/CMakeLists.txt b/tools/swift-demangle/CMakeLists.txt
index 234959e..ddb70af 100644
--- a/tools/swift-demangle/CMakeLists.txt
+++ b/tools/swift-demangle/CMakeLists.txt
@@ -1,7 +1,7 @@
 add_swift_executable(swift-demangle
   swift-demangle.cpp
   LINK_LIBRARIES swiftBasic
-  COMPONENT_DEPENDS support)
+  LLVM_COMPONENT_DEPENDS support)
 
 swift_install_in_component(compiler
     TARGETS swift-demangle
diff --git a/tools/swift-demangle/swift-demangle.cpp b/tools/swift-demangle/swift-demangle.cpp
index 3d0e66a..dcbcf01 100644
--- a/tools/swift-demangle/swift-demangle.cpp
+++ b/tools/swift-demangle/swift-demangle.cpp
@@ -15,6 +15,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "swift/Basic/DemangleWrappers.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
@@ -24,6 +25,11 @@
 
 #include <cstdlib>
 #include <string>
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
+#include <unistd.h>
+#else
+#include <io.h>
+#endif
 
 static llvm::cl::opt<bool>
 ExpandMode("expand",
@@ -53,6 +59,16 @@
 InputNames(llvm::cl::Positional, llvm::cl::desc("[mangled name...]"),
                llvm::cl::ZeroOrMore);
 
+static llvm::StringRef substrBefore(llvm::StringRef whole,
+                                    llvm::StringRef part) {
+  return whole.slice(0, part.data() - whole.data());
+}
+
+static llvm::StringRef substrAfter(llvm::StringRef whole,
+                                   llvm::StringRef part) {
+  return whole.substr((part.data() - whole.data()) + part.size());
+}
+
 static void demangle(llvm::raw_ostream &os, llvm::StringRef name,
                      const swift::Demangle::DemangleOptions &options) {
   bool hadLeadingUnderscore = false;
@@ -86,14 +102,34 @@
   }
 }
 
-static llvm::StringRef substrBefore(llvm::StringRef whole,
-                                    llvm::StringRef part) {
-  return whole.slice(0, part.data() - whole.data());
-}
+static int demangleSTDIN(const swift::Demangle::DemangleOptions &options) {
+  // This doesn't handle Unicode symbols, but maybe that's okay.
+  llvm::Regex maybeSymbol("_T[_a-zA-Z0-9$]+");
 
-static llvm::StringRef substrAfter(llvm::StringRef whole,
-                                   llvm::StringRef part) {
-  return whole.substr((part.data() - whole.data()) + part.size());
+  while (true) {
+    char *inputLine = NULL;
+    size_t size;
+    if (getline(&inputLine, &size, stdin) == -1 || size <= 0) {
+      if (errno == 0) {
+        break;
+      }
+
+      return EXIT_FAILURE;
+    }
+
+    llvm::StringRef inputContents(inputLine);
+    llvm::SmallVector<llvm::StringRef, 1> matches;
+    while (maybeSymbol.match(inputContents, &matches)) {
+      llvm::outs() << substrBefore(inputContents, matches.front());
+      demangle(llvm::outs(), matches.front(), options);
+      inputContents = substrAfter(inputContents, matches.front());
+    }
+
+    llvm::outs() << inputContents;
+    free(inputLine);
+  }
+
+  return EXIT_SUCCESS;
 }
 
 int main(int argc, char **argv) {
@@ -101,7 +137,7 @@
   // Cygwin clang 3.5.2 with '-O3' generates CRASHING BINARY,
   // if main()'s first function call is passing argv[0].
   std::rand();
-#endif  
+#endif
   llvm::cl::ParseCommandLineOptions(argc, argv);
 
   swift::Demangle::DemangleOptions options;
@@ -111,29 +147,13 @@
 
   if (InputNames.empty()) {
     CompactMode = true;
-    auto input = llvm::MemoryBuffer::getSTDIN();
-    if (!input) {
-      llvm::errs() << input.getError().message() << '\n';
-      return EXIT_FAILURE;
-    }
-    llvm::StringRef inputContents = input.get()->getBuffer();
-
-    // This doesn't handle Unicode symbols, but maybe that's okay.
-    llvm::Regex maybeSymbol("_T[_a-zA-Z0-9$]+");
-    llvm::SmallVector<llvm::StringRef, 1> matches;
-    while (maybeSymbol.match(inputContents, &matches)) {
-      llvm::outs() << substrBefore(inputContents, matches.front());
-      demangle(llvm::outs(), matches.front(), options);
-      inputContents = substrAfter(inputContents, matches.front());
-    }
-    llvm::outs() << inputContents;
-
+    return demangleSTDIN(options);
   } else {
     for (llvm::StringRef name : InputNames) {
       demangle(llvm::outs(), name, options);
       llvm::outs() << '\n';
     }
-  }
 
-  return EXIT_SUCCESS;
+    return EXIT_SUCCESS;
+  }
 }
diff --git a/tools/swift-ide-test/swift-ide-test.cpp b/tools/swift-ide-test/swift-ide-test.cpp
index 7b8c46a..3349054 100644
--- a/tools/swift-ide-test/swift-ide-test.cpp
+++ b/tools/swift-ide-test/swift-ide-test.cpp
@@ -294,11 +294,6 @@
     llvm::cl::init(false));
 
 static llvm::cl::opt<bool>
-Swift3Migration("swift3-migration",
-                   llvm::cl::desc("Enable Fix-It based migration aids for Swift 3"),
-                   llvm::cl::init(false));
-
-static llvm::cl::opt<bool>
 InferImportAsMember("enable-infer-import-as-member",
                    llvm::cl::desc("Infer when a global could be imported as a member"),
                    llvm::cl::init(false));
@@ -2791,7 +2786,6 @@
     !options::DisableAccessControl;
   InitInvok.getLangOptions().CodeCompleteInitsInPostfixExpr |=
       options::CodeCompleteInitsInPostfixExpr;
-  InitInvok.getLangOptions().Swift3Migration |= options::Swift3Migration;
   InitInvok.getLangOptions().InferImportAsMember |=
     options::InferImportAsMember;
   InitInvok.getClangImporterOptions().ImportForwardDeclarations |=
diff --git a/tools/swift-reflection-dump/CMakeLists.txt b/tools/swift-reflection-dump/CMakeLists.txt
index 86ea560..c24edf3 100644
--- a/tools/swift-reflection-dump/CMakeLists.txt
+++ b/tools/swift-reflection-dump/CMakeLists.txt
@@ -2,7 +2,7 @@
   swift-reflection-dump.cpp
   LINK_FAT_LIBRARIES
     swiftReflection
-  COMPONENT_DEPENDS object support
+  LLVM_COMPONENT_DEPENDS object support
 )
 
 swift_install_in_component(tools
diff --git a/utils/PathSanitizingFileCheck b/utils/PathSanitizingFileCheck
new file mode 100755
index 0000000..4c3ae3a
--- /dev/null
+++ b/utils/PathSanitizingFileCheck
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# utils/PathSanitizingFileCheck -*- python -*-
+#
+# This source file is part of the Swift.org open source project
+#
+# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+# Licensed under Apache License v2.0 with Runtime Library Exception
+#
+# See http://swift.org/LICENSE.txt for license information
+# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+
+from __future__ import print_function
+
+import argparse
+import subprocess
+import sys
+
+def main():
+    parser = argparse.ArgumentParser(
+        formatter_class=argparse.RawDescriptionHelpFormatter,
+        description="""
+PathSanitizingFileCheck is a wrapper around LLVM's FileCheck.  In addition
+to all FileCheck features, PathSanitizingFileCheck can replace given
+strings in the input with other strings.  This feature is used to replace
+paths to the source and build directories with path-independent
+constants.""")
+
+    parser.add_argument(
+        "--sanitize",
+        help="replace the given string with another string",
+        metavar="REPLACEMENT=SOURCE",
+        action="append",
+        dest="sanitize_strings",
+        default=[])
+
+    args, unknown_args = parser.parse_known_args()
+
+    stdin = sys.stdin.read()
+    for s in args.sanitize_strings:
+        replacement, pattern = s.split('=', 1)
+        stdin = stdin.replace(pattern, replacement)
+
+    p = subprocess.Popen(["FileCheck"] + unknown_args, stdin=subprocess.PIPE)
+    stdout, stderr = p.communicate(stdin)
+    if stdout is not None:
+        print(stdout)
+    if stderr is not None:
+        print(stderr, file=sys.stderr)
+    return p.wait()
+
+
+if __name__ == '__main__':
+    exit(main())
+
diff --git a/utils/SwiftFloatingPointTypes.py b/utils/SwiftFloatingPointTypes.py
index a7661a7..37a4b1a 100644
--- a/utils/SwiftFloatingPointTypes.py
+++ b/utils/SwiftFloatingPointTypes.py
@@ -1,4 +1,4 @@
-# ===--- SwiftFloatingPointTypes.py ----------------------------*- coding: utf-8 -*-===//
+# ===--- SwiftFloatingPointTypes.py ------------------*- coding: utf-8 -*-===//
 #
 # This source file is part of the Swift.org open source project
 #
@@ -8,21 +8,25 @@
 # See http://swift.org/LICENSE.txt for license information
 # See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 
+
 # returns (lower, upper) exclusive bounds for the integer values
 # that can be stored into a float
 def getFtoIBounds(floatBits, intBits, signed):
-  sigBits = floating_point_bits_to_type()[floatBits].explicit_significand_bits
-  if not signed:
-    return (-1, 1 << intBits)
-  upper = 1 << (intBits - 1)
-  if intBits <= sigBits:
-    return (-upper - 1, upper)
-  ulp = 1 << (intBits - sigBits)
-  return (-upper - ulp, upper)
+    floatTy = floating_point_bits_to_type()[floatBits]
+    sigBits = floatTy.explicit_significand_bits
+    if not signed:
+        return (-1, 1 << intBits)
+    upper = 1 << (intBits - 1)
+    if intBits <= sigBits:
+        return (-upper - 1, upper)
+    ulp = 1 << (intBits - sigBits)
+    return (-upper - ulp, upper)
+
 
 class SwiftFloatType(object):
-    
-    def __init__(self, name, cFuncSuffix, significandBits, exponentBits, significandSize, totalBits):
+
+    def __init__(self, name, cFuncSuffix, significandBits, exponentBits,
+                 significandSize, totalBits):
         self.stdlib_name = name
         self.cFuncSuffix = cFuncSuffix
         self.significand_bits = significandBits
@@ -30,19 +34,26 @@
         self.exponent_bits = exponentBits
         self.explicit_significand_bits = significandBits + 1
         self.bits = totalBits
-        
+
+
 def floating_point_bits_to_type():
     return {
-        32: SwiftFloatType(name="Float",   cFuncSuffix="f", significandBits=23, exponentBits=8,  significandSize=32, totalBits=32),
-        64: SwiftFloatType(name="Double",  cFuncSuffix="",  significandBits=52, exponentBits=11, significandSize=64, totalBits=64),
-        80: SwiftFloatType(name="Float80", cFuncSuffix="l", significandBits=63, exponentBits=15, significandSize=64, totalBits=80),
+        32: SwiftFloatType(name="Float",   cFuncSuffix="f", significandBits=23,
+                           exponentBits=8,  significandSize=32, totalBits=32),
+        64: SwiftFloatType(name="Double",  cFuncSuffix="",  significandBits=52,
+                           exponentBits=11, significandSize=64, totalBits=64),
+        80: SwiftFloatType(name="Float80", cFuncSuffix="l", significandBits=63,
+                           exponentBits=15, significandSize=64, totalBits=80),
     }
 
+
 def all_floating_point_types():
     return floating_point_bits_to_type().values()
 
-# // Bit counts for all floating point types. 
-# // 80-bit floating point types are only permitted on x86 architectures. This
-# // restriction is handled via #if's in the generated code.
+
+# Bit counts for all floating point types.
+#
+# 80-bit floating point types are only permitted on x86 architectures. This
+# restriction is handled via #if's in the generated code.
 def all_floating_point_bits():
     return floating_point_bits_to_type().keys()
diff --git a/utils/SwiftIntTypes.py b/utils/SwiftIntTypes.py
index bedfdf5..3b43f4f 100644
--- a/utils/SwiftIntTypes.py
+++ b/utils/SwiftIntTypes.py
@@ -14,14 +14,17 @@
 # Number of bits in the biggest int type
 int_max_bits = max(_all_integer_type_bitwidths)
 
-def int_max(bits, signed): 
-    bits = bits - 1 if signed else bits 
+
+def int_max(bits, signed):
+    bits = bits - 1 if signed else bits
     bits = max(bits, 0)
     return (1 << bits) - 1
-    
+
+
 def int_min(bits, signed):
     return (-1 * int_max(bits, signed) - 1) if signed else 0
 
+
 class SwiftIntegerType(object):
 
     def __init__(self, is_word, bits, is_signed):
@@ -33,7 +36,7 @@
             self.possible_bitwidths = [32, 64]
         else:
             self.possible_bitwidths = [bits]
-            
+
         self.min = int_min(bits, is_signed)
         self.max = int_max(bits, is_signed)
 
@@ -128,4 +131,3 @@
 
 def all_integer_or_real_assignment_operator_names():
     return ['=', '*=', '/=', '+=', '-=']
-
diff --git a/utils/build-presets.ini b/utils/build-presets.ini
index 371961b..174737b 100644
--- a/utils/build-presets.ini
+++ b/utils/build-presets.ini
@@ -27,6 +27,7 @@
 test
 validation-test
 lit-args=-v
+compiler-vendor=apple
 
 dash-dash
 
@@ -39,8 +40,6 @@
 build-swift-static-sdk-overlay
 build-swift-stdlib-unittest-extra
 
-compiler-vendor=apple
-
 install-swift
 
 # Path to the root of the installation filesystem.
@@ -206,6 +205,8 @@
 validation-test
 lit-args=-v
 
+compiler-vendor=apple
+
 dash-dash
 
 # On buildbots, always force a reconfiguration to make sure we pick up changes
@@ -217,8 +218,6 @@
 
 build-swift-stdlib-unittest-extra
 
-compiler-vendor=apple
-
 
 [preset: buildbot_incremental_base_all_platforms]
 mixin-preset=buildbot_incremental_base
@@ -428,6 +427,11 @@
 test
 validation-test
 
+llvm-targets-to-build=X86
+
+# Set the vendor to apple
+compiler-vendor=apple
+
 dash-dash
 
 # Always reconfigure cmake
@@ -442,15 +446,11 @@
 # We need to build the unittest extras so we can test
 build-swift-stdlib-unittest-extra
 
-# Set the vendor to apple
-compiler-vendor=apple
-
 # Make sure our stdlib is RA.
 swift-stdlib-build-type=RelWithDebInfo
 swift-stdlib-enable-assertions=true
 
 # Disable non-x86 building/testing.
-llvm-targets-to-build=X86
 skip-build-ios
 skip-test-ios
 skip-build-tvos
@@ -481,6 +481,8 @@
 test=0
 lit-args=-v
 
+compiler-vendor=apple
+
 dash-dash
 
 llvm-include-tests
@@ -488,8 +490,6 @@
 verbose-build
 build-ninja
 
-compiler-vendor=apple
-
 # Do not build swift or cmark
 skip-build-swift
 skip-build-cmark
@@ -510,6 +510,7 @@
 extra-swift-args=%(extra_swift_args)s
 release
 assertions
+compiler-vendor=apple
 
 dash-dash
 
@@ -526,7 +527,6 @@
 skip-test-ios
 skip-build-lldb
 
-compiler-vendor=apple
 sil-verify-all
 
 #===------------------------------------------------------------------------===#
@@ -547,7 +547,7 @@
 
 [preset: buildbot_incremental_leaks]
 build-subdir=buildbot_incremental_leaks
-
+compiler-vendor=apple
 dash-dash
 
 # Disable ios. These builders are x86 only.
@@ -563,7 +563,6 @@
 verbose-build
 build-ninja
 build-swift-stdlib-unittest-extra
-compiler-vendor=apple
 swift-runtime-enable-leak-checker
 
 [preset: buildbot_incremental_leaks,tools=RA,stdlib=R]
@@ -646,11 +645,13 @@
 validation-test
 long-test
 foundation
+libdispatch
 lit-args=-v
 
 dash-dash
 
 install-foundation
+install-libdispatch
 reconfigure
 
 # Ubuntu 16.04 preset for backwards compat and future customizations.
@@ -665,6 +666,16 @@
 [preset: buildbot_linux_1404]
 mixin-preset=buildbot_linux
 
+[preset: buildbot_linux_1404_no_lldb]
+mixin-preset=buildbot_incremental_linux
+build-subdir=buildbot_linux
+release
+test
+validation-test
+long-test
+foundation
+lit-args=-v
+
 [preset: buildbot_linux_armv7]
 release
 llbuild
@@ -722,6 +733,7 @@
 swiftpm
 xctest
 foundation
+libdispatch
 dash-dash
 
 [preset: buildbot_incremental_linux,long_test]
@@ -764,6 +776,7 @@
 # Build with debug info, this allows us to symbolicate crashes from
 # production builds.
 release-debuginfo
+compiler-vendor=apple
 
 dash-dash
 
@@ -775,7 +788,6 @@
 build-swift-static-stdlib
 build-swift-static-sdk-overlay
 build-swift-stdlib-unittest-extra
-compiler-vendor=apple
 playgroundlogger-build-type=Release
 playgroundsupport-build-type=Release
 
@@ -971,12 +983,12 @@
 no-assertions
 swift-assertions
 
+compiler-vendor=apple
 dash-dash
 
 build-ninja
 release-debuginfo
 reconfigure
-compiler-vendor=apple
 swift-install-components=swift-remote-mirror
 install-destdir=%(install_destdir)s
 install-symroot=%(install_symroot)s
@@ -999,11 +1011,12 @@
 
 [preset: remote_mirror_ios_customization]
 
+clang-user-visible-version=8.0.0
+
 dash-dash
 
 darwin-xcrun-toolchain=ios
 darwin-deployment-version-ios=10.0
-clang-user-visible-version=8.0
 skip-build-osx
 skip-test-osx
 skip-build-tvos
@@ -1022,11 +1035,12 @@
 
 [preset: remote_mirror_watchos_customization]
 
+clang-user-visible-version=8.0.0
+
 dash-dash
 
 darwin-xcrun-toolchain=watchos
 darwin-deployment-version-watchos=3.0
-clang-user-visible-version=8.0
 skip-build-osx
 skip-test-osx
 skip-build-tvos
@@ -1045,11 +1059,12 @@
 
 [preset: remote_mirror_tvos_customization]
 
+clang-user-visible-version=8.0.0
+
 dash-dash
 
 darwin-xcrun-toolchain=tvos
 darwin-deployment-version-tvos=10.0
-clang-user-visible-version=8.0
 skip-build-osx
 skip-test-osx
 skip-build-watchos
diff --git a/utils/build-script b/utils/build-script
index 5fdf111..9484b83 100755
--- a/utils/build-script
+++ b/utils/build-script
@@ -311,6 +311,13 @@
                 platform.system() != "Darwin"):
             args.build_foundation = True
 
+        # Foundation has a dependency on libdispatch.
+        # On OS X, libdispatch is provided by the OS.
+        # On Linux, we must ensure that it is built manually.
+        if (args.build_foundation and
+                platform.system() != "Darwin"):
+            args.build_libdispatch = True
+
         # Propagate global --skip-build
         if args.skip_build:
             args.skip_build_linux = True
@@ -577,7 +584,6 @@
             "--foundation-build-type", args.foundation_build_variant,
             "--libdispatch-build-type", args.libdispatch_build_variant,
             "--xctest-build-type", args.build_variant,
-            "--llvm-enable-assertions", str(args.llvm_assertions).lower(),
             "--swift-enable-assertions", str(args.swift_assertions).lower(),
             "--swift-stdlib-enable-assertions", str(
                 args.swift_stdlib_assertions).lower(),
@@ -598,14 +604,20 @@
                 args=args,
                 toolchain=self.toolchain,
                 source_dir=self.workspace.source_dir(product_name),
-                # FIXME: This is incorrect
+                # FIXME: This is incorrect since it always assumes the host
+                # target I think?
                 build_dir=self.workspace.build_dir(
                     args.host_target, product_name))
             cmake_opts = product.cmake_options
+
+            # FIXME: We should be using pipes.quote here but we run into issues
+            # with build-script-impl/cmake not being happy with all of the
+            # extra "'" in the strings. To fix this easily, we really need to
+            # just invoke cmake from build-script directly rather than futzing
+            # with build-script-impl. This makes even more sense since there
+            # really isn't a security issue here.
             impl_args += [
-                "--%s-cmake-options=%s" % (
-                    product_name,
-                    ' '.join(pipes.quote(opt) for opt in cmake_opts))
+                "--%s-cmake-options=%s" % (product_name, ' '.join(cmake_opts))
             ]
 
         if args.build_stdlib_deployment_targets:
@@ -627,11 +639,6 @@
             impl_args += ["--enable-asan"]
         if args.enable_ubsan:
             impl_args += ["--enable-ubsan"]
-        if args.clang_compiler_version:
-            impl_args += [
-                "--clang-compiler-version=%s" % (
-                    args.clang_compiler_version)
-            ]
         if args.verbose_build:
             impl_args += ["--verbose-build"]
         if args.install_symroot:
@@ -1806,6 +1813,13 @@
              "must be escaped with a '\\'",
         action="append", dest="extra_swift_args", default=[])
 
+    llvm_group = parser.add_argument_group(
+        title="Build settings specific for LLVM")
+    llvm_group.add_argument(
+        '--llvm-targets-to-build',
+        help='LLVM target generators to build',
+        default="X86;ARM;AArch64;PowerPC;SystemZ")
+
     android_group = parser.add_argument_group(
         title="Build settings for Android")
     android_group.add_argument(
@@ -1881,11 +1895,34 @@
     parser.add_argument(
         "--enable-tsan-runtime",
         help="enable Thread Sanitizer on the swift runtime")
+
+    parser.add_argument(
+        "--compiler-vendor",
+        choices=["none", "apple"],
+        default="none",
+        help="Compiler vendor name")
     parser.add_argument(
         "--clang-compiler-version",
         help="string that indicates a compiler version for Clang",
         type=arguments.type.clang_compiler_version,
         metavar="MAJOR.MINOR.PATCH")
+    parser.add_argument(
+        "--clang-user-visible-version",
+        help="User-visible version of the embedded Clang and LLVM compilers",
+        type=arguments.type.clang_compiler_version,
+        default="3.8.0",
+        metavar="MAJOR.MINOR.PATCH")
+    parser.add_argument(
+        "--swift-compiler-version",
+        help="string that indicates a compiler version for Swift",
+        type=arguments.type.swift_compiler_version,
+        metavar="MAJOR.MINOR")
+    parser.add_argument(
+        "--swift-user-visible-version",
+        help="User-visible version of the embedded Swift compiler",
+        type=arguments.type.swift_compiler_version,
+        default="3.0",
+        metavar="MAJOR.MINOR")
 
     parser.add_argument(
         "--darwin-deployment-version-osx",
diff --git a/utils/build-script-impl b/utils/build-script-impl
index 7a1600b..2105797 100755
--- a/utils/build-script-impl
+++ b/utils/build-script-impl
@@ -57,7 +57,6 @@
     lldb-no-debugserver         ""               "delete debugserver after building it, and don't try to codesign it"
     lldb-use-system-debugserver ""               "don't try to codesign debugserver, and use the system's debugserver instead"
     llvm-build-type             "Debug"          "the CMake build variant for LLVM and Clang (Debug, RelWithDebInfo, Release, MinSizeRel).  Defaults to Debug."
-    llvm-enable-assertions      "1"              "enable assertions in LLVM and Clang"
     swift-build-type            "Debug"          "the CMake build variant for Swift"
     swift-enable-assertions     "1"              "enable assertions in Swift"
     swift-analyze-code-coverage "not-merged"     "Code coverage analysis mode for Swift (false, not-merged, merged). Defaults to false if the argument is not present, and not-merged if the argument is present without a modifier."
@@ -237,7 +236,6 @@
     user-config-args            ""               "**Renamed to --extra-cmake-options**: User-supplied arguments to cmake when used to do configuration."
     only-execute                       "all"     "Only execute the named action (see implementation)"
     llvm-lit-args                      ""        "If set, override the lit args passed to LLVM"
-    llvm-targets-to-build              "X86;ARM;AArch64;PowerPC;SystemZ" "The code generators that LLVM should build"
     build-toolchain-only               ""        "If set, only build the necessary tools to build an external toolchain"
 )
 
@@ -1797,53 +1795,12 @@
         fi
     fi
 
-    case "${COMPILER_VENDOR}" in
-        none)
-            ;;
-        apple)
-            llvm_cmake_options=(
-                "${llvm_cmake_options[@]}"
-                -DCLANG_VENDOR=Apple
-                -DCLANG_VENDOR_UTI=com.apple.compilers.llvm.clang
-                -DPACKAGE_VERSION="${CLANG_USER_VISIBLE_VERSION}"
-            )
-            swift_cmake_options=(
-                "${swift_cmake_options[@]}"
-                -DSWIFT_VENDOR=Apple
-                -DSWIFT_VENDOR_UTI=com.apple.compilers.llvm.swift
-                -DSWIFT_VERSION="${SWIFT_USER_VISIBLE_VERSION}"
-                -DSWIFT_COMPILER_VERSION="${SWIFT_COMPILER_VERSION}"
-            )
-            ;;
-        *)
-            echo "unknown compiler vendor"
-            exit 1
-            ;;
-    esac
-
     llvm_cmake_options=(
         "${llvm_cmake_options[@]}"
         -DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})"
         -DINTERNAL_INSTALL_PREFIX="local"
     )
 
-    if [[ "${CLANG_COMPILER_VERSION}" ]] ; then
-        llvm_cmake_options=(
-            "${llvm_cmake_options[@]}"
-            -DCLANG_REPOSITORY_STRING="clang-${CLANG_COMPILER_VERSION}"
-        )
-        swift_cmake_options=(
-            "${swift_cmake_options[@]}"
-            -DCLANG_COMPILER_VERSION="${CLANG_COMPILER_VERSION}"
-            -DSWIFT_COMPILER_VERSION="${SWIFT_COMPILER_VERSION}"
-        )
-    fi
-    if [[ "${SWIFT_COMPILER_VERSION}" ]] ; then
-        swift_cmake_options=(
-            "${swift_cmake_options[@]}"
-            -DSWIFT_COMPILER_VERSION="${SWIFT_COMPILER_VERSION}"
-        )
-    fi
     if [[ "${DARWIN_TOOLCHAIN_VERSION}" ]] ; then
         swift_cmake_options=(
             "${swift_cmake_options[@]}"
@@ -1962,9 +1919,7 @@
                     -DCMAKE_C_FLAGS="$(llvm_c_flags ${host})"
                     -DCMAKE_CXX_FLAGS="$(llvm_c_flags ${host})"
                     -DCMAKE_BUILD_TYPE:STRING="${LLVM_BUILD_TYPE}"
-                    -DLLVM_ENABLE_ASSERTIONS:BOOL=$(true_false "${LLVM_ENABLE_ASSERTIONS}")
                     -DLLVM_TOOL_SWIFT_BUILD:BOOL=NO
-                    -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS_TO_BUILD}"
                     -DLLVM_INCLUDE_DOCS:BOOL=TRUE
                     -DLLVM_ENABLE_LTO:STRING="${LLVM_ENABLE_LTO}"
                     "${llvm_cmake_options[@]}"
@@ -2408,7 +2363,8 @@
                 SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc"
                 LLVM_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"
 
-                if [[ ! -f "${LIBDISPATCH_BUILD_DIR}"/config.status ]]; then
+                if [[ "${RECONFIGURE}" || ! -f "${LIBDISPATCH_BUILD_DIR}"/config.status ]]; then
+                    echo "Reconfiguring libdispatch"
                     # First time building; need to run autotools and configure
                     if [[ "$LIBDISPATCH_BUILD_TYPE" == "Release" ]] ; then
                         dispatch_build_variant_arg="release"
@@ -2425,7 +2381,8 @@
                             "${LIBDISPATCH_SOURCE_DIR}"/configure --with-swift-toolchain="${SWIFT_BUILD_PATH}" \
                             --with-build-variant=$dispatch_build_variant_arg \
                             --prefix="$(get_host_install_destdir ${host})$(get_host_install_prefix ${host})"
-
+                else
+                    echo "Skipping reconfiguration of libdispatch"
                 fi
                 with_pushd "${LIBDISPATCH_BUILD_DIR}" \
                     call make
diff --git a/utils/gyb.py b/utils/gyb.py
index 02ab01a..336bd94 100755
--- a/utils/gyb.py
+++ b/utils/gyb.py
@@ -711,7 +711,11 @@
         # its value
         if result is not None and result != '':
             from numbers import Number, Integral
-            result_string = repr(result) if isinstance(result, Number) and not isinstance(result, Integral) else str(result)
+            result_string = None
+            if isinstance(result, Number) and not isinstance(result, Integral):
+                result_string = repr(result)
+            else:
+                result_string = str(result)
             context.append_text(
                 result_string, self.filename, self.start_line_number)
 
diff --git a/utils/pygments/swift.py b/utils/pygments/swift.py
old mode 100644
new mode 100755
index 0e2c3ab..dc97fb8
--- a/utils/pygments/swift.py
+++ b/utils/pygments/swift.py
@@ -5,6 +5,7 @@
 from pygments.lexer import (
     RegexLexer,
     bygroups,
+    default,
     include,
 )
 from pygments.token import (
@@ -20,7 +21,7 @@
     Whitespace,
 )
 
-__all__ = ['SwiftLexer', 'SwiftConsoleLexer']
+__all__ = ['SwiftLexer', 'SILLexer', 'SwiftConsoleLexer']
 
 
 class SwiftLexer(RegexLexer):
@@ -30,10 +31,11 @@
 
     flags = re.MULTILINE | re.DOTALL
 
-    _isa = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s+)(:)(\s+)([A-Z0-9_][a-zA-Z0-9_]*)'
-    _isa_comma = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s+)(:)(\s+)' + \
+    _isa = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(:)(\s*)([A-Z0-9_][a-zA-Z0-9_]*)'
+    _isa_comma = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(:)(\s*)' + \
                  '([A-Z0-9_][a-zA-Z0-9_]*)(,\s?)'
-    _name = r'[a-zA-Z_][a-zA-Z0-9_?]*'
+    _name = u'([@a-zA-Z_\U00000100-\U00100000]' + \
+            u'[a-zA-Z0-9_\U00000100-\U00100000]*)'
 
     tokens = {
 
@@ -43,46 +45,61 @@
 
         'root2': [
             (r'\n', Text, '#pop'),
-
-            (r'//.*?\n', Comment.Single, '#pop'),
-            (r'/\*', Comment.Multiline, 'comment'),
-
-            (r'\b(var|let)\s', Keyword.Declaration, 'var-decl'),
-            (r'\bfor\s', Keyword.Reserved, 'for-loop'),
-            (r'\b(func|init|deinit)\s', Keyword.Declaration, 'func-decl'),
-            (r'(\bset\b)(\s?)(\()', bygroups(
-                Keyword.Declaration, Whitespace, Punctuation), 'arg-list'),
-            (r'(set|get)(:)', bygroups(Keyword.Reserved, Punctuation)),
-            (r'\b(self|Self)\b', Name.Builtin.Pseudo),
-            (r'\bid\b', Name.Builtin),
-
+            include('func-class-list'),
             (r'\bimport\s+', Keyword.Namespace, 'import'),
             (r'\b(class|struct|protocol|extension)\s',
              Keyword.Declaration, 'class-decl'),
+            include('body'),
+        ],
 
-            (r'(\b[A-Z][a-zA-Z0-9_]*\s?)(\()',
-             bygroups(Name.Constant, Punctuation), 'type-cast'),
-            (r'(\b[A-Z][a-zA-Z0-9_]*)(\.)([a-z][a-zA-Z0-9_]*)',
-             bygroups(Name.Constant, Punctuation, Name), 'arg-list'),
-            (r'"', String, 'string'),
+        'func-class-list': [
+            (r'\b(func|init|deinit|class func|public func)\s',
+             Keyword.Declaration, 'func-decl'),
+        ],
 
-            (r'(\bnew\b\s?)', Keyword.Reserved, 'class-name'),
-            (r'\b(true|false)\b', Keyword.Reserved),
-            (r'\b(if|else)\s', Keyword.Reserved),
-            (r'\b(return|break)\b', Keyword.Reserved),
+        'comment': [
+            (r'//.*?\n', Comment.Single, '#pop'),
+            (r'/\*', Comment.Multiline, 'comment-multiline'),
+        ],
 
-            (r'[\^\*!%&<>+=/?-]|\.{2}', Operator),
+        'token-list': [
             (r'\$([0-9]+)', Name.Variable),   # Tokens
+        ],
+
+        'body': [
+            include('comment'),
+            include('name'),
+            (r'\.{3}', Generic.Emph),  # emphasize ellipses
+            (r'[\~\^\*!%&<>+=/?-]|\.{2}', Operator),
+            include('token-list'),
             (r'[\[\]\(\)\{\}\|:;,.#]', Punctuation),
             (r'[0-9]+\.[0-9]+', Number.Float),
             (r'0x[0-9a-fA-F]+', Number.Hex),
             (r'[0-9]+', Number.Integer),
             (r'\s', Whitespace),
-
             (r'\(', Punctuation, 'tuple'),
+            (r'(\b[A-Z][a-zA-Z0-9_]*\s?)(\()',
+             bygroups(Name.Constant, Punctuation), 'type-cast'),
+            (r'(\b[A-Z][a-zA-Z0-9_]*)(\.)([a-z][a-zA-Z0-9_]*)',
+             bygroups(Name.Constant, Punctuation, Name), 'arg-list'),
+            (r'"', String, 'string'),
+            (r'\'', String.Char, 'string'),
+            (r'(\bnew\b\s?)', Keyword.Reserved, 'class-name'),
+            (r'\b(true|false)\b', Keyword.Reserved),
+            (r'\b(if|else)\s', Keyword.Reserved),
+            (r'\b(return|break)\b', Keyword.Reserved),
+            (r'(\bset\b)(\s?)(\()', bygroups(
+                Keyword.Declaration, Whitespace, Punctuation), 'arg-list'),
+            (r'(set|get)(:)', bygroups(Keyword.Reserved, Punctuation)),
+            (r'\b(self|Self)\b', Name.Builtin.Pseudo),
+            (r'\bid\b', Name.Builtin),
+            (r'\b(var|let)\s', Keyword.Declaration, 'var-decl'),
+            (r'\bfor\s', Keyword.Reserved, 'for-loop'),
+        ],
 
-            include('name'),
-
+        'body2': [
+            (r'}', Punctuation, '#pop'),
+            include('body'),
         ],
 
         'isa': [
@@ -133,9 +150,11 @@
 
         'name': [
             (_name, Name),
+            (r'`[^\n`]*`', Name),
+            (r'@_specialize', Name),
         ],
 
-        'comment': [
+        'comment-multiline': [
             (r'[^*/]', Comment.Multiline),
             (r'/\*', Comment.Multiline, '#push'),
             (r'\*/', Comment.Multiline, '#pop'),
@@ -144,6 +163,14 @@
 
         'import': [
             (_name, Name.Namespace),
+            (r'(func|var|class)\s+', Keyword.Declaration),
+            (r'\.', Punctuation),
+            (r',\s*', Punctuation),
+            (r'\(', Punctuation, 'import'),
+            (r'\)', Punctuation, '#pop'),
+            (r'=', Operator),
+            (r' ', Text.Whitespace),
+            default('#pop'),
             # ('\n', Punctuation, '#pop'),
         ],
 
@@ -156,7 +183,7 @@
         ],
 
         'class-name': [
-            (r'[A-Z][a-zA-Z0-9_?]*', Name.Constant),
+            (r'[_A-Z][a-zA-Z0-9_?]*', Name.Constant),
             (r'(\[)([0-9]+)(\])',
              bygroups(Operator, Number.Integer, Operator)),
             (r'<', Punctuation, 'generic-type'),
@@ -179,6 +206,7 @@
                 Name.Attribute,
                 Punctuation,
                 Whitespace)),
+            (':\s*', Punctuation),
             include('tuple'),
             include('var-isa-comma'),
             include('var-isa-pop'),
@@ -201,20 +229,37 @@
                 Name.Attribute,
                 Punctuation,
                 Whitespace)),
+            (r'\s?\bthrows\b', Keyword.Reserved),
+            (r'\s?\brethrows\b', Keyword.Reserved),
             (r'\s?\breturn\b', Keyword.Reserved, 'root2'),
-            (r'\s?\w', Name.Function),
             (r'<', Punctuation, 'generic-type'),
             (r'\(\s?', Punctuation, 'arg-list'),
             (r'\s?->\s?', Operator, 'return-type'),
+            (r'\s?(\w+|[\*\+\-\=]{1,2})(\s*)', bygroups(
+                Name.Function, Punctuation)),
+            (r'\s?' + _name + r'(\s*)', bygroups(
+                Name.Function, Punctuation)),
             (r'\s?\{', Punctuation, '#pop'),
+            default('#pop'),
         ],
 
         'return-type': [
             include('tuple'),
             include('class-name'),
             (r'\bid\b', Name.Builtin),
-            (r'\s?\{', Punctuation, '#pop'),
-            (r'\s?\)', Punctuation),
+            (r'\s?\)', Punctuation, '#pop'),
+            (r'\s?\[', Punctuation),
+            (r'\s?\]\s*', Punctuation, '#pop'),
+            default('#pop'),
+        ],
+
+        'name-list': [
+            (_name, Name.Namespace),
+            (r',\s*', Punctuation),
+            (r' ', Text.Whitespace),
+            (r'(\()(\d+\.\d+)(\))', bygroups(
+             Punctuation, Number.Float, Punctuation)),
+            default('#pop'),
         ],
 
         'class-decl': [
@@ -225,14 +270,24 @@
                 Punctuation,
                 Whitespace)),
             include('class-isa'),
-            (r'[A-Z][a-zA-Z0-9_?]*', Name.Class),
-            (r'\s', Whitespace),
+            (r'(\*?)([a-zA-Z_][a-zA-Z0-9_?]*)', bygroups(
+             Punctuation, Name.Class)),
+            (r'\.', Punctuation),
             (r'<', Punctuation, 'generic-type'),
+            (r':', Punctuation, 'name-list'),
+            (r'\s', Whitespace),
+            (r'\s?(,)(\s*)([A-Z0-9_][a-zA-Z0-9_]*)', bygroups(
+             Punctuation, Whitespace, Name.Constant)),
+            (r'<', Punctuation, 'generic-type'),
+            (r'where', Keyword.Reserved),
+            default("#pop"),
         ],
 
         'arg-list': [
             (r',\s?', Punctuation),
             (r'\)', Punctuation, '#pop'),
+            (r'\s?\bthrows\b', Keyword.Reserved),
+            (r'\s?\brethrows\b', Keyword.Reserved),
             include('isa'),
             (r'\s?->\s?', Operator, 'return-type'),
             include('root2'),
@@ -259,6 +314,26 @@
     }
 
 
+class SILLexer(RegexLexer):
+    name = 'SIL'
+    aliases = ['sil']
+    filenames = ['*.sil']
+
+    flags = re.MULTILINE | re.DOTALL
+
+    _isa = SwiftLexer._isa
+    _isa_comma = SwiftLexer._isa_comma
+
+    _name = SwiftLexer._name
+
+    tokens = SwiftLexer.tokens.copy()
+    tokens['token-list'] = [
+            (r'[%]([a-zA-Z0-9]+)', Name.Variable),   # Tokens
+            (r'\$[*]?([a-zA-Z0-9]+)', Name.Variable),   # Tokens
+            (r'\$[*]?\(([a-zA-Z0-9, ]+\))', Name.Variable),   # Tokens
+        ]
+
+
 class SwiftConsoleLexer(RegexLexer):
     name = 'SwiftConsole'
     aliases = ['swift-console']
@@ -266,10 +341,10 @@
 
     flags = re.MULTILINE | re.DOTALL
 
-    _isa = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s+)(:)(\s+)([A-Z0-9_][a-zA-Z0-9_]*)'
-    _isa_comma = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s+)(:)(\s+)' + \
-        r'([A-Z0-9_][a-zA-Z0-9_]*)(,\s?)'
-    _name = r'[a-zA-Z_][a-zA-Z0-9_?]*'
+    _isa = SwiftLexer._isa
+    _isa_comma = SwiftLexer._isa_comma
+
+    _name = SwiftLexer._name
 
     tokens = SwiftLexer.tokens.copy()
     tokens['root'] = [
diff --git a/utils/swift_build_support/swift_build_support/arguments.py b/utils/swift_build_support/swift_build_support/arguments.py
index 75ae5e3..82f78c2 100644
--- a/utils/swift_build_support/swift_build_support/arguments.py
+++ b/utils/swift_build_support/swift_build_support/arguments.py
@@ -104,6 +104,26 @@
 _register(type, 'clang_compiler_version', type_clang_compiler_version)
 
 
+def type_swift_compiler_version(string):
+    """
+    Parse version string and split into a tuple of strings
+    (major, minor, patch)
+
+    Supports "MAJOR.MINOR" and "MAJOR.MINOR.PATCH" formats.
+    """
+    m = re.match(r'^([0-9]+)\.([0-9]+)(\.([0-9]+))?$', string)
+    if m is not None:
+        return CompilerVersion(
+            string_representation=string,
+            components=m.group(1, 2, 4))
+    raise argparse.ArgumentTypeError(
+        "%r is an invalid version value, "
+        "must be 'MAJOR.MINOR' or "
+        "'MAJOR.MINOR.PATCH'" % string)
+
+_register(type, 'swift_compiler_version', type_swift_compiler_version)
+
+
 def type_executable(string):
     """
     Check the string is executable path string.
diff --git a/utils/swift_build_support/swift_build_support/products/llvm.py b/utils/swift_build_support/swift_build_support/products/llvm.py
index fe89813..8caa41a 100644
--- a/utils/swift_build_support/swift_build_support/products/llvm.py
+++ b/utils/swift_build_support/swift_build_support/products/llvm.py
@@ -14,4 +14,47 @@
 
 
 class LLVM(product.Product):
-    pass
+
+    def __init__(self, args, toolchain, source_dir, build_dir):
+        product.Product.__init__(self, args, toolchain, source_dir,
+                                 build_dir)
+
+        # Add the cmake option for enabling or disabling assertions.
+        self.cmake_options.extend([
+            '-DLLVM_ENABLE_ASSERTIONS=%s' % str(args.llvm_assertions).upper()
+        ])
+
+        # Add the cmake option for LLVM_TARGETS_TO_BUILD.
+        self.cmake_options.extend([
+            '-DLLVM_TARGETS_TO_BUILD=%s' % args.llvm_targets_to_build
+        ])
+
+        # Add the cmake options for vendors
+        self.cmake_options.extend(self._compiler_vendor_flags)
+
+        # Add the cmake options for compiler version information.
+        self.cmake_options.extend(self._version_flags)
+
+    @property
+    def _compiler_vendor_flags(self):
+        if self.args.compiler_vendor == "none":
+            return []
+
+        if self.args.compiler_vendor != "apple":
+            raise RuntimeError("Unknown compiler vendor?!")
+
+        return [
+            "-DCLANG_VENDOR=Apple",
+            "-DCLANG_VENDOR_UTI=com.apple.compilers.llvm.clang",
+            # This is safe since we always provide a default of 3.8.0
+            "-DPACKAGE_VERSION={}".format(self.args.clang_user_visible_version)
+        ]
+
+    @property
+    def _version_flags(self):
+        result = []
+        if self.args.clang_compiler_version is not None:
+            result.append("-DCLANG_REPOSITORY_STRING=clang-{}".format(
+                self.args.clang_compiler_version
+            ))
+        return result
diff --git a/utils/swift_build_support/swift_build_support/products/swift.py b/utils/swift_build_support/swift_build_support/products/swift.py
index de002bd..e58c8ad 100644
--- a/utils/swift_build_support/swift_build_support/products/swift.py
+++ b/utils/swift_build_support/swift_build_support/products/swift.py
@@ -19,9 +19,16 @@
         product.Product.__init__(self, args, toolchain, source_dir,
                                  build_dir)
         # Add any runtime sanitizer arguments.
-        self.cmake_options.extend(self._compute_runtime_use_sanitizer())
+        self.cmake_options.extend(self._runtime_sanitizer_flags)
 
-    def _compute_runtime_use_sanitizer(self):
+        # Add any compiler vendor cmake flags.
+        self.cmake_options.extend(self._compiler_vendor_flags)
+
+        # Add any swift version related cmake flags.
+        self.cmake_options.extend(self._version_flags)
+
+    @property
+    def _runtime_sanitizer_flags(self):
         sanitizer_list = []
         if self.args.enable_tsan_runtime:
             sanitizer_list += ['Thread']
@@ -29,3 +36,44 @@
             return []
         return ["-DSWIFT_RUNTIME_USE_SANITIZERS=%s" %
                 ";".join(sanitizer_list)]
+
+    @property
+    def _compiler_vendor_flags(self):
+        if self.args.compiler_vendor == "none":
+            return []
+
+        if self.args.compiler_vendor != "apple":
+            raise RuntimeError("Unknown compiler vendor?! Was build-script \
+updated without updating swift.py?")
+
+        swift_compiler_version = ""
+        if self.args.swift_compiler_version is not None:
+            swift_compiler_version = self.args.swift_compiler_version
+
+        return [
+            "-DSWIFT_VENDOR=Apple",
+            "-DSWIFT_VENDOR_UTI=com.apple.compilers.llvm.swift",
+
+            # This has a default of 3.0, so it should be safe to use here.
+            "-DSWIFT_VERSION={}".format(self.args.swift_user_visible_version),
+
+            # FIXME: We are matching build-script-impl here. But it seems like
+            # bit rot since this flag is specified in another place with the
+            # exact same value in build-script-impl.
+            "-DSWIFT_COMPILER_VERSION={}".format(swift_compiler_version),
+        ]
+
+    @property
+    def _version_flags(self):
+        r = []
+        if self.args.swift_compiler_version is not None:
+            swift_compiler_version = self.args.swift_compiler_version
+            r.append(
+                "-DSWIFT_COMPILER_VERSION={}".format(swift_compiler_version)
+            )
+        if self.args.clang_compiler_version is not None:
+            clang_compiler_version = self.args.clang_compiler_version
+            r.append(
+                "-DCLANG_COMPILER_VERSION={}".format(clang_compiler_version)
+            )
+        return r
diff --git a/utils/swift_build_support/tests/products/test_llvm.py b/utils/swift_build_support/tests/products/test_llvm.py
new file mode 100644
index 0000000..7646105
--- /dev/null
+++ b/utils/swift_build_support/tests/products/test_llvm.py
@@ -0,0 +1,160 @@
+# tests/products/test_llvm.py -----------------------------------*- python -*-
+#
+# This source file is part of the LLVM.org open source project
+#
+# Copyright (c) 2014 - 2016 Apple Inc. and the LLVM project authors
+# Licensed under Apache License v2.0 with Runtime Library Exception
+#
+# See http://swift.org/LICENSE.txt for license information
+# See http://swift.org/CONTRIBUTORS.txt for the list of LLVM project authors
+# ----------------------------------------------------------------------------
+
+import argparse
+import os
+import shutil
+import sys
+import tempfile
+import unittest
+try:
+    # py2
+    from StringIO import StringIO
+except ImportError:
+    # py3
+    from io import StringIO
+
+from swift_build_support import shell
+from swift_build_support.products import LLVM
+from swift_build_support.toolchain import host_toolchain
+from swift_build_support.workspace import Workspace
+
+
+class LLVMTestCase(unittest.TestCase):
+
+    def setUp(self):
+        # Setup workspace
+        tmpdir1 = os.path.realpath(tempfile.mkdtemp())
+        tmpdir2 = os.path.realpath(tempfile.mkdtemp())
+        os.makedirs(os.path.join(tmpdir1, 'llvm'))
+
+        self.workspace = Workspace(source_root=tmpdir1,
+                                   build_root=tmpdir2)
+
+        # Setup toolchain
+        self.toolchain = host_toolchain()
+        self.toolchain.cc = '/path/to/cc'
+        self.toolchain.cxx = '/path/to/cxx'
+
+        # Setup args
+        self.args = argparse.Namespace(
+            llvm_targets_to_build='X86;ARM;AArch64;PowerPC;SystemZ',
+            llvm_assertions='true',
+            compiler_vendor='none',
+            clang_compiler_version=None,
+            clang_user_visible_version=None,
+            darwin_deployment_version_osx='10.9')
+
+        # Setup shell
+        shell.dry_run = True
+        self._orig_stdout = sys.stdout
+        self._orig_stderr = sys.stderr
+        self.stdout = StringIO()
+        self.stderr = StringIO()
+        sys.stdout = self.stdout
+        sys.stderr = self.stderr
+
+    def tearDown(self):
+        shutil.rmtree(self.workspace.build_root)
+        shutil.rmtree(self.workspace.source_root)
+        sys.stdout = self._orig_stdout
+        sys.stderr = self._orig_stderr
+        shell.dry_run = False
+        self.workspace = None
+        self.toolchain = None
+        self.args = None
+
+    def test_llvm_targets_to_build(self):
+        llvm = LLVM(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        expected_targets = 'X86;ARM;AArch64;PowerPC;SystemZ'
+        expected_arg = '-DLLVM_TARGETS_TO_BUILD=%s' % expected_targets
+        self.assertIn(expected_arg, llvm.cmake_options)
+
+    def test_llvm_enable_assertions(self):
+        self.args.llvm_assertions = True
+        llvm = LLVM(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertIn('-DLLVM_ENABLE_ASSERTIONS=TRUE', llvm.cmake_options)
+
+        self.args.llvm_assertions = False
+        llvm = LLVM(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertIn('-DLLVM_ENABLE_ASSERTIONS=FALSE', llvm.cmake_options)
+
+    def test_compiler_vendor_flags(self):
+        self.args.compiler_vendor = "none"
+        self.args.clang_user_visible_version = "1.2.3"
+        llvm = LLVM(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertNotIn('-DCLANG_VENDOR=Apple', llvm.cmake_options)
+        self.assertNotIn(
+            '-DCLANG_VENDOR_UTI=com.apple.compilers.llvm.clang',
+            llvm.cmake_options
+        )
+        self.assertNotIn('-DPACKAGE_VERSION=1.2.3', llvm.cmake_options)
+
+        self.args.compiler_vendor = "apple"
+        self.args.clang_user_visible_version = "2.2.3"
+        llvm = LLVM(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertIn('-DCLANG_VENDOR=Apple', llvm.cmake_options)
+        self.assertIn(
+            '-DCLANG_VENDOR_UTI=com.apple.compilers.llvm.clang',
+            llvm.cmake_options
+        )
+        self.assertIn('-DPACKAGE_VERSION=2.2.3', llvm.cmake_options)
+
+        self.args.compiler_vendor = "unknown"
+        with self.assertRaises(RuntimeError):
+            llvm = LLVM(
+                args=self.args,
+                toolchain=self.toolchain,
+                source_dir='/path/to/src',
+                build_dir='/path/to/build')
+
+    def test_version_flags(self):
+        self.args.clang_compiler_version = None
+        llvm = LLVM(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertListEqual(
+            [],
+            [x for x in llvm.cmake_options if 'CLANG_REPOSITORY_STRING' in x]
+        )
+
+        self.args.clang_compiler_version = "2.2.3"
+        llvm = LLVM(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertIn(
+            '-DCLANG_REPOSITORY_STRING=clang-2.2.3',
+            llvm.cmake_options
+        )
diff --git a/utils/swift_build_support/tests/products/test_swift.py b/utils/swift_build_support/tests/products/test_swift.py
index 8400874..87e6fa0 100644
--- a/utils/swift_build_support/tests/products/test_swift.py
+++ b/utils/swift_build_support/tests/products/test_swift.py
@@ -47,6 +47,10 @@
         # Setup args
         self.args = argparse.Namespace(
             enable_tsan_runtime=False,
+            compiler_vendor='none',
+            swift_compiler_version=None,
+            clang_compiler_version=None,
+            swift_user_visible_version=None,
             darwin_deployment_version_osx="10.9")
 
         # Setup shell
@@ -77,3 +81,126 @@
             build_dir='/path/to/build')
         self.assertEqual(swift.cmake_options,
                          ['-DSWIFT_RUNTIME_USE_SANITIZERS=Thread'])
+
+    def test_swift_compiler_vendor_flags(self):
+        self.args.compiler_vendor = "none"
+        self.args.swift_user_visible_version = None
+        self.args.swift_compiler_version = None
+        swift = Swift(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertListEqual(
+            [], [x for x in swift.cmake_options if 'SWIFT_VENDOR' in x])
+        self.assertListEqual(
+            [], [x for x in swift.cmake_options if 'SWIFT_VENDOR_UTI' in x])
+        self.assertListEqual(
+            [], [x for x in swift.cmake_options if 'SWIFT_VERSION' in x])
+        self.assertListEqual(
+            [],
+            [x for x in swift.cmake_options if 'SWIFT_COMPILER_VERSION' in x])
+
+        self.args.compiler_vendor = "apple"
+        self.args.swift_user_visible_version = "1.3"
+        self.args.swift_compiler_version = None
+        swift = Swift(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertIn('-DSWIFT_VENDOR=Apple', swift.cmake_options)
+        self.assertIn(
+            '-DSWIFT_VENDOR_UTI=com.apple.compilers.llvm.swift',
+            swift.cmake_options)
+        self.assertIn('-DSWIFT_VERSION=1.3', swift.cmake_options)
+        self.assertIn('-DSWIFT_COMPILER_VERSION=', swift.cmake_options)
+
+        self.args.compiler_vendor = "apple"
+        self.args.swift_user_visible_version = "1.3"
+        self.args.swift_compiler_version = "2.3"
+        swift = Swift(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertIn('-DSWIFT_VENDOR=Apple', swift.cmake_options)
+        self.assertIn(
+            '-DSWIFT_VENDOR_UTI=com.apple.compilers.llvm.swift',
+            swift.cmake_options)
+        self.assertIn('-DSWIFT_VERSION=1.3', swift.cmake_options)
+        self.assertIn('-DSWIFT_COMPILER_VERSION=2.3', swift.cmake_options)
+
+        self.args.compiler_vendor = "unknown"
+        with self.assertRaises(RuntimeError):
+            swift = Swift(
+                args=self.args,
+                toolchain=self.toolchain,
+                source_dir='/path/to/src',
+                build_dir='/path/to/build')
+
+    def test_version_flags(self):
+        # First make sure that by default, we do not get any version flags.
+        swift = Swift(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertListEqual(
+            [],
+            [x for x in swift.cmake_options if 'SWIFT_COMPILER_VERSION' in x]
+        )
+        self.assertListEqual(
+            [],
+            [x for x in swift.cmake_options if 'CLANG_COMPILER_VERSION' in x]
+        )
+
+        self.args.swift_compiler_version = "3.0"
+        self.args.clang_compiler_version = None
+        swift = Swift(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertListEqual(
+            ['-DSWIFT_COMPILER_VERSION=3.0'],
+            [x for x in swift.cmake_options if 'SWIFT_COMPILER_VERSION' in x]
+        )
+        self.assertListEqual(
+            [],
+            [x for x in swift.cmake_options if 'CLANG_COMPILER_VERSION' in x]
+        )
+
+        self.args.swift_compiler_version = None
+        self.args.clang_compiler_version = "3.8.0"
+        swift = Swift(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertListEqual(
+            [],
+            [x for x in swift.cmake_options if 'SWIFT_COMPILER_VERSION' in x]
+        )
+        self.assertListEqual(
+            ['-DCLANG_COMPILER_VERSION=3.8.0'],
+            [x for x in swift.cmake_options if 'CLANG_COMPILER_VERSION' in x]
+        )
+
+        self.args.swift_compiler_version = "1.0"
+        self.args.clang_compiler_version = "1.9.3"
+        swift = Swift(
+            args=self.args,
+            toolchain=self.toolchain,
+            source_dir='/path/to/src',
+            build_dir='/path/to/build')
+        self.assertListEqual(
+            ['-DSWIFT_COMPILER_VERSION=1.0'],
+            [x for x in swift.cmake_options if 'SWIFT_COMPILER_VERSION' in x]
+        )
+        self.assertListEqual(
+            ['-DCLANG_COMPILER_VERSION=1.9.3'],
+            [x for x in swift.cmake_options if 'CLANG_COMPILER_VERSION' in x]
+        )
+        self.args.swift_compiler_version = None
+        self.args.clang_compiler_version = None
diff --git a/utils/vim/syntax/swift.vim b/utils/vim/syntax/swift.vim
index 0016efb..d70542b 100644
--- a/utils/vim/syntax/swift.vim
+++ b/utils/vim/syntax/swift.vim
@@ -28,7 +28,6 @@
       \ switch
       \ throw
       \ try
-      \ typealias
       \ var
       \ where
       \ while
diff --git a/validation-test/Driver/Dependencies/rdar25405605.swift b/validation-test/Driver/Dependencies/rdar25405605.swift
index 7d29f7b..f7408d8 100644
--- a/validation-test/Driver/Dependencies/rdar25405605.swift
+++ b/validation-test/Driver/Dependencies/rdar25405605.swift
@@ -4,7 +4,7 @@
 // RUN: cp %S/Inputs/rdar25405605/helper-1.swift %t/helper.swift
 // RUN: touch -t 201401240005 %t/*.swift
 
-// RUN: cd %t && %target-build-swift -c -incremental -output-file-map %S/Inputs/rdar25405605/output.json -parse-as-library ./main.swift ./helper.swift -parseable-output -j1 -module-name main 2>&1 | FileCheck -check-prefix=CHECK-1 %s
+// RUN: cd %t && %target-build-swift -c -incremental -output-file-map %S/Inputs/rdar25405605/output.json -parse-as-library ./main.swift ./helper.swift -parseable-output -j1 -module-name main 2>&1 | %FileCheck -check-prefix=CHECK-1 %s
 
 // CHECK-1-NOT: warning
 // CHECK-1: {{^{$}}
@@ -19,12 +19,12 @@
 // CHECK-1: ".\/helper.swift"
 // CHECK-1: {{^}$}}
 
-// RUN: ls %t/ | FileCheck -check-prefix=CHECK-LS %s
+// RUN: ls %t/ | %FileCheck -check-prefix=CHECK-LS %s
 
 // CHECK-LS-DAG: main.o
 // CHECK-LS-DAG: helper.o
 
-// RUN: cd %t && %target-build-swift -c -incremental -output-file-map %S/Inputs/rdar25405605/output.json -parse-as-library ./main.swift ./helper.swift -parseable-output -j1 -module-name main 2>&1 | FileCheck -check-prefix=CHECK-1-SKIPPED %s
+// RUN: cd %t && %target-build-swift -c -incremental -output-file-map %S/Inputs/rdar25405605/output.json -parse-as-library ./main.swift ./helper.swift -parseable-output -j1 -module-name main 2>&1 | %FileCheck -check-prefix=CHECK-1-SKIPPED %s
 
 // CHECK-1-SKIPPED-NOT: warning
 // CHECK-1-SKIPPED: {{^{$}}
@@ -41,7 +41,7 @@
 
 // RUN: cp %S/Inputs/rdar25405605/helper-2.swift %t/helper.swift
 // RUN: touch -t 201401240006 %t/helper.swift
-// RUN: cd %t && not %target-build-swift -c -incremental -output-file-map %S/Inputs/rdar25405605/output.json -parse-as-library ./main.swift ./helper.swift -parseable-output -j1 -module-name main 2>&1 | FileCheck -check-prefix=CHECK-2 %s
+// RUN: cd %t && not %target-build-swift -c -incremental -output-file-map %S/Inputs/rdar25405605/output.json -parse-as-library ./main.swift ./helper.swift -parseable-output -j1 -module-name main 2>&1 | %FileCheck -check-prefix=CHECK-2 %s
 
 // CHECK-2-NOT: warning
 // CHECK-2: {{^{$}}
@@ -58,7 +58,7 @@
 
 // RUN: cp %S/Inputs/rdar25405605/helper-3.swift %t/helper.swift
 // RUN: touch -t 201401240007 %t/helper.swift
-// RUN: cd %t && not %target-build-swift -c -incremental -output-file-map %S/Inputs/rdar25405605/output.json -parse-as-library ./main.swift ./helper.swift -parseable-output -j1 -module-name main 2>&1 | FileCheck -check-prefix=CHECK-3 %s
+// RUN: cd %t && not %target-build-swift -c -incremental -output-file-map %S/Inputs/rdar25405605/output.json -parse-as-library ./main.swift ./helper.swift -parseable-output -j1 -module-name main 2>&1 | %FileCheck -check-prefix=CHECK-3 %s
 
 // CHECK-3-NOT: warning
 // CHECK-3: {{^{$}}
diff --git a/validation-test/Driver/many-inputs.swift b/validation-test/Driver/many-inputs.swift
index 88ef3d7..3db862a 100644
--- a/validation-test/Driver/many-inputs.swift
+++ b/validation-test/Driver/many-inputs.swift
@@ -5,16 +5,16 @@
 // RUN: for i in {1..1100}; do echo "public func foo$i() {}" > %t/$i.swift; echo "CHECK: foo$i" >> %t/check.txt; done
 
 // RUN: (cd %t && %target-build-swift -force-single-frontend-invocation -emit-library ./*.swift -o ./libWMO)
-// RUN: nm %t/libWMO | FileCheck %t/check.txt
+// RUN: nm %t/libWMO | %FileCheck %t/check.txt
 
 // RUN: (cd %t && %target-build-swift -force-single-frontend-invocation -num-threads 1 -emit-library ./*.swift -o ./libWMOThreaded)
-// RUN: nm %t/libWMOThreaded | FileCheck %t/check.txt
+// RUN: nm %t/libWMOThreaded | %FileCheck %t/check.txt
 
 // This is very slow due to process overhead. It's also doing one file at a time
 // because we don't have a good way for lit tests to claim more than one thread.
 // But it's still important to check.
 // RUN: (cd %t && %target-build-swift -emit-library ./*.swift -o ./libMultiFile)
-// RUN: nm %t/libMultiFile | FileCheck %t/check.txt
+// RUN: nm %t/libMultiFile | %FileCheck %t/check.txt
 
 // REQUIRES: long_test
 // REQUIRES: executable_test
diff --git a/validation-test/IDE/complete_from_cocoa.swift b/validation-test/IDE/complete_from_cocoa.swift
index 2a9fa48..e392023 100644
--- a/validation-test/IDE/complete_from_cocoa.swift
+++ b/validation-test/IDE/complete_from_cocoa.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=T1 | FileCheck %s -check-prefix=T1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=T1 | %FileCheck %s -check-prefix=T1
 
 // REQUIRES: objc_interop
 // REQUIRES: no_asan
diff --git a/validation-test/IDE/complete_from_cocoa_2.swift b/validation-test/IDE/complete_from_cocoa_2.swift
index e35e0ea..b023642 100644
--- a/validation-test/IDE/complete_from_cocoa_2.swift
+++ b/validation-test/IDE/complete_from_cocoa_2.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=T1 | FileCheck %s -check-prefix=T1
-// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=T2 | FileCheck %s -check-prefix=T2
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=T1 | %FileCheck %s -check-prefix=T1
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=T2 | %FileCheck %s -check-prefix=T2
 
 // REQUIRES: objc_interop
 
diff --git a/validation-test/IDE/complete_repl_from_cocoa.swift b/validation-test/IDE/complete_repl_from_cocoa.swift
index 6bd8ff0..f3a641f 100644
--- a/validation-test/IDE/complete_repl_from_cocoa.swift
+++ b/validation-test/IDE/complete_repl_from_cocoa.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -repl-code-completion -source-filename %s | FileCheck %s
+// RUN: %target-swift-ide-test -repl-code-completion -source-filename %s | %FileCheck %s
 
 // A smoketest for REPL code completion in Cocoa.
 
diff --git a/validation-test/IDE/crashers/060-swift-constructordecl-getresulttype.swift b/validation-test/IDE/crashers/060-swift-constructordecl-getresulttype.swift
deleted file mode 100644
index 5017609..0000000
--- a/validation-test/IDE/crashers/060-swift-constructordecl-getresulttype.swift
+++ /dev/null
@@ -1,2 +0,0 @@
-// RUN: not --crash %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
-typealias f=B{func a{f#^A^#}}struct B{let d
diff --git a/validation-test/IDE/crashers_fixed/009-swift-performdelayedparsing.swift b/validation-test/IDE/crashers_fixed/009-swift-performdelayedparsing.swift
index 7e23cbc..86e6576 100644
--- a/validation-test/IDE/crashers_fixed/009-swift-performdelayedparsing.swift
+++ b/validation-test/IDE/crashers_fixed/009-swift-performdelayedparsing.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | FileCheck %s
+// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | %FileCheck %s
 enum b:a{var f={static#^A^#
 // FIXME: we shouldn't back the parser to the beginning of the line, it leads
 // to ridiculous override completions like this.
diff --git a/validation-test/IDE/crashers_fixed/060-swift-constructordecl-getresulttype.swift b/validation-test/IDE/crashers_fixed/060-swift-constructordecl-getresulttype.swift
new file mode 100644
index 0000000..04c6216
--- /dev/null
+++ b/validation-test/IDE/crashers_fixed/060-swift-constructordecl-getresulttype.swift
@@ -0,0 +1,2 @@
+// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
+typealias f=B{func a{f#^A^#}}struct B{let d
diff --git a/validation-test/IDE/crashers_fixed/063-swift-generictypeparamtype-get.swift b/validation-test/IDE/crashers_fixed/063-swift-generictypeparamtype-get.swift
index 9e3a3c4..a5784a2 100644
--- a/validation-test/IDE/crashers_fixed/063-swift-generictypeparamtype-get.swift
+++ b/validation-test/IDE/crashers_fixed/063-swift-generictypeparamtype-get.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | FileCheck %s
+// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | %FileCheck %s
 {protocol A{func b
 }enum B:A{let s=b
 let A{#^A^#
diff --git a/validation-test/IDE/crashers_fixed/assign-anyobject.swift b/validation-test/IDE/crashers_fixed/assign-anyobject.swift
index f506fcc..501c941 100644
--- a/validation-test/IDE/crashers_fixed/assign-anyobject.swift
+++ b/validation-test/IDE/crashers_fixed/assign-anyobject.swift
@@ -1,4 +1,4 @@
-// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | FileCheck %s
+// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | %FileCheck %s
 var bar: AnyObject
 var foo: AnyObject
 foo = #^A^#
diff --git a/validation-test/IDE/crashers_fixed/extension-protocol-composition.swift b/validation-test/IDE/crashers_fixed/extension-protocol-composition.swift
index fe88e46..34844ce 100644
--- a/validation-test/IDE/crashers_fixed/extension-protocol-composition.swift
+++ b/validation-test/IDE/crashers_fixed/extension-protocol-composition.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | FileCheck %s
-// RUN: %target-swift-ide-test -code-completion -code-completion-token=B -source-filename=%s | FileCheck %s
+// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | %FileCheck %s
+// RUN: %target-swift-ide-test -code-completion -code-completion-token=B -source-filename=%s | %FileCheck %s
 
 typealias X = protocol<CustomStringConvertible>
 typealias Y = protocol<CustomStringConvertible>
diff --git a/validation-test/IDE/crashers_fixed/subexpr-literal-in-sequence-expr.swift b/validation-test/IDE/crashers_fixed/subexpr-literal-in-sequence-expr.swift
index 8706f0b..093624a 100644
--- a/validation-test/IDE/crashers_fixed/subexpr-literal-in-sequence-expr.swift
+++ b/validation-test/IDE/crashers_fixed/subexpr-literal-in-sequence-expr.swift
@@ -1,5 +1,5 @@
-// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | FileCheck %s
-// RUN: %target-swift-ide-test -code-completion -code-completion-token=B -source-filename=%s | FileCheck %s
+// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | %FileCheck %s
+// RUN: %target-swift-ide-test -code-completion -code-completion-token=B -source-filename=%s | %FileCheck %s
 
 func test1() {
   1 + [0]#^A^#
diff --git a/validation-test/Python/gyb.swift b/validation-test/Python/gyb.swift
index 1852f61..8e0ff6c 100644
--- a/validation-test/Python/gyb.swift
+++ b/validation-test/Python/gyb.swift
@@ -1,4 +1,4 @@
 // RUN: %{python} -m doctest %utils/gyb.py
-// RUN: echo 'Hello ${ME}' | %gyb --test -DME=Swift | FileCheck %s
-// RUN: echo 'Hello ${ME}' | %gyb --verbose-test -DME=Swift | FileCheck %s
+// RUN: echo 'Hello ${ME}' | %gyb --test -DME=Swift | %FileCheck %s
+// RUN: echo 'Hello ${ME}' | %gyb --verbose-test -DME=Swift | %FileCheck %s
 // CHECK: Hello Swift
diff --git a/validation-test/Reflection/existentials.swift b/validation-test/Reflection/existentials.swift
index aff16c4..fba79b5 100644
--- a/validation-test/Reflection/existentials.swift
+++ b/validation-test/Reflection/existentials.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/existentials
-// RUN: %target-run %target-swift-reflection-test %t/existentials | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/existentials | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/functions.swift b/validation-test/Reflection/functions.swift
index 0db5700..da2c2ff 100644
--- a/validation-test/Reflection/functions.swift
+++ b/validation-test/Reflection/functions.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/functions
-// RUN: %target-run %target-swift-reflection-test %t/functions | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/functions | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 // FIXME: Should not require objc_interop -- please put Objective-C-specific
 // testcases in functions_objc.swift
diff --git a/validation-test/Reflection/functions_objc.swift b/validation-test/Reflection/functions_objc.swift
index 062c803..6e6139b 100644
--- a/validation-test/Reflection/functions_objc.swift
+++ b/validation-test/Reflection/functions_objc.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/functions
-// RUN: %target-run %target-swift-reflection-test %t/functions | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/functions | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/inherits_NSObject.swift b/validation-test/Reflection/inherits_NSObject.swift
index c4c073e..d82ff7c 100644
--- a/validation-test/Reflection/inherits_NSObject.swift
+++ b/validation-test/Reflection/inherits_NSObject.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/inherits_NSObject
-// RUN: %target-run %target-swift-reflection-test %t/inherits_NSObject | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/inherits_NSObject | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
 
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
diff --git a/validation-test/Reflection/reflect_Array.swift b/validation-test/Reflection/reflect_Array.swift
index 10f61e6..38914c7 100644
--- a/validation-test/Reflection/reflect_Array.swift
+++ b/validation-test/Reflection/reflect_Array.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Array
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Array 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Array 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Bool.swift b/validation-test/Reflection/reflect_Bool.swift
index 8fd86da..8e67e2c 100644
--- a/validation-test/Reflection/reflect_Bool.swift
+++ b/validation-test/Reflection/reflect_Bool.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Bool
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Bool 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Bool 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Character.swift b/validation-test/Reflection/reflect_Character.swift
index 6665bf6..3d16f73 100644
--- a/validation-test/Reflection/reflect_Character.swift
+++ b/validation-test/Reflection/reflect_Character.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Character
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Character 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Character 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Dictionary.swift b/validation-test/Reflection/reflect_Dictionary.swift
index 87f4672..063ead6 100644
--- a/validation-test/Reflection/reflect_Dictionary.swift
+++ b/validation-test/Reflection/reflect_Dictionary.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Dictionary
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Dictionary 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Dictionary 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Double.swift b/validation-test/Reflection/reflect_Double.swift
index c15df5b..9a0e5c3 100644
--- a/validation-test/Reflection/reflect_Double.swift
+++ b/validation-test/Reflection/reflect_Double.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Double
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Double 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Double 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Float.swift b/validation-test/Reflection/reflect_Float.swift
index 1f5fa1d..15f6ac7 100644
--- a/validation-test/Reflection/reflect_Float.swift
+++ b/validation-test/Reflection/reflect_Float.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Float
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Float 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Float 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Int.swift b/validation-test/Reflection/reflect_Int.swift
index 80e4b01..4fe4e20 100644
--- a/validation-test/Reflection/reflect_Int.swift
+++ b/validation-test/Reflection/reflect_Int.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Int 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Int 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Int16.swift b/validation-test/Reflection/reflect_Int16.swift
index 46e7b6c..2e5bbce 100644
--- a/validation-test/Reflection/reflect_Int16.swift
+++ b/validation-test/Reflection/reflect_Int16.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int16
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Int16 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Int16 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Int32.swift b/validation-test/Reflection/reflect_Int32.swift
index 08bf4a9..dc9b693 100644
--- a/validation-test/Reflection/reflect_Int32.swift
+++ b/validation-test/Reflection/reflect_Int32.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int32
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Int32 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Int32 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Int64.swift b/validation-test/Reflection/reflect_Int64.swift
index a51aad1..dc92435 100644
--- a/validation-test/Reflection/reflect_Int64.swift
+++ b/validation-test/Reflection/reflect_Int64.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int64
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Int64 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Int64 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Int8.swift b/validation-test/Reflection/reflect_Int8.swift
index ae9ccc4..e643731 100644
--- a/validation-test/Reflection/reflect_Int8.swift
+++ b/validation-test/Reflection/reflect_Int8.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int8
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Int8 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Int8 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_NSArray.swift b/validation-test/Reflection/reflect_NSArray.swift
index 4bb099a..b882e59 100644
--- a/validation-test/Reflection/reflect_NSArray.swift
+++ b/validation-test/Reflection/reflect_NSArray.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSArray
-// RUN: %target-run %target-swift-reflection-test %t/reflect_NSArray 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_NSArray 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_NSNumber.swift b/validation-test/Reflection/reflect_NSNumber.swift
index df29230..d225ace 100644
--- a/validation-test/Reflection/reflect_NSNumber.swift
+++ b/validation-test/Reflection/reflect_NSNumber.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSNumber
-// RUN: %target-run %target-swift-reflection-test %t/reflect_NSNumber 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_NSNumber 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_NSSet.swift b/validation-test/Reflection/reflect_NSSet.swift
index 840f251..e869d1b 100644
--- a/validation-test/Reflection/reflect_NSSet.swift
+++ b/validation-test/Reflection/reflect_NSSet.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSSet
-// RUN: %target-run %target-swift-reflection-test %t/reflect_NSSet 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_NSSet 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_NSString.swift b/validation-test/Reflection/reflect_NSString.swift
index 32cbb45..15d349c 100644
--- a/validation-test/Reflection/reflect_NSString.swift
+++ b/validation-test/Reflection/reflect_NSString.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSString
-// RUN: %target-run %target-swift-reflection-test %t/reflect_NSString 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_NSString 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_Set.swift b/validation-test/Reflection/reflect_Set.swift
index 07e962d..acc57f4 100644
--- a/validation-test/Reflection/reflect_Set.swift
+++ b/validation-test/Reflection/reflect_Set.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Set
-// RUN: %target-run %target-swift-reflection-test %t/reflect_Set 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_Set 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_String.swift b/validation-test/Reflection/reflect_String.swift
index 6bcc4d2..ab59a79 100644
--- a/validation-test/Reflection/reflect_String.swift
+++ b/validation-test/Reflection/reflect_String.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_String
-// RUN: %target-run %target-swift-reflection-test %t/reflect_String 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_String 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_UInt.swift b/validation-test/Reflection/reflect_UInt.swift
index 82596a5..71ad6c8 100644
--- a/validation-test/Reflection/reflect_UInt.swift
+++ b/validation-test/Reflection/reflect_UInt.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt
-// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_UInt16.swift b/validation-test/Reflection/reflect_UInt16.swift
index d118b28..9229b5b 100644
--- a/validation-test/Reflection/reflect_UInt16.swift
+++ b/validation-test/Reflection/reflect_UInt16.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt16
-// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt16 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt16 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_UInt32.swift b/validation-test/Reflection/reflect_UInt32.swift
index 6ae2abf..2ebfc44 100644
--- a/validation-test/Reflection/reflect_UInt32.swift
+++ b/validation-test/Reflection/reflect_UInt32.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt32
-// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt32 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt32 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_UInt64.swift b/validation-test/Reflection/reflect_UInt64.swift
index 7b8c39e..0f52877 100644
--- a/validation-test/Reflection/reflect_UInt64.swift
+++ b/validation-test/Reflection/reflect_UInt64.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt64
-// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt64 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt64 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_UInt8.swift b/validation-test/Reflection/reflect_UInt8.swift
index 7838ab6..f9f991c 100644
--- a/validation-test/Reflection/reflect_UInt8.swift
+++ b/validation-test/Reflection/reflect_UInt8.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt8
-// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt8 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt8 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_empty_class.swift b/validation-test/Reflection/reflect_empty_class.swift
index fb0bd97..55b42d6 100644
--- a/validation-test/Reflection/reflect_empty_class.swift
+++ b/validation-test/Reflection/reflect_empty_class.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_empty_class
-// RUN: %target-run %target-swift-reflection-test %t/reflect_empty_class 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_empty_class 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/Reflection/reflect_multiple_types.swift b/validation-test/Reflection/reflect_multiple_types.swift
index b6a4315..51a51bd 100644
--- a/validation-test/Reflection/reflect_multiple_types.swift
+++ b/validation-test/Reflection/reflect_multiple_types.swift
@@ -1,6 +1,6 @@
 // RUN: rm -rf %t && mkdir -p %t
 // RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_multiple_types
-// RUN: %target-run %target-swift-reflection-test %t/reflect_multiple_types 2>&1 | FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-run %target-swift-reflection-test %t/reflect_multiple_types 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
 // REQUIRES: objc_interop
 // REQUIRES: executable_test
 
diff --git a/validation-test/SIL/crashers/018-swift-valuedecl-getinterfacetype.sil b/validation-test/SIL/crashers/018-swift-valuedecl-getinterfacetype.sil
deleted file mode 100644
index 1d8596e..0000000
--- a/validation-test/SIL/crashers/018-swift-valuedecl-getinterfacetype.sil
+++ /dev/null
@@ -1,3 +0,0 @@
-// RUN: not --crash %target-sil-opt %s
-// REQUIRES: asserts
-@objc protocol P{func t throw
diff --git a/validation-test/SIL/crashers_fixed/018-swift-valuedecl-getinterfacetype.sil b/validation-test/SIL/crashers_fixed/018-swift-valuedecl-getinterfacetype.sil
new file mode 100644
index 0000000..db39c47
--- /dev/null
+++ b/validation-test/SIL/crashers_fixed/018-swift-valuedecl-getinterfacetype.sil
@@ -0,0 +1,2 @@
+// RUN: not %target-sil-opt %s
+@objc protocol P{func t throw
diff --git a/validation-test/SIL/verify_all_overlays.sil b/validation-test/SIL/verify_all_overlays.sil
index caa86c6..424e9d5 100644
--- a/validation-test/SIL/verify_all_overlays.sil
+++ b/validation-test/SIL/verify_all_overlays.sil
@@ -1,4 +1,4 @@
-// RUN: for x in %platform-sdk-overlay-dir/*.swiftmodule; do [[ $(basename "$x") = Swift.swiftmodule ]] && continue; llvm-bcanalyzer $x | FileCheck %s; %target-sil-opt -sdk %sdk -enable-sil-verify-all $x > /dev/null; done
+// RUN: for x in %platform-sdk-overlay-dir/*.swiftmodule; do [[ $(basename "$x") = Swift.swiftmodule ]] && continue; llvm-bcanalyzer $x | %FileCheck %s; %target-sil-opt -sdk %sdk -enable-sil-verify-all $x > /dev/null; done
 
 // CHECK-NOT: Unknown
 
diff --git a/validation-test/Sema/type_checker_crashers/rdar27261929.swift b/validation-test/Sema/type_checker_crashers/rdar27261929.swift
new file mode 100644
index 0000000..116f6c7
--- /dev/null
+++ b/validation-test/Sema/type_checker_crashers/rdar27261929.swift
@@ -0,0 +1,20 @@
+// RUN: not --crash %target-swift-frontend %s -parse
+
+public enum R<V> {
+  case value(V)
+}
+
+public struct P<I, O> {
+  public var run: (I) -> R<(O, I)>
+
+  public init(run: @escaping (I) -> R<(O, I)>) {
+    self.run = run
+  }
+
+  public func test() -> P<I, [O]> {
+    return P<I, [O]> { input in
+      var output: [O] = []
+      return R<([O], I)>.value(output, input)
+    }
+  }
+}
diff --git a/validation-test/Sema/type_checker_crashers/rdar27329076.swift b/validation-test/Sema/type_checker_crashers/rdar27329076.swift
new file mode 100644
index 0000000..aa85257
--- /dev/null
+++ b/validation-test/Sema/type_checker_crashers/rdar27329076.swift
@@ -0,0 +1,3 @@
+// RUN: not --crash %target-swift-frontend %s -parse
+
+_ = try [ { return .D($0[0]) } ]
diff --git a/validation-test/Sema/type_checker_crashers/rdar27464577.swift b/validation-test/Sema/type_checker_crashers/rdar27464577.swift
new file mode 100644
index 0000000..0d96a07
--- /dev/null
+++ b/validation-test/Sema/type_checker_crashers/rdar27464577.swift
@@ -0,0 +1,3 @@
+// RUN: not --crash %target-swift-frontend %s -parse
+
+_ = [1].map { v -> T in return v as? Int }
diff --git a/validation-test/Sema/type_checker_crashers/rdar27575060.swift b/validation-test/Sema/type_checker_crashers/rdar27575060.swift
new file mode 100644
index 0000000..e088cf9
--- /dev/null
+++ b/validation-test/Sema/type_checker_crashers/rdar27575060.swift
@@ -0,0 +1,7 @@
+// RUN: not --crash %target-swift-frontend %s -parse
+// REQUIRES: asserts
+
+func f(_ x: Any...) {}
+
+var a = 1
+f((a, 2))
diff --git a/validation-test/Sema/type_checker_crashers/rdar27680407.swift b/validation-test/Sema/type_checker_crashers/rdar27680407.swift
new file mode 100644
index 0000000..1e16463
--- /dev/null
+++ b/validation-test/Sema/type_checker_crashers/rdar27680407.swift
@@ -0,0 +1,10 @@
+// RUN: not --crash %target-swift-frontend %s -parse
+
+struct rdar27680407 : ExpressibleByStringLiteral {
+  let value: String
+
+  // Stack overflow while validating rdar27680407.StringLiteralType.
+  init(stringLiteral value: rdar27680407.StringLiteralType) {
+    self.value = value
+  }
+}
diff --git a/validation-test/Sema/type_checker_crashers/rdar27787341.swift b/validation-test/Sema/type_checker_crashers/rdar27787341.swift
new file mode 100644
index 0000000..c7688c3
--- /dev/null
+++ b/validation-test/Sema/type_checker_crashers/rdar27787341.swift
@@ -0,0 +1,3 @@
+// RUN: not --crash %target-swift-frontend %s -parse
+
+_ = [1].reduce([:]) { $0[$1] }
diff --git a/validation-test/Sema/type_checker_crashers/rdar27879334.swift b/validation-test/Sema/type_checker_crashers/rdar27879334.swift
new file mode 100644
index 0000000..4eadc52
--- /dev/null
+++ b/validation-test/Sema/type_checker_crashers/rdar27879334.swift
@@ -0,0 +1,11 @@
+// RUN: not --crash %target-swift-frontend %s -parse
+
+class N {}
+
+class C {
+  var number: N!
+  var int64: Int64 = 0
+}
+
+let c: C? = C()
+_ = (c!.number ?? 0) == (c?.int64 ?? 0)
diff --git a/validation-test/Sema/type_checker_crashers_fixed/rdar27815848.swift b/validation-test/Sema/type_checker_crashers_fixed/rdar27815848.swift
new file mode 100644
index 0000000..ed94b0c
--- /dev/null
+++ b/validation-test/Sema/type_checker_crashers_fixed/rdar27815848.swift
@@ -0,0 +1,13 @@
+// RUN: not %target-swift-frontend %s -parse
+
+class C {}
+class D : C {}
+
+@_silgen_name("consume")
+func consume(_: [C])  // note, returns ()
+
+// Assert/crash while emitting diagnostic for coercion from () to Bool
+// in the context of a collection cast.
+func test(x: [D]) -> Bool {
+  return consume(x)  // no way to coerce from () to Bool
+}
diff --git a/validation-test/StdlibUnittest/Android.swift b/validation-test/StdlibUnittest/Android.swift
index 0256952..3ed3e5f 100644
--- a/validation-test/StdlibUnittest/Android.swift
+++ b/validation-test/StdlibUnittest/Android.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-stdlib-swift | FileCheck %s
+// RUN: %target-run-stdlib-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/validation-test/StdlibUnittest/CheckEquatable.swift.gyb b/validation-test/StdlibUnittest/CheckEquatable.swift.gyb
index 825baf2..8487bcd 100644
--- a/validation-test/StdlibUnittest/CheckEquatable.swift.gyb
+++ b/validation-test/StdlibUnittest/CheckEquatable.swift.gyb
@@ -1,5 +1,5 @@
 // RUN: %target-run-simple-swiftgyb > %t.stdout 2>&1
-// RUN: FileCheck %s < %t.stdout
+// RUN: %FileCheck %s < %t.stdout
 // REQUIRES: executable_test
 
 import StdlibUnittest
diff --git a/validation-test/StdlibUnittest/ChildProcessShutdown/FailIfChildCrashesDuringShutdown.swift b/validation-test/StdlibUnittest/ChildProcessShutdown/FailIfChildCrashesDuringShutdown.swift
index 4e3e271..7d9ba05 100644
--- a/validation-test/StdlibUnittest/ChildProcessShutdown/FailIfChildCrashesDuringShutdown.swift
+++ b/validation-test/StdlibUnittest/ChildProcessShutdown/FailIfChildCrashesDuringShutdown.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift 2>&1 | FileCheck %s
+// RUN: %target-run-simple-swift 2>&1 | %FileCheck %s
 // REQUIRES: executable_test
 
 import StdlibUnittest
diff --git a/validation-test/StdlibUnittest/ChildProcessShutdown/FailIfChildExitsDuringShutdown.swift b/validation-test/StdlibUnittest/ChildProcessShutdown/FailIfChildExitsDuringShutdown.swift
index 7f6a795..25334f2 100644
--- a/validation-test/StdlibUnittest/ChildProcessShutdown/FailIfChildExitsDuringShutdown.swift
+++ b/validation-test/StdlibUnittest/ChildProcessShutdown/FailIfChildExitsDuringShutdown.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift 2>&1 | FileCheck %s
+// RUN: %target-run-simple-swift 2>&1 | %FileCheck %s
 // REQUIRES: executable_test
 
 import StdlibUnittest
diff --git a/validation-test/StdlibUnittest/CommandLine.swift b/validation-test/StdlibUnittest/CommandLine.swift
index 9ca9fe5..db63909 100644
--- a/validation-test/StdlibUnittest/CommandLine.swift
+++ b/validation-test/StdlibUnittest/CommandLine.swift
@@ -1,9 +1,9 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: %target-build-swift %s -o %t/main.out
-// RUN: %target-run %t/main.out | FileCheck -check-prefix=CHECK-EMPTY %s
-// RUN: %target-run %t/main.out --abc | FileCheck -check-prefix=CHECK-1 %s
-// RUN: %target-run %t/main.out --abc def | FileCheck -check-prefix=CHECK-2 %s
-// RUN: %target-run %t/main.out a --bcd efghijk | FileCheck -check-prefix=CHECK-3 %s
+// RUN: %target-run %t/main.out | %FileCheck -check-prefix=CHECK-EMPTY %s
+// RUN: %target-run %t/main.out --abc | %FileCheck -check-prefix=CHECK-1 %s
+// RUN: %target-run %t/main.out --abc def | %FileCheck -check-prefix=CHECK-2 %s
+// RUN: %target-run %t/main.out a --bcd efghijk | %FileCheck -check-prefix=CHECK-3 %s
 // REQUIRES: executable_test
 
 import StdlibUnittest
diff --git a/validation-test/StdlibUnittest/Common.swift b/validation-test/StdlibUnittest/Common.swift
index 8f8bc89..b8521ae 100644
--- a/validation-test/StdlibUnittest/Common.swift
+++ b/validation-test/StdlibUnittest/Common.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import SwiftPrivate
diff --git a/validation-test/StdlibUnittest/CrashingTests.swift b/validation-test/StdlibUnittest/CrashingTests.swift
index 2398ae7..1275849 100644
--- a/validation-test/StdlibUnittest/CrashingTests.swift
+++ b/validation-test/StdlibUnittest/CrashingTests.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift 2>&1 | FileCheck %s
+// RUN: %target-run-simple-swift 2>&1 | %FileCheck %s
 // REQUIRES: executable_test
 
 import StdlibUnittest
diff --git a/validation-test/StdlibUnittest/Filter.swift b/validation-test/StdlibUnittest/Filter.swift
index 14c1889..1a2d41b 100644
--- a/validation-test/StdlibUnittest/Filter.swift
+++ b/validation-test/StdlibUnittest/Filter.swift
@@ -1,6 +1,6 @@
 // RUN: %target-build-swift %s -o %t.out
-// RUN: %target-run %t.out --stdlib-unittest-filter abc | FileCheck --check-prefix=CHECK-ABC %s
-// RUN: %target-run %t.out --stdlib-unittest-filter xyz | FileCheck --check-prefix=CHECK-XYZ %s
+// RUN: %target-run %t.out --stdlib-unittest-filter abc | %FileCheck --check-prefix=CHECK-ABC %s
+// RUN: %target-run %t.out --stdlib-unittest-filter xyz | %FileCheck --check-prefix=CHECK-XYZ %s
 
 // CHECK-ABC: StdlibUnittest: using filter: abc{{$}}
 // CHECK-ABC: [ RUN      ] Filter.abc{{$}}
diff --git a/validation-test/StdlibUnittest/ForgotToRunTests.swift b/validation-test/StdlibUnittest/ForgotToRunTests.swift
index 10469f7..f8c1ab1 100644
--- a/validation-test/StdlibUnittest/ForgotToRunTests.swift
+++ b/validation-test/StdlibUnittest/ForgotToRunTests.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift 2>&1 | FileCheck %s
+// RUN: %target-run-simple-swift 2>&1 | %FileCheck %s
 // REQUIRES: executable_test
 
 import StdlibUnittest
diff --git a/validation-test/StdlibUnittest/FreeBSD.swift b/validation-test/StdlibUnittest/FreeBSD.swift
index 81c623a..1e654bf8 100644
--- a/validation-test/StdlibUnittest/FreeBSD.swift
+++ b/validation-test/StdlibUnittest/FreeBSD.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-stdlib-swift | FileCheck %s
+// RUN: %target-run-stdlib-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/validation-test/StdlibUnittest/IOS.swift b/validation-test/StdlibUnittest/IOS.swift
index 468f9ed..bef3ec9 100644
--- a/validation-test/StdlibUnittest/IOS.swift
+++ b/validation-test/StdlibUnittest/IOS.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-stdlib-swift | FileCheck %s
+// RUN: %target-run-stdlib-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/validation-test/StdlibUnittest/IOSSimulator.swift b/validation-test/StdlibUnittest/IOSSimulator.swift
index 5aef358..f480022 100644
--- a/validation-test/StdlibUnittest/IOSSimulator.swift
+++ b/validation-test/StdlibUnittest/IOSSimulator.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-stdlib-swift | FileCheck %s
+// RUN: %target-run-stdlib-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/validation-test/StdlibUnittest/Linux.swift b/validation-test/StdlibUnittest/Linux.swift
index 3a03a84..4ce4724 100644
--- a/validation-test/StdlibUnittest/Linux.swift
+++ b/validation-test/StdlibUnittest/Linux.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-stdlib-swift | FileCheck %s
+// RUN: %target-run-stdlib-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/validation-test/StdlibUnittest/Misc.swift b/validation-test/StdlibUnittest/Misc.swift
index b2f516e..75371fc 100644
--- a/validation-test/StdlibUnittest/Misc.swift
+++ b/validation-test/StdlibUnittest/Misc.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import StdlibUnittest
diff --git a/validation-test/StdlibUnittest/NSException.swift b/validation-test/StdlibUnittest/NSException.swift
index 5d127e2..202e7b9 100644
--- a/validation-test/StdlibUnittest/NSException.swift
+++ b/validation-test/StdlibUnittest/NSException.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift 2>&1 | FileCheck %s
+// RUN: %target-run-simple-swift 2>&1 | %FileCheck %s
 // REQUIRES: executable_test
 // REQUIRES: objc_interop
 
diff --git a/validation-test/StdlibUnittest/PS4.swift b/validation-test/StdlibUnittest/PS4.swift
index a3ce7e8..3e6b319 100644
--- a/validation-test/StdlibUnittest/PS4.swift
+++ b/validation-test/StdlibUnittest/PS4.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-stdlib-swift | FileCheck %s
+// RUN: %target-run-stdlib-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 import Swift
diff --git a/validation-test/StdlibUnittest/RaceTest.swift b/validation-test/StdlibUnittest/RaceTest.swift
index ec5345f..4b6f025 100644
--- a/validation-test/StdlibUnittest/RaceTest.swift
+++ b/validation-test/StdlibUnittest/RaceTest.swift
@@ -1,5 +1,5 @@
 // RUN: %target-build-swift -Xfrontend -disable-access-control -module-name a %s -o %t.out
-// RUN: %target-run %t.out | FileCheck %s
+// RUN: %target-run %t.out | %FileCheck %s
 
 import StdlibUnittest
 
diff --git a/validation-test/StdlibUnittest/RunAllTestsCalledTwice.swift b/validation-test/StdlibUnittest/RunAllTestsCalledTwice.swift
index 48697f0..d3f16a2 100644
--- a/validation-test/StdlibUnittest/RunAllTestsCalledTwice.swift
+++ b/validation-test/StdlibUnittest/RunAllTestsCalledTwice.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift 2>&1 | FileCheck %s
+// RUN: %target-run-simple-swift 2>&1 | %FileCheck %s
 // REQUIRES: executable_test
 
 import StdlibUnittest
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers/09650-swift-typebase-getcanonicaltype.swift
similarity index 88%
copy from validation-test/compiler_crashers/28265-swift-expr-walk.swift
copy to validation-test/compiler_crashers/09650-swift-typebase-getcanonicaltype.swift
index 27ed0a8..65d7c44 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers/09650-swift-typebase-getcanonicaltype.swift
@@ -6,5 +6,6 @@
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 
 // RUN: not --crash %target-swift-frontend %s -parse
-// REQUIRES: asserts
-class c<func a{if c == .h.c=a{
+class B<I
+func g<T{enum A:T
+enum S<b:B<T.j>
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers/28393-swift-type-transform.swift
similarity index 89%
copy from validation-test/compiler_crashers/28265-swift-expr-walk.swift
copy to validation-test/compiler_crashers/28393-swift-type-transform.swift
index 27ed0a8..0635240 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers/28393-swift-type-transform.swift
@@ -7,4 +7,4 @@
 
 // RUN: not --crash %target-swift-frontend %s -parse
 // REQUIRES: asserts
-class c<func a{if c == .h.c=a{
+enum S:A{let d=b}protocol A{associatedtype b:A=S
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers/28394-swift-typechecker-checkconformance.swift
similarity index 84%
copy from validation-test/compiler_crashers/28265-swift-expr-walk.swift
copy to validation-test/compiler_crashers/28394-swift-typechecker-checkconformance.swift
index 27ed0a8..8d95395 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers/28394-swift-typechecker-checkconformance.swift
@@ -7,4 +7,4 @@
 
 // RUN: not --crash %target-swift-frontend %s -parse
 // REQUIRES: asserts
-class c<func a{if c == .h.c=a{
+class d:a{let c=A}protocol a{struct A{}class S<T{}typealias e:a typealias d:a
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers/28395-swift-expr-propagatelvalueaccesskind.swift
similarity index 88%
copy from validation-test/compiler_crashers/28265-swift-expr-walk.swift
copy to validation-test/compiler_crashers/28395-swift-expr-propagatelvalueaccesskind.swift
index 27ed0a8..a1b4216 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers/28395-swift-expr-propagatelvalueaccesskind.swift
@@ -6,5 +6,4 @@
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 
 // RUN: not --crash %target-swift-frontend %s -parse
-// REQUIRES: asserts
-class c<func a{if c == .h.c=a{
+{guard let b=.h.h=.n?(){
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers/28396-swift-lowering-silgenfunction-emitclosurevalue.swift
similarity index 79%
copy from validation-test/compiler_crashers/28265-swift-expr-walk.swift
copy to validation-test/compiler_crashers/28396-swift-lowering-silgenfunction-emitclosurevalue.swift
index 27ed0a8..e8adc08 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers/28396-swift-lowering-silgenfunction-emitclosurevalue.swift
@@ -5,6 +5,6 @@
 // See http://swift.org/LICENSE.txt for license information
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 
-// RUN: not --crash %target-swift-frontend %s -parse
+// RUN: not --crash %target-swift-frontend %s -emit-ir
 // REQUIRES: asserts
-class c<func a{if c == .h.c=a{
+func a(){var b:()->(){return{b()}}}
diff --git a/validation-test/compiler_crashers_fixed/09650-swift-typebase-getcanonicaltype.swift b/validation-test/compiler_crashers/28397-getselftypeforcontainer.swift
similarity index 78%
copy from validation-test/compiler_crashers_fixed/09650-swift-typebase-getcanonicaltype.swift
copy to validation-test/compiler_crashers/28397-getselftypeforcontainer.swift
index af5dbb6..796497f 100644
--- a/validation-test/compiler_crashers_fixed/09650-swift-typebase-getcanonicaltype.swift
+++ b/validation-test/compiler_crashers/28397-getselftypeforcontainer.swift
@@ -5,7 +5,5 @@
 // See http://swift.org/LICENSE.txt for license information
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 
-// RUN: not %target-swift-frontend %s -parse
-class B<I
-func g<T{enum A:T
-enum S<b:B<T.j>
+// RUN: not --crash %target-swift-frontend %s -emit-ir
+protocol y{class B:Array<e>typealias e
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift
similarity index 87%
copy from validation-test/compiler_crashers/28265-swift-expr-walk.swift
copy to validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift
index 27ed0a8..9c1d203 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift
@@ -7,4 +7,4 @@
 
 // RUN: not --crash %target-swift-frontend %s -parse
 // REQUIRES: asserts
-class c<func a{if c == .h.c=a{
+protocol A{class A{var _=c<}protocol A{extension{func<:a
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers/28399-getpointerelementtype-is-not-storagetype.swift
similarity index 61%
copy from validation-test/compiler_crashers/28265-swift-expr-walk.swift
copy to validation-test/compiler_crashers/28399-getpointerelementtype-is-not-storagetype.swift
index 27ed0a8..089f11d 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers/28399-getpointerelementtype-is-not-storagetype.swift
@@ -5,6 +5,16 @@
 // See http://swift.org/LICENSE.txt for license information
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 
-// RUN: not --crash %target-swift-frontend %s -parse
+// RUN: not --crash %target-swift-frontend %s -emit-ir
 // REQUIRES: asserts
-class c<func a{if c == .h.c=a{
+protocol A{associatedtype B
+}
+struct C<T:A>{
+}
+protocol E{associatedtype F
+func g<T where F==T.B>(_:C<T>)
+}
+struct H:E{
+typealias F = Void
+func g<T where F==T.B>(_:C<T>){}
+}
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers/28400-swift-nominaltypedecl-prepareextensions.swift
similarity index 71%
copy from validation-test/compiler_crashers/28265-swift-expr-walk.swift
copy to validation-test/compiler_crashers/28400-swift-nominaltypedecl-prepareextensions.swift
index 27ed0a8..ac0c6d6 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers/28400-swift-nominaltypedecl-prepareextensions.swift
@@ -7,4 +7,9 @@
 
 // RUN: not --crash %target-swift-frontend %s -parse
 // REQUIRES: asserts
-class c<func a{if c == .h.c=a{
+// Discovered by https://github.com/airspeedswift (airspeedswift)
+
+let s1: Set<Int>? = []
+let s2: Set<Int>? = []
+let s3: Set<Int>? = []
+let x = s1 ?? s2 ?? s3 ?? []
diff --git a/validation-test/compiler_crashers_fixed/09650-swift-typebase-getcanonicaltype.swift b/validation-test/compiler_crashers/28401-swift-boundgenerictype-get.swift
similarity index 78%
rename from validation-test/compiler_crashers_fixed/09650-swift-typebase-getcanonicaltype.swift
rename to validation-test/compiler_crashers/28401-swift-boundgenerictype-get.swift
index af5dbb6..f19d999 100644
--- a/validation-test/compiler_crashers_fixed/09650-swift-typebase-getcanonicaltype.swift
+++ b/validation-test/compiler_crashers/28401-swift-boundgenerictype-get.swift
@@ -5,7 +5,5 @@
 // See http://swift.org/LICENSE.txt for license information
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 
-// RUN: not %target-swift-frontend %s -parse
-class B<I
-func g<T{enum A:T
-enum S<b:B<T.j>
+// RUN: not --crash %target-swift-frontend %s -emit-ir
+protocol P{class a:Array<b>typealias b
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers/28402-swift-typebase-getcanonicaltype.swift
similarity index 92%
rename from validation-test/compiler_crashers/28265-swift-expr-walk.swift
rename to validation-test/compiler_crashers/28402-swift-typebase-getcanonicaltype.swift
index 27ed0a8..47cd0f9 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers/28402-swift-typebase-getcanonicaltype.swift
@@ -7,4 +7,6 @@
 
 // RUN: not --crash %target-swift-frontend %s -parse
 // REQUIRES: asserts
-class c<func a{if c == .h.c=a{
+let c{{
+return.E == .i
+c
diff --git a/validation-test/compiler_crashers/28265-swift-expr-walk.swift b/validation-test/compiler_crashers_fixed/28265-swift-expr-walk.swift
similarity index 88%
copy from validation-test/compiler_crashers/28265-swift-expr-walk.swift
copy to validation-test/compiler_crashers_fixed/28265-swift-expr-walk.swift
index 27ed0a8..d3c06ee 100644
--- a/validation-test/compiler_crashers/28265-swift-expr-walk.swift
+++ b/validation-test/compiler_crashers_fixed/28265-swift-expr-walk.swift
@@ -5,6 +5,6 @@
 // See http://swift.org/LICENSE.txt for license information
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 
-// RUN: not --crash %target-swift-frontend %s -parse
+// RUN: not %target-swift-frontend %s -parse
 // REQUIRES: asserts
 class c<func a{if c == .h.c=a{
diff --git a/validation-test/execution/interpret-with-dependencies-linux.swift b/validation-test/execution/interpret-with-dependencies-linux.swift
index 1bce744..44313ff 100644
--- a/validation-test/execution/interpret-with-dependencies-linux.swift
+++ b/validation-test/execution/interpret-with-dependencies-linux.swift
@@ -4,7 +4,7 @@
 // RUN: echo 'int abc = 42;' | %clang -x c - -shared -fPIC -o %t/libabc.so
 // RUN: echo 'int test() { extern int abc; return abc; }' | %clang -x c - -L%t -shared -fPIC -labc -o %t/libfoo.so
 
-// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t %s | FileCheck %s
+// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t %s | %FileCheck %s
 // CHECK: {{okay}}
 
 // Now test a dependency on a library in the compiler's resource directory.
@@ -15,7 +15,7 @@
 // RUN: mkdir -p %t/other
 // RUN: ln -s %t/libfoo.so %t/other
 
-// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t/other -resource-dir %t/rsrc/ %s | FileCheck %s
+// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t/other -resource-dir %t/rsrc/ %s | %FileCheck %s
 
 import foo
 
diff --git a/validation-test/execution/interpret-with-dependencies.swift b/validation-test/execution/interpret-with-dependencies.swift
index 75bd2b9..6f1a170 100644
--- a/validation-test/execution/interpret-with-dependencies.swift
+++ b/validation-test/execution/interpret-with-dependencies.swift
@@ -4,7 +4,7 @@
 // RUN: echo 'int abc = 42;' | %clang -x c - -dynamiclib -Xlinker -install_name -Xlinker libabc.dylib -o %t/libabc.dylib
 // RUN: echo 'int test() { extern int abc; return abc; }' | %clang -x c - -L%t -dynamiclib -labc -o %t/libfoo.dylib
 
-// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t %s | FileCheck %s
+// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t %s | %FileCheck %s
 // CHECK: {{okay}}
 
 // Now test a dependency on a library in the compiler's resource directory.
@@ -15,7 +15,7 @@
 // RUN: mkdir -p %t/other
 // RUN: ln -s %t/libfoo.dylib %t/other
 
-// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t/other -resource-dir %t/rsrc/ %s | FileCheck %s
+// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t/other -resource-dir %t/rsrc/ %s | %FileCheck %s
 
 import foo
 
diff --git a/validation-test/execution/testability.swift b/validation-test/execution/testability.swift
index e317441..d87e500 100644
--- a/validation-test/execution/testability.swift
+++ b/validation-test/execution/testability.swift
@@ -11,5 +11,5 @@
 // RUN: %target-build-swift -O -emit-library -c %S/../../test/Interpreter/Inputs/testability_helper.swift -enable-testing -force-single-frontend-invocation -o %t/testability_helper.o -emit-module
 
 // RUN: %target-build-swift -O %S/../../test/Interpreter/testability.swift -I %t -Xlinker %t/testability_helper.o -o %t/main
-// RUN: %target-run %t/main | FileCheck %S/../../test/Interpreter/testability.swift
+// RUN: %target-run %t/main | %FileCheck %S/../../test/Interpreter/testability.swift
 // REQUIRES: executable_test
diff --git a/validation-test/stdlib/Arrays.swift.gyb b/validation-test/stdlib/Arrays.swift.gyb
index def3a35..fabdc22 100644
--- a/validation-test/stdlib/Arrays.swift.gyb
+++ b/validation-test/stdlib/Arrays.swift.gyb
@@ -87,9 +87,9 @@
 ArrayTestSuite.test("sizeof") {
   var a = [ 10, 20, 30 ]
 #if arch(i386) || arch(arm)
-  expectEqual(4, MemoryLayout._ofInstance(a).size)
+  expectEqual(4, MemoryLayout.size(ofValue: a))
 #else
-  expectEqual(8, MemoryLayout._ofInstance(a).size)
+  expectEqual(8, MemoryLayout.size(ofValue: a))
 #endif
 }
 
diff --git a/validation-test/stdlib/BoolDiagnostics_Dataflow.swift b/validation-test/stdlib/BoolDiagnostics_Dataflow.swift
index 494d293..29774a6 100644
--- a/validation-test/stdlib/BoolDiagnostics_Dataflow.swift
+++ b/validation-test/stdlib/BoolDiagnostics_Dataflow.swift
@@ -55,3 +55,5 @@
   }
 } // expected-error {{missing return in a function expected to return 'Int'}}
 
+// expected-warning@+1 {{'ExpressibleByStringInterpolation' is deprecated: it will be replaced or redesigned in Swift 4.0.  Instead of conforming to 'ExpressibleByStringInterpolation', consider adding an 'init(_:String)'}}
+typealias X = ExpressibleByStringInterpolation
diff --git a/validation-test/stdlib/CollectionDiagnostics.swift b/validation-test/stdlib/CollectionDiagnostics.swift
index e4956b1..94a85db 100644
--- a/validation-test/stdlib/CollectionDiagnostics.swift
+++ b/validation-test/stdlib/CollectionDiagnostics.swift
@@ -23,7 +23,7 @@
     fatalError("unreachable")
   }
 
-  // expected-note@+3 {{possibly intended match 'SubSequence' (aka 'OpaqueValue<Int8>') does not conform to 'IndexableBase'}}
+  // expected-note@+3 {{possibly intended match 'CollectionWithBadSubSequence.SubSequence' (aka 'OpaqueValue<Int8>') does not conform to 'IndexableBase'}}
   // expected-note@+2 {{possibly intended match}}
   // expected-note@+1 {{possibly intended match}}
   typealias SubSequence = OpaqueValue<Int8>
diff --git a/validation-test/stdlib/CollectionOld.swift b/validation-test/stdlib/CollectionOld.swift
index c01f125..9cc0640 100644
--- a/validation-test/stdlib/CollectionOld.swift
+++ b/validation-test/stdlib/CollectionOld.swift
@@ -1,5 +1,5 @@
 // RUN: %target-run-simple-swift --stdlib-unittest-in-process | tee %t.txt
-// RUN: FileCheck %s < %t.txt
+// RUN: %FileCheck %s < %t.txt
 // note: remove the --stdlib-unittest-in-process once all the FileCheck tests
 // have been converted to StdlibUnittest
 // REQUIRES: executable_test
diff --git a/validation-test/stdlib/CryptoTokenKitTests.swift b/validation-test/stdlib/CryptoTokenKitTests.swift
index e6b43a8..7805ab4 100644
--- a/validation-test/stdlib/CryptoTokenKitTests.swift
+++ b/validation-test/stdlib/CryptoTokenKitTests.swift
@@ -69,8 +69,8 @@
 
   struct TKTokenTest {
     func f1(session: TKTokenSession, sessionDelegate: TKTokenSessionDelegate,
-            algorithm: TKTokenSessionDelegate.KeyAlgorithm,
-            parameters: TKTokenSessionDelegate.KeyExchangeParameters) throws {
+            algorithm: TKTokenKeyAlgorithm,
+            parameters: TKTokenKeyExchangeParameters) throws {
       let _: Bool = sessionDelegate.tokenSession!(session, supports: .none,
            keyObjectID: "", algorithm: algorithm)
       let _: Data = try sessionDelegate.tokenSession!(session, sign: Data(),
diff --git a/validation-test/stdlib/Dictionary.swift b/validation-test/stdlib/Dictionary.swift
index da78dfc..4bb8711 100644
--- a/validation-test/stdlib/Dictionary.swift
+++ b/validation-test/stdlib/Dictionary.swift
@@ -72,9 +72,9 @@
 DictionaryTestSuite.test("sizeof") {
   var dict = [1: "meow", 2: "meow"]
 #if arch(i386) || arch(arm)
-  expectEqual(4, MemoryLayout._ofInstance(dict).size)
+  expectEqual(4, MemoryLayout.size(ofValue: dict))
 #else
-  expectEqual(8, MemoryLayout._ofInstance(dict).size)
+  expectEqual(8, MemoryLayout.size(ofValue: dict))
 #endif
 }
 
diff --git a/validation-test/stdlib/ErrorProtocol.swift b/validation-test/stdlib/ErrorProtocol.swift
index 91d7255..5c2b557 100644
--- a/validation-test/stdlib/ErrorProtocol.swift
+++ b/validation-test/stdlib/ErrorProtocol.swift
@@ -1,6 +1,5 @@
 // RUN: %target-run-simple-swift
 // REQUIRES: executable_test
-// REQUIRES: rdar27541751
 // REQUIRES: objc_interop
 
 import SwiftPrivate
diff --git a/validation-test/stdlib/Glibc.swift b/validation-test/stdlib/Glibc.swift
index 3388ea8..d993fb0 100644
--- a/validation-test/stdlib/Glibc.swift
+++ b/validation-test/stdlib/Glibc.swift
@@ -24,6 +24,11 @@
   expectEqual(EBADF, errno)
 }
 
+GlibcTestSuite.test("sendfile") {
+  // Check that `sendfile` is available.  Don't actually call it, because doing that is non-trivial.
+  expectEqual(((Int32, Int32, UnsafeMutablePointer<off_t>!, ssize_t) -> ssize_t).self, type(of: sendfile))
+}
+
 var GlibcIoctlConstants = TestSuite("GlibcIoctlConstants")
 
 GlibcIoctlConstants.test("tty ioctl constants availability") {
diff --git a/validation-test/stdlib/HashingICU.swift b/validation-test/stdlib/HashingICU.swift
index ee4e556..cba5411 100644
--- a/validation-test/stdlib/HashingICU.swift
+++ b/validation-test/stdlib/HashingICU.swift
@@ -1,4 +1,4 @@
-// RUN: %target-run-simple-swift | FileCheck %s
+// RUN: %target-run-simple-swift | %FileCheck %s
 // REQUIRES: executable_test
 
 // REQUIRES: OS=linux-gnu
diff --git a/validation-test/stdlib/Lazy.swift.gyb b/validation-test/stdlib/Lazy.swift.gyb
index 2cab409..7f2a3cf 100644
--- a/validation-test/stdlib/Lazy.swift.gyb
+++ b/validation-test/stdlib/Lazy.swift.gyb
@@ -639,7 +639,7 @@
 
   SequenceLog._copyContents.expectIncrement(baseType) { () -> Void in
     let buf = UnsafeMutablePointer<S.Iterator.Element>.allocate(capacity: count)
-  
+
     let end = s._copyContents(initializing: buf)
     expectTrue(end <= buf + count)
     buf.deinitialize(count: end - buf)
@@ -955,9 +955,9 @@
   // Check that reversing a lazy collection, or lazy-ing a reverse
   // collection, produces the same lazy reverse collection.
   do {
-    
+
     let base = Array(stride(from: 11, through: 0, by: -1)).lazy.map { $0 }
-    
+
     typealias Base = LazyMapRandomAccessCollection<[Int], Int>
     ExpectType<Base>.test(base)
 
@@ -1279,5 +1279,138 @@
   }
 }
 
-runAllTests()
+//===--- LazyPrefixWhile --------------------------------------------------===//
 
+let prefixDropWhileTests: [(data: [Int], value: Int, pivot: Int)] = [
+  ([],                       0,     0),
+  ([0],                      0,     0),
+  ([0],                     99,     1),
+  ([0, 10],                  0,     0),
+  ([0, 10],                 10,     1),
+  ([0, 10],                 99,     2),
+  ([0, 10, 20, 30, 40],      0,     0),
+  ([0, 10, 20, 30, 40],     10,     1),
+  ([0, 10, 20, 30, 40],     20,     2),
+  ([0, 10, 20, 30, 40],     30,     3),
+  ([0, 10, 20, 30, 40],     40,     4),
+  ([0, 10, 20, 30, 40],     99,     5) ]
+
+% for Kind in 'Sequence', 'Forward', 'Bidirectional':
+%   Self = 'Sequence' if Kind == 'Sequence' else collectionForTraversal(Kind)
+%   checkKind = 'ForwardCollection' if Kind == 'Forward' else Self
+tests.test("LazyPrefixWhile${Self}").forEach(in: prefixDropWhileTests) {
+  (data, value, pivot) in
+
+  let base = Minimal${Self}(elements: data)
+
+  var calls1 = 0
+  let prefixed = base.lazy.prefix(while: { calls1 += 1; return $0 != value })
+  let expected = data.prefix(upTo: pivot)
+  expectEqual(0, calls1)
+  check${checkKind}(expected, prefixed)
+
+  var calls2 = 0
+  _ = prefixed.map { _ in calls2 += 1 }
+  expectEqual(0, calls2, "unexpected eagerness in \(type(of: prefixed))")
+
+  % if Kind == 'Bidirectional':
+  check${checkKind}(expected.reversed(), prefixed.reversed())
+  % end
+}
+% end
+
+tests.test("LazyPrefixWhileSequence/AssociatedTypes") {
+  typealias Base = MinimalSequence<OpaqueValue<Int>>
+  typealias Subject = LazyPrefixWhileSequence<Base>
+  expectSequenceAssociatedTypes(
+    sequenceType: Subject.self,
+    iteratorType: LazyPrefixWhileIterator<Base.Iterator>.self,
+    subSequenceType: AnySequence<OpaqueValue<Int>>.self)
+}
+
+tests.test("LazyPrefixWhileCollection/AssociatedTypes") {
+  typealias Base = MinimalCollection<OpaqueValue<Int>>
+  typealias Subject = LazyPrefixWhileCollection<Base>
+  expectCollectionAssociatedTypes(
+    collectionType: Subject.self,
+    iteratorType: LazyPrefixWhileIterator<Base.Iterator>.self,
+    subSequenceType: Slice<Subject>.self,
+    indexType: LazyPrefixWhileIndex<Base>.self,
+    indexDistanceType: Base.IndexDistance.self,
+    indicesType: DefaultIndices<Subject>.self)
+}
+
+tests.test("LazyPrefixWhileBidirectionalCollection/AssociatedTypes") {
+  typealias Base = MinimalBidirectionalCollection<OpaqueValue<Int>>
+  typealias Subject = LazyPrefixWhileBidirectionalCollection<Base>
+  expectBidirectionalCollectionAssociatedTypes(
+    collectionType: Subject.self,
+    iteratorType: LazyPrefixWhileIterator<Base.Iterator>.self,
+    // FIXME(ABI): SubSequence should be `LazyFilterBidirectionalCollection<Base.Slice>`.
+    subSequenceType: BidirectionalSlice<Subject>.self,
+    indexType: LazyPrefixWhileIndex<Base>.self,
+    indexDistanceType: Base.IndexDistance.self,
+    indicesType: DefaultBidirectionalIndices<Subject>.self)
+}
+
+//===--- LazyDropWhile ----------------------------------------------------===//
+
+% for Kind in 'Sequence', 'Forward', 'Bidirectional':
+%   Self = 'Sequence' if Kind == 'Sequence' else collectionForTraversal(Kind)
+%   checkKind = 'ForwardCollection' if Kind == 'Forward' else Self
+tests.test("LazyDropWhile${Self}").forEach(in: prefixDropWhileTests) {
+  (data, value, pivot) in
+
+  let base = Minimal${Self}(elements: data)
+
+  var calls1 = 0
+  let dropped = base.lazy.drop(while: { calls1 += 1; return $0 != value })
+  let expected = data.suffix(from: pivot)
+  expectEqual(0, calls1)
+  check${checkKind}(expected, dropped)
+
+  var calls2 = 0
+  _ = dropped.map { _ in calls2 += 1 }
+  expectEqual(0, calls2, "unexpected eagerness in \(type(of: dropped))")
+
+  % if Kind == 'Bidirectional':
+  check${checkKind}(expected.reversed(), dropped.reversed())
+  % end
+}
+% end
+
+tests.test("LazyDropWhileSequence/AssociatedTypes") {
+  typealias Base = MinimalSequence<OpaqueValue<Int>>
+  typealias Subject = LazyDropWhileSequence<Base>
+  expectSequenceAssociatedTypes(
+    sequenceType: Subject.self,
+    iteratorType: LazyDropWhileIterator<Base.Iterator>.self,
+    subSequenceType: AnySequence<OpaqueValue<Int>>.self)
+}
+
+tests.test("LazyDropWhileCollection/AssociatedTypes") {
+  typealias Base = MinimalCollection<OpaqueValue<Int>>
+  typealias Subject = LazyDropWhileCollection<Base>
+  expectCollectionAssociatedTypes(
+    collectionType: Subject.self,
+    iteratorType: LazyDropWhileIterator<Base.Iterator>.self,
+    subSequenceType: Slice<Subject>.self,
+    indexType: LazyDropWhileIndex<Base>.self,
+    indexDistanceType: Base.IndexDistance.self,
+    indicesType: DefaultIndices<Subject>.self)
+}
+
+tests.test("LazyDropWhileBidirectionalCollection/AssociatedTypes") {
+  typealias Base = MinimalBidirectionalCollection<OpaqueValue<Int>>
+  typealias Subject = LazyDropWhileBidirectionalCollection<Base>
+  expectBidirectionalCollectionAssociatedTypes(
+    collectionType: Subject.self,
+    iteratorType: LazyDropWhileIterator<Base.Iterator>.self,
+    // FIXME(ABI): SubSequence should be `LazyFilterBidirectionalCollection<Base.Slice>`.
+    subSequenceType: BidirectionalSlice<Subject>.self,
+    indexType: LazyDropWhileIndex<Base>.self,
+    indexDistanceType: Base.IndexDistance.self,
+    indicesType: DefaultBidirectionalIndices<Subject>.self)
+}
+
+runAllTests()
diff --git a/validation-test/stdlib/MicroStdlib/MicroStdlib.swift b/validation-test/stdlib/MicroStdlib/MicroStdlib.swift
index 1d191b2..06d2955 100644
--- a/validation-test/stdlib/MicroStdlib/MicroStdlib.swift
+++ b/validation-test/stdlib/MicroStdlib/MicroStdlib.swift
@@ -6,7 +6,7 @@
 // RUN: ls %t/Swift.o
 // RUN: %target-clang -x c -c %S/Inputs/RuntimeStubs.c -o %t/RuntimeStubs.o
 // RUN: %target-build-swift -I %t -module-name main -o %t/hello %S/Inputs/main.swift %t/Swift.o %t/RuntimeStubs.o
-// RUN: %target-run %t/hello | FileCheck %s
+// RUN: %target-run %t/hello | %FileCheck %s
 // REQUIRES: executable_test
 // CHECK: Hello
 
diff --git a/validation-test/stdlib/NSNumberBridging.swift.gyb b/validation-test/stdlib/NSNumberBridging.swift.gyb
index bea3051..1b9f07d 100644
--- a/validation-test/stdlib/NSNumberBridging.swift.gyb
+++ b/validation-test/stdlib/NSNumberBridging.swift.gyb
@@ -128,7 +128,7 @@
 NSNumberTests.test("_SwiftTypePreservingNSNumber.copy(zone:)") {
   let n: NSNumber = (42 as Int)._bridgeToObjectiveC()
   expectTrue(isTypePreservingNSNumber(n))
-  let copy = n.copy() as! AnyObject
+  let copy = n.copy() as AnyObject
   expectTrue(n === copy)
 }
 
@@ -151,7 +151,7 @@
   func toNSNumberByteArray() -> [UInt8] {
     var v = self.bitPattern
     var result: [UInt8] = []
-    for _ in 0 ..< MemoryLayout._ofInstance(v).size {
+    for _ in 0 ..< MemoryLayout.size(ofValue: v) {
       result.append(UInt8(v & 0xff))
       v = v >> 8
     }
@@ -197,7 +197,11 @@
   .forEach(in: ${Self}._interestingValues) {
   input in
   let bridgedNSNumber = input._bridgeToObjectiveC()
+%   if Self == 'Bool':
+  expectTrue(CFGetTypeID(bridgedNSNumber) == CFBooleanGetTypeID())
+%   else:
   expectTrue(isTypePreservingNSNumber(bridgedNSNumber))
+%   end
 
   let expectedObjCType: String
 %   if Self == 'Int':
@@ -229,7 +233,9 @@
   _UnknownArchError()
 #endif
 %   elif Self == 'Bool':
-  expectedObjCType = "B"
+  // NSNumber always encodes booleans as 'signed char', even on platforms where
+  // ObjCBool is a true Bool. This is a very old compatibility concern.
+  expectedObjCType = "c"
 %   else:
   _UnknownTypeError()
 %   end
@@ -247,13 +253,20 @@
   input in
   // Bridged NSNumbers preserve the Swift type when put into AnyHashable.
   let bridgedNSNumber = input._bridgeToObjectiveC()
+%   if Self == 'Bool':
+  expectTrue(CFGetTypeID(bridgedNSNumber) == CFBooleanGetTypeID())
+%   else:
   expectTrue(isTypePreservingNSNumber(bridgedNSNumber))
+%   end
   expectNotEmpty(bridgedNSNumber._toCustomAnyHashable())
 
   // Explicitly constructed NSNumbers don't have a special AnyHashable
   // representation.
 %   if Self == 'CGFloat':
   let explicitNSNumber = NSNumber(value: input.native)
+%   elif Self == 'Bool':
+  // Bool actually /is/ type-preserving for NSNumber. Use a dummy value instead.
+  let explicitNSNumber = NSNumber(value: (input ? 1 : 0) as Int8)
 %   else:
   let explicitNSNumber = NSNumber(value: input)
 %   end
diff --git a/validation-test/stdlib/NewArray.swift.gyb b/validation-test/stdlib/NewArray.swift.gyb
index 80e33c2..4125f15 100644
--- a/validation-test/stdlib/NewArray.swift.gyb
+++ b/validation-test/stdlib/NewArray.swift.gyb
@@ -10,10 +10,10 @@
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 //
 //===----------------------------------------------------------------------===//
-// RUN-DISABLED: %target-run-simple-swift | FileCheck %s
+// RUN-DISABLED: %target-run-simple-swift | %FileCheck %s
 // RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/NewArray.swift
 // RUN: %line-directive %t/NewArray.swift -- %target-build-swift %t/NewArray.swift -o %t/a.out -Xfrontend -disable-access-control
-// RUN: %target-run %t/a.out 2>&1 | %line-directive %t/NewArray.swift -- FileCheck %t/NewArray.swift --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
+// RUN: %target-run %t/a.out 2>&1 | %line-directive %t/NewArray.swift -- %FileCheck %t/NewArray.swift --check-prefix=CHECK --check-prefix=CHECK-%target-runtime
 // REQUIRES: executable_test
 
 import StdlibUnittest
diff --git a/validation-test/stdlib/OpenCLSDKOverlay.swift b/validation-test/stdlib/OpenCLSDKOverlay.swift
index d386314..58959c5 100644
--- a/validation-test/stdlib/OpenCLSDKOverlay.swift
+++ b/validation-test/stdlib/OpenCLSDKOverlay.swift
@@ -194,7 +194,7 @@
           kernel!, 3,
           0, MemoryLayout<cl_mem>.size, inputPtr,
           1, MemoryLayout<cl_mem>.size, outputPtr,
-          2, MemoryLayout._ofInstance(count).size, countPtr)
+          2, MemoryLayout.size(ofValue: count), countPtr)
       }
     }
   }
@@ -208,7 +208,7 @@
 
   // Get the maximum work group size for executing the kernel on the device
   //
-  err = clGetKernelWorkGroupInfo(kernel, device_id, cl_kernel_work_group_info(CL_KERNEL_WORK_GROUP_SIZE), MemoryLayout._ofInstance(local).size, &local, nil)
+  err = clGetKernelWorkGroupInfo(kernel, device_id, cl_kernel_work_group_info(CL_KERNEL_WORK_GROUP_SIZE), MemoryLayout.size(ofValue: local), &local, nil)
   if (err != CL_SUCCESS)
   {
     print("Error: Failed to retrieve kernel work group info! \(err)")
diff --git a/validation-test/stdlib/SceneKit.swift b/validation-test/stdlib/SceneKit.swift
index 2de7f60..f85f243 100644
--- a/validation-test/stdlib/SceneKit.swift
+++ b/validation-test/stdlib/SceneKit.swift
@@ -346,7 +346,7 @@
     let sceneData = sceneDescription.data(
       using: .utf8,
       allowLossyConversion: true)!
-    let sceneSource = SCNSceneSource(data: sceneData as Data, options: [:])!
+    let sceneSource = SCNSceneSource(data: sceneData as Data, options: nil)!
 
     do {
       var unarchivedPlaneGeometry =
diff --git a/validation-test/stdlib/SequenceType.swift.gyb b/validation-test/stdlib/SequenceType.swift.gyb
index 7e6f664..c28aa0c 100644
--- a/validation-test/stdlib/SequenceType.swift.gyb
+++ b/validation-test/stdlib/SequenceType.swift.gyb
@@ -972,6 +972,16 @@
 }
 
 //===----------------------------------------------------------------------===//
+// drop(while:)
+//===----------------------------------------------------------------------===//
+
+SequenceTypeTests.test("drop(while:)/dispatch") {
+  var tester = SequenceLog.dispatchTester([OpaqueValue(1)])
+  tester.drop { _ in return false }
+  expectCustomizable(tester, tester.log.dropWhile)
+}
+
+//===----------------------------------------------------------------------===//
 // prefix()
 //===----------------------------------------------------------------------===//
 
@@ -982,6 +992,16 @@
 }
 
 //===----------------------------------------------------------------------===//
+// prefix(while:)
+//===----------------------------------------------------------------------===//
+
+SequenceTypeTests.test("prefix(while:)/dispatch") {
+  var tester = SequenceLog.dispatchTester([OpaqueValue(1)])
+  tester.prefix { _ in return false }
+  expectCustomizable(tester, tester.log.prefixWhile)
+}
+
+//===----------------------------------------------------------------------===//
 // suffix()
 //===----------------------------------------------------------------------===//
 
diff --git a/validation-test/stdlib/Set.swift b/validation-test/stdlib/Set.swift
index 87cc89c..56f30b9 100644
--- a/validation-test/stdlib/Set.swift
+++ b/validation-test/stdlib/Set.swift
@@ -325,9 +325,9 @@
 SetTestSuite.test("sizeof") {
   var s = Set(["Hello", "world"])
 #if arch(i386) || arch(arm)
-  expectEqual(4, MemoryLayout._ofInstance(s).size)
+  expectEqual(4, MemoryLayout.size(ofValue: s))
 #else
-  expectEqual(8, MemoryLayout._ofInstance(s).size)
+  expectEqual(8, MemoryLayout.size(ofValue: s))
 #endif
 }
 
diff --git a/validation-test/stdlib/SetAlgebra.swift b/validation-test/stdlib/SetAlgebra.swift
new file mode 100644
index 0000000..9361530
--- /dev/null
+++ b/validation-test/stdlib/SetAlgebra.swift
@@ -0,0 +1,161 @@
+// RUN: %target-run-simple-swift
+// REQUIRES: executable_test
+
+import StdlibUnittest
+import StdlibCollectionUnittest
+
+extension MinimalEquatableValue : Hashable {
+  public var hashValue: Int {
+    return value
+  }
+}
+
+public struct DefaultedSetAlgebra<Element : Hashable> : SetAlgebra {
+  var store = Set<Element>()
+  public init() {}
+
+  public init(_ elements: [Element]) {
+    store = Set(elements)
+  }
+
+  public init(_store: Set<Element>) {
+    store = _store
+  }
+
+  public func contains(_ member: Element) -> Bool {
+    return store.contains(member)
+  }
+
+  public func union(_ other: DefaultedSetAlgebra) -> DefaultedSetAlgebra {
+    return DefaultedSetAlgebra(_store: store.union(other.store))
+  }
+
+  public func intersection(_ other: DefaultedSetAlgebra)
+    -> DefaultedSetAlgebra {
+    var defaultedSetAlgebra = DefaultedSetAlgebra()
+    defaultedSetAlgebra.store = store.intersection(other.store)
+    return defaultedSetAlgebra
+  }
+
+  public func symmetricDifference(_ other: DefaultedSetAlgebra)
+    -> DefaultedSetAlgebra {
+    var defaultedSetAlgebra = DefaultedSetAlgebra()
+    defaultedSetAlgebra.store = store.symmetricDifference(other.store)
+    return defaultedSetAlgebra
+  }
+
+  public mutating func insert(_ newMember: Element)
+    -> (inserted: Bool, memberAfterInsert: Element) {
+    return store.insert(newMember)
+  }
+
+  public mutating func remove(_ member: Element) -> Element? {
+    return store.remove(member)
+  }
+
+  public mutating func update(with newMember: Element) -> Element? {
+    return store.update(with: newMember)
+  }
+
+  public mutating func formUnion(_ other: DefaultedSetAlgebra) {
+    store.formUnion(other.store)
+  }
+
+  public mutating func formSymmetricDifference(_ other: DefaultedSetAlgebra) {
+    store.formSymmetricDifference(other.store)
+  }
+
+  public mutating func formIntersection(_ other: DefaultedSetAlgebra) {
+    store.formIntersection(other.store)
+  }
+}
+
+public func ==<Element>(lhs: DefaultedSetAlgebra<Element>,
+  rhs: DefaultedSetAlgebra<Element>) -> Bool {
+  return lhs.store == rhs.store
+}
+
+let SetAlgebraTests = TestSuite("SetAlgebra")
+
+SetAlgebraTests.test("contains").forEach(in: findTests) { test in
+  typealias P = DefaultedSetAlgebra<MinimalEquatableValue>
+  expectEqual(test.expected != nil,
+    P(test.sequence).contains(test.element))
+}
+
+SetAlgebraTests.test("union").forEach(in: unionTests) { test in
+  expectEqual(DefaultedSetAlgebra(test.expected),
+    DefaultedSetAlgebra(test.lhs).union(DefaultedSetAlgebra(test.rhs)))
+}
+
+SetAlgebraTests.test("intersection").forEach(in: intersectionTests) { test in
+  expectEqual(DefaultedSetAlgebra(test.expected),
+    DefaultedSetAlgebra(test.lhs).intersection(DefaultedSetAlgebra(test.rhs)))
+}
+
+SetAlgebraTests.test("symmetricDifference")
+  .forEach(in: symmetricDifferenceTests) { test in
+  let sequence =  DefaultedSetAlgebra(test.rhs)
+  expectEqual(DefaultedSetAlgebra(test.expected),
+    DefaultedSetAlgebra(test.lhs).symmetricDifference(sequence))
+}
+
+SetAlgebraTests.test("insert").forEach(in: findTests) { test in
+  var sequence = DefaultedSetAlgebra(test.sequence)
+  expectEqual((test.expected == nil, test.element),
+    sequence.insert(test.element))
+}
+
+SetAlgebraTests.test("subtracting").forEach(in: subtractingTests) { test in
+  expectEqual(DefaultedSetAlgebra(test.expected),
+    DefaultedSetAlgebra(test.lhs).subtracting(DefaultedSetAlgebra(test.rhs)))
+}
+
+SetAlgebraTests.test("isSubset").forEach(in: findTests) { test in
+  let sequence = DefaultedSetAlgebra(test.sequence)
+  expectEqual(test.expected != nil,
+    DefaultedSetAlgebra([test.element]).isSubset(of: sequence))
+}
+
+SetAlgebraTests.test("isDisjoint").forEach(in: findTests) { test in
+  let sequence = DefaultedSetAlgebra(test.sequence)
+  expectEqual(test.expected == nil,
+    sequence.isDisjoint(with: DefaultedSetAlgebra([test.element])))
+}
+
+SetAlgebraTests.test("isSuperset").forEach(in: findTests) { test in
+  let sequence = DefaultedSetAlgebra(test.sequence)
+  expectEqual(test.expected != nil,
+    sequence.isSuperset(of: DefaultedSetAlgebra([test.element])))
+}
+
+SetAlgebraTests.test("isStrictSuperset")
+  .forEach(in: strictSupersetTests) { test in
+  let sequence = DefaultedSetAlgebra(test.rhs)
+  expectEqual(test.expected,
+    DefaultedSetAlgebra(test.lhs).isStrictSuperset(of: sequence))
+}
+
+SetAlgebraTests.test("isStrictSubset").forEach(in: strictSupersetTests) {
+  test in
+  let sequence = DefaultedSetAlgebra(test.lhs)
+  expectEqual(test.expected,
+    DefaultedSetAlgebra(test.rhs).isStrictSubset(of: sequence))
+}
+
+SetAlgebraTests.test("isEmpty") {
+  let sequence = [MinimalEquatableValue(1, identity: 1),
+    MinimalEquatableValue(2, identity: 2)]
+
+  expectTrue(DefaultedSetAlgebra<MinimalEquatableValue>().isEmpty)
+  expectFalse(DefaultedSetAlgebra(sequence).isEmpty)
+}
+
+SetAlgebraTests.test("subtract").forEach(in: subtractTests) { test in
+  var sequence = DefaultedSetAlgebra(test.lhs)
+  sequence.subtract(DefaultedSetAlgebra(test.rhs))
+  expectEqual(sequence, DefaultedSetAlgebra(test.expected))
+}
+
+runAllTests()
+
diff --git a/validation-test/stdlib/SwiftNativeNSBase.swift b/validation-test/stdlib/SwiftNativeNSBase.swift
new file mode 100644
index 0000000..26c3551
--- /dev/null
+++ b/validation-test/stdlib/SwiftNativeNSBase.swift
@@ -0,0 +1,28 @@
+//===--- SwiftNativeNSBase.swift - Test _SwiftNativeNS*Base classes -------===//
+//
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+//===----------------------------------------------------------------------===//
+
+// RUN: rm -rf %t  &&  mkdir -p %t
+// 
+// RUN: %target-clang %S/Inputs/SwiftNativeNSBase/SwiftNativeNSBase.m -c -o %t/SwiftNativeNSBase.o -g
+// RUN: %target-build-swift %s -I %S/Inputs/SwiftNativeNSBase/ -Xlinker %t/SwiftNativeNSBase.o -o %t/SwiftNativeNSBase
+// RUN: %target-run %t/SwiftNativeNSBase
+// REQUIRES: executable_test
+
+// REQUIRES: objc_interop
+
+import Foundation
+
+@_silgen_name("TestSwiftNativeNSBase") 
+func TestSwiftNativeNSBase()
+
+TestSwiftNativeNSBase()
+// does not return
diff --git a/validation-test/stdlib/UnicodeTrieGenerator.gyb b/validation-test/stdlib/UnicodeTrieGenerator.gyb
index 11e9f5b..4c76637 100644
--- a/validation-test/stdlib/UnicodeTrieGenerator.gyb
+++ b/validation-test/stdlib/UnicodeTrieGenerator.gyb
@@ -1,6 +1,6 @@
 %{
 
-# RUN: rm -rf %t && mkdir -p %t && %gyb %s | FileCheck %s
+# RUN: rm -rf %t && mkdir -p %t && %gyb %s | %FileCheck %s
 
 from __future__ import print_function