llvm.org GIT mirror llvm / 15bfd6d
Catch more CHECK that can be converted to CHECK-LABEL in Transforms for easier debugging. No functionality change. This conversion was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)define\([^@]*\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3define\4@$FUNC(/g" $TEMP done mv $TEMP $NAME fi done git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186269 91177308-0d34-0410-b5e6-96231b3b80d8 Stephen Lin 6 years ago
63 changed file(s) with 301 addition(s) and 301 deletion(s). Raw diff Collapse all Expand all
99
1010 declare i80 @llvm.bswap.i80(i80)
1111
12 ; CHECK: define i16 @W
12 ; CHECK-LABEL: define i16 @W(
1313 define i16 @W() {
1414 ; CHECK: ret i16 256
1515 %Z = call i16 @llvm.bswap.i16( i16 1 ) ; [#uses=1]
1616 ret i16 %Z
1717 }
1818
19 ; CHECK: define i32 @X
19 ; CHECK-LABEL: define i32 @X(
2020 define i32 @X() {
2121 ; CHECK: ret i32 16777216
2222 %Z = call i32 @llvm.bswap.i32( i32 1 ) ; [#uses=1]
2323 ret i32 %Z
2424 }
2525
26 ; CHECK: define i64 @Y
26 ; CHECK-LABEL: define i64 @Y(
2727 define i64 @Y() {
2828 ; CHECK: ret i64 72057594037927936
2929 %Z = call i64 @llvm.bswap.i64( i64 1 ) ; [#uses=1]
3030 ret i64 %Z
3131 }
3232
33 ; CHECK: define i80 @Z
33 ; CHECK-LABEL: define i80 @Z(
3434 define i80 @Z() {
3535 ; CHECK: ret i80 -450681596205739728166896
3636 ; 0xA0908070605040302010
1212 }
1313
1414 ; This checks if the struct doesn't get non-packed
15 ; CHECK: define internal <{ i32, i32 }> @test2
15 ; CHECK-LABEL: define internal <{ i32, i32 }> @test2(
1616 define internal <{ i32, i32 }> @test2(i32 %DEADARG1) {
1717 ret <{ i32, i32 }> <{ i32 1, i32 2 }>
1818 }
1010 %x = load i32* inttoptr (i32 12345 to i32*)
1111 store i32 %x, i32* %p
1212 ret void
13 ; CHECK: define void @test1
13 ; CHECK-LABEL: define void @test1(
1414 ; CHECK: store
1515 ; CHECK-NOT: store
1616 ; CHECK: ret void
2020 store i32 1, i32* @g; <-- This is dead.
2121 store i32 42, i32* @g
2222 ret void
23 ; CHECK: define void @test3
23 ; CHECK-LABEL: define void @test3(
2424 ; CHECK: store
2525 ; CHECK-NOT: store
2626 ; CHECK: ret void
3131 %x = load i32* @g; <-- %p and @g could alias
3232 store i32 %x, i32* %p
3333 ret void
34 ; CHECK: define void @test4
34 ; CHECK-LABEL: define void @test4(
3535 ; CHECK: store
3636 ; CHECK: store
3737 ; CHECK: ret void
66 call void @test1f()
77 store i32 2, i32 *%p
88 ret void
9 ; CHECK: define void @test1
9 ; CHECK-LABEL: define void @test1(
1010 ; CHECK-NOT: store
1111 ; CHECK-NEXT: call void
1212 ; CHECK-NEXT: store i32 2
1515 br label %lbl_1215
1616 }
1717
18 ; CHECK: define i32 @fn
18 ; CHECK-LABEL: define i32 @fn(
0 ; RUN: opt -gvn -S < %s | FileCheck %s
11
22 define i32 @f1(i32 %x) {
3 ; CHECK: define i32 @f1(
3 ; CHECK-LABEL: define i32 @f1(
44 bb0:
55 %cmp = icmp eq i32 %x, 0
66 br i1 %cmp, label %bb2, label %bb1
1515 }
1616
1717 define i32 @f2(i32 %x) {
18 ; CHECK: define i32 @f2(
18 ; CHECK-LABEL: define i32 @f2(
1919 bb0:
2020 %cmp = icmp ne i32 %x, 0
2121 br i1 %cmp, label %bb1, label %bb2
3030 }
3131
3232 define i32 @f3(i32 %x) {
33 ; CHECK: define i32 @f3(
33 ; CHECK-LABEL: define i32 @f3(
3434 bb0:
3535 switch i32 %x, label %bb1 [ i32 0, label %bb2]
3636 bb1:
4545
4646 declare void @g(i1)
4747 define void @f4(i8 * %x) {
48 ; CHECK: define void @f4(
48 ; CHECK-LABEL: define void @f4(
4949 bb0:
5050 %y = icmp eq i8* null, %x
5151 br i1 %y, label %bb2, label %bb1
1010 call void @use(i8* %a)
1111 %b = load i8* %a
1212 ret i8 %b
13 ; CHECK: define i8 @test
13 ; CHECK-LABEL: define i8 @test(
1414 ; CHECK: call void @use(i8* %a)
1515 ; CHECK-NEXT: ret i8 1
1616 }
11 ; Check that the mere presence of a blockaddress doesn't prevent -globalopt
22 ; from promoting @f to fastcc.
33
4 ; CHECK: define{{.*}}fastcc{{.*}}@f
4 ; CHECK-LABEL: define{{.*}}fastcc{{.*}}@f(
55 define internal i8* @f() {
66 ret i8* blockaddress(@f, %L1)
77 L1:
1515 @G2 = linkonce_odr constant i32 42
1616
1717 define void @foo2() {
18 ; CHECK: define void @foo2
18 ; CHECK-LABEL: define void @foo2(
1919 ; CHECK-NEXT: store
2020 store i32 1, i32* @G2
2121 ret void
1616 }
1717
1818 define void @foo(i32* %x) {
19 ; CHECK: define void @foo
19 ; CHECK-LABEL: define void @foo(
2020 ; CHECK: store i32 %1, i32* %x
2121 call void @bar(i32* byval %x)
2222 ret void
127127 define void @outer2(i32 %z, i1 %b) {
128128 ; Ensure that after inlining, none of the blocks with a call to @f actually
129129 ; make it through inlining.
130 ; CHECK: define void @outer2
130 ; CHECK-LABEL: define void @outer2(
131131 ; CHECK-NOT: call
132132 ; CHECK: ret void
133133
163163 ; This previously crashed during inliner cleanup and folding inner return
164164 ; instructions. Check that we don't crash and we produce a function with a single
165165 ; return instruction due to merging the returns of the inlined function.
166 ; CHECK: define void @PR12470_outer
166 ; CHECK-LABEL: define void @PR12470_outer(
167167 ; CHECK-NOT: call
168168 ; CHECK: ret void
169169 ; CHECK-NOT: ret void
55 }
66
77 define i32 @caller1() {
8 ; CHECK: define i32 @caller1
8 ; CHECK-LABEL: define i32 @caller1(
99 ; CHECK-NEXT: ret i32 3
1010
1111 %X = call i32 @callee1( i32 10, i32 3 )
1414
1515 define i32 @g() {
1616 entry:
17 ; CHECK: define i32 @g
17 ; CHECK-LABEL: define i32 @g(
1818 ; CHECK: call i32 @f()
1919 ; CHECK-NOT: call i32 @a()
2020 %call = call i32 @f()
3131
3232 define i32 @i() {
3333 entry:
34 ; CHECK: define i32 @i
34 ; CHECK-LABEL: define i32 @i(
3535 ; CHECK: call i32 @b()
3636 ; CHECK-NOT: call i32 @h()
3737 %call = call i32 @h() returns_twice
55 ; rdar://10853263
66
77 ; Make sure that the callee is still here.
8 ; CHECK: define i32 @callee
8 ; CHECK-LABEL: define i32 @callee(
99 define i32 @callee(i32 %param) {
1010 %yyy = alloca [100000 x i8]
1111 %r = bitcast [100000 x i8]* %yyy to i8*
1313 ret i32 4
1414 }
1515
16 ; CHECK: define i32 @caller
16 ; CHECK-LABEL: define i32 @caller(
1717 ; CHECK-NEXT: entry:
1818 ; CHECK-NOT: alloca
1919 ; CHECK: ret
11 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
22 target triple = "i386-apple-darwin10.0.0"
33
4 ; CHECK: define void @fu1
4 ; CHECK-LABEL: define void @fu1(
55 define void @fu1(i32 %parm) nounwind ssp {
66 %1 = alloca i32, align 4
77 ; CHECK: alloca double*
3232
3333 declare void @bar(double*)
3434
35 ; CHECK: define void @fu2
35 ; CHECK-LABEL: define void @fu2(
3636 define void @fu2(i32 %parm) nounwind ssp {
3737 %1 = alloca i32, align 4
3838 %ptr = alloca double*, align 4
88 %or4 = or i32 or (i32 zext (i1 icmp eq (i32* @g, i32* null) to i32), i32 1), %xor
99 ret i32 %or4
1010 }
11 ; CHECK: define i32 @function
11 ; CHECK-LABEL: define i32 @function(
55 ; Check transforms involving atomic operations
66
77 define i32* @test1(i8** %p) {
8 ; CHECK: define i32* @test1
8 ; CHECK-LABEL: define i32* @test1(
99 ; CHECK: load atomic i8** %p monotonic, align 8
1010 %c = bitcast i8** %p to i32**
1111 %r = load atomic i32** %c monotonic, align 8
1313 }
1414
1515 define i32 @test2(i32* %p) {
16 ; CHECK: define i32 @test2
16 ; CHECK-LABEL: define i32 @test2(
1717 ; CHECK: %x = load atomic i32* %p seq_cst, align 4
1818 ; CHECK: shl i32 %x, 1
1919 %x = load atomic i32* %p seq_cst, align 4
22 declare void @bar({i32, i32} %a)
33 declare i32 @baz(i32 %a)
44
5 ; CHECK: define i32 @foo
5 ; CHECK-LABEL: define i32 @foo(
66 ; CHECK-NOT: extractvalue
77 define i32 @foo(i32 %a, i32 %b) {
88 ; Instcombine should fold various combinations of insertvalue and extractvalue
3838 ret i32 %v5
3939 }
4040
41 ; CHECK: define i32 @extract2gep
41 ; CHECK-LABEL: define i32 @extract2gep(
4242 ; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}* %pair, i32 0, i32 1
4343 ; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32* [[GEP]]
4444 ; CHECK-NEXT: store
6666 ret i32 %E
6767 }
6868
69 ; CHECK: define i32 @doubleextract2gep
69 ; CHECK-LABEL: define i32 @doubleextract2gep(
7070 ; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}* %arg, i32 0, i32 1, i32 1
7171 ; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32* [[GEP]]
7272 ; CHECK-NEXT: ret i32 [[LOAD]]
989989 }
990990
991991 ; PR16244
992 ; CHECK: define i1 @test71
992 ; CHECK-LABEL: define i1 @test71(
993993 ; CHECK-NEXT: ret i1 false
994994 define i1 @test71(i8* %x) {
995995 %a = getelementptr i8* %x, i64 8
55 define void @test1(i8* %a) {
66 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 false)
77 ret void
8 ; CHECK: define void @test1
8 ; CHECK-LABEL: define void @test1(
99 ; CHECK-NEXT: ret void
1010 }
1111
1414 define void @test2(i8* %a) {
1515 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 true)
1616 ret void
17 ; CHECK: define void @test2
17 ; CHECK-LABEL: define void @test2(
1818 ; CHECK-NEXT: call void @llvm.memcpy
1919 }
2020
2121 define void @test3(i8* %d, i8* %s) {
2222 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 17179869184, i32 4, i1 false)
2323 ret void
24 ; CHECK: define void @test3
24 ; CHECK-LABEL: define void @test3(
2525 ; CHECK-NEXT: call void @llvm.memcpy
2626 }
1313 @.str2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
1414
1515 define void @test1(%struct.__sFILE* %stream) nounwind {
16 ; CHECK: define void @test1
16 ; CHECK-LABEL: define void @test1(
1717 ; CHECK: call i32 @"fwrite$UNIX2003"
1818 %call = tail call i32 (%struct.__sFILE*, i8*, ...)* @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0)) nounwind
1919 ret void
2020 }
2121
2222 define void @test2(%struct.__sFILE* %stream, i8* %str) nounwind ssp {
23 ; CHECK: define void @test2
23 ; CHECK-LABEL: define void @test2(
2424 ; CHECK: call i32 @"fputs$UNIX2003"
2525 %call = tail call i32 (%struct.__sFILE*, i8*, ...)* @fprintf(%struct.__sFILE* %stream, i8* getelementptr inbounds ([3 x i8]* @.str2, i32 0, i32 0), i8* %str) nounwind
2626 ret void
154154
155155 define <4 x float> @dead_shuffle_elt(<4 x float> %x, <2 x float> %y) nounwind {
156156 entry:
157 ; CHECK: define <4 x float> @dead_shuffle_elt
157 ; CHECK-LABEL: define <4 x float> @dead_shuffle_elt(
158158 ; CHECK: shufflevector <2 x float> %y, <2 x float> undef, <4 x i32>
159159 %shuffle.i = shufflevector <2 x float> %y, <2 x float> %y, <4 x i32>
160160 %shuffle9.i = shufflevector <4 x float> %x, <4 x float> %shuffle.i, <4 x i32>
77 @.str = private constant [2 x i8] c"y\00"
88
99 define i32 @foo() nounwind {
10 ; CHECK: define i32 @foo
10 ; CHECK-LABEL: define i32 @foo(
1111 ; CHECK: call i32 @strcmp
1212 ; CHECK: ret i32 %temp1
1313
1919 }
2020
2121 define i32 @bar() nounwind {
22 ; CHECK: define i32 @bar
22 ; CHECK-LABEL: define i32 @bar(
2323 ; CHECK: ret i32 0
2424
2525 entry:
2626 ; MERGE: @j = global
2727 @j = global i32 0
2828
29 ; NOARGS: define internal void @main
30 ; LIST: define internal void @main
31 ; EMPTYFILE: define internal void @main
32 ; LIST2: define internal void @main
33 ; MERGE: define internal void @main
29 ; NOARGS-LABEL: define internal void @main(
30 ; LIST-LABEL: define internal void @main(
31 ; EMPTYFILE-LABEL: define internal void @main(
32 ; LIST2-LABEL: define internal void @main(
33 ; MERGE-LABEL: define internal void @main(
3434 define void @main() {
3535 ret void
3636 }
3737
38 ; NOARGS: define internal void @foo
39 ; LIST: define void @foo
40 ; EMPTYFILE: define internal void @foo
41 ; LIST2: define void @foo
42 ; MERGE: define void @foo
38 ; NOARGS-LABEL: define internal void @foo(
39 ; LIST-LABEL: define void @foo(
40 ; EMPTYFILE-LABEL: define internal void @foo(
41 ; LIST2-LABEL: define void @foo(
42 ; MERGE-LABEL: define void @foo(
4343 define void @foo() {
4444 ret void
4545 }
4646
47 ; NOARGS: define internal void @bar
48 ; LIST: define internal void @bar
49 ; EMPTYFILE: define internal void @bar
50 ; LIST2: define void @bar
51 ; MERGE: define void @bar
47 ; NOARGS-LABEL: define internal void @bar(
48 ; LIST-LABEL: define internal void @bar(
49 ; EMPTYFILE-LABEL: define internal void @bar(
50 ; LIST2-LABEL: define void @bar(
51 ; MERGE-LABEL: define void @bar(
5252 define void @bar() {
5353 ret void
5454 }
0 ; RUN: opt < %s -internalize -internalize-public-api-list foo -S | FileCheck %s
11
2 ; CHECK: define void @foo
2 ; CHECK-LABEL: define void @foo(
33 define void @foo() {
44 ret void
55 }
66
7 ; CHECK: define internal void @zed
7 ; CHECK-LABEL: define internal void @zed(
88 define void @zed() {
99 ret void
1010 }
1111
12 ; CHECK: define available_externally void @bar
12 ; CHECK-LABEL: define available_externally void @bar(
1313 define available_externally void @bar() {
1414 ret void
1515 }
1313
1414 end:
1515 ret i32 %val
16 ; CHECK: define i32 @test1(
16 ; CHECK-LABEL: define i32 @test1(
1717 ; CHECK: load atomic
1818 ; CHECK-NEXT: br label %loop
1919 }
3232
3333 end:
3434 ret i32 %val
35 ; CHECK: define i32 @test2(
35 ; CHECK-LABEL: define i32 @test2(
3636 ; CHECK: load atomic
3737 ; CHECK-NEXT: %exitcond = icmp ne
3838 ; CHECK-NEXT: br i1 %exitcond, label %end, label %loop
5353
5454 end:
5555 ret i32 %vala
56 ; CHECK: define i32 @test3(
56 ; CHECK-LABEL: define i32 @test3(
5757 ; CHECK: load atomic i32* %x unordered
5858 ; CHECK-NEXT: br label %loop
5959 }
7272
7373 end:
7474 ret i32 %vala
75 ; CHECK: define i32 @test4(
75 ; CHECK-LABEL: define i32 @test4(
7676 ; CHECK: load atomic i32* %y monotonic
7777 ; CHECK-NEXT: store atomic
7878 }
5151
5252 ; This loop invariant instruction should be constant folded, not hoisted.
5353 define i32 @test3(i1 %c) {
54 ; CHECK: define i32 @test3
54 ; CHECK-LABEL: define i32 @test3(
5555 ; CHECK: call void @foo2(i32 6)
5656 %A = load i32* @X ; [#uses=2]
5757 br label %Loop
33 declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
44
55 define i32 @tak(i32 %x, i32 %y, i32 %z) nounwind ssp {
6 ; CHECK: define i32 @tak
6 ; CHECK-LABEL: define i32 @tak(
77 ; CHECK: entry
88 ; CHECK-NEXT: call void @llvm.dbg.value(metadata !{i32 %x}
99
4242 define void @FindFreeHorzSeg(i64 %startCol, i64 %row, i64* %rowStart) {
4343 ; Ensure that the loop increment basic block is rotated into the tail of the
4444 ; body, even though it contains a debug intrinsic call.
45 ; CHECK: define void @FindFreeHorzSeg
45 ; CHECK-LABEL: define void @FindFreeHorzSeg(
4646 ; CHECK: %dec = add
4747 ; CHECK-NEXT: tail call void @llvm.dbg.value
4848 ; CHECK-NEXT: br i1 %tobool, label %for.cond, label %for.end
2828 }
2929
3030 ; Should only end up with one phi.
31 ; CHECK: define void @test
31 ; CHECK-LABEL: define void @test(
3232 ; CHECK-NEXT: entry:
3333 ; CHECK-NEXT: br label %for.body
3434 ; CHECK: for.body:
55 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
66
77 define void @Z4() nounwind {
8 ; CHECK: define void @Z4
8 ; CHECK-LABEL: define void @Z4(
99 bb:
1010 br label %bb3
1111
2121 ; Foo.A[i] = Foo.B[i] + a;
2222 ; return Foo.A[a];
2323 ; }
24 ; CHECK: define i32 @noAlias01
24 ; CHECK-LABEL: define i32 @noAlias01(
2525 ; CHECK: add nsw <4 x i32>
2626 ; CHECK: ret
2727
6969 ; Foo.A[i] = Foo.B[i+10] + a;
7070 ; return Foo.A[a];
7171 ; }
72 ; CHECK: define i32 @noAlias02
72 ; CHECK-LABEL: define i32 @noAlias02(
7373 ; CHECK: add nsw <4 x i32>
7474 ; CHECK: ret
7575
118118 ; Foo.A[i+10] = Foo.B[i] + a;
119119 ; return Foo.A[a];
120120 ; }
121 ; CHECK: define i32 @noAlias03
121 ; CHECK-LABEL: define i32 @noAlias03(
122122 ; CHECK: add nsw <4 x i32>
123123 ; CHECK: ret
124124
167167 ; *(PA+i) = *(PB+i) + a;
168168 ; return *(PA+a);
169169 ; }
170 ; CHECK: define i32 @noAlias04
170 ; CHECK-LABEL: define i32 @noAlias04(
171171 ; CHECK-NOT: add nsw <4 x i32>
172172 ; CHECK: ret
173173 ;
221221 ; Bar.A[N][i] = Bar.B[N][i] + a;
222222 ; return Bar.A[N][a];
223223 ; }
224 ; CHECK: define i32 @noAlias05
224 ; CHECK-LABEL: define i32 @noAlias05(
225225 ; CHECK: add nsw <4 x i32>
226226 ; CHECK: ret
227227
277277 ; Bar.A[N][i] = Bar.A[N+1][i] + a;
278278 ; return Bar.A[N][a];
279279 ; }
280 ; CHECK: define i32 @noAlias06
280 ; CHECK-LABEL: define i32 @noAlias06(
281281 ; CHECK: add nsw <4 x i32>
282282 ; CHECK: ret
283283
334334 ; Foo.A[SIZE-i-1] = Foo.B[SIZE-i-1] + a;
335335 ; return Foo.A[a];
336336 ; }
337 ; CHECK: define i32 @noAlias07
337 ; CHECK-LABEL: define i32 @noAlias07(
338338 ; CHECK: sub nsw <4 x i32>
339339 ; CHECK: ret
340340
386386 ; Foo.A[SIZE-i-1] = Foo.B[SIZE-i-10] + a;
387387 ; return Foo.A[a];
388388 ; }
389 ; CHECK: define i32 @noAlias08
389 ; CHECK-LABEL: define i32 @noAlias08(
390390 ; CHECK: sub nsw <4 x i32>
391391 ; CHECK: ret
392392
438438 ; Foo.A[SIZE-i-10] = Foo.B[SIZE-i-1] + a;
439439 ; return Foo.A[a];
440440 ; }
441 ; CHECK: define i32 @noAlias09
441 ; CHECK-LABEL: define i32 @noAlias09(
442442 ; CHECK: sub nsw <4 x i32>
443443 ; CHECK: ret
444444
490490 ; *(PA+SIZE-i-1) = *(PB+SIZE-i-1) + a;
491491 ; return *(PA+a);
492492 ; }
493 ; CHECK: define i32 @noAlias10
493 ; CHECK-LABEL: define i32 @noAlias10(
494494 ; CHECK-NOT: sub nsw <4 x i32>
495495 ; CHECK: ret
496496 ;
550550 ; Bar.A[N][SIZE-i-1] = Bar.B[N][SIZE-i-1] + a;
551551 ; return Bar.A[N][a];
552552 ; }
553 ; CHECK: define i32 @noAlias11
553 ; CHECK-LABEL: define i32 @noAlias11(
554554 ; CHECK: sub nsw <4 x i32>
555555 ; CHECK: ret
556556
610610 ; Bar.A[N][SIZE-i-1] = Bar.A[N+1][SIZE-i-1] + a;
611611 ; return Bar.A[N][a];
612612 ; }
613 ; CHECK: define i32 @noAlias12
613 ; CHECK-LABEL: define i32 @noAlias12(
614614 ; CHECK: sub nsw <4 x i32>
615615 ; CHECK: ret
616616
671671 ; Foo.A[i] = Foo.A[i+4] + a;
672672 ; return Foo.A[a];
673673 ; }
674 ; CHECK: define i32 @noAlias13
674 ; CHECK-LABEL: define i32 @noAlias13(
675675 ; CHECK: add nsw <4 x i32>
676676 ; CHECK: ret
677677
720720 ; Foo.A[SIZE-i-1] = Foo.A[SIZE-i-5] + a;
721721 ; return Foo.A[a];
722722 ; }
723 ; CHECK: define i32 @noAlias14
723 ; CHECK-LABEL: define i32 @noAlias14(
724724 ; CHECK: sub nsw <4 x i32>
725725 ; CHECK: ret
726726
776776 ; Foo.A[i] = Foo.B[SIZE-i-1] + a;
777777 ; return Foo.A[a];
778778 ; }
779 ; CHECK: define i32 @mayAlias01
779 ; CHECK-LABEL: define i32 @mayAlias01(
780780 ; CHECK-NOT: add nsw <4 x i32>
781781 ; CHECK: ret
782782
826826 ; Foo.A[SIZE-i-1] = Foo.B[i] + a;
827827 ; return Foo.A[a];
828828 ; }
829 ; CHECK: define i32 @mayAlias02
829 ; CHECK-LABEL: define i32 @mayAlias02(
830830 ; CHECK-NOT: add nsw <4 x i32>
831831 ; CHECK: ret
832832
876876 ; *(PA+i) = *(PB+SIZE-i-1) + a;
877877 ; return *(PA+a);
878878 ; }
879 ; CHECK: define i32 @mayAlias03
879 ; CHECK-LABEL: define i32 @mayAlias03(
880880 ; CHECK-NOT: add nsw <4 x i32>
881881 ; CHECK: ret
882882
933933 ; Foo.A[i+10] = Foo.B[SIZE-i-1] + a;
934934 ; return Foo.A[a];
935935 ; }
936 ; CHECK: define i32 @mustAlias01
936 ; CHECK-LABEL: define i32 @mustAlias01(
937937 ; CHECK-NOT: add nsw <4 x i32>
938938 ; CHECK: ret
939939
983983 ; Foo.A[i] = Foo.B[SIZE-i-10] + a;
984984 ; return Foo.A[a];
985985 ; }
986 ; CHECK: define i32 @mustAlias02
986 ; CHECK-LABEL: define i32 @mustAlias02(
987987 ; CHECK-NOT: add nsw <4 x i32>
988988 ; CHECK: ret
989989
10321032 ; Foo.A[i+10] = Foo.B[SIZE-i-10] + a;
10331033 ; return Foo.A[a];
10341034 ; }
1035 ; CHECK: define i32 @mustAlias03
1035 ; CHECK-LABEL: define i32 @mustAlias03(
10361036 ; CHECK-NOT: add nsw <4 x i32>
10371037 ; CHECK: ret
10381038
2626 ; Simple retain+release pair deletion, with some intervening control
2727 ; flow and harmless instructions.
2828
29 ; CHECK: define void @test0(
29 ; CHECK-LABEL: define void @test0(
3030 ; CHECK: entry:
3131 ; CHECK: call void @llvm.arc.annotation.bottomup.bbstart(i8** @x, i8** @S_None)
3232 ; CHECK: %0 = tail call i8* @objc_retain(i8* %a) #0, !llvm.arc.annotation.bottomup ![[ANN0:[0-9]+]], !llvm.arc.annotation.topdown ![[ANN1:[0-9]+]]
176176 ret void
177177 }
178178
179 ; CHECK: define void @test1b_imprecise(
179 ; CHECK-LABEL: define void @test1b_imprecise(
180180 ; CHECK: entry:
181181 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW:#[0-9]+]]
182182 ; CHECK-NOT: @objc_
209209 ; Like test0 but the pointer is passed to an intervening call,
210210 ; so the optimization is not safe.
211211
212 ; CHECK: define void @test2_precise(
212 ; CHECK-LABEL: define void @test2_precise(
213213 ; CHECK: @objc_retain(i8* %a)
214214 ; CHECK: @objc_release
215215 ; CHECK: }
238238 ret void
239239 }
240240
241 ; CHECK: define void @test2_imprecise(
241 ; CHECK-LABEL: define void @test2_imprecise(
242242 ; CHECK: @objc_retain(i8* %a)
243243 ; CHECK: @objc_release
244244 ; CHECK: }
272272
273273 ; TODO: For now, assume this can't happen.
274274
275 ; CHECK: define void @test3_precise(
275 ; CHECK-LABEL: define void @test3_precise(
276276 ; TODO: @objc_retain(i8* %a)
277277 ; TODO: @objc_release
278278 ; CHECK: }
292292 ret void
293293 }
294294
295 ; CHECK: define void @test3_imprecise(
295 ; CHECK-LABEL: define void @test3_imprecise(
296296 ; TODO: @objc_retain(i8* %a)
297297 ; TODO: @objc_release
298298 ; CHECK: }
318318 ; Like test0 but the retain is in a loop,
319319 ; so the optimization is not safe.
320320
321 ; CHECK: define void @test4_precise(
321 ; CHECK-LABEL: define void @test4_precise(
322322 ; TODO: @objc_retain(i8* %a)
323323 ; TODO: @objc_release
324324 ; CHECK: }
338338 ret void
339339 }
340340
341 ; CHECK: define void @test4_imprecise(
341 ; CHECK-LABEL: define void @test4_imprecise(
342342 ; TODO: @objc_retain(i8* %a)
343343 ; TODO: @objc_release
344344 ; CHECK: }
362362 ; Like test0 but the pointer is conditionally passed to an intervening call,
363363 ; so the optimization is not safe.
364364
365 ; CHECK: define void @test5a(
365 ; CHECK-LABEL: define void @test5a(
366366 ; CHECK: @objc_retain(i8*
367367 ; CHECK: @objc_release
368368 ; CHECK: }
378378 ret void
379379 }
380380
381 ; CHECK: define void @test5b(
381 ; CHECK-LABEL: define void @test5b(
382382 ; CHECK: @objc_retain(i8*
383383 ; CHECK: @objc_release
384384 ; CHECK: }
398398 ; retain+release pair deletion, where the release happens on two different
399399 ; flow paths.
400400
401 ; CHECK: define void @test6a(
401 ; CHECK-LABEL: define void @test6a(
402402 ; CHECK: entry:
403403 ; CHECK: tail call i8* @objc_retain(
404404 ; CHECK: t:
432432 ret void
433433 }
434434
435 ; CHECK: define void @test6b(
435 ; CHECK-LABEL: define void @test6b(
436436 ; CHECK-NOT: @objc_
437437 ; CHECK: }
438438 define void @test6b(i32* %x, i1 %p) nounwind {
460460 ret void
461461 }
462462
463 ; CHECK: define void @test6c(
463 ; CHECK-LABEL: define void @test6c(
464464 ; CHECK: entry:
465465 ; CHECK: tail call i8* @objc_retain(
466466 ; CHECK: t:
494494 ret void
495495 }
496496
497 ; CHECK: define void @test6d(
497 ; CHECK-LABEL: define void @test6d(
498498 ; CHECK: entry:
499499 ; CHECK: tail call i8* @objc_retain(
500500 ; CHECK: t:
532532 ; retain+release pair deletion, where the retain happens on two different
533533 ; flow paths.
534534
535 ; CHECK: define void @test7(
535 ; CHECK-LABEL: define void @test7(
536536 ; CHECK: entry:
537537 ; CHECK-NOT: objc_
538538 ; CHECK: t:
566566 ret void
567567 }
568568
569 ; CHECK: define void @test7b(
569 ; CHECK-LABEL: define void @test7b(
570570 ; CHECK-NOT: @objc_
571571 ; CHECK: }
572572 define void @test7b(i32* %x, i1 %p) nounwind {
595595
596596 ; Like test7, but there's a retain/retainBlock mismatch. Don't delete!
597597
598 ; CHECK: define void @test7c
598 ; CHECK-LABEL: define void @test7c(
599599 ; CHECK: t:
600600 ; CHECK: call i8* @objc_retainBlock
601601 ; CHECK: f:
630630 ; retain+release pair deletion, where the retain and release both happen on
631631 ; different flow paths. Wild!
632632
633 ; CHECK: define void @test8a(
633 ; CHECK-LABEL: define void @test8a(
634634 ; CHECK: entry:
635635 ; CHECK: t:
636636 ; CHECK: @objc_retain
678678 ret void
679679 }
680680
681 ; CHECK: define void @test8b(
681 ; CHECK-LABEL: define void @test8b(
682682 ; CHECK-NOT: @objc_
683683 ; CHECK: }
684684 define void @test8b(i32* %x, i1 %p, i1 %q) nounwind {
716716 ret void
717717 }
718718
719 ; CHECK: define void @test8c(
719 ; CHECK-LABEL: define void @test8c(
720720 ; CHECK: entry:
721721 ; CHECK: t:
722722 ; CHECK: @objc_retain
764764 ret void
765765 }
766766
767 ; CHECK: define void @test8d(
767 ; CHECK-LABEL: define void @test8d(
768768 ; CHECK: entry:
769769 ; CHECK: t:
770770 ; CHECK: @objc_retain
814814
815815 ; Trivial retain+release pair deletion.
816816
817 ; CHECK: define void @test9(
817 ; CHECK-LABEL: define void @test9(
818818 ; CHECK-NOT: @objc_
819819 ; CHECK: }
820820 define void @test9(i8* %x) nounwind {
826826
827827 ; Retain+release pair, but on an unknown pointer relationship. Don't delete!
828828
829 ; CHECK: define void @test9b
829 ; CHECK-LABEL: define void @test9b(
830830 ; CHECK: @objc_retain(i8* %x)
831831 ; CHECK: @objc_release(i8* %s)
832832 ; CHECK: }
840840
841841 ; Trivial retain+release pair with intervening calls - don't delete!
842842
843 ; CHECK: define void @test10(
843 ; CHECK-LABEL: define void @test10(
844844 ; CHECK: @objc_retain(i8* %x)
845845 ; CHECK: @callee
846846 ; CHECK: @use_pointer
859859 ; Also, add a tail keyword, since objc_retain can never be passed
860860 ; a stack argument.
861861
862 ; CHECK: define void @test11(
862 ; CHECK-LABEL: define void @test11(
863863 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
864864 ; CHECK: call i8* @objc_autorelease(i8* %0) [[NUW]]
865865 ; CHECK: }
873873
874874 ; Same as test11 but with no use_pointer call. Delete the pair!
875875
876 ; CHECK: define void @test11a(
876 ; CHECK-LABEL: define void @test11a(
877877 ; CHECK: entry:
878878 ; CHECK-NEXT: ret void
879879 ; CHECK: }
888888 ; since if the frontend emitted code for an __autoreleasing variable, we may
889889 ; want it to be in the autorelease pool.
890890
891 ; CHECK: define i8* @test11b(
891 ; CHECK-LABEL: define i8* @test11b(
892892 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
893893 ; CHECK: call i8* @objc_autorelease(i8* %0) [[NUW]]
894894 ; CHECK: }
902902 ; Trivial retain,release pair with intervening call, but it's dominated
903903 ; by another retain - delete!
904904
905 ; CHECK: define void @test12(
905 ; CHECK-LABEL: define void @test12(
906906 ; CHECK-NEXT: entry:
907907 ; CHECK-NEXT: @objc_retain(i8* %x)
908908 ; CHECK-NOT: @objc_
919919
920920 ; Trivial retain,autorelease pair. Don't delete!
921921
922 ; CHECK: define void @test13(
922 ; CHECK-LABEL: define void @test13(
923923 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
924924 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
925925 ; CHECK: @use_pointer(i8* %x)
936936
937937 ; Delete the retain+release pair.
938938
939 ; CHECK: define void @test13b
939 ; CHECK-LABEL: define void @test13b(
940940 ; CHECK-NEXT: entry:
941941 ; CHECK-NEXT: @objc_retain(i8* %x)
942942 ; CHECK-NEXT: @use_pointer
956956 ; Don't delete the retain+release pair because there's an
957957 ; autoreleasePoolPop in the way.
958958
959 ; CHECK: define void @test13c
959 ; CHECK-LABEL: define void @test13c(
960960 ; CHECK: @objc_retain(i8* %x)
961961 ; CHECK: @objc_autoreleasePoolPop
962962 ; CHECK: @objc_retain(i8* %x)
977977 ; Like test13c, but there's an autoreleasePoolPush in the way, but that
978978 ; doesn't matter.
979979
980 ; CHECK: define void @test13d
980 ; CHECK-LABEL: define void @test13d(
981981 ; CHECK-NEXT: entry:
982982 ; CHECK-NEXT: @objc_retain(i8* %x)
983983 ; CHECK-NEXT: @objc_autoreleasePoolPush
999999 ; Trivial retain,release pair with intervening call, but it's post-dominated
10001000 ; by another release - delete!
10011001
1002 ; CHECK: define void @test14(
1002 ; CHECK-LABEL: define void @test14(
10031003 ; CHECK-NEXT: entry:
10041004 ; CHECK-NEXT: @use_pointer
10051005 ; CHECK-NEXT: @use_pointer
10191019 ; Trivial retain,autorelease pair with intervening call, but it's post-dominated
10201020 ; by another release. Don't delete anything.
10211021
1022 ; CHECK: define void @test15(
1022 ; CHECK-LABEL: define void @test15(
10231023 ; CHECK-NEXT: entry:
10241024 ; CHECK-NEXT: @objc_retain(i8* %x)
10251025 ; CHECK-NEXT: @use_pointer
10391039 ; Trivial retain,autorelease pair, post-dominated
10401040 ; by another release. Delete the retain and release.
10411041
1042 ; CHECK: define void @test15b
1042 ; CHECK-LABEL: define void @test15b(
10431043 ; CHECK-NEXT: entry:
10441044 ; CHECK-NEXT: @objc_retain
10451045 ; CHECK-NEXT: @objc_autorelease
10541054 ret void
10551055 }
10561056
1057 ; CHECK: define void @test15c
1057 ; CHECK-LABEL: define void @test15c(
10581058 ; CHECK-NEXT: entry:
10591059 ; CHECK-NEXT: @objc_autorelease
10601060 ; CHECK-NEXT: ret void
10691069
10701070 ; Retain+release pairs in diamonds, all dominated by a retain.
10711071
1072 ; CHECK: define void @test16a(
1072 ; CHECK-LABEL: define void @test16a(
10731073 ; CHECK: @objc_retain(i8* %x)
10741074 ; CHECK-NOT: @objc
10751075 ; CHECK: }
11031103 ret void
11041104 }
11051105
1106 ; CHECK: define void @test16b(
1106 ; CHECK-LABEL: define void @test16b(
11071107 ; CHECK: @objc_retain(i8* %x)
11081108 ; CHECK-NOT: @objc
11091109 ; CHECK: }
11371137 ret void
11381138 }
11391139
1140 ; CHECK: define void @test16c(
1140 ; CHECK-LABEL: define void @test16c(
11411141 ; CHECK: @objc_retain(i8* %x)
11421142 ; CHECK-NOT: @objc
11431143 ; CHECK: }
11711171 ret void
11721172 }
11731173
1174 ; CHECK: define void @test16d(
1174 ; CHECK-LABEL: define void @test16d(
11751175 ; CHECK: @objc_retain(i8* %x)
11761176 ; CHECK-NOT: @objc
11771177 ; CHECK: }
12081208
12091209 ; Retain+release pairs in diamonds, all post-dominated by a release.
12101210
1211 ; CHECK: define void @test17(
1211 ; CHECK-LABEL: define void @test17(
12121212 ; CHECK-NOT: @objc_
12131213 ; CHECK: purple:
12141214 ; CHECK: @objc_release
12451245
12461246 ; Delete no-ops.
12471247
1248 ; CHECK: define void @test18(
1248 ; CHECK-LABEL: define void @test18(
12491249 ; CHECK-NOT: @objc_
12501250 ; CHECK: }
12511251 define void @test18() {
12571257
12581258 ; Delete no-ops where undef can be assumed to be null.
12591259
1260 ; CHECK: define void @test18b
1260 ; CHECK-LABEL: define void @test18b(
12611261 ; CHECK-NOT: @objc_
12621262 ; CHECK: }
12631263 define void @test18b() {
12931293
12941294 ; Bitcast insertion
12951295
1296 ; CHECK: define void @test20(
1296 ; CHECK-LABEL: define void @test20(
12971297 ; CHECK: %tmp1 = tail call i8* @objc_retain(i8* %tmp) [[NUW]]
12981298 ; CHECK-NEXT: invoke
12991299 ; CHECK: }
13211321 ; Delete a redundant retain,autorelease when forwaring a call result
13221322 ; directly to a return value.
13231323
1324 ; CHECK: define i8* @test21(
1324 ; CHECK-LABEL: define i8* @test21(
13251325 ; CHECK: call i8* @returner()
13261326 ; CHECK-NEXT: ret i8* %call
13271327 ; CHECK-NEXT: }
13351335
13361336 ; Move an objc call up through a phi that has null operands.
13371337
1338 ; CHECK: define void @test22(
1338 ; CHECK-LABEL: define void @test22(
13391339 ; CHECK: B:
13401340 ; CHECK: %1 = bitcast double* %p to i8*
13411341 ; CHECK: call void @objc_release(i8* %1)
13581358
13591359 ; Optimize objc_retainBlock.
13601360
1361 ; CHECK: define void @test23(
1361 ; CHECK-LABEL: define void @test23(
13621362 ; CHECK-NOT: @objc_
13631363 ; CHECK: }
13641364 %block0 = type { i64, i64, i8*, i8* }
13921392
13931393 ; Don't optimize objc_retainBlock, because there's no copy_on_escape metadata.
13941394
1395 ; CHECK: define void @test23c(
1395 ; CHECK-LABEL: define void @test23c(
13961396 ; CHECK: @objc_retainBlock
13971397 ; CHECK: @objc_release
13981398 ; CHECK: }
14071407
14081408 ; Any call can decrement a retain count.
14091409
1410 ; CHECK: define void @test24(
1410 ; CHECK-LABEL: define void @test24(
14111411 ; CHECK: @objc_retain(i8* %a)
14121412 ; CHECK: @objc_release
14131413 ; CHECK: }
14221422 ; Don't move a retain/release pair if the release can be moved
14231423 ; but the retain can't be moved to balance it.
14241424
1425 ; CHECK: define void @test25(
1425 ; CHECK-LABEL: define void @test25(
14261426 ; CHECK: entry:
14271427 ; CHECK: call i8* @objc_retain(i8* %p)
14281428 ; CHECK: true:
14471447 ; Don't move a retain/release pair if the retain can be moved
14481448 ; but the release can't be moved to balance it.
14491449
1450 ; CHECK: define void @test26(
1450 ; CHECK-LABEL: define void @test26(
14511451 ; CHECK: entry:
14521452 ; CHECK: call i8* @objc_retain(i8* %p)
14531453 ; CHECK: true:
14711471
14721472 ; Don't sink the retain,release into the loop.
14731473
1474 ; CHECK: define void @test27(
1474 ; CHECK-LABEL: define void @test27(
14751475 ; CHECK: entry:
14761476 ; CHECK: call i8* @objc_retain(i8* %p)
14771477 ; CHECK: loop:
14961496
14971497 ; Trivial code motion case: Triangle.
14981498
1499 ; CHECK: define void @test28(
1499 ; CHECK-LABEL: define void @test28(
15001500 ; CHECK-NOT: @objc_
15011501 ; CHECK: true:
15021502 ; CHECK: call i8* @objc_retain(
15241524 ; Trivial code motion case: Triangle, but no metadata. Don't move past
15251525 ; unrelated memory references!
15261526
1527 ; CHECK: define void @test28b
1527 ; CHECK-LABEL: define void @test28b(
15281528 ; CHECK: call i8* @objc_retain(
15291529 ; CHECK: true:
15301530 ; CHECK-NOT: @objc_
15541554 ; Trivial code motion case: Triangle, with metadata. Do move past
15551555 ; unrelated memory references! And preserve the metadata.
15561556
1557 ; CHECK: define void @test28c
1557 ; CHECK-LABEL: define void @test28c(
15581558 ; CHECK-NOT: @objc_
15591559 ; CHECK: true:
15601560 ; CHECK: call i8* @objc_retain(
15821582
15831583 ; Like test28. but with two releases.
15841584
1585 ; CHECK: define void @test29(
1585 ; CHECK-LABEL: define void @test29(
15861586 ; CHECK-NOT: @objc_
15871587 ; CHECK: true:
15881588 ; CHECK: call i8* @objc_retain(
16171617 ; Basic case with the use and call in a diamond
16181618 ; with an extra release.
16191619
1620 ; CHECK: define void @test30(
1620 ; CHECK-LABEL: define void @test30(
16211621 ; CHECK-NOT: @objc_
16221622 ; CHECK: true:
16231623 ; CHECK: call i8* @objc_retain(
16561656
16571657 ; Basic case with a mergeable release.
16581658
1659 ; CHECK: define void @test31(
1659 ; CHECK-LABEL: define void @test31(
16601660 ; CHECK: call i8* @objc_retain(i8* %p)
16611661 ; CHECK: call void @callee()
16621662 ; CHECK: store
16851685
16861686 ; Don't consider bitcasts or getelementptrs direct uses.
16871687
1688 ; CHECK: define void @test32(
1688 ; CHECK-LABEL: define void @test32(
16891689 ; CHECK-NOT: @objc_
16901690 ; CHECK: true:
16911691 ; CHECK: call i8* @objc_retain(
17141714
17151715 ; Do consider icmps to be direct uses.
17161716
1717 ; CHECK: define void @test33(
1717 ; CHECK-LABEL: define void @test33(
17181718 ; CHECK-NOT: @objc_
17191719 ; CHECK: true:
17201720 ; CHECK: call i8* @objc_retain(
17441744 ; Delete retain,release if there's just a possible dec and we have imprecise
17451745 ; releases.
17461746
1747 ; CHECK: define void @test34a(
1747 ; CHECK-LABEL: define void @test34a(
17481748 ; CHECK: call i8* @objc_retain
17491749 ; CHECK: true:
17501750 ; CHECK: done:
17661766 ret void
17671767 }
17681768
1769 ; CHECK: define void @test34b(
1769 ; CHECK-LABEL: define void @test34b(
17701770 ; CHECK-NOT: @objc_
17711771 ; CHECK: }
17721772 define void @test34b(i8* %p, i1 %x, i8* %y) {
17901790 ; release.
17911791
17921792 ; Precise.
1793 ; CHECK: define void @test35a(
1793 ; CHECK-LABEL: define void @test35a(
17941794 ; CHECK: entry:
17951795 ; CHECK: call i8* @objc_retain
17961796 ; CHECK: true:
18141814 }
18151815
18161816 ; Imprecise.
1817 ; CHECK: define void @test35b(
1817 ; CHECK-LABEL: define void @test35b(
18181818 ; CHECK-NOT: @objc_
18191819 ; CHECK: }
18201820 define void @test35b(i8* %p, i1 %x, i8* %y) {
18351835
18361836 ; Delete a retain,release if there's no actual use and we have precise release.
18371837
1838 ; CHECK: define void @test36a(
1838 ; CHECK-LABEL: define void @test36a(
18391839 ; CHECK: @objc_retain
18401840 ; CHECK: call void @callee()
18411841 ; CHECK-NOT: @objc_
18531853
18541854 ; Like test36, but with metadata.
18551855
1856 ; CHECK: define void @test36b(
1856 ; CHECK-LABEL: define void @test36b(
18571857 ; CHECK-NOT: @objc_
18581858 ; CHECK: }
18591859 define void @test36b(i8* %p) {
18671867
18681868 ; Be aggressive about analyzing phis to eliminate possible uses.
18691869
1870 ; CHECK: define void @test38(
1870 ; CHECK-LABEL: define void @test38(
18711871 ; CHECK-NOT: @objc_
18721872 ; CHECK: }
18731873 define void @test38(i8* %p, i1 %u, i1 %m, i8* %z, i8* %y, i8* %x, i8* %w) {
19011901
19021902 ; Delete retain,release pairs around loops.
19031903
1904 ; CHECK: define void @test39(
1904 ; CHECK-LABEL: define void @test39(
19051905 ; CHECK-NOT: @objc_
19061906 ; CHECK: }
19071907 define void @test39(i8* %p) {
19191919
19201920 ; Delete retain,release pairs around loops containing uses.
19211921
1922 ; CHECK: define void @test39b(
1922 ; CHECK-LABEL: define void @test39b(
19231923 ; CHECK-NOT: @objc_
19241924 ; CHECK: }
19251925 define void @test39b(i8* %p) {
19381938
19391939 ; Delete retain,release pairs around loops containing potential decrements.
19401940
1941 ; CHECK: define void @test39c(
1941 ; CHECK-LABEL: define void @test39c(
19421942 ; CHECK-NOT: @objc_
19431943 ; CHECK: }
19441944 define void @test39c(i8* %p) {
19581958 ; Delete retain,release pairs around loops even if
19591959 ; the successors are in a different order.
19601960
1961 ; CHECK: define void @test40(
1961 ; CHECK-LABEL: define void @test40(
19621962 ; CHECK-NOT: @objc_
19631963 ; CHECK: }
19641964 define void @test40(i8* %p) {
19781978 ; Do the known-incremented retain+release elimination even if the pointer
19791979 ; is also autoreleased.
19801980
1981 ; CHECK: define void @test42(
1981 ; CHECK-LABEL: define void @test42(
19821982 ; CHECK-NEXT: entry:
19831983 ; CHECK-NEXT: call i8* @objc_retain(i8* %p)
19841984 ; CHECK-NEXT: call i8* @objc_autorelease(i8* %p)
20002000 ; Don't the known-incremented retain+release elimination if the pointer is
20012001 ; autoreleased and there's an autoreleasePoolPop.
20022002
2003 ; CHECK: define void @test43(
2003 ; CHECK-LABEL: define void @test43(
20042004 ; CHECK-NEXT: entry:
20052005 ; CHECK-NEXT: call i8* @objc_retain(i8* %p)
20062006 ; CHECK-NEXT: call i8* @objc_autorelease(i8* %p)
20262026 ; Do the known-incremented retain+release elimination if the pointer is
20272027 ; autoreleased and there's an autoreleasePoolPush.
20282028
2029 ; CHECK: define void @test43b
2029 ; CHECK-LABEL: define void @test43b(
20302030 ; CHECK-NEXT: entry:
20312031 ; CHECK-NEXT: call i8* @objc_retain(i8* %p)
20322032 ; CHECK-NEXT: call i8* @objc_autorelease(i8* %p)
20492049
20502050 ; Do retain+release elimination for non-provenance pointers.
20512051
2052 ; CHECK: define void @test44(
2052 ; CHECK-LABEL: define void @test44(
20532053 ; CHECK-NOT: objc_
20542054 ; CHECK: }
20552055 define void @test44(i8** %pp) {
20622062 ; Don't delete retain+release with an unknown-provenance
20632063 ; may-alias objc_release between them.
20642064
2065 ; CHECK: define void @test45(
2065 ; CHECK-LABEL: define void @test45(
20662066 ; CHECK: call i8* @objc_retain(i8* %p)
20672067 ; CHECK: call void @objc_release(i8* %q)
20682068 ; CHECK: call void @use_pointer(i8* %p)
20802080
20812081 ; Don't delete retain and autorelease here.
20822082
2083 ; CHECK: define void @test46(
2083 ; CHECK-LABEL: define void @test46(
20842084 ; CHECK: tail call i8* @objc_retain(i8* %p) [[NUW]]
20852085 ; CHECK: true:
20862086 ; CHECK: call i8* @objc_autorelease(i8* %p) [[NUW]]
21012101
21022102 ; Delete no-op cast calls.
21032103
2104 ; CHECK: define i8* @test47(
2104 ; CHECK-LABEL: define i8* @test47(
21052105 ; CHECK-NOT: call
21062106 ; CHECK: ret i8* %p
21072107 ; CHECK: }
21122112
21132113 ; Delete no-op cast calls.
21142114
2115 ; CHECK: define i8* @test48(
2115 ; CHECK-LABEL: define i8* @test48(
21162116 ; CHECK-NOT: call
21172117 ; CHECK: ret i8* %p
21182118 ; CHECK: }
21232123
21242124 ; Delete no-op cast calls.
21252125
2126 ; CHECK: define i8* @test49(
2126 ; CHECK-LABEL: define i8* @test49(
21272127 ; CHECK-NOT: call
21282128 ; CHECK: ret i8* %p
21292129 ; CHECK: }
21352135 ; Do delete retain+release with intervening stores of the address value if we
21362136 ; have imprecise release attached to objc_release.
21372137
2138 ; CHECK: define void @test50a(
2138 ; CHECK-LABEL: define void @test50a(
21392139 ; CHECK-NEXT: call i8* @objc_retain
21402140 ; CHECK-NEXT: call void @callee
21412141 ; CHECK-NEXT: store
21502150 ret void
21512151 }
21522152
2153 ; CHECK: define void @test50b(
2153 ; CHECK-LABEL: define void @test50b(
21542154 ; CHECK-NOT: @objc_
21552155 ; CHECK: }
21562156 define void @test50b(i8* %p, i8** %pp) {
21652165 ; Don't delete retain+release with intervening stores through the
21662166 ; address value.
21672167
2168 ; CHECK: define void @test51a(
2168 ; CHECK-LABEL: define void @test51a(
21692169 ; CHECK: call i8* @objc_retain(i8* %p)
21702170 ; CHECK: call void @objc_release(i8* %p)
21712171 ; CHECK: ret void
21782178 ret void
21792179 }
21802180
2181 ; CHECK: define void @test51b(
2181 ; CHECK-LABEL: define void @test51b(
21822182 ; CHECK: call i8* @objc_retain(i8* %p)
21832183 ; CHECK: call void @objc_release(i8* %p)
21842184 ; CHECK: ret void
21942194 ; Don't delete retain+release with intervening use of a pointer of
21952195 ; unknown provenance.
21962196
2197 ; CHECK: define void @test52a(
2197 ; CHECK-LABEL: define void @test52a(
21982198 ; CHECK: call i8* @objc_retain
21992199 ; CHECK: call void @callee()
22002200 ; CHECK: call void @use_pointer(i8* %z)
22112211 ret void
22122212 }
22132213
2214 ; CHECK: define void @test52b(
2214 ; CHECK-LABEL: define void @test52b(
22152215 ; CHECK: call i8* @objc_retain
22162216 ; CHECK: call void @callee()
22172217 ; CHECK: call void @use_pointer(i8* %z)
22332233 ; Oops. That's wrong. Clang sometimes uses function types gratuitously.
22342234 ; See rdar://10551239.
22352235
2236 ; CHECK: define void @test53(
2236 ; CHECK-LABEL: define void @test53(
22372237 ; CHECK: @objc_
22382238 ; CHECK: }
22392239 define void @test53(void ()** %zz, i8** %pp) {
22482248
22492249 ; Convert autorelease to release if the value is unused.
22502250
2251 ; CHECK: define void @test54(
2251 ; CHECK-LABEL: define void @test54(
22522252 ; CHECK: call i8* @returner()
22532253 ; CHECK-NEXT: call void @objc_release(i8* %t) [[NUW]], !clang.imprecise_release !0
22542254 ; CHECK-NEXT: ret void
22612261
22622262 ; Nested retain+release pairs. Delete them both.
22632263
2264 ; CHECK: define void @test55(
2264 ; CHECK-LABEL: define void @test55(
22652265 ; CHECK-NOT: @objc
22662266 ; CHECK: }
22672267 define void @test55(i8* %x) {
22782278 ; can be partially eliminated. Plus an extra outer pair to
22792279 ; eliminate, for fun.
22802280
2281 ; CHECK: define void @test56(
2281 ; CHECK-LABEL: define void @test56(
22822282 ; CHECK-NOT: @objc
22832283 ; CHECK: if.then:
22842284 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) [[NUW]]
23122312 ; known unnecessary because the presence of the second one means that
23132313 ; the first one won't be deleting the object.
23142314
2315 ; CHECK: define void @test57(
2315 ; CHECK-LABEL: define void @test57(
23162316 ; CHECK-NEXT: entry:
23172317 ; CHECK-NEXT: call void @use_pointer(i8* %x)
23182318 ; CHECK-NEXT: call void @use_pointer(i8* %x)
23382338 ; An adjacent retain+release pair is sufficient even if it will be
23392339 ; removed itself.
23402340
2341 ; CHECK: define void @test58(
2341 ; CHECK-LABEL: define void @test58(
23422342 ; CHECK-NEXT: entry:
23432343 ; CHECK-NEXT: call void @use_pointer(i8* %x)
23442344 ; CHECK-NEXT: call void @use_pointer(i8* %x)
23572357
23582358 ; Don't delete the second retain+release pair in an adjacent set.
23592359
2360 ; CHECK: define void @test59(
2360 ; CHECK-LABEL: define void @test59(
23612361 ; CHECK-NEXT: entry:
23622362 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) [[NUW]]
23632363 ; CHECK-NEXT: call void @use_pointer(i8* %x)
23842384 ; We have a precise lifetime retain/release here. We can not remove them since
23852385 ; @something is not constant.
23862386
2387 ; CHECK: define void @test60a(
2387 ; CHECK-LABEL: define void @test60a(
23882388 ; CHECK: call i8* @objc_retain
23892389 ; CHECK: call void @objc_release
23902390 ; CHECK: }
23982398 ret void
23992399 }
24002400
2401 ; CHECK: define void @test60b(
2401 ; CHECK-LABEL: define void @test60b(
24022402 ; CHECK: call i8* @objc_retain
24032403 ; CHECK-NOT: call i8* @objc_retain
24042404 ; CHECK-NOT: call i8* @objc_rrelease
24142414 ret void
24152415 }
24162416
2417 ; CHECK: define void @test60c(
2417 ; CHECK-LABEL: define void @test60c(
24182418 ; CHECK-NOT: @objc_
24192419 ; CHECK: }
24202420 define void @test60c() {
24272427 ret void
24282428 }
24292429
2430 ; CHECK: define void @test60d(
2430 ; CHECK-LABEL: define void @test60d(
24312431 ; CHECK-NOT: @objc_
24322432 ; CHECK: }
24332433 define void @test60d() {
24402440 ret void
24412441 }
24422442
2443 ; CHECK: define void @test60e(
2443 ; CHECK-LABEL: define void @test60e(
24442444 ; CHECK-NOT: @objc_
24452445 ; CHECK: }
24462446 define void @test60e() {
24562456 ; Constant pointers to objects don't need to be considered related to other
24572457 ; pointers.
24582458
2459 ; CHECK: define void @test61(
2459 ; CHECK-LABEL: define void @test61(
24602460 ; CHECK-NOT: @objc_
24612461 ; CHECK: }
24622462 define void @test61() {
24712471 ; Delete a retain matched by releases when one is inside the loop and the
24722472 ; other is outside the loop.
24732473
2474 ; CHECK: define void @test62(
2474 ; CHECK-LABEL: define void @test62(
24752475 ; CHECK-NOT: @objc_
24762476 ; CHECK: }
24772477 define void @test62(i8* %x, i1* %p) nounwind {
24952495 ; Like test62 but with no release in exit.
24962496 ; Don't delete anything!
24972497
2498 ; CHECK: define void @test63(
2498 ; CHECK-LABEL: define void @test63(
24992499 ; CHECK: loop:
25002500 ; CHECK: tail call i8* @objc_retain(i8* %x)
25012501 ; CHECK: loop.more:
25212521 ; Like test62 but with no release in loop.more.
25222522 ; Don't delete anything!
25232523
2524 ; CHECK: define void @test64(
2524 ; CHECK-LABEL: define void @test64(
25252525 ; CHECK: loop:
25262526 ; CHECK: tail call i8* @objc_retain(i8* %x)
25272527 ; CHECK: exit:
25462546
25472547 ; Move an autorelease past a phi with a null.
25482548
2549 ; CHECK: define i8* @test65(
2549 ; CHECK-LABEL: define i8* @test65(
25502550 ; CHECK: if.then:
25512551 ; CHECK: call i8* @objc_autorelease(
25522552 ; CHECK: return:
25692569
25702570 ; Don't move an autorelease past an autorelease pool boundary.
25712571
2572 ; CHECK: define i8* @test65b(
2572 ; CHECK-LABEL: define i8* @test65b(
25732573 ; CHECK: if.then:
25742574 ; CHECK-NOT: @objc_autorelease
25752575 ; CHECK: return:
25952595 ; Don't move an autoreleaseReuturnValue, which would break
25962596 ; the RV optimization.
25972597
2598 ; CHECK: define i8* @test65c(
2598 ; CHECK-LABEL: define i8* @test65c(
25992599 ; CHECK: if.then:
26002600 ; CHECK-NOT: @objc_autorelease
26012601 ; CHECK: return:
26192619 ; An objc_retain can serve as a may-use for a different pointer.
26202620 ; rdar://11931823
26212621
2622 ; CHECK: define void @test66a(
2622 ; CHECK-LABEL: define void @test66a(
26232623 ; CHECK: tail call i8* @objc_retain(i8* %cond) [[NUW]]
26242624 ; CHECK: tail call void @objc_release(i8* %call) [[NUW]]
26252625 ; CHECK: tail call i8* @objc_retain(i8* %tmp8) [[NUW]]
26422642 ret void
26432643 }
26442644
2645 ; CHECK: define void @test66b(
2645 ; CHECK-LABEL: define void @test66b(
26462646 ; CHECK: tail call i8* @objc_retain(i8* %cond) [[NUW]]
26472647 ; CHECK: tail call void @objc_release(i8* %call) [[NUW]]
26482648 ; CHECK: tail call i8* @objc_retain(i8* %tmp8) [[NUW]]
26652665 ret void
26662666 }
26672667
2668 ; CHECK: define void @test66c(
2668 ; CHECK-LABEL: define void @test66c(
26692669 ; CHECK: tail call i8* @objc_retain(i8* %cond) [[NUW]]
26702670 ; CHECK: tail call void @objc_release(i8* %call) [[NUW]]
26712671 ; CHECK: tail call i8* @objc_retain(i8* %tmp8) [[NUW]]
26882688 ret void
26892689 }
26902690
2691 ; CHECK: define void @test66d(
2691 ; CHECK-LABEL: define void @test66d(
26922692 ; CHECK: tail call i8* @objc_retain(i8* %cond) [[NUW]]
26932693 ; CHECK: tail call void @objc_release(i8* %call) [[NUW]]
26942694 ; CHECK: tail call i8* @objc_retain(i8* %tmp8) [[NUW]]
30443044 ; Make sure that we understand that objc_sync_{enter,exit} are IC_User not
30453045 ; IC_Call/IC_CallOrUser.
30463046
3047 ; CHECK: define void @test67
3047 ; CHECK-LABEL: define void @test67(
30483048 ; CHECK-NEXT: call i32 @objc_sync_enter(i8* %x)
30493049 ; CHECK-NEXT: call i32 @objc_sync_exit(i8* %x)
30503050 ; CHECK-NEXT: ret void
99 declare void @callee()
1010 declare void @block_callee(void ()*)
1111
12 ; CHECK: define void @test0(
12 ; CHECK-LABEL: define void @test0(
1313 ; CHECK: call i8* @objc_retain(
1414 ; CHECK: for.body:
1515 ; CHECK-NOT: @objc
3434 ret void
3535 }
3636
37 ; CHECK: define void @test1(
37 ; CHECK-LABEL: define void @test1(
3838 ; CHECK: call i8* @objc_retain(
3939 ; CHECK: for.body:
4040 ; CHECK-NOT: @objc
5959 ret void
6060 }
6161
62 ; CHECK: define void @test2(
62 ; CHECK-LABEL: define void @test2(
6363 ; CHECK: call i8* @objc_retain(
6464 ; CHECK: for.body:
6565 ; CHECK-NOT: @objc
77
88 @x = external global i8*
99
10 ; CHECK: define void @test0(
10 ; CHECK-LABEL: define void @test0(
1111 ; CHECK: entry:
1212 ; CHECK-NEXT: tail call void @objc_storeStrong(i8** @x, i8* %p) [[NUW:#[0-9]+]]
1313 ; CHECK-NEXT: ret void
136136
137137 ; Like test0, but there's no store, so don't form an objc_storeStrong.
138138
139 ; CHECK: define void @test7(
139 ; CHECK-LABEL: define void @test7(
140140 ; CHECK-NEXT: entry:
141141 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) [[NUW]]
142142 ; CHECK-NEXT: %tmp = load i8** @x, align 8
153153
154154 ; Like test0, but there's no retain, so don't form an objc_storeStrong.
155155
156 ; CHECK: define void @test8(
156 ; CHECK-LABEL: define void @test8(
157157 ; CHECK-NEXT: entry:
158158 ; CHECK-NEXT: %tmp = load i8** @x, align 8
159159 ; CHECK-NEXT: store i8* %p, i8** @x, align 8
1717
1818 ; Don't get in trouble on bugpointed code.
1919
20 ; CHECK: define void @test0(
20 ; CHECK-LABEL: define void @test0(
2121 define void @test0() {
2222 bb:
2323 %tmp = bitcast %4* undef to i8*
4444 ; When rewriting operands for a phi which has multiple operands
4545 ; for the same block, use the exactly same value in each block.
4646
47 ; CHECK: define void @test1(
47 ; CHECK-LABEL: define void @test1(
4848 ; CHECK: %0 = bitcast i8* %tmp3 to %0*
4949 ; CHECK: br i1 undef, label %bb7, label %bb7
5050 ; CHECK: bb7:
1111 declare i8* @returner()
1212 declare void @callee()
1313
14 ; CHECK: define void @test0
14 ; CHECK-LABEL: define void @test0(
1515 ; CHECK: call void @use_pointer(i8* %0)
1616 ; CHECK: }
1717 define void @test0(i8* %x) nounwind {
2121 ret void
2222 }
2323
24 ; CHECK: define void @test1
24 ; CHECK-LABEL: define void @test1(
2525 ; CHECK: call void @use_pointer(i8* %0)
2626 ; CHECK: }
2727 define void @test1(i8* %x) nounwind {
3333
3434 ; Merge objc_retain and objc_autorelease into objc_retainAutorelease.
3535
36 ; CHECK: define void @test2(
36 ; CHECK-LABEL: define void @test2(
3737 ; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) [[NUW:#[0-9]+]]
3838 ; CHECK: }
3939 define void @test2(i8* %x) nounwind {
4646
4747 ; Same as test2 but the value is returned. Do an RV optimization.
4848
49 ; CHECK: define i8* @test2b(
49 ; CHECK-LABEL: define i8* @test2b(
5050 ; CHECK: tail call i8* @objc_retainAutoreleaseReturnValue(i8* %x) [[NUW]]
5151 ; CHECK: }
5252 define i8* @test2b(i8* %x) nounwind {
5858
5959 ; Merge a retain,autorelease pair around a call.
6060
61 ; CHECK: define void @test3(
61 ; CHECK-LABEL: define void @test3(
6262 ; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) [[NUW]]
6363 ; CHECK: @use_pointer(i8* %0)
6464 ; CHECK: }
7373 ; Trivial retain,autorelease pair with intervening call, but it's post-dominated
7474 ; by another release. The retain and autorelease can be merged.
7575
76 ; CHECK: define void @test4(
76 ; CHECK-LABEL: define void @test4(
7777 ; CHECK-NEXT: entry:
7878 ; CHECK-NEXT: @objc_retainAutorelease(i8* %x) [[NUW]]
7979 ; CHECK-NEXT: @use_pointer
9191
9292 ; Don't merge retain and autorelease if they're not control-equivalent.
9393
94 ; CHECK: define void @test5(
94 ; CHECK-LABEL: define void @test5(
9595 ; CHECK: tail call i8* @objc_retain(i8* %p) [[NUW]]
9696 ; CHECK: true:
9797 ; CHECK: call i8* @objc_autorelease(i8* %0) [[NUW]]
118118 ; into objc_retainAutoreleasedReturnValueAutoreleaseReturnValue?
119119 ; Those entrypoints don't exist yet though.
120120
121 ; CHECK: define i8* @test6(
121 ; CHECK-LABEL: define i8* @test6(
122122 ; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %p) [[NUW]]
123123 ; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %1) [[NUW]]
124124 ; CHECK: }
147147
148148 ; Do the return value substitution for PHI nodes too.
149149
150 ; CHECK: define i8* @test8(
150 ; CHECK-LABEL: define i8* @test8(
151151 ; CHECK: %retval = phi i8* [ %p, %if.then ], [ null, %entry ]
152152 ; CHECK: }
153153 define i8* @test8(i1 %x, i8* %c) {
164164 }
165165
166166 ; Kill calls to @clang.arc.use(...)
167 ; CHECK: define void @test9(
167 ; CHECK-LABEL: define void @test9(
168168 ; CHECK-NOT: clang.arc.use
169169 ; CHECK: }
170170 define void @test9(i8* %a, i8* %b) {
187187 ; Convert objc_retain to objc_retainAutoreleasedReturnValue if its
188188 ; argument is a return value.
189189
190 ; CHECK: define void @test11(
190 ; CHECK-LABEL: define void @test11(
191191 ; CHECK-NEXT: %y = call i8* @returner()
192192 ; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) [[NUW]]
193193 ; CHECK-NEXT: ret void
200200 ; Don't convert objc_retain to objc_retainAutoreleasedReturnValue if its
201201 ; argument is not a return value.
202202
203 ; CHECK: define void @test12(
203 ; CHECK-LABEL: define void @test12(
204204 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) [[NUW]]
205205 ; CHECK-NEXT: ret void
206206 ; CHECK-NEXT: }
212212 ; Don't Convert objc_retain to objc_retainAutoreleasedReturnValue if it
213213 ; isn't next to the call providing its return value.
214214
215 ; CHECK: define void @test13(
215 ; CHECK-LABEL: define void @test13(
216216 ; CHECK-NEXT: %y = call i8* @returner()
217217 ; CHECK-NEXT: call void @callee()
218218 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) [[NUW]]
1010
1111 ; Don't delete the autorelease.
1212
13 ; CHECK: define %0* @test0(
13 ; CHECK-LABEL: define %0* @test0(
1414 ; CHECK: @objc_retain
1515 ; CHECK: .lr.ph:
1616 ; CHECK-NOT: @objc_r
3434
3535 ; Do delete the autorelease, even with the retain in a different block.
3636
37 ; CHECK: define %0* @test1(
37 ; CHECK-LABEL: define %0* @test1(
3838 ; CHECK-NOT: @objc
3939 ; CHECK: }
4040 define %0* @test1() nounwind {
88 ; Don't optimize away the retainBlock, because the object's address "escapes"
99 ; with the objc_storeWeak call.
1010
11 ; CHECK: define void @test0(
11 ; CHECK-LABEL: define void @test0(
1212 ; CHECK: %tmp7 = call i8* @objc_retainBlock(i8* %tmp6) [[NUW:#[0-9]+]], !clang.arc.copy_on_escape !0
1313 ; CHECK: call void @objc_release(i8* %tmp7) [[NUW]], !clang.imprecise_release !0
1414 ; CHECK: }
6464 ; Like test0, but it makes a regular call instead of a storeWeak call,
6565 ; so the optimization is valid.
6666
67 ; CHECK: define void @test1(
67 ; CHECK-LABEL: define void @test1(
6868 ; CHECK-NOT: @objc_retainBlock
6969 ; CHECK: }
7070 define void @test1() nounwind {
2525 ; GVN should not be able to eliminate this redundant load, with ARC-specific
2626 ; alias analysis.
2727
28 ; CHECK: define i8* @test1
28 ; CHECK-LABEL: define i8* @test1(
2929 ; CHECK: load
3030 ; CHECK: load
3131 ; CHECK: ret i8* %t
55 declare void @clang.arc.use(...) nounwind
66
77 ; Kill calls to @clang.arc.use(...)
8 ; CHECK: define void @test0(
8 ; CHECK-LABEL: define void @test0(
99 ; CHECK-NOT: clang.arc.use
1010 ; CHECK: }
1111 define void @test0(i8* %a, i8* %b) {
1616 ; FIXME: the fact that we re-order retains w.r.t. @clang.arc.use could
1717 ; be problematic if we get run twice, e.g. under LTO.
1818 ;
19 ; CHECK: define void @test0(
19 ; CHECK-LABEL: define void @test0(
2020 ; CHECK: @objc_retain(i8* %x)
2121 ; CHECK-NEXT: store i8* %y, i8** %temp0
2222 ; CHECK-NEXT: @objc_retain(i8* %y)
6464 ret void
6565 }
6666
67 ; CHECK: define void @test0a(
67 ; CHECK-LABEL: define void @test0a(
6868 ; CHECK: @objc_retain(i8* %x)
6969 ; CHECK-NEXT: store i8* %y, i8** %temp0
7070 ; CHECK-NEXT: @objc_retain(i8* %y)
99
1010 ; ARCOpt shouldn't try to move the releases to the block containing the invoke.
1111
12 ; CHECK: define void @test0(
12 ; CHECK-LABEL: define void @test0(
1313 ; CHECK: invoke.cont:
1414 ; CHECK: call void @objc_release(i8* %zipFile) [[NUW:#[0-9]+]], !clang.imprecise_release !0
1515 ; CHECK: ret void
3737
3838 ; ARCOpt should move the release before the callee calls.
3939
40 ; CHECK: define void @test1(
40 ; CHECK-LABEL: define void @test1(
4141 ; CHECK: invoke.cont:
4242 ; CHECK: call void @objc_release(i8* %zipFile) [[NUW]], !clang.imprecise_release !0
4343 ; CHECK: call void @callee()
107107
108108 ; Don't try to place code on invoke critical edges.
109109
110 ; CHECK: define void @test3(
110 ; CHECK-LABEL: define void @test3(
111111 ; CHECK: if.end:
112112 ; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]]
113113 ; CHECK-NEXT: ret void
138138
139139 ; Like test3, but with ARC-relevant exception handling.
140140
141 ; CHECK: define void @test4(
141 ; CHECK-LABEL: define void @test4(
142142 ; CHECK: lpad:
143143 ; CHECK-NEXT: %r = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
144144 ; CHECK-NEXT: cleanup
176176 ; Don't turn the retainAutoreleaseReturnValue into retain, because it's
177177 ; for an invoke which we can assume codegen will put immediately prior.
178178
179 ; CHECK: define void @test5(
179 ; CHECK-LABEL: define void @test5(
180180 ; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %z)
181181 ; CHECK: }
182182 define void @test5() {
196196
197197 ; Like test5, but there's intervening code.
198198
199 ; CHECK: define void @test6(
199 ; CHECK-LABEL: define void @test6(
200200 ; CHECK: call i8* @objc_retain(i8* %z)
201201 ; CHECK: }
202202 define void @test6() {
2424
2525 ; Delete a nested retain+release pair.
2626
27 ; CHECK: define void @test0(
27 ; CHECK-LABEL: define void @test0(
2828 ; CHECK: call i8* @objc_retain
2929 ; CHECK-NOT: @objc_retain
3030 ; CHECK: }
8888
8989 ; Delete a nested retain+release pair.
9090
91 ; CHECK: define void @test2(
91 ; CHECK-LABEL: define void @test2(
9292 ; CHECK: call i8* @objc_retain
9393 ; CHECK-NOT: @objc_retain
9494 ; CHECK: }
153153
154154 ; Delete a nested retain+release pair.
155155
156 ; CHECK: define void @test4(
156 ; CHECK-LABEL: define void @test4(
157157 ; CHECK: call i8* @objc_retain
158158 ; CHECK-NOT: @objc_retain
159159 ; CHECK: }
218218
219219 ; Delete a nested retain+release pair.
220220
221 ; CHECK: define void @test5(
221 ; CHECK-LABEL: define void @test5(
222222 ; CHECK: call i8* @objc_retain
223223 ; CHECK-NOT: @objc_retain
224224 ; CHECK: }
286286 ; The optimizer currently can't do this, because isn't isn't sophisticated enough in
287287 ; reasnoning about nesting.
288288
289 ; CHECK: define void @test6(
289 ; CHECK-LABEL: define void @test6(
290290 ; CHECK: call i8* @objc_retain
291291 ; CHECK: @objc_retain
292292 ; CHECK: }
354354 ; The optimizer currently can't do this, because isn't isn't sophisticated enough in
355355 ; reasnoning about nesting.
356356
357 ; CHECK: define void @test7(
357 ; CHECK-LABEL: define void @test7(
358358 ; CHECK: call i8* @objc_retain
359359 ; CHECK: @objc_retain
360360 ; CHECK: }
421421
422422 ; Delete a nested retain+release pair.
423423
424 ; CHECK: define void @test8(
424 ; CHECK-LABEL: define void @test8(
425425 ; CHECK: call i8* @objc_retain
426426 ; CHECK-NOT: @objc_retain
427427 ; CHECK: }
495495 ; The optimizer currently can't do this, because of a split loop backedge.
496496 ; See test9b for the same testcase without a split backedge.
497497
498 ; CHECK: define void @test9(
498 ; CHECK-LABEL: define void @test9(
499499 ; CHECK: call i8* @objc_retain
500500 ; CHECK: call i8* @objc_retain
501501 ; CHECK: call i8* @objc_retain
562562
563563 ; Like test9, but without a split backedge. TODO: optimize this.
564564
565 ; CHECK: define void @test9b(
565 ; CHECK-LABEL: define void @test9b(
566566 ; CHECK: call i8* @objc_retain
567567 ; CHECK: call i8* @objc_retain
568568 ; CHECK: @objc_retain
628628 ; The optimizer currently can't do this, because of a split loop backedge.
629629 ; See test10b for the same testcase without a split backedge.
630630
631 ; CHECK: define void @test10(
631 ; CHECK-LABEL: define void @test10(
632632 ; CHECK: call i8* @objc_retain
633633 ; CHECK: call i8* @objc_retain
634634 ; CHECK: call i8* @objc_retain
696696
697697 ; Like test10, but without a split backedge. TODO: optimize this.
698698
699 ; CHECK: define void @test10b(
699 ; CHECK-LABEL: define void @test10b(
700700 ; CHECK: call i8* @objc_retain
701701 ; CHECK: call i8* @objc_retain
702702 ; CHECK: @objc_retain
768768 @__block_d_tmp = external hidden constant { i64, i64, i8*, i8*, i8*, i8* }
769769 @__block_d_tmp5 = external hidden constant { i64, i64, i8*, i8*, i8*, i8* }
770770
771 ; CHECK: define void @test11(
771 ; CHECK-LABEL: define void @test11(
772772 ; CHECK: tail call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]]
773773 ; CHECK: tail call i8* @objc_retain(i8* %call) [[NUW]]
774774 ; CHECK: call void @objc_release(i8* %call) [[NUW]], !clang.imprecise_release !0
99 ; metadata and eliminate the retainBlock+release pair here.
1010 ; rdar://10803830.
1111
12 ; CHECK: define void @test0(
12 ; CHECK-LABEL: define void @test0(
1313 ; CHECK-NOT: @objc
1414 ; CHECK: }
1515 define void @test0() {
6262 ; shouldn't eliminate anything, but *CAN* strength reduce the objc_retainBlock
6363 ; to an objc_retain.
6464
65 ; CHECK: define void @test0_no_metadata(
65 ; CHECK-LABEL: define void @test0_no_metadata(
6666 ; CHECK: call i8* @objc_retain(
6767 ; CHECK: invoke
6868 ; CHECK: call void @objc_release(
44 ; in dubious ways.
55 ; rdar://10551239
66
7 ; CHECK: define void @test0(
7 ; CHECK-LABEL: define void @test0(
88 ; CHECK: %otherBlock = phi void ()* [ %b1, %if.then ], [ null, %entry ]
99 ; CHECK-NEXT: call void @use_fptr(void ()* %otherBlock)
1010 ; CHECK-NEXT: %tmp11 = bitcast void ()* %otherBlock to i8*
77
88 ; Clean up residue left behind after inlining.
99
10 ; CHECK: define void @test0(
10 ; CHECK-LABEL: define void @test0(
1111 ; CHECK: entry:
1212 ; CHECK-NEXT: ret void
1313 ; CHECK-NEXT: }
2020
2121 ; Same as test0, but with slightly different use arrangements.
2222
23 ; CHECK: define void @test1(
23 ; CHECK-LABEL: define void @test1(
2424 ; CHECK: entry:
2525 ; CHECK-NEXT: ret void
2626 ; CHECK-NEXT: }
3333
3434 ; Delete a retainRV+autoreleaseRV even if the pointer is used.
3535
36 ; CHECK: define void @test24(
36 ; CHECK-LABEL: define void @test24(
3737 ; CHECK-NEXT: entry:
3838 ; CHECK-NEXT: call void @use_pointer(i8* %p)
3939 ; CHECK-NEXT: ret void
77 @__block_descriptor_tmp = external hidden constant { i64, i64, i8*, i8*, i8*, i8* }
88 @"\01L_OBJC_SELECTOR_REFERENCES_" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"
99
10 ; CHECK: define void @test(
10 ; CHECK-LABEL: define void @test(
1111 ; CHECK: %3 = call i8* @objc_retainBlock(i8* %2) [[NUW:#[0-9]+]]
1212 ; CHECK: @objc_msgSend
1313 ; CHECK-NEXT: @objc_release(i8* %3)
4242 ; Same as test, but the objc_retainBlock has a clang.arc.copy_on_escape
4343 ; tag so it's safe to delete.
4444
45 ; CHECK: define void @test_with_COE(
45 ; CHECK-LABEL: define void @test_with_COE(
4646 ; CHECK-NOT: @objc_retainBlock
4747 ; CHECK: @objc_msgSend
4848 ; CHECK: @objc_release
1919 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2020
2121 define void @bitcasttest(i8* %storage, void (...)* %block) {
22 ; CHECK: define void @bitcasttest
22 ; CHECK-LABEL: define void @bitcasttest(
2323 entry:
2424 %t1 = bitcast void (...)* %block to i8*
2525 ; CHECK: tail call i8* @objc_retain
3636 }
3737
3838 define void @bitcasttest_a(i8* %storage, void (...)* %block) {
39 ; CHECK: define void @bitcasttest_a
39 ; CHECK-LABEL: define void @bitcasttest_a(
4040 entry:
4141 %t1 = bitcast void (...)* %block to i8*
4242 ; CHECK-NOT: tail call i8* @objc_retain
5353 }
5454
5555 define void @geptest(void (...)** %storage_array, void (...)* %block) {
56 ; CHECK: define void @geptest
56 ; CHECK-LABEL: define void @geptest(
5757 entry:
5858 %t1 = bitcast void (...)* %block to i8*
5959 ; CHECK: tail call i8* @objc_retain
7272 }
7373
7474 define void @geptest_a(void (...)** %storage_array, void (...)* %block) {
75 ; CHECK: define void @geptest_a
75 ; CHECK-LABEL: define void @geptest_a(
7676 entry:
7777 %t1 = bitcast void (...)* %block to i8*
7878 ; CHECK-NOT: tail call i8* @objc_retain
9292
9393 define void @selecttest(void (...)** %store1, void (...)** %store2,
9494 void (...)* %block) {
95 ; CHECK: define void @selecttest
95 ; CHECK-LABEL: define void @selecttest(
9696 entry:
9797 %t1 = bitcast void (...)* %block to i8*
9898 ; CHECK: tail call i8* @objc_retain
110110
111111 define void @selecttest_a(void (...)** %store1, void (...)** %store2,
112112 void (...)* %block) {
113 ; CHECK: define void @selecttest_a
113 ; CHECK-LABEL: define void @selecttest_a(
114114 entry:
115115 %t1 = bitcast void (...)* %block to i8*
116116 ; CHECK-NOT: tail call i8* @objc_retain
129129 define void @phinodetest(void (...)** %storage1,
130130 void (...)** %storage2,
131131 void (...)* %block) {
132 ; CHECK: define void @phinodetest
132 ; CHECK-LABEL: define void @phinodetest(
133133 entry:
134134 %t1 = bitcast void (...)* %block to i8*
135135 ; CHECK: tail call i8* @objc_retain
159159 define void @phinodetest_a(void (...)** %storage1,
160160 void (...)** %storage2,
161161 void (...)* %block) {
162 ; CHECK: define void @phinodetest_a
162 ; CHECK-LABEL: define void @phinodetest_a(
163163 entry:
164164 %t1 = bitcast void (...)* %block to i8*
165165 ; CHECK-NOT: tail call i8* @objc_retain
2525 ; retain is an objc_retainAutoreleasedReturnValue, since it's
2626 ; better to do the RV optimization.
2727
28 ; CHECK: define void @test0(
28 ; CHECK-LABEL: define void @test0(
2929 ; CHECK-NEXT: entry:
3030 ; CHECK-NEXT: %x = call i8* @returner
3131 ; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %x) [[NUW:#[0-9]+]]
5353
5454 ; Delete no-ops.
5555
56 ; CHECK: define void @test2
56 ; CHECK-LABEL: define void @test2(
5757 ; CHECK-NOT: @objc_
5858 ; CHECK: }
5959 define void @test2() {
6666 ; Delete a redundant retainRV,autoreleaseRV when forwaring a call result
6767 ; directly to a return value.
6868
69 ; CHECK: define i8* @test3
69 ; CHECK-LABEL: define i8* @test3(
7070 ; CHECK: call i8* @returner()
7171 ; CHECK-NEXT: ret i8* %call
7272 define i8* @test3() {
8080 ; Delete a redundant retain,autoreleaseRV when forwaring a call result
8181 ; directly to a return value.
8282
83 ; CHECK: define i8* @test4
83 ; CHECK-LABEL: define i8* @test4(
8484 ; CHECK: call i8* @returner()
8585 ; CHECK-NEXT: ret i8* %call
8686 define i8* @test4() {
113113 ; into objc_retainAutoreleasedReturnValueAutoreleaseReturnValue?
114114 ; Those entrypoints don't exist yet though.
115115
116 ; CHECK: define i8* @test7(
116 ; CHECK-LABEL: define i8* @test7(
117117 ; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %p)
118118 ; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %p)
119119 define i8* @test7() {
124124 ret i8* %t
125125 }
126126
127 ; CHECK: define i8* @test7b(
127 ; CHECK-LABEL: define i8* @test7b(
128128 ; CHECK: call i8* @objc_retain(i8* %p)
129129 ; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %p)
130130 define i8* @test7b() {
187187
188188 ; Don't zap the objc_retainAutoreleasedReturnValue.
189189
190 ; CHECK: define i8* @test13(
190 ; CHECK-LABEL: define i8* @test13(
191191 ; CHECK: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %p)
192192 ; CHECK: call i8* @objc_autorelease(i8* %p)
193193 ; CHECK: ret i8* %p
202202 ; Convert objc_retainAutoreleasedReturnValue to objc_retain if its
203203 ; argument is not a return value.
204204
205 ; CHECK: define void @test14(
205 ; CHECK-LABEL: define void @test14(
206206 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %p) [[NUW]]
207207 ; CHECK-NEXT: ret void
208208 define void @test14(i8* %p) {
213213 ; Don't convert objc_retainAutoreleasedReturnValue to objc_retain if its
214214 ; argument is a return value.
215215
216 ; CHECK: define void @test15(
216 ; CHECK-LABEL: define void @test15(
217217 ; CHECK-NEXT: %y = call i8* @returner()
218218 ; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) [[NUW]]
219219 ; CHECK-NEXT: ret void
271271
272272 ; Convert autoreleaseRV to autorelease.
273273
274 ; CHECK: define void @test23(
274 ; CHECK-LABEL: define void @test23(
275275 ; CHECK: call i8* @objc_autorelease(i8* %p) [[NUW]]
276276 define void @test23(i8* %p) {
277277 store i8 0, i8* %p
282282 ; Don't convert autoreleaseRV to autorelease if the result is returned,
283283 ; even through a bitcast.
284284
285 ; CHECK: define {}* @test24(
285 ; CHECK-LABEL: define {}* @test24(
286286 ; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %p)
287287 define {}* @test24(i8* %p) {
288288 %t = call i8* @objc_autoreleaseReturnValue(i8* %p)
22 ; Handle a retain+release pair entirely contained within a split loop backedge.
33 ; rdar://11256239
44
5 ; CHECK: define void @test0
5 ; CHECK-LABEL: define void @test0(
66 ; CHECK: call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]]
77 ; CHECK: call i8* @objc_retain(i8* %call) [[NUW]]
88 ; CHECK: call i8* @objc_retain(i8* %cond) [[NUW]]
99
1010 ; If the pointer-to-weak-pointer is null, it's undefined behavior.
1111
12 ; CHECK: define void @test0(
12 ; CHECK-LABEL: define void @test0(
1313 ; CHECK: store i8* undef, i8** null
1414 ; CHECK: store i8* undef, i8** null
1515 ; CHECK: store i8* undef, i8** null
1515 store atomic i32 123, i32* @G seq_cst, align 4
1616 ret i32 0
1717 }
18 ; CHECK: define i32 @test1
18 ; CHECK-LABEL: define i32 @test1(
1919 ; CHECK-NOT: store
2020 ; CHECK: ret i32 17
2121
2424 ret i32 %V
2525 }
2626
27 ; CHECK: define i32 @test2
27 ; CHECK-LABEL: define i32 @test2(
2828 ; CHECK-NOT: load
2929 ; CHECK: ret i32 222
55 %X = add i32 1, 2
66 ret i32 %A
77 }
8 ; CHECK: define internal i32 @test1a
8 ; CHECK-LABEL: define internal i32 @test1a(
99 ; CHECK: ret i32 undef
1010
1111 define i32 @test1b() {
1212 %X = call i32 @test1a( i32 17 )
1313 ret i32 %X
1414
15 ; CHECK: define i32 @test1b
15 ; CHECK-LABEL: define i32 @test1b(
1616 ; CHECK: ret i32 17
1717 }
1818
3030 %C.upgrd.1 = call i32 @test2a(i32 1)
3131 ret i32 %C.upgrd.1
3232 }
33 ; CHECK: define internal i32 @test2a
33 ; CHECK-LABEL: define internal i32 @test2a(
3434 ; CHECK-NEXT: br label %T
3535 ; CHECK: ret i32 undef
3636
3939 %X = call i32 @test2a(i32 0)
4040 ret i32 %X
4141 }
42 ; CHECK: define i32 @test2b
42 ; CHECK-LABEL: define i32 @test2b(
4343 ; CHECK-NEXT: %X = call i32 @test2a(i32 0)
4444 ; CHECK-NEXT: ret i32 0
4545
5353 store i32 %X, i32* @G
5454 ret void
5555 }
56 ; CHECK: define void @test3a
56 ; CHECK-LABEL: define void @test3a(
5757 ; CHECK-NEXT: ret void
5858
5959
6868 store i32 123, i32* @G
6969 ret i32 0
7070 }
71 ; CHECK: define i32 @test3b
71 ; CHECK-LABEL: define i32 @test3b(
7272 ; CHECK-NOT: store
7373 ; CHECK: ret i32 0
7474
101101 define internal i64 @test4c(i64 %a) {
102102 ret i64 %a
103103 }
104 ; CHECK: define internal i64 @test4c
104 ; CHECK-LABEL: define internal i64 @test4c(
105105 ; CHECK: ret i64 undef
106106
107107
148148 %a = call i64 @test6a()
149149 ret i64 %a
150150 }
151 ; CHECK: define i64 @test6b
151 ; CHECK-LABEL: define i64 @test6b(
152152 ; CHECK: ret i64 0
153153
154154 ;;======================== test7
171171 %Y = extractvalue %T %X, 0
172172 %Z = add i32 %Y, %Y
173173 ret i32 %Z
174 ; CHECK: define i32 @test7b
174 ; CHECK-LABEL: define i32 @test7b(
175175 ; CHECK-NEXT: call %T @test7a(i32 17)
176176 ; CHECK-NEXT: ret i32 36
177177 }
190190 define void @test8b(i32* %P) {
191191 %X = call {} @test8a(i32 5, i32* %P)
192192 ret void
193 ; CHECK: define void @test8b
193 ; CHECK-LABEL: define void @test8b(
194194 ; CHECK-NEXT: call {} @test8a
195195 ; CHECK-NEXT: ret void
196196 }
215215 entry:
216216 %call = call i32 @test10b(i32 undef)
217217 ret i32 %call
218 ; CHECK: define i32 @test10a
218 ; CHECK-LABEL: define i32 @test10a(
219219 ; CHECK: ret i32 0
220220 }
221221
223223 entry:
224224 %r = and i32 %x, 1
225225 ret i32 %r
226 ; CHECK: define internal i32 @test10b
226 ; CHECK-LABEL: define internal i32 @test10b(
227227 ; CHECK: ret i32 undef
228228 }
33 ; with no cases.
44 declare void @foo()
55 define void @test1() {
6 ; CHECK: define void @test1
6 ; CHECK-LABEL: define void @test1(
77 ; CHECK: call void @foo()
88 switch i32 undef, label %d []
99 d:
3535 unreachable
3636 }
3737
38 ; CHECK: define void @odd_fn
38 ; CHECK-LABEL: define void @odd_fn(
3939 ; CHECK: %storemerge.in = phi i32* [ %retptr2, %else ], [ %retptr1, %then ]
55
66 %struct.anon = type { [1 x float] }
77
8 ; CHECK: define void @Test(
8 ; CHECK-LABEL: define void @Test(
99 ; CHECK: load float addrspace(2)*
1010 ; CHECK-NEXT: fsub float
1111 ; CHECK: store float {{.*}}, float addrspace(2)*
55 %struct.Vector4 = type { float, float, float, float }
66 @f.vector = internal constant %struct.Vector4 { float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 }, align 16
77
8 ; CHECK: define void @f
8 ; CHECK-LABEL: define void @f(
99 ; CHECK-NOT: alloca
1010 ; CHECK: phi <4 x float>
1111
262262 if.end:
263263 %dirent_type.0 = phi i32 [ 3, %sw.default ], [ 6, %sw.bb3 ], [ 5, %sw.bb2 ], [ 0, %sw.bb1 ], [ 3, %sw.bb ], [ 0, %if.else ]
264264 ret i32 %dirent_type.0
265 ; CHECK: define i32 @overflow
265 ; CHECK-LABEL: define i32 @overflow(
266266 ; CHECK: switch
267267 ; CHECK: phi
268268 }
283283 bb3:
284284 %tmp4 = phi i1 [ undef, %bb ], [ false, %bb2 ], [ true, %bb1 ]
285285 ret i1 %tmp4
286 ; CHECK: define i1 @undef
286 ; CHECK-LABEL: define i1 @undef(
287287 ; CHECK: %switch.cast = trunc i32 %switch.tableidx to i9
288288 ; CHECK: %switch.downshift = lshr i9 3, %switch.shiftamt
289289 }
1212 declare void @foo() nounwind uwtable
1313
1414 define void @func(i32 %A) nounwind uwtable {
15 ; CHECK: define void @func
15 ; CHECK-LABEL: define void @func(
1616 entry:
1717 %cmp11 = icmp eq i32 %A, 1
1818 br i1 %cmp11, label %if.then, label %if.else, !prof !0
11 ; PR7328
22 ; PR7506
33 define i32 @foo(i32 %x) {
4 ; CHECK: define i32 @foo
4 ; CHECK-LABEL: define i32 @foo(
55 ; CHECK: %accumulator.tr = phi i32 [ 1, %entry ], [ 0, %body ]
66 entry:
77 %cond = icmp ugt i32 %x, 0 ; [#uses=1]
1212 ret i32 1
1313 }
1414
15 ; CHECK: define i32 @test1_factorial
15 ; CHECK-LABEL: define i32 @test1_factorial(
1616 ; CHECK: phi i32
1717 ; CHECK-NOT: call i32
1818 ; CHECK: else:
3333 ret i32 %x
3434 }
3535
36 ; CHECK: define i32 @test2_mul
36 ; CHECK-LABEL: define i32 @test2_mul(
3737 ; CHECK: phi i32
3838 ; CHECK-NOT: call i32
3939 ; CHECK: return:
1313
1414 ; Do turn other calls into infinite loops though.
1515
16 ; CHECK: define double @foo
16 ; CHECK-LABEL: define double @foo(
1717 ; CHECK-NOT: call
1818 ; CHECK: }
1919 define double @foo(double %f) {
2121 ret double %t
2222 }
2323
24 ; CHECK: define float @fabsf
24 ; CHECK-LABEL: define float @fabsf(
2525 ; CHECK-NOT: call
2626 ; CHECK: }
2727 define float @fabsf(float %f) {