diff options
author | Dan Gohman <gohman@apple.com> | 2011-08-22 17:29:11 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2011-08-22 17:29:11 +0000 |
commit | 1b31ea8f935d4b643abf100c4943180c9ed8ba1a (patch) | |
tree | 8bb82696cb508e2560a25e690512fc278350cedd /test/Transforms | |
parent | 986b865c03b04e9d65bd100c7254c58547fc89e7 (diff) | |
download | external_llvm-1b31ea8f935d4b643abf100c4943180c9ed8ba1a.zip external_llvm-1b31ea8f935d4b643abf100c4943180c9ed8ba1a.tar.gz external_llvm-1b31ea8f935d4b643abf100c4943180c9ed8ba1a.tar.bz2 |
Constant pointers to objects don't need reference counting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138242 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/ObjCARC/basic.ll | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Transforms/ObjCARC/basic.ll b/test/Transforms/ObjCARC/basic.ll index def7039..72f05ff 100644 --- a/test/Transforms/ObjCARC/basic.ll +++ b/test/Transforms/ObjCARC/basic.ll @@ -1638,6 +1638,39 @@ entry: ret void } +; Constant pointers to objects don't need reference counting. + +@constptr = external constant i8* +@something = external global i8* + +; CHECK: define void @test60( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test60() { + %t = load i8** @constptr + %s = load i8** @something + call i8* @objc_retain(i8* %s) + call void @callee() + call void @use_pointer(i8* %t) + call void @objc_release(i8* %s) + ret void +} + +; Constant pointers to objects don't need to be considered related to other +; pointers. + +; CHECK: define void @test61( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test61() { + %t = load i8** @constptr + call i8* @objc_retain(i8* %t) + call void @callee() + call void @use_pointer(i8* %t) + call void @objc_release(i8* %t) + ret void +} + declare void @bar(i32 ()*) ; A few real-world testcases. |