Using ExternalPassPipeline in Swift 5.1 branch

I am trying to use the "-external-pass-pipeline-filename" option in the swift 5.1 compiler and can not get the input file format correct.

Steps:

  1. Download and build: swift-5.1-branch or swift-5.2-branch

  2. Invoke swift compiler with options
    swiftc -O -wmo -Xfrontend -external-pass-pipeline-filename -Xfrontend ./cpp.yaml main.swift

    Contents of cpp.yaml

[
  [
    "Serialization",
    ["SerializeSILPass"]
  ],
  [ 
    "Rest of Onone",
    ["RawSILInstLowering"]
  ]
]

Error

Assertion failed: ((C.IsAtBeginning || C.IsAtEnd) && "Cannot skip mid parse!"), function skip, file /Users/rajbarik/workspace/swift-5.1-latest/llvm/include/llvm/Support/YAMLParser.h, line 391.
Stack dump:
0.	Program arguments: .../swift -frontend -c main.swift -target x86_64-apple-darwin19.4.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs//MacOSX10.15.sdk -O -external-pass-pipeline-filename ./cpp.yaml -color-diagnostics -module-name main -o /var/folders/kd/dsy9l7093gl_7yr_hvsmj_gr0000gn/T/main-94bb73.o
0  swift                    0x00000001043e00e5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x00000001043df3d5 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x00000001043e06c8 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff6cda55fd _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000004098 _sigtramp + 2468735672
5  libsystem_c.dylib        0x00007fff6cc7b808 abort + 120
6  libsystem_c.dylib        0x00007fff6cc7aac6 err + 0
7  swift                    0x00000001055043f3 void llvm::yaml::skip<llvm::yaml::SequenceNode>(llvm::yaml::SequenceNode&) (.cold.1) + 35
8  swift                    0x00000001043c35d0 std::__1::enable_if<(__is_forward_iterator<char const*>::value) && (__libcpp_string_gets_noexcept_iterator<char const*>::value), std::__1::__wrap_iter<char*> >::type std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert<char const*>(std::__1::__wrap_iter<char const*>, char const*, char const*) + 0
9  swift                    0x00000001043c2cf7 llvm::yaml::SequenceNode::increment() + 71
10 swift                    0x00000001011005c8 swift::SILPassPipelinePlan::getPassPipelineFromFile(swift::SILOptions const&, llvm::StringRef) + 1640
11 swift                    0x00000001010f8722 swift::runSILOptimizationPassesWithFileSpecification(swift::SILModule&, llvm::StringRef) + 82
12 swift                    0x0000000100d9ed31 swift::CompilerInstance::performSILProcessing(swift::SILModule*, swift::UnifiedStatsReporter*) + 433
13 swift                    0x0000000100b8d1e7 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 12215
14 swift                    0x0000000100b8930a swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3002