forked from OSchip/llvm-project
[objc-arc] Test cleanups.
Mainly adding paranoid checks for the closing brace of a function to help with FileCheck error readability. Also some other minor changes. No actual CHECK changes. llvm-svn: 180668
This commit is contained in:
parent
85058af650
commit
b33b6cb84a
|
@ -26,7 +26,7 @@ entry:
|
|||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define internal void @_GLOBAL__I_x()
|
||||
; CHECK: define internal void @_GLOBAL__I_x() {
|
||||
; CHECK-NOT: @objc
|
||||
; CHECK: }
|
||||
define internal void @_GLOBAL__I_x() {
|
||||
|
@ -37,7 +37,7 @@ entry:
|
|||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define internal void @_GLOBAL__I_y()
|
||||
; CHECK: define internal void @_GLOBAL__I_y() {
|
||||
; CHECK: %0 = call i8* @objc_autoreleasePoolPush() [[NUW:#[0-9]+]]
|
||||
; CHECK: call void @objc_autoreleasePoolPop(i8* %0) [[NUW]]
|
||||
; CHECK: }
|
||||
|
|
|
@ -29,7 +29,7 @@ declare i8* @objc_msgSend(i8*, i8*, ...)
|
|||
; Simple retain+release pair deletion, with some intervening control
|
||||
; flow and harmless instructions.
|
||||
|
||||
; CHECK: define void @test0_precise(
|
||||
; CHECK: define void @test0_precise(i32* %x, i1 %p) [[NUW:#[0-9]+]] {
|
||||
; CHECK: @objc_retain
|
||||
; CHECK: @objc_release
|
||||
; CHECK: }
|
||||
|
@ -55,7 +55,7 @@ return:
|
|||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define void @test0_imprecise(
|
||||
; CHECK: define void @test0_imprecise(i32* %x, i1 %p) [[NUW]] {
|
||||
; CHECK-NOT: @objc_
|
||||
; CHECK: }
|
||||
define void @test0_imprecise(i32* %x, i1 %p) nounwind {
|
||||
|
@ -85,7 +85,7 @@ return:
|
|||
|
||||
; TODO: Make the objc_release's argument be %0.
|
||||
|
||||
; CHECK: define void @test1_precise(
|
||||
; CHECK: define void @test1_precise(i32* %x, i1 %p, i1 %q) [[NUW]] {
|
||||
; CHECK: @objc_retain(i8* %a)
|
||||
; CHECK: @objc_release
|
||||
; CHECK: }
|
||||
|
@ -115,7 +115,7 @@ alt_return:
|
|||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define void @test1_imprecise(
|
||||
; CHECK: define void @test1_imprecise(i32* %x, i1 %p, i1 %q) [[NUW]] {
|
||||
; CHECK: @objc_retain(i8* %a)
|
||||
; CHECK: @objc_release
|
||||
; CHECK: }
|
||||
|
@ -148,9 +148,9 @@ alt_return:
|
|||
|
||||
; Don't do partial elimination into two different CFG diamonds.
|
||||
|
||||
; CHECK: define void @test1b_precise(
|
||||
; CHECK: define void @test1b_precise(i8* %x, i1 %p, i1 %q) {
|
||||
; CHECK: entry:
|
||||
; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW:#[0-9]+]]
|
||||
; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
|
||||
; CHECK-NOT: @objc_
|
||||
; CHECK: if.end5:
|
||||
; CHECK: tail call void @objc_release(i8* %x) [[NUW]]
|
||||
|
@ -943,6 +943,7 @@ entry:
|
|||
; CHECK-NEXT: @use_pointer
|
||||
; CHECK-NEXT: @use_pointer
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: }
|
||||
define void @test13b(i8* %x, i64 %n) {
|
||||
entry:
|
||||
call i8* @objc_retain(i8* %x) nounwind
|
||||
|
@ -984,6 +985,7 @@ entry:
|
|||
; CHECK-NEXT: @use_pointer
|
||||
; CHECK-NEXT: @use_pointer
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: }
|
||||
define void @test13d(i8* %x, i64 %n) {
|
||||
entry:
|
||||
call i8* @objc_retain(i8* %x) nounwind
|
||||
|
@ -1295,6 +1297,7 @@ entry:
|
|||
; CHECK: define void @test20(
|
||||
; CHECK: %tmp1 = tail call i8* @objc_retain(i8* %tmp) [[NUW]]
|
||||
; CHECK-NEXT: invoke
|
||||
; CHECK: }
|
||||
define void @test20(double* %self) {
|
||||
if.then12:
|
||||
%tmp = bitcast double* %self to i8*
|
||||
|
@ -1322,6 +1325,7 @@ if.end: ; preds = %invoke.cont23
|
|||
; CHECK: define i8* @test21(
|
||||
; CHECK: call i8* @returner()
|
||||
; CHECK-NEXT: ret i8* %call
|
||||
; CHECK-NEXT: }
|
||||
define i8* @test21() {
|
||||
entry:
|
||||
%call = call i8* @returner()
|
||||
|
@ -1374,7 +1378,7 @@ entry:
|
|||
|
||||
; Don't optimize objc_retainBlock, but do strength reduce it.
|
||||
|
||||
; CHECK: define void @test23b
|
||||
; CHECK: define void @test23b(i8* %p) {
|
||||
; CHECK: @objc_retain
|
||||
; CHECK: @objc_release
|
||||
; CHECK: }
|
||||
|
@ -2064,6 +2068,7 @@ define void @test44(i8** %pp) {
|
|||
; CHECK: call void @objc_release(i8* %q)
|
||||
; CHECK: call void @use_pointer(i8* %p)
|
||||
; CHECK: call void @objc_release(i8* %p)
|
||||
; CHECK: }
|
||||
define void @test45(i8** %pp, i8** %qq) {
|
||||
%p = load i8** %pp
|
||||
%q = load i8** %qq
|
||||
|
@ -2080,6 +2085,7 @@ define void @test45(i8** %pp, i8** %qq) {
|
|||
; CHECK: tail call i8* @objc_retain(i8* %p) [[NUW]]
|
||||
; CHECK: true:
|
||||
; CHECK: call i8* @objc_autorelease(i8* %p) [[NUW]]
|
||||
; CHECK: }
|
||||
define void @test46(i8* %p, i1 %a) {
|
||||
entry:
|
||||
call i8* @objc_retain(i8* %p)
|
||||
|
@ -2099,6 +2105,7 @@ false:
|
|||
; CHECK: define i8* @test47(
|
||||
; CHECK-NOT: call
|
||||
; CHECK: ret i8* %p
|
||||
; CHECK: }
|
||||
define i8* @test47(i8* %p) nounwind {
|
||||
%x = call i8* @objc_retainedObject(i8* %p)
|
||||
ret i8* %x
|
||||
|
@ -2109,6 +2116,7 @@ define i8* @test47(i8* %p) nounwind {
|
|||
; CHECK: define i8* @test48(
|
||||
; CHECK-NOT: call
|
||||
; CHECK: ret i8* %p
|
||||
; CHECK: }
|
||||
define i8* @test48(i8* %p) nounwind {
|
||||
%x = call i8* @objc_unretainedObject(i8* %p)
|
||||
ret i8* %x
|
||||
|
@ -2119,6 +2127,7 @@ define i8* @test48(i8* %p) nounwind {
|
|||
; CHECK: define i8* @test49(
|
||||
; CHECK-NOT: call
|
||||
; CHECK: ret i8* %p
|
||||
; CHECK: }
|
||||
define i8* @test49(i8* %p) nounwind {
|
||||
%x = call i8* @objc_unretainedPointer(i8* %p)
|
||||
ret i8* %x
|
||||
|
@ -2244,6 +2253,7 @@ define void @test53(void ()** %zz, i8** %pp) {
|
|||
; CHECK: call i8* @returner()
|
||||
; CHECK-NEXT: call void @objc_release(i8* %t) [[NUW]], !clang.imprecise_release !0
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK: }
|
||||
define void @test54() {
|
||||
%t = call i8* @returner()
|
||||
call i8* @objc_autorelease(i8* %t)
|
||||
|
@ -2710,7 +2720,7 @@ declare i32 @printf(i8* nocapture, ...) nounwind
|
|||
declare i32 @puts(i8* nocapture) nounwind
|
||||
@str = internal constant [16 x i8] c"-[ Top0 _getX ]\00"
|
||||
|
||||
; CHECK: @"\01-[A z]"
|
||||
; CHECK: define { <2 x float>, <2 x float> } @"\01-[A z]"({}* %self, i8* nocapture %_cmd) [[NUW]] {
|
||||
; CHECK-NOT: @objc_
|
||||
; CHECK: }
|
||||
|
||||
|
@ -2756,7 +2766,7 @@ invoke.cont:
|
|||
ret {<2 x float>, <2 x float>} %tmp35
|
||||
}
|
||||
|
||||
; CHECK: @"\01-[Top0 _getX]"
|
||||
; CHECK: @"\01-[Top0 _getX]"({}* %self, i8* nocapture %_cmd) [[NUW]] {
|
||||
; CHECK-NOT: @objc_
|
||||
; CHECK: }
|
||||
|
||||
|
@ -2775,12 +2785,13 @@ invoke.cont:
|
|||
|
||||
; A simple loop. Eliminate the retain and release inside of it!
|
||||
|
||||
; CHECK: define void @loop
|
||||
; CHECK: define void @loop(i8* %x, i64 %n) {
|
||||
; CHECK: for.body:
|
||||
; CHECK-NOT: @objc_
|
||||
; CHECK: @objc_msgSend
|
||||
; CHECK-NOT: @objc_
|
||||
; CHECK: for.end:
|
||||
; CHECK: }
|
||||
define void @loop(i8* %x, i64 %n) {
|
||||
entry:
|
||||
%0 = tail call i8* @objc_retain(i8* %x) nounwind
|
||||
|
@ -2804,7 +2815,7 @@ for.end: ; preds = %for.body, %entry
|
|||
|
||||
; ObjCARCOpt can delete the retain,release on self.
|
||||
|
||||
; CHECK: define void @TextEditTest
|
||||
; CHECK: define void @TextEditTest(%2* %self, %3* %pboard) {
|
||||
; CHECK-NOT: call i8* @objc_retain(i8* %tmp7)
|
||||
; CHECK: }
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
; RUN: opt -S -objc-arc-contract < %s | FileCheck %s
|
||||
|
||||
; CHECK: define void @foo() {
|
||||
; CHECK: %call = tail call i32* @qux()
|
||||
; CHECK-NEXT: %tcall = bitcast i32* %call to i8*
|
||||
; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue", ""()
|
||||
; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %tcall) [[NUW:#[0-9]+]]
|
||||
; CHECK: }
|
||||
|
||||
define void @foo() {
|
||||
entry:
|
||||
|
|
|
@ -12,6 +12,7 @@ declare void @use_pointer(i8*)
|
|||
; CHECK: entry:
|
||||
; CHECK-NEXT: tail call void @objc_storeStrong(i8** @x, i8* %p) [[NUW:#[0-9]+]]
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: }
|
||||
define void @test0(i8* %p) {
|
||||
entry:
|
||||
%0 = tail call i8* @objc_retain(i8* %p) nounwind
|
||||
|
@ -107,6 +108,7 @@ entry:
|
|||
; CHECK: define i1 @test5(i8* %newValue, i8* %foo) {
|
||||
; CHECK: %t = icmp eq i8* %x1, %foo
|
||||
; CHECK: tail call void @objc_storeStrong(i8** @x, i8* %newValue) [[NUW]]
|
||||
; CHECK: }
|
||||
define i1 @test5(i8* %newValue, i8* %foo) {
|
||||
entry:
|
||||
%x0 = tail call i8* @objc_retain(i8* %newValue) nounwind
|
||||
|
@ -122,6 +124,7 @@ entry:
|
|||
; CHECK: define i1 @test6(i8* %newValue, i8* %foo) {
|
||||
; CHECK: %t = icmp eq i8* %x1, %foo
|
||||
; CHECK: tail call void @objc_storeStrong(i8** @x, i8* %newValue) [[NUW]]
|
||||
; CHECK: }
|
||||
define i1 @test6(i8* %newValue, i8* %foo) {
|
||||
entry:
|
||||
%x0 = tail call i8* @objc_retain(i8* %newValue) nounwind
|
||||
|
|
|
@ -50,6 +50,7 @@ bb6: ; preds = %bb5, %bb4, %bb4, %b
|
|||
; CHECK: br i1 undef, label %bb7, label %bb7
|
||||
; CHECK: bb7:
|
||||
; CHECK: %tmp8 = phi %0* [ %0, %bb ], [ %0, %bb ]
|
||||
; CHECK: }
|
||||
define void @test1() {
|
||||
bb:
|
||||
%tmp = tail call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* ()*)()
|
||||
|
@ -70,6 +71,7 @@ bb7: ; preds = %bb6, %bb6, %bb5
|
|||
; CHECK: invoke.cont: ; preds = %entry
|
||||
; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue", ""()
|
||||
; CHECK-NEXT: %tmp = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call) [[NUW:#[0-9]+]]
|
||||
; CHECK: }
|
||||
define void @_Z6doTestP8NSString() {
|
||||
entry:
|
||||
%call = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* ()*)()
|
||||
|
|
|
@ -137,6 +137,7 @@ define i8* @test6() {
|
|||
; CHECK: call void @use_pointer(i8* %1)
|
||||
; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %1)
|
||||
; CHECK: ret i8* %2
|
||||
; CHECK-NEXT: }
|
||||
define i8* @test7(i8* %p) {
|
||||
%1 = tail call i8* @objc_retain(i8* %p)
|
||||
call void @use_pointer(i8* %p)
|
||||
|
|
|
@ -7,11 +7,12 @@ declare i8* @objc_retain(i8*)
|
|||
; GVN should be able to eliminate this redundant load, with ARC-specific
|
||||
; alias analysis.
|
||||
|
||||
; CHECK: @foo
|
||||
; CHECK: define i8* @foo(i32 %n)
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: %s = load i8** @x
|
||||
; CHECK-NOT: load
|
||||
; CHECK: ret i8* %s
|
||||
; CHECK-NEXT: }
|
||||
define i8* @foo(i32 %n) nounwind {
|
||||
entry:
|
||||
%s = load i8** @x
|
||||
|
|
|
@ -38,6 +38,7 @@ declare void @test0_helper(i8*, i8**)
|
|||
; CHECK-NEXT: @objc_release(i8* [[VAL2]])
|
||||
; CHECK-NEXT: @objc_release(i8* %x)
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: }
|
||||
define void @test0(i8** %out, i8* %x, i8* %y) {
|
||||
entry:
|
||||
%temp0 = alloca i8*, align 8
|
||||
|
@ -83,6 +84,7 @@ entry:
|
|||
; CHECK-NEXT: @objc_release(i8* [[VAL2]])
|
||||
; CHECK-NEXT: store i8* %x, i8** %out
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: }
|
||||
define void @test0a(i8** %out, i8* %x, i8* %y) {
|
||||
entry:
|
||||
%temp0 = alloca i8*, align 8
|
||||
|
|
|
@ -17,6 +17,7 @@ declare i8* @returner()
|
|||
; CHECK: lpad:
|
||||
; CHECK: call void @objc_release(i8* %zipFile) [[NUW]], !clang.imprecise_release !0
|
||||
; CHECK: ret void
|
||||
; CHECK-NEXT: }
|
||||
define void @test0(i8* %zipFile) {
|
||||
entry:
|
||||
call i8* @objc_retain(i8* %zipFile) nounwind
|
||||
|
@ -48,6 +49,7 @@ lpad: ; preds = %entry
|
|||
; CHECK: br label %done
|
||||
; CHECK: done:
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: }
|
||||
define void @test1(i8* %zipFile) {
|
||||
entry:
|
||||
call i8* @objc_retain(i8* %zipFile) nounwind
|
||||
|
@ -110,6 +112,7 @@ finally.rethrow: ; preds = %invoke.cont, %entry
|
|||
; CHECK: if.end:
|
||||
; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]]
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: }
|
||||
define void @test3(i8* %p, i1 %b) {
|
||||
entry:
|
||||
%0 = call i8* @objc_retain(i8* %p)
|
||||
|
@ -145,6 +148,7 @@ if.end:
|
|||
; CHECK: if.end:
|
||||
; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]]
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: }
|
||||
define void @test4(i8* %p, i1 %b) {
|
||||
entry:
|
||||
%0 = call i8* @objc_retain(i8* %p)
|
||||
|
|
Loading…
Reference in New Issue