|
1 |
| -// RUN: %target-sil-opt -enable-sil-verify-all %s -onone-simplification -simplify-instruction=builtin | %FileCheck %s --check-prefix=CHECK --check-prefix=EARLY |
2 |
| -// RUN: %target-sil-opt -enable-sil-verify-all %s -late-onone-simplification -simplify-instruction=builtin | %FileCheck %s --check-prefix=CHECK --check-prefix=LATE |
| 1 | +// RUN: %target-sil-opt -enable-sil-verify-all %s -onone-simplification -simplify-instruction=builtin | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-EARLY |
| 2 | +// RUN: %target-sil-opt -enable-sil-verify-all %s -late-onone-simplification -simplify-instruction=builtin | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-LATE |
| 3 | +// RUN: %target-sil-opt -enable-sil-verify-all %s -assert-conf-id=1 -onone-simplification -simplify-instruction=builtin | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOASSERTS |
| 4 | +// RUN: %target-sil-opt -enable-sil-verify-all %s -assert-conf-id=2 -onone-simplification -simplify-instruction=builtin | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOASSERTS |
3 | 5 |
|
4 | 6 | // REQUIRES: swift_in_compiler
|
5 | 7 |
|
@@ -55,7 +57,7 @@ bb0(%0 : $@thin Int.Type):
|
55 | 57 | // CHECK-LABEL: sil @isConcrete_false
|
56 | 58 | // CHECK: bb0(%0 : $@thin T.Type):
|
57 | 59 | // CHECK-EARLY: [[R:%.*]] = builtin "isConcrete"<T>(%0 : $@thin T.Type) : $Builtin.Int1
|
58 |
| -// CHECK-LATE: [[R:%.*]] = integer_literal $Builtin.Int1, -1 |
| 60 | +// CHECK-LATE: [[R:%.*]] = integer_literal $Builtin.Int1, 0 |
59 | 61 | // CHECK: return [[R]]
|
60 | 62 | // CHECK: } // end sil function 'isConcrete_false'
|
61 | 63 | sil @isConcrete_false : $@convention(thin) <T> (@thin T.Type) -> Builtin.Int1 {
|
@@ -322,3 +324,60 @@ bb0(%0 : $Builtin.RawPointer):
|
322 | 324 | return %3 : $()
|
323 | 325 | }
|
324 | 326 |
|
| 327 | +// CHECK-LABEL: sil @generic_canBeClass |
| 328 | +// CHECK: [[TYPE:%.*]] = metatype $@thick T.Type |
| 329 | +// CHECK: [[B:%.*]] = builtin "canBeClass"<T>([[TYPE]] : $@thick T.Type) |
| 330 | +// CHECK: [[R:%.*]] = struct $Int8 ([[B]] : $Builtin.Int8) |
| 331 | +// CHECK: return [[R]] |
| 332 | +// CHECK: } // end sil function 'generic_canBeClass' |
| 333 | +sil @generic_canBeClass : $@convention(thin) <T> (@in T) -> Int8 { |
| 334 | +bb0(%0 : $*T): |
| 335 | + %1 = metatype $@thick T.Type |
| 336 | + %3 = builtin "canBeClass"<T>(%1 : $@thick T.Type) : $Builtin.Int8 |
| 337 | + %4 = struct $Int8 (%3 : $Builtin.Int8) |
| 338 | + destroy_addr %0 : $*T |
| 339 | + return %4 : $Int8 |
| 340 | +} |
| 341 | + |
| 342 | +// CHECK-LABEL: sil @int_canBeClass |
| 343 | +// CHECK-NOT: builtin "canBeClass" |
| 344 | +// CHECK: [[L:%.*]] = integer_literal $Builtin.Int8, 0 |
| 345 | +// CHECK: [[R:%.*]] = struct $Int8 ([[L]] : $Builtin.Int8) |
| 346 | +// CHECK: return [[R]] |
| 347 | +// CHECK: } // end sil function 'int_canBeClass' |
| 348 | +sil @int_canBeClass : $@convention(thin) () -> Int8 { |
| 349 | +bb0: |
| 350 | + %1 = metatype $@thick Int.Type |
| 351 | + %3 = builtin "canBeClass"<Int>(%1 : $@thick Int.Type) : $Builtin.Int8 |
| 352 | + %4 = struct $Int8 (%3 : $Builtin.Int8) |
| 353 | + return %4 : $Int8 |
| 354 | +} |
| 355 | + |
| 356 | +// CHECK-LABEL: sil @class_canBeClass |
| 357 | +// CHECK-NOT: builtin "canBeClass" |
| 358 | +// CHECK: [[L:%.*]] = integer_literal $Builtin.Int8, 1 |
| 359 | +// CHECK: [[R:%.*]] = struct $Int8 ([[L]] : $Builtin.Int8) |
| 360 | +// CHECK: return [[R]] |
| 361 | +// CHECK: } // end sil function 'class_canBeClass' |
| 362 | +sil @class_canBeClass : $@convention(thin) () -> Int8 { |
| 363 | +bb0: |
| 364 | + %1 = metatype $@thick C1<Int>.Type |
| 365 | + %3 = builtin "canBeClass"<C1<Int>>(%1 : $@thick C1<Int>.Type) : $Builtin.Int8 |
| 366 | + %4 = struct $Int8 (%3 : $Builtin.Int8) |
| 367 | + return %4 : $Int8 |
| 368 | +} |
| 369 | + |
| 370 | +// CHECK-LABEL: sil @remove_assert_configuration |
| 371 | +// CHECK-NOT: builtin "assert_configuration" |
| 372 | +// CHECK-EARLY: [[L:%.*]] = integer_literal $Builtin.Int8, 1 |
| 373 | +// CHECK-NOASSERTS: [[L:%.*]] = integer_literal $Builtin.Int8, 0 |
| 374 | +// CHECK: [[R:%.*]] = struct $Int8 ([[L]] : $Builtin.Int8) |
| 375 | +// CHECK: return [[R]] |
| 376 | +// CHECK: } // end sil function 'remove_assert_configuration' |
| 377 | +sil @remove_assert_configuration : $@convention(thin) () -> Int8 { |
| 378 | +bb0: |
| 379 | + %3 = builtin "assert_configuration"() : $Builtin.Int8 |
| 380 | + %4 = struct $Int8 (%3 : $Builtin.Int8) |
| 381 | + return %4 : $Int8 |
| 382 | +} |
| 383 | + |
0 commit comments