1 ; RUN: opt -objc-arc -S < %s | FileCheck %s
3 declare i8* @llvm.objc.initWeak(i8**, i8*)
4 declare i8* @llvm.objc.storeWeak(i8**, i8*)
5 declare i8* @llvm.objc.loadWeak(i8**)
6 declare void @llvm.objc.destroyWeak(i8**)
7 declare i8* @llvm.objc.loadWeakRetained(i8**)
8 declare void @llvm.objc.moveWeak(i8**, i8**)
9 declare void @llvm.objc.copyWeak(i8**, i8**)
11 ; If the pointer-to-weak-pointer is null, it's undefined behavior.
13 ; CHECK-LABEL: define void @test0(
14 ; CHECK: store i8* undef, i8** null
15 ; CHECK: store i8* undef, i8** null
16 ; CHECK: store i8* undef, i8** null
17 ; CHECK: store i8* undef, i8** null
18 ; CHECK: store i8* undef, i8** null
19 ; CHECK: store i8* undef, i8** null
20 ; CHECK: store i8* undef, i8** null
21 ; CHECK: store i8* undef, i8** null
22 ; CHECK: store i8* undef, i8** null
23 ; CHECK: store i8* undef, i8** null
24 ; CHECK: store i8* undef, i8** null
25 ; CHECK: store i8* undef, i8** null
26 ; CHECK: store i8* undef, i8** null
27 ; CHECK: store i8* undef, i8** null
28 ; CHECK: store i8* undef, i8** null
29 ; CHECK: store i8* undef, i8** null
30 ; CHECK: store i8* undef, i8** null
31 ; CHECK: store i8* undef, i8** null
33 define void @test0(i8* %p, i8** %q) {
35 call i8* @llvm.objc.storeWeak(i8** null, i8* %p)
36 call i8* @llvm.objc.storeWeak(i8** undef, i8* %p)
37 call i8* @llvm.objc.loadWeakRetained(i8** null)
38 call i8* @llvm.objc.loadWeakRetained(i8** undef)
39 call i8* @llvm.objc.loadWeak(i8** null)
40 call i8* @llvm.objc.loadWeak(i8** undef)
41 call i8* @llvm.objc.initWeak(i8** null, i8* %p)
42 call i8* @llvm.objc.initWeak(i8** undef, i8* %p)
43 call void @llvm.objc.destroyWeak(i8** null)
44 call void @llvm.objc.destroyWeak(i8** undef)
46 call void @llvm.objc.copyWeak(i8** null, i8** %q)
47 call void @llvm.objc.copyWeak(i8** undef, i8** %q)
48 call void @llvm.objc.copyWeak(i8** %q, i8** null)
49 call void @llvm.objc.copyWeak(i8** %q, i8** undef)
51 call void @llvm.objc.moveWeak(i8** null, i8** %q)
52 call void @llvm.objc.moveWeak(i8** undef, i8** %q)
53 call void @llvm.objc.moveWeak(i8** %q, i8** null)
54 call void @llvm.objc.moveWeak(i8** %q, i8** undef)