diff options
author | Dan Gohman <gohman@apple.com> | 2012-05-18 22:17:29 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2012-05-18 22:17:29 +0000 |
commit | ce5d8b0d03b9c37727d08de4fa1bcc7be7ea8bb1 (patch) | |
tree | 6683dd50db2384891cd383a96157570ec14955a7 /test/Transforms/ObjCARC/weak-dce.ll | |
parent | c696c8bd35a8ab293879e821142dd9136201f16e (diff) | |
download | llvm-ce5d8b0d03b9c37727d08de4fa1bcc7be7ea8bb1.tar.gz llvm-ce5d8b0d03b9c37727d08de4fa1bcc7be7ea8bb1.tar.bz2 llvm-ce5d8b0d03b9c37727d08de4fa1bcc7be7ea8bb1.tar.xz |
Fix replacing all the users of objc weak runtime routines
when deleting them. rdar://11434915.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157080 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ObjCARC/weak-dce.ll')
-rw-r--r-- | test/Transforms/ObjCARC/weak-dce.ll | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/Transforms/ObjCARC/weak-dce.ll b/test/Transforms/ObjCARC/weak-dce.ll new file mode 100644 index 0000000000..f09467182b --- /dev/null +++ b/test/Transforms/ObjCARC/weak-dce.ll @@ -0,0 +1,46 @@ +; RUN: opt -S -basicaa -objc-arc < %s | FileCheck %s +; rdar://11434915 + +; Delete the weak calls and replace them with just the net retain. + +; CHECK: define void @test0(i8* %p) { +; CHECK-NEXT: call i8* @objc_retain(i8* %p) +; CHECK-NEXT: ret void + +define void @test0(i8* %p) { + %weakBlock = alloca i8*, align 8 + %tmp7 = call i8* @objc_initWeak(i8** %weakBlock, i8* %p) nounwind + %tmp26 = call i8* @objc_loadWeakRetained(i8** %weakBlock) nounwind + call void @objc_destroyWeak(i8** %weakBlock) nounwind + ret void +} + +; CHECK: define i8* @test1(i8* %p) { +; CHECK-NEXT: call i8* @objc_retain(i8* %p) +; CHECK-NEXT: ret i8* %p + +define i8* @test1(i8* %p) { + %weakBlock = alloca i8*, align 8 + %tmp7 = call i8* @objc_initWeak(i8** %weakBlock, i8* %p) nounwind + %tmp26 = call i8* @objc_loadWeakRetained(i8** %weakBlock) nounwind + call void @objc_destroyWeak(i8** %weakBlock) nounwind + ret i8* %tmp26 +} + +; CHECK: define i8* @test2(i8* %p, i8* %q) { +; CHECK-NEXT: call i8* @objc_retain(i8* %q) +; CHECK-NEXT: ret i8* %q + +define i8* @test2(i8* %p, i8* %q) { + %weakBlock = alloca i8*, align 8 + %tmp7 = call i8* @objc_initWeak(i8** %weakBlock, i8* %p) nounwind + %tmp19 = call i8* @objc_storeWeak(i8** %weakBlock, i8* %q) nounwind + %tmp26 = call i8* @objc_loadWeakRetained(i8** %weakBlock) nounwind + call void @objc_destroyWeak(i8** %weakBlock) nounwind + ret i8* %tmp26 +} + +declare i8* @objc_initWeak(i8**, i8*) +declare void @objc_destroyWeak(i8**) +declare i8* @objc_loadWeakRetained(i8**) +declare i8* @objc_storeWeak(i8** %weakBlock, i8* %q) |