summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/ObjCARC/allocas.ll
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2013-05-24 20:44:02 +0000
committerMichael Gottesman <mgottesman@apple.com>2013-05-24 20:44:02 +0000
commit5a91bbf33a6a940346e3577812b2185be47b5dad (patch)
tree76a1b00c54f70ec38db8f13b8d2bac6b68c1a63b /llvm/test/Transforms/ObjCARC/allocas.ll
parent0b342b6ddf629005e47a2fdf9929fc7bfe162814 (diff)
downloadbcm5719-llvm-5a91bbf33a6a940346e3577812b2185be47b5dad.tar.gz
bcm5719-llvm-5a91bbf33a6a940346e3577812b2185be47b5dad.zip
[objc-arc] Make sure that multiple owners is propogated correctly through the pass via the usage of a global data structure.
rdar://13750319 llvm-svn: 182669
Diffstat (limited to 'llvm/test/Transforms/ObjCARC/allocas.ll')
-rw-r--r--llvm/test/Transforms/ObjCARC/allocas.ll97
1 files changed, 97 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ObjCARC/allocas.ll b/llvm/test/Transforms/ObjCARC/allocas.ll
index eabd54deb7c..58740d2d802 100644
--- a/llvm/test/Transforms/ObjCARC/allocas.ll
+++ b/llvm/test/Transforms/ObjCARC/allocas.ll
@@ -197,6 +197,103 @@ entry:
ret void
}
+; Make sure that if a store is in a different basic block we handle known safe
+; conservatively.
+
+
+; CHECK: define void @test2a(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test2a(i8* %x) {
+entry:
+ %A = alloca i8*
+ store i8* %x, i8** %A, align 8
+ %y = load i8** %A
+ br label %bb1
+
+bb1:
+ br label %bb2
+
+bb2:
+ br label %bb3
+
+bb3:
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; CHECK: define void @test2b(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test2b(i8* %x) {
+entry:
+ %A = alloca i8*
+ %gep1 = getelementptr i8** %A, i32 0
+ store i8* %x, i8** %gep1, align 8
+ %gep2 = getelementptr i8** %A, i32 0
+ %y = load i8** %gep2
+ br label %bb1
+
+bb1:
+ br label %bb2
+
+bb2:
+ br label %bb3
+
+bb3:
+ tail call i8* @objc_retain(i8* %x)
+ tail call i8* @objc_retain(i8* %x)
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
+
+; CHECK: define void @test2c(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_retain(i8* %x)
+; CHECK: @objc_release(i8* %y)
+; CHECK: @objc_release(i8* %x)
+; CHECK: ret void
+; CHECK: }
+define void @test2c(i8* %x) {
+entry:
+ %A = alloca i8*, i32 3
+ %gep1 = getelementptr i8** %A, i32 2
+ store i8* %x, i8** %gep1, align 8
+ %gep2 = getelementptr i8** %A, i32 2
+ %y = load i8** %gep2
+ tail call i8* @objc_retain(i8* %x)
+ br label %bb1
+
+bb1:
+ br label %bb2
+
+bb2:
+ br label %bb3
+
+bb3:
+ tail call i8* @objc_retain(i8* %x)
+ call void @use_alloca(i8** %A)
+ call void @objc_release(i8* %y), !clang.imprecise_release !0
+ call void @use_pointer(i8* %x)
+ call void @objc_release(i8* %x), !clang.imprecise_release !0
+ ret void
+}
!0 = metadata !{}
OpenPOWER on IntegriCloud