Files
clang-p2996/llvm/test/Transforms/ObjCARC/empty-block.ll
Matt Arsenault 01e4f41b43 ObjCARC: Update tests to use opaque pointers
escape.ll needed a simple manual check line update.

contract-storestrong.ll:test12 is kind of contrived now. The comment
says it's for testing bitcasts of pointers, which don't really matter
anymore. Leaves identity ptr to ptr bitcasts (which I thought were
illegal).
2022-12-12 22:46:26 -05:00

58 lines
1.8 KiB
LLVM

; RUN: opt -S -passes=objc-arc < %s | FileCheck %s
; rdar://10210274
%0 = type opaque
declare ptr @llvm.objc.retain(ptr)
declare void @llvm.objc.release(ptr)
declare ptr @llvm.objc.autoreleaseReturnValue(ptr)
; Don't delete the autorelease.
; CHECK-LABEL: define ptr @test0(
; CHECK: @llvm.objc.retain
; CHECK: .lr.ph:
; CHECK-NOT: @llvm.objc.r
; CHECK: @llvm.objc.autoreleaseReturnValue
; CHECK-NOT: @llvm.objc.
; CHECK: }
define ptr @test0(ptr %buffer) nounwind {
%1 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
br i1 undef, label %.lr.ph, label %._crit_edge
.lr.ph: ; preds = %.lr.ph, %0
br i1 false, label %.lr.ph, label %._crit_edge
._crit_edge: ; preds = %.lr.ph, %0
%2 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
tail call void @llvm.objc.release(ptr %buffer) nounwind, !clang.imprecise_release !0
%3 = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr %buffer) nounwind
ret ptr %buffer
}
; Do delete the autorelease, even with the retain in a different block.
; CHECK-LABEL: define ptr @test1(
; CHECK-NOT: @objc
; CHECK: }
define ptr @test1() nounwind {
%buffer = call ptr @foo()
%1 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
br i1 undef, label %.lr.ph, label %._crit_edge
.lr.ph: ; preds = %.lr.ph, %0
br i1 false, label %.lr.ph, label %._crit_edge
._crit_edge: ; preds = %.lr.ph, %0
%2 = tail call ptr @llvm.objc.retain(ptr %buffer) nounwind
tail call void @llvm.objc.release(ptr %buffer) nounwind, !clang.imprecise_release !0
%3 = tail call ptr @llvm.objc.autoreleaseReturnValue(ptr %buffer) nounwind
ret ptr %buffer
}
declare ptr @foo()
!0 = !{}