mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-08 04:07:07 +00:00
9fbd318d36
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133108 91177308-0d34-0410-b5e6-96231b3b80d8
87 lines
2.5 KiB
LLVM
87 lines
2.5 KiB
LLVM
; RUN: opt -S -objc-arc < %s | FileCheck %s
|
|
; rdar://9503416
|
|
|
|
; Detect loop boundaries and don't move retains and releases
|
|
; across them.
|
|
|
|
declare void @use_pointer(i8*)
|
|
declare i8* @objc_retain(i8*)
|
|
declare void @objc_release(i8*)
|
|
|
|
; CHECK: define void @test0(
|
|
; CHECK: call i8* @objc_retain(
|
|
; CHECK: for.body:
|
|
; CHECK-NOT: @objc
|
|
; CHECK: for.end:
|
|
; CHECK: call void @objc_release(
|
|
; CHECK: }
|
|
define void @test0(i8* %digits) {
|
|
entry:
|
|
%tmp1 = call i8* @objc_retain(i8* %digits) nounwind
|
|
call void @use_pointer(i8* %tmp1)
|
|
br label %for.body
|
|
|
|
for.body: ; preds = %for.body, %entry
|
|
%upcDigitIndex.01 = phi i64 [ 2, %entry ], [ %inc, %for.body ]
|
|
call void @use_pointer(i8* %tmp1)
|
|
%inc = add i64 %upcDigitIndex.01, 1
|
|
%cmp = icmp ult i64 %inc, 12
|
|
br i1 %cmp, label %for.body, label %for.end
|
|
|
|
for.end: ; preds = %for.body
|
|
call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0
|
|
ret void
|
|
}
|
|
|
|
; CHECK: define void @test1(
|
|
; CHECK: call i8* @objc_retain(
|
|
; CHECK: for.body:
|
|
; CHECK-NOT: @objc
|
|
; CHECK: for.end:
|
|
; CHECK: void @objc_release(
|
|
; CHECK: }
|
|
define void @test1(i8* %digits) {
|
|
entry:
|
|
%tmp1 = call i8* @objc_retain(i8* %digits) nounwind
|
|
br label %for.body
|
|
|
|
for.body: ; preds = %for.body, %entry
|
|
%upcDigitIndex.01 = phi i64 [ 2, %entry ], [ %inc, %for.body ]
|
|
call void @use_pointer(i8* %tmp1)
|
|
call void @use_pointer(i8* %tmp1)
|
|
%inc = add i64 %upcDigitIndex.01, 1
|
|
%cmp = icmp ult i64 %inc, 12
|
|
br i1 %cmp, label %for.body, label %for.end
|
|
|
|
for.end: ; preds = %for.body
|
|
call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0
|
|
ret void
|
|
}
|
|
|
|
; CHECK: define void @test2(
|
|
; CHECK: call i8* @objc_retain(
|
|
; CHECK: for.body:
|
|
; CHECK-NOT: @objc
|
|
; CHECK: for.end:
|
|
; CHECK: void @objc_release(
|
|
; CHECK: }
|
|
define void @test2(i8* %digits) {
|
|
entry:
|
|
%tmp1 = call i8* @objc_retain(i8* %digits) nounwind
|
|
br label %for.body
|
|
|
|
for.body: ; preds = %for.body, %entry
|
|
%upcDigitIndex.01 = phi i64 [ 2, %entry ], [ %inc, %for.body ]
|
|
call void @use_pointer(i8* %tmp1)
|
|
%inc = add i64 %upcDigitIndex.01, 1
|
|
%cmp = icmp ult i64 %inc, 12
|
|
br i1 %cmp, label %for.body, label %for.end
|
|
|
|
for.end: ; preds = %for.body
|
|
call void @use_pointer(i8* %tmp1)
|
|
call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0
|
|
ret void
|
|
}
|
|
|
|
!0 = metadata !{}
|