1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=objc-arc -S < %s | FileCheck %s
4 declare ptr @llvm.objc.initWeak(ptr, ptr)
5 declare ptr @llvm.objc.storeWeak(ptr, ptr)
6 declare ptr @llvm.objc.loadWeak(ptr)
7 declare void @llvm.objc.destroyWeak(ptr)
8 declare ptr @llvm.objc.loadWeakRetained(ptr)
9 declare void @llvm.objc.moveWeak(ptr, ptr)
10 declare void @llvm.objc.copyWeak(ptr, ptr)
12 ; If the pointer-to-weak-pointer is null, it's undefined behavior.
14 define void @test0(ptr %p, ptr %q) {
15 ; CHECK-LABEL: @test0(
17 ; CHECK-NEXT: store i1 true, ptr poison, align 1
18 ; CHECK-NEXT: store i1 true, ptr poison, align 1
19 ; CHECK-NEXT: store i1 true, ptr poison, align 1
20 ; CHECK-NEXT: store i1 true, ptr poison, align 1
21 ; CHECK-NEXT: store i1 true, ptr poison, align 1
22 ; CHECK-NEXT: store i1 true, ptr poison, align 1
23 ; CHECK-NEXT: store i1 true, ptr poison, align 1
24 ; CHECK-NEXT: store i1 true, ptr poison, align 1
25 ; CHECK-NEXT: store i1 true, ptr poison, align 1
26 ; CHECK-NEXT: store i1 true, ptr poison, align 1
27 ; CHECK-NEXT: store i1 true, ptr poison, align 1
28 ; CHECK-NEXT: store i1 true, ptr poison, align 1
29 ; CHECK-NEXT: store i1 true, ptr poison, align 1
30 ; CHECK-NEXT: store i1 true, ptr poison, align 1
31 ; CHECK-NEXT: store i1 true, ptr poison, align 1
32 ; CHECK-NEXT: store i1 true, ptr poison, align 1
33 ; CHECK-NEXT: store i1 true, ptr poison, align 1
34 ; CHECK-NEXT: store i1 true, ptr poison, align 1
35 ; CHECK-NEXT: ret void
38 call ptr @llvm.objc.storeWeak(ptr null, ptr %p)
39 call ptr @llvm.objc.storeWeak(ptr undef, ptr %p)
40 call ptr @llvm.objc.loadWeakRetained(ptr null)
41 call ptr @llvm.objc.loadWeakRetained(ptr undef)
42 call ptr @llvm.objc.loadWeak(ptr null)
43 call ptr @llvm.objc.loadWeak(ptr undef)
44 call ptr @llvm.objc.initWeak(ptr null, ptr %p)
45 call ptr @llvm.objc.initWeak(ptr undef, ptr %p)
46 call void @llvm.objc.destroyWeak(ptr null)
47 call void @llvm.objc.destroyWeak(ptr undef)
49 call void @llvm.objc.copyWeak(ptr null, ptr %q)
50 call void @llvm.objc.copyWeak(ptr undef, ptr %q)
51 call void @llvm.objc.copyWeak(ptr %q, ptr null)
52 call void @llvm.objc.copyWeak(ptr %q, ptr undef)
54 call void @llvm.objc.moveWeak(ptr null, ptr %q)
55 call void @llvm.objc.moveWeak(ptr undef, ptr %q)
56 call void @llvm.objc.moveWeak(ptr %q, ptr null)
57 call void @llvm.objc.moveWeak(ptr %q, ptr undef)