Files
swift-mirror/test/SILOptimizer/specialize_no_definition.sil
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

44 lines
1.7 KiB
Plaintext

// RUN: %target-sil-opt -enable-sil-verify-all -generic-specializer -save-optimization-record-path=%t.yaml -o /dev/null %/s
// RUN: %FileCheck %s < %t.yaml
import Builtin
import Swift
sil_stage canonical
// CHECK: --- !Missed
// CHECK-NEXT: Pass: sil-generic-specializer
// CHECK-NEXT: Name: sil.NoDef
// CHECK-NEXT: DebugLoc:
// CHECK: File: {{.*}}/specialize_no_definition.sil
// CHECK: Line: 36
// CHECK: Column: 8
// CHECK-NEXT: Function: foo
// CHECK-NEXT: Args:
// CHECK-NEXT: - String: 'Unable to specialize generic function '
// CHECK-NEXT: - Callee: '"bar"'
// CHECK-NEXT: DebugLoc:
// CHECK: File: {{.*}}/specialize_no_definition.sil
// CHECK: Line: 35
// CHECK: Column: 21
// CHECK-NEXT: - String: ' since definition is not visible'
// CHECK-NEXT: ...
// foo()
sil hidden @foo : $@convention(thin) () -> () {
bb0:
%0 = integer_literal $Builtin.Int64, 2 // user: %1
%1 = struct $Int64 (%0 : $Builtin.Int64) // user: %3
%2 = alloc_stack $Int64 // users: %3, %6, %5
store %1 to %2 : $*Int64 // id: %3
// function_ref bar<A>(_:)
%4 = function_ref @bar : $@convention(thin) <τ_0_0> (@in τ_0_0) -> () // user: %5
%5 = apply %4<Int64>(%2) : $@convention(thin) <τ_0_0> (@in τ_0_0) -> ()
dealloc_stack %2 : $*Int64 // id: %6
%7 = tuple () // user: %8
return %7 : $() // id: %8
} // end sil function 'foo'
// bar<A>(_:)
sil hidden_external @bar : $@convention(thin) <τ_0_0> (@in τ_0_0) -> ()