diff options
author | Michael Gottesman <mgottesman@apple.com> | 2013-05-24 20:44:02 +0000 |
---|---|---|
committer | Michael Gottesman <mgottesman@apple.com> | 2013-05-24 20:44:02 +0000 |
commit | 35e88e57eacdb8edff3b5890e8271a805f250606 (patch) | |
tree | 60bc2eb76558f557dcb7da1ff1dc287d1378f9c4 /test/Transforms/ObjCARC/allocas.ll | |
parent | 36fe3f2b5651882b12e24b49dc7818ebb1a5d79f (diff) | |
download | external_llvm-35e88e57eacdb8edff3b5890e8271a805f250606.zip external_llvm-35e88e57eacdb8edff3b5890e8271a805f250606.tar.gz external_llvm-35e88e57eacdb8edff3b5890e8271a805f250606.tar.bz2 |
[objc-arc] Make sure that multiple owners is propogated correctly through the pass via the usage of a global data structure.
rdar://13750319
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ObjCARC/allocas.ll')
-rw-r--r-- | test/Transforms/ObjCARC/allocas.ll | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/test/Transforms/ObjCARC/allocas.ll b/test/Transforms/ObjCARC/allocas.ll index eabd54d..58740d2d 100644 --- a/test/Transforms/ObjCARC/allocas.ll +++ b/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 !{} |