[llvm] r189868 - [objc-arc] Move some block tests from basic.ll -> retain-block.ll and add some missing CHECK-LABELS.

Michael Gottesman mgottesman at apple.com
Tue Sep 3 15:40:50 PDT 2013


Author: mgottesman
Date: Tue Sep  3 17:40:50 2013
New Revision: 189868

URL: http://llvm.org/viewvc/llvm-project?rev=189868&view=rev
Log:
[objc-arc] Move some block tests from basic.ll -> retain-block.ll and add some missing CHECK-LABELS.

Modified:
    llvm/trunk/test/Transforms/ObjCARC/basic.ll
    llvm/trunk/test/Transforms/ObjCARC/retain-block-escape-analysis.ll
    llvm/trunk/test/Transforms/ObjCARC/retain-block.ll

Modified: llvm/trunk/test/Transforms/ObjCARC/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ObjCARC/basic.ll?rev=189868&r1=189867&r2=189868&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/ObjCARC/basic.ll (original)
+++ llvm/trunk/test/Transforms/ObjCARC/basic.ll Tue Sep  3 17:40:50 2013
@@ -1357,55 +1357,6 @@ C:
   ret void
 }
 
-; Optimize objc_retainBlock.
-
-; CHECK-LABEL: define void @test23(
-; CHECK-NOT: @objc_
-; CHECK: }
-%block0 = type { i64, i64, i8*, i8* }
-%block1 = type { i8**, i32, i32, i32 (%struct.__block_literal_1*)*, %block0* }
-%struct.__block_descriptor = type { i64, i64 }
-%struct.__block_literal_1 = type { i8**, i32, i32, i8**, %struct.__block_descriptor* }
- at __block_holder_tmp_1 = external constant %block1
-define void @test23() {
-entry:
-  %0 = call i8* @objc_retainBlock(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind, !clang.arc.copy_on_escape !0
-  call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
-  call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
-  call void @objc_release(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind
-  ret void
-}
-
-; Don't optimize objc_retainBlock, but do strength reduce it.
-
-; CHECK: define void @test23b(i8* %p) {
-; CHECK: @objc_retain
-; CHECK: @objc_release
-; CHECK: }
-define void @test23b(i8* %p) {
-entry:
-  %0 = call i8* @objc_retainBlock(i8* %p) nounwind, !clang.arc.copy_on_escape !0
-  call void @callee()
-  call void @use_pointer(i8* %p)
-  call void @objc_release(i8* %p) nounwind
-  ret void
-}
-
-; Don't optimize objc_retainBlock, because there's no copy_on_escape metadata.
-
-; CHECK-LABEL: define void @test23c(
-; CHECK: @objc_retainBlock
-; CHECK: @objc_release
-; CHECK: }
-define void @test23c() {
-entry:
-  %0 = call i8* @objc_retainBlock(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind
-  call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
-  call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
-  call void @objc_release(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind
-  ret void
-}
-
 ; Any call can decrement a retain count.
 
 ; CHECK-LABEL: define void @test24(

Modified: llvm/trunk/test/Transforms/ObjCARC/retain-block-escape-analysis.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ObjCARC/retain-block-escape-analysis.ll?rev=189868&r1=189867&r2=189868&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/ObjCARC/retain-block-escape-analysis.ll (original)
+++ llvm/trunk/test/Transforms/ObjCARC/retain-block-escape-analysis.ll Tue Sep  3 17:40:50 2013
@@ -196,7 +196,7 @@ end:
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 define void @phinode_use_cycle(i8* %block) uwtable optsize ssp {
-; CHECK: define void @phinode_use_cycle(i8* %block)
+; CHECK-LABEL: define void @phinode_use_cycle(i8* %block)
 entry:
   br label %for.body
 

Modified: llvm/trunk/test/Transforms/ObjCARC/retain-block.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ObjCARC/retain-block.ll?rev=189868&r1=189867&r2=189868&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/ObjCARC/retain-block.ll (original)
+++ llvm/trunk/test/Transforms/ObjCARC/retain-block.ll Tue Sep  3 17:40:50 2013
@@ -13,7 +13,7 @@ declare i8* @objc_autorelease(i8*)
 
 ; Basic retainBlock+release elimination.
 
-; CHECK: define void @test0(i8* %tmp) {
+; CHECK-LABEL: define void @test0(i8* %tmp) {
 ; CHECK-NOT: @objc
 ; CHECK: }
 define void @test0(i8* %tmp) {
@@ -27,7 +27,7 @@ entry:
 ; Same as test0, but there's no copy_on_escape metadata, so there's no
 ; optimization possible.
 
-; CHECK: define void @test0_no_metadata(i8* %tmp) {
+; CHECK-LABEL: define void @test0_no_metadata(i8* %tmp) {
 ; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW:#[0-9]+]]
 ; CHECK: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
 ; CHECK: }
@@ -42,7 +42,7 @@ entry:
 ; Same as test0, but the pointer escapes, so there's no
 ; optimization possible.
 
-; CHECK: define void @test0_escape(i8* %tmp, i8** %z) {
+; CHECK-LABEL: define void @test0_escape(i8* %tmp, i8** %z) {
 ; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]], !clang.arc.copy_on_escape !0
 ; CHECK: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
 ; CHECK: }
@@ -57,7 +57,7 @@ entry:
 
 ; Same as test0_escape, but there's no intervening call.
 
-; CHECK: define void @test0_just_escape(i8* %tmp, i8** %z) {
+; CHECK-LABEL: define void @test0_just_escape(i8* %tmp, i8** %z) {
 ; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]], !clang.arc.copy_on_escape !0
 ; CHECK: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
 ; CHECK: }
@@ -93,7 +93,7 @@ entry:
 ; retainBlock+release optimization possible. But we can still eliminate
 ; the outer retain+release.
 
-; CHECK: define void @test1_no_metadata(i8* %tmp) {
+; CHECK-LABEL: define void @test1_no_metadata(i8* %tmp) {
 ; CHECK-NEXT: entry:
 ; CHECK-NEXT: tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]]
 ; CHECK-NEXT: @use_pointer(i8* %tmp2)
@@ -137,4 +137,53 @@ entry:
   ret void
 }
 
+; Optimize objc_retainBlock.
+
+; CHECK-LABEL: define void @test23(
+; CHECK-NOT: @objc_
+; CHECK: }
+%block0 = type { i64, i64, i8*, i8* }
+%block1 = type { i8**, i32, i32, i32 (%struct.__block_literal_1*)*, %block0* }
+%struct.__block_descriptor = type { i64, i64 }
+%struct.__block_literal_1 = type { i8**, i32, i32, i8**, %struct.__block_descriptor* }
+ at __block_holder_tmp_1 = external constant %block1
+define void @test23() {
+entry:
+  %0 = call i8* @objc_retainBlock(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind, !clang.arc.copy_on_escape !0
+  call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
+  call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
+  call void @objc_release(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind
+  ret void
+}
+
+; Don't optimize objc_retainBlock, but do strength reduce it.
+
+; CHECK-LABEL: define void @test3a(i8* %p) {
+; CHECK: @objc_retain
+; CHECK: @objc_release
+; CHECK: }
+define void @test3a(i8* %p) { 
+entry:
+  %0 = call i8* @objc_retainBlock(i8* %p) nounwind, !clang.arc.copy_on_escape !0
+  call void @callee()
+  call void @use_pointer(i8* %p)
+  call void @objc_release(i8* %p) nounwind
+  ret void
+}
+
+; Don't optimize objc_retainBlock, because there's no copy_on_escape metadata.
+
+; CHECK-LABEL: define void @test3b(
+; CHECK: @objc_retainBlock
+; CHECK: @objc_release
+; CHECK: }
+define void @test3b() {
+entry:
+  %0 = call i8* @objc_retainBlock(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind
+  call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
+  call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*))
+  call void @objc_release(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind
+  ret void
+}
+
 ; CHECK: attributes [[NUW]] = { nounwind }





More information about the llvm-commits mailing list