; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=objc-arc -S < %s | FileCheck %s
declare ptr @llvm.objc.initWeak(ptr, ptr)
declare ptr @llvm.objc.storeWeak(ptr, ptr)
declare ptr @llvm.objc.loadWeak(ptr)
declare void @llvm.objc.destroyWeak(ptr)
declare ptr @llvm.objc.loadWeakRetained(ptr)
declare void @llvm.objc.moveWeak(ptr, ptr)
declare void @llvm.objc.copyWeak(ptr, ptr)
; If the pointer-to-weak-pointer is null, it's undefined behavior.
define void @test0(ptr %p, ptr %q) {
; CHECK-LABEL: @test0(
; CHECK-NEXT: entry:
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: store i1 true, ptr poison, align 1
; CHECK-NEXT: ret void
;
entry:
call ptr @llvm.objc.storeWeak(ptr null, ptr %p)
call ptr @llvm.objc.storeWeak(ptr undef, ptr %p)
call ptr @llvm.objc.loadWeakRetained(ptr null)
call ptr @llvm.objc.loadWeakRetained(ptr undef)
call ptr @llvm.objc.loadWeak(ptr null)
call ptr @llvm.objc.loadWeak(ptr undef)
call ptr @llvm.objc.initWeak(ptr null, ptr %p)
call ptr @llvm.objc.initWeak(ptr undef, ptr %p)
call void @llvm.objc.destroyWeak(ptr null)
call void @llvm.objc.destroyWeak(ptr undef)
call void @llvm.objc.copyWeak(ptr null, ptr %q)
call void @llvm.objc.copyWeak(ptr undef, ptr %q)
call void @llvm.objc.copyWeak(ptr %q, ptr null)
call void @llvm.objc.copyWeak(ptr %q, ptr undef)
call void @llvm.objc.moveWeak(ptr null, ptr %q)
call void @llvm.objc.moveWeak(ptr undef, ptr %q)
call void @llvm.objc.moveWeak(ptr %q, ptr null)
call void @llvm.objc.moveWeak(ptr %q, ptr undef)
ret void
}