summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2017-10-16 16:46:59 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2017-10-16 16:46:59 +0000
commite8c1a54c07b7594e4057c76a57cadbcb0b1544a3 (patch)
treee7779cb6ac9a0c76b7a4cbb0b8b5fa0c77c47e7d /llvm/test
parenta4b89ed0b764e2a2e5cf2cea0519d6f191425307 (diff)
downloadbcm5719-llvm-e8c1a54c07b7594e4057c76a57cadbcb0b1544a3.tar.gz
bcm5719-llvm-e8c1a54c07b7594e4057c76a57cadbcb0b1544a3.zip
[ObjCARC] Do not move a release that has the clang.imprecise_release tag
above PHI instructions. ARC optimizer has an optimization that moves a call to an ObjC runtime function above a phi instruction when the phi has a null operand and is an argument passed to the function call. This optimization should not kick in when the runtime function is an objc_release that releases an object with precise lifetime semantics. rdar://problem/34959669 llvm-svn: 315914
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/ObjCARC/basic.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ObjCARC/basic.ll b/llvm/test/Transforms/ObjCARC/basic.ll
index cecaa3f2b4d..70b83b93138 100644
--- a/llvm/test/Transforms/ObjCARC/basic.ll
+++ b/llvm/test/Transforms/ObjCARC/basic.ll
@@ -1345,6 +1345,26 @@ B:
C:
%h = phi double* [ null, %A ], [ %p, %B ]
%c = bitcast double* %h to i8*
+ call void @objc_release(i8* %c), !clang.imprecise_release !0
+ ret void
+}
+
+; Do not move an objc_release that doesn't have the clang.imprecise_release tag.
+
+; CHECK-LABEL: define void @test22_precise(
+; CHECK: %[[P0:.*]] = phi double*
+; CHECK: %[[V0:.*]] = bitcast double* %[[P0]] to i8*
+; CHECK: call void @objc_release(i8* %[[V0]])
+; CHECK: ret void
+define void @test22_precise(double* %p, i1 %a) {
+ br i1 %a, label %A, label %B
+A:
+ br label %C
+B:
+ br label %C
+C:
+ %h = phi double* [ null, %A ], [ %p, %B ]
+ %c = bitcast double* %h to i8*
call void @objc_release(i8* %c)
ret void
}
OpenPOWER on IntegriCloud