|
66 | 66 | return %13 : $()
|
67 | 67 | }
|
68 | 68 |
|
| 69 | +// CHECK-LABEL: @testConstantFoldingOfStructExtractMetatypeArg : |
| 70 | +// CHECK-DAG: [[STRINGUSE:%[0-9]+]] = function_ref @useFormatString |
| 71 | +// CHECK-DAG: {{%.*}} = apply [[STRINGUSE]]([[BORROW:%[0-9]+]]) |
| 72 | +// CHECK-DAG: [[BORROW]] = begin_borrow [[STRINGCONST:%[0-9]+]] |
| 73 | +// CHECK-DAG: [[STRINGCONST]] = apply [[STRINGINIT:%[0-9]+]]([[LIT:%[0-9]+]], {{%.*}}, {{%.*}}, {{%.*}}) |
| 74 | +// CHECK-DAG: [[STRINGINIT]] = function_ref @$sSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC |
| 75 | +// CHECK-DAG: [[LIT]] = string_literal oslog "test message: %lld" |
| 76 | +// CHECK-DAG: destroy_value [[STRINGCONST]] : $String |
| 77 | +sil [ossa] @testConstantFoldingOfStructExtractMetatypeArg : $@convention(thin) (@thin String.Type) -> () { |
| 78 | +bb0(%0 : $@thin String.Type): |
| 79 | + %1 = string_literal utf8 "test message: %lld" |
| 80 | + %2 = integer_literal $Builtin.Word, 18 |
| 81 | + %3 = integer_literal $Builtin.Int1, -1 |
| 82 | + %4 = function_ref @$sSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String |
| 83 | + %5 = apply %4(%1, %2, %3, %0) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String |
| 84 | + %6 = function_ref @oslogMessageInit : $@convention(thin) (@owned String) -> @owned OSLogMessageStub |
| 85 | + %7 = apply %6(%5) : $@convention(thin) (@owned String) -> @owned OSLogMessageStub |
| 86 | + %8 = begin_borrow %7 |
| 87 | + %9 = struct_extract %8, #OSLogMessageStub.interpolation |
| 88 | + %10 = struct_extract %9, #OSLogInterpolationStub.formatString |
| 89 | + %11 = function_ref @useFormatString : $@convention(thin) (@guaranteed String) -> () |
| 90 | + %12 = apply %11(%10) : $@convention(thin) (@guaranteed String) -> () |
| 91 | + end_borrow %8 |
| 92 | + destroy_value %7 |
| 93 | + %15 = tuple () |
| 94 | + return %15 |
| 95 | +} |
| 96 | + |
69 | 97 | /// A function that models the use of a string in some arbitrary way.
|
70 | 98 | sil @useFormatStringIndirect: $@convention(thin) (@in_guaranteed String) -> ()
|
71 | 99 |
|
|
0 commit comments