Home | History | Annotate | Download | only in ObjCARC
      1 ; RUN: opt -objc-arc -S < %s | FileCheck %s
      2 
      3 declare i8* @objc_initWeak(i8**, i8*)
      4 declare i8* @objc_storeWeak(i8**, i8*)
      5 declare i8* @objc_loadWeak(i8**)
      6 declare void @objc_destroyWeak(i8**)
      7 declare i8* @objc_loadWeakRetained(i8**)
      8 declare void @objc_moveWeak(i8**, i8**)
      9 declare void @objc_copyWeak(i8**, i8**)
     10 
     11 ; If the pointer-to-weak-pointer is null, it's undefined behavior.
     12 
     13 ; CHECK: 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
     32 ; CHECK: ret void
     33 define void @test0(i8* %p, i8** %q) {
     34 entry:
     35   call i8* @objc_storeWeak(i8** null, i8* %p)
     36   call i8* @objc_storeWeak(i8** undef, i8* %p)
     37   call i8* @objc_loadWeakRetained(i8** null)
     38   call i8* @objc_loadWeakRetained(i8** undef)
     39   call i8* @objc_loadWeak(i8** null)
     40   call i8* @objc_loadWeak(i8** undef)
     41   call i8* @objc_initWeak(i8** null, i8* %p)
     42   call i8* @objc_initWeak(i8** undef, i8* %p)
     43   call void @objc_destroyWeak(i8** null)
     44   call void @objc_destroyWeak(i8** undef)
     45 
     46   call void @objc_copyWeak(i8** null, i8** %q)
     47   call void @objc_copyWeak(i8** undef, i8** %q)
     48   call void @objc_copyWeak(i8** %q, i8** null)
     49   call void @objc_copyWeak(i8** %q, i8** undef)
     50 
     51   call void @objc_moveWeak(i8** null, i8** %q)
     52   call void @objc_moveWeak(i8** undef, i8** %q)
     53   call void @objc_moveWeak(i8** %q, i8** null)
     54   call void @objc_moveWeak(i8** %q, i8** undef)
     55 
     56   ret void
     57 }
     58