Files
swift-mirror/test/Driver/opt-record-bitstream.swift
Francis Visoiu Mistrih e724ebab6b [Remarks] Add a specialized RemarkStreamer for SIL remarks
This allows the usage of the whole remark infrastructure developed in
LLVM, which includes a new binary format, metadata in object files, etc.

This gets rid of the YAMLTraits-based remark serialization and does the
plumbing for hooking to LLVM's main remark streamer.

For more about the idea behind LLVM's main remark streamer, see the
docs/Remarks.rst changes in https://reviews.llvm.org/D73676.

The flags are now:

* -save-optimization-record: enable remarks, defaults to YAML
* -save-optimization-record=<format>: enable remarks, use <format> for
serialization
* -save-optimization-record-passes <regex>: only serialize passes that
match <regex>.

The YAMLTraits in swift had a different `flow` setting for the debug
location, resulting in some test changes.
2020-03-02 18:33:20 -08:00

32 lines
1.3 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swiftc_driver -O -wmo -save-optimization-record=bitstream %s -module-name optrecordmod -o %t/opt-record 2>&1 | %FileCheck -allow-empty %s
// RUN: llvm-bcanalyzer -dump %t/optrecordmod.opt.bitstream | %FileCheck -check-prefix=BITSTREAM %s
// REQUIRES: OS=macosx || OS=ios || OS=tvos || OS=watchos
// CHECK-NOT: remark
var a: Int = 1
#sourceLocation(file: "custom.swift", line: 2000)
func foo() {
a = 2
}
#sourceLocation() // reset
public func bar() {
foo()
// BITSTREAM: <Remark NumWords=13 BlockCodeSize=4>
// BITSTREAM-NEXT: <Remark header abbrevid=4 op0=1 op1=0 op2=1 op3=2/>
// BITSTREAM-NEXT: <Remark debug location abbrevid=5 op0=3 op1=[[@LINE-3]] op2=3/>
// BITSTREAM-NEXT: <Argument with debug location abbrevid=7 op0=4 op1=5 op2=6 op3=2000 op4=6/>
// BITSTREAM-NEXT: <Argument abbrevid=8 op0=7 op1=8/>
// BITSTREAM-NEXT: <Argument with debug location abbrevid=7 op0=9 op1=10 op2=3 op3=[[@LINE-7]] op4=13/>
// BITSTREAM-NEXT: <Argument abbrevid=8 op0=7 op1=11/>
// BITSTREAM-NEXT: <Argument abbrevid=8 op0=12 op1=13/>
// BITSTREAM-NEXT: <Argument abbrevid=8 op0=7 op1=14/>
// BITSTREAM-NEXT: <Argument abbrevid=8 op0=15 op1=16/>
// BITSTREAM-NEXT: <Argument abbrevid=8 op0=7 op1=17/>
// BITSTREAM-NEXT: </Remark>
}