|
1 | 1 | // RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine -verify-skip-unreachable-must-be-last | FileCheck %s
|
2 | 2 |
|
3 |
| -// XFAIL: linux |
4 |
| - |
5 | 3 | sil_stage canonical
|
6 | 4 |
|
7 | 5 | import Builtin
|
@@ -694,48 +692,6 @@ bb0(%0 : $*X):
|
694 | 692 | return %19 : $()
|
695 | 693 | }
|
696 | 694 |
|
697 |
| -sil @stringcore_invariant_check : $@convention(thin) (@owned _StringCore) -> @owned Optional<_CocoaStringType> |
698 |
| -sil @reabstraction_thunk : $@convention(thin) (@out Optional<_CocoaStringType>, @owned @callee_owned () -> @owned Optional<_CocoaStringType>) -> () |
699 |
| - |
700 |
| -// CHECK-LABEL: sil @dead_closure_elimination : $@convention(thin) (@owned _StringCore) -> () |
701 |
| -// CHECK: bb0 |
702 |
| -// CHECK-NEXT: release_value |
703 |
| -// CHECK-NEXT: tuple |
704 |
| -// CHECK-NEXT: return |
705 |
| -sil @dead_closure_elimination : $@convention(thin) (@owned _StringCore) -> () { |
706 |
| -bb0(%0 : $_StringCore): |
707 |
| - %1 = function_ref @stringcore_invariant_check : $@convention(thin) (@owned _StringCore) -> @owned Optional<_CocoaStringType> |
708 |
| - %2 = partial_apply %1(%0) : $@convention(thin) (@owned _StringCore) -> @owned Optional<_CocoaStringType> |
709 |
| - %3 = function_ref @reabstraction_thunk : $@convention(thin) (@out Optional<_CocoaStringType>, @owned @callee_owned () -> @owned Optional<_CocoaStringType>) -> () |
710 |
| - %4 = partial_apply %3(%2) : $@convention(thin) (@out Optional<_CocoaStringType>, @owned @callee_owned () -> @owned Optional<_CocoaStringType>) -> () |
711 |
| - strong_release %4 : $@callee_owned (@out Optional<_CocoaStringType>) -> () |
712 |
| - %5 = tuple() |
713 |
| - return %5 : $() |
714 |
| -} |
715 |
| - |
716 |
| -// CHECK-LABEL: sil @dead_closure_elimination2 |
717 |
| -// CHECK: bb0 |
718 |
| -// CHECK-NEXT: br bb1 |
719 |
| -// CHECK: bb1 |
720 |
| -// CHECK-NEXT: release_value |
721 |
| -// CHECK-NEXT: tuple |
722 |
| -// CHECK-NEXT: return |
723 |
| -sil @dead_closure_elimination2 : $@convention(thin) (@owned _StringCore) -> () { |
724 |
| -bb0(%0 : $_StringCore): |
725 |
| - %1 = function_ref @stringcore_invariant_check : $@convention(thin) (@owned _StringCore) -> @owned Optional<_CocoaStringType> |
726 |
| - %2 = partial_apply %1(%0) : $@convention(thin) (@owned _StringCore) -> @owned Optional<_CocoaStringType> |
727 |
| - %3 = function_ref @reabstraction_thunk : $@convention(thin) (@out Optional<_CocoaStringType>, @owned @callee_owned () -> @owned Optional<_CocoaStringType>) -> () |
728 |
| - %4 = partial_apply %3(%2) : $@convention(thin) (@out Optional<_CocoaStringType>, @owned @callee_owned () -> @owned Optional<_CocoaStringType>) -> () |
729 |
| - br bb1 |
730 |
| - |
731 |
| -bb1: |
732 |
| - strong_retain %4 : $@callee_owned (@out Optional<_CocoaStringType>) -> () |
733 |
| - strong_release %4 : $@callee_owned (@out Optional<_CocoaStringType>) -> () |
734 |
| - strong_release %4 : $@callee_owned (@out Optional<_CocoaStringType>) -> () |
735 |
| - %5 = tuple() |
736 |
| - return %5 : $() |
737 |
| -} |
738 |
| - |
739 | 695 | sil @unbalanced_closure : $@convention(thin) (@guaranteed B) -> ()
|
740 | 696 |
|
741 | 697 | // CHECK-LABEL: sil @partial_apply_unbalanced_retain_release
|
@@ -1855,32 +1811,6 @@ bb3(%a : $ZZZ):
|
1855 | 1811 | return %a : $ZZZ
|
1856 | 1812 | }
|
1857 | 1813 |
|
1858 |
| - |
1859 |
| -// FIXME: <rdar://problem/20980377> Add dead array elimination to DeadObjectElimination |
1860 |
| -// CHECK-LABEL: test_dead_array |
1861 |
| -// CHECK: bb0(%0 : $ZZZ): |
1862 |
| -// DISABLED-CHECK-NEXT: strong_release %0 |
1863 |
| -// DISABLED-CHECK-NEXT: tuple |
1864 |
| -// DISABLED-CHECK-NEXT: return |
1865 |
| -sil @test_dead_array : $@convention(thin) (@owned ZZZ) -> () { |
1866 |
| -bb0(%0 : $ZZZ): |
1867 |
| - %1 = integer_literal $Builtin.Word, 1 |
1868 |
| - %2 = function_ref @_allocate_uninitialized_ZZZ : $@convention(thin) (Builtin.Word) -> @owned (Array<ZZZ>, Builtin.RawPointer) |
1869 |
| - %3 = apply %2(%1) : $@convention(thin) (Builtin.Word) -> @owned (Array<ZZZ>, Builtin.RawPointer) |
1870 |
| - %4 = tuple_extract %3 : $(Array<ZZZ>, Builtin.RawPointer), 0 |
1871 |
| - %5 = tuple_extract %3 : $(Array<ZZZ>, Builtin.RawPointer), 1 |
1872 |
| - %6 = pointer_to_address %5 : $Builtin.RawPointer to $*ZZZ |
1873 |
| - store %0 to %6 : $*ZZZ |
1874 |
| - %8 = struct_extract %4 : $Array<ZZZ>, #Array._buffer |
1875 |
| - %9 = struct_extract %8 : $_ArrayBuffer<ZZZ>, #_ArrayBuffer._storage |
1876 |
| - %10 = struct_extract %9 : $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCoreType>, #_BridgeStorage.rawValue |
1877 |
| - strong_release %10 : $Builtin.BridgeObject |
1878 |
| - %12 = tuple () |
1879 |
| - return %12 : $() |
1880 |
| -} |
1881 |
| - |
1882 |
| -sil [_semantics "array.uninitialized"] @_allocate_uninitialized_ZZZ : $@convention(thin) (Builtin.Word) -> @owned (Array<ZZZ>, Builtin.RawPointer) |
1883 |
| - |
1884 | 1814 | struct FakeInt16 {
|
1885 | 1815 | var val : Builtin.Int16
|
1886 | 1816 | }
|
@@ -2602,55 +2532,6 @@ bb0(%0 : $Builtin.Int1):
|
2602 | 2532 | return %2 : $Builtin.Int1
|
2603 | 2533 | }
|
2604 | 2534 |
|
2605 |
| -// dead_array test helpers |
2606 |
| -sil [thunk] @dead_array_run_closure : $@convention(thin) (@owned @callee_owned () -> Bool) -> () { |
2607 |
| -bb0(%0 : $@callee_owned () -> Bool): |
2608 |
| - %1 = apply %0() : $@callee_owned () -> Bool |
2609 |
| - %2 = tuple () |
2610 |
| - return %2 : $() |
2611 |
| -} |
2612 |
| - |
2613 |
| -sil @dead_array_closure : $@convention(thin) (@inout _HeapBuffer<C, Int>) -> Bool { |
2614 |
| -bb0(%0 : $*_HeapBuffer<C, Int>): |
2615 |
| - %1 = struct_element_addr %0 : $*_HeapBuffer<C, Int>, #_HeapBuffer._storage // user: %2 |
2616 |
| - %2 = is_unique %1 : $*Optional<Builtin.NativeObject> // user: %3 |
2617 |
| - %3 = struct $Bool (%2 : $Builtin.Int1) // user: %4 |
2618 |
| - return %3 : $Bool // id: %4 |
2619 |
| -} |
2620 |
| - |
2621 |
| -// Mimicks Swift._allocateUninitializedArray |
2622 |
| -sil [_semantics "array.uninitialized"] @dead_array_alloc : $@convention(thin) <τ_0_0> (Builtin.Word) -> @owned (Array<τ_0_0>, Builtin.RawPointer) |
2623 |
| - |
2624 |
| -// <rdar://problem/20980377> HeapBuffer.swift test case spuriously reports a "unique" buffer |
2625 |
| -// CHECK-LABEL: sil @dead_array |
2626 |
| -// CHECK-NOT: release |
2627 |
| -// CHECK: retain_value %{{[0-9]+}} : $Optional<Builtin.NativeObject> |
2628 |
| -// CHECK: apply |
2629 |
| -// CHECK: strong_release %{{[0-9]+}} : $Builtin.BridgeObject |
2630 |
| -sil @dead_array : $@convention(thin) (@inout _HeapBuffer<C, Int>) -> () { |
2631 |
| -bb0(%0 : $*_HeapBuffer<C, Int>): |
2632 |
| - %1 = integer_literal $Builtin.Word, 1 // user: %3 |
2633 |
| - %2 = function_ref @dead_array_alloc : $@convention(thin) <τ_0_0> (Builtin.Word) -> @owned (Array<τ_0_0>, Builtin.RawPointer) |
2634 |
| - %3 = apply %2<_HeapBuffer<C, Int>>(%1) : $@convention(thin) <τ_0_0> (Builtin.Word) -> @owned (Array<τ_0_0>, Builtin.RawPointer) |
2635 |
| - %4 = tuple_extract %3 : $(Array<_HeapBuffer<C, Int>>, Builtin.RawPointer), 0 // user: %15 |
2636 |
| - %5 = tuple_extract %3 : $(Array<_HeapBuffer<C, Int>>, Builtin.RawPointer), 1 // user: %6 |
2637 |
| - %6 = pointer_to_address %5 : $Builtin.RawPointer to $*_HeapBuffer<C, Int> // user: %9 |
2638 |
| - %7 = load %0 : $*_HeapBuffer<C, Int> // users: %8, %9 |
2639 |
| - %8 = struct_extract %7 : $_HeapBuffer<C, Int>, #_HeapBuffer._storage // user: %13 |
2640 |
| - store %7 to %6 : $*_HeapBuffer<C, Int> // id: %9 |
2641 |
| - %10 = function_ref @dead_array_run_closure : $@convention(thin) (@owned @callee_owned () -> Bool) -> () // user: %14 |
2642 |
| - %11 = function_ref @dead_array_closure : $@convention(thin) (@inout _HeapBuffer<C, Int>) -> Bool // user: %12 |
2643 |
| - %12 = partial_apply %11(%0) : $@convention(thin) (@inout _HeapBuffer<C, Int>) -> Bool // user: %14 |
2644 |
| - retain_value %8 : $Optional<Builtin.NativeObject> // id: %13 |
2645 |
| - %14 = apply %10(%12) : $@convention(thin) (@owned @callee_owned () -> Bool) -> () |
2646 |
| - %15 = struct_extract %4 : $Array<_HeapBuffer<C, Int>>, #Array._buffer // user: %16 |
2647 |
| - %16 = struct_extract %15 : $_ArrayBuffer<_HeapBuffer<C, Int>>, #_ArrayBuffer._storage // user: %17 |
2648 |
| - %17 = struct_extract %16 : $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCoreType>, #_BridgeStorage.rawValue // user: %18 |
2649 |
| - strong_release %17 : $Builtin.BridgeObject // id: %18 |
2650 |
| - %19 = tuple () // user: %20 |
2651 |
| - return %19 : $() // id: %20 |
2652 |
| -} |
2653 |
| - |
2654 | 2535 | struct NStruct {
|
2655 | 2536 | var a:Int
|
2656 | 2537 | var b:Int
|
@@ -2792,25 +2673,6 @@ bb0:
|
2792 | 2673 | return %2 : $Builtin.Int1
|
2793 | 2674 | }
|
2794 | 2675 |
|
2795 |
| -// Check that it does not crash the compiler. |
2796 |
| -// Int is ObjC-bridgeable in this case, but its conformance is not know, |
2797 |
| -// because Foundation is not imported yet. |
2798 |
| -// Therefore the cast may succeed from the compiler point of view. |
2799 |
| -// CHECK-LABEL: sil @cast_of_class_to_int |
2800 |
| -// CHECK: unconditional_checked_cast_addr |
2801 |
| -// CHECK: return |
2802 |
| -sil @cast_of_class_to_int : $@convention(thin) (C) -> Int { |
2803 |
| -bb0(%0 : $C): |
2804 |
| - %1 = alloc_stack $Int |
2805 |
| - %2 = alloc_stack $C |
2806 |
| - store %0 to %2#1 : $*C |
2807 |
| - unconditional_checked_cast_addr take_always C in %2#1 : $*C to Int in %1#1 : $*Int |
2808 |
| - %4 = load %1#1 : $*Int |
2809 |
| - dealloc_stack %2#0 : $*@local_storage C |
2810 |
| - dealloc_stack %1#0 : $*@local_storage Int |
2811 |
| - return %4 : $Int |
2812 |
| -} |
2813 |
| - |
2814 | 2676 | class CC1 {
|
2815 | 2677 | deinit
|
2816 | 2678 | init()
|
|
0 commit comments