llvm.org GIT mirror llvm / 351b7a1
Use references to attribute groups on the call/invoke instructions. Listing all of the attributes for the callee of a call/invoke instruction is way too much and makes the IR unreadable. Use references to attributes instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175877 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 6 years ago
40 changed file(s) with 251 addition(s) and 161 deletion(s). Raw diff Collapse all Expand all
553553 if (MDNode *N = dyn_cast_or_null(I->getOperand(i)))
554554 CreateMetadataSlot(N);
555555
556 // Add all the call attributes to the table. This is important for
557 // inline ASM, which may have attributes but no declaration.
558 if (CI->isInlineAsm()) {
559 AttributeSet Attrs = CI->getAttributes().getFnAttributes();
560 if (Attrs.hasAttributes(AttributeSet::FunctionIndex))
561 CreateAttributeSetSlot(Attrs);
562 }
556 // Add all the call attributes to the table.
557 AttributeSet Attrs = CI->getAttributes().getFnAttributes();
558 if (Attrs.hasAttributes(AttributeSet::FunctionIndex))
559 CreateAttributeSetSlot(Attrs);
560 } else if (const InvokeInst *II = dyn_cast(I)) {
561 // Add all the call attributes to the table.
562 AttributeSet Attrs = II->getAttributes().getFnAttributes();
563 if (Attrs.hasAttributes(AttributeSet::FunctionIndex))
564 CreateAttributeSetSlot(Attrs);
563565 }
564566
565567 // Process metadata attached with this instruction.
19341936 }
19351937 Out << ')';
19361938 if (PAL.hasAttributes(AttributeSet::FunctionIndex))
1937 Out << ' ' << PAL.getAsString(AttributeSet::FunctionIndex);
1939 Out << " #" << Machine.getAttributeGroupSlot(PAL.getFnAttributes());
19381940 } else if (const InvokeInst *II = dyn_cast(&I)) {
19391941 Operand = II->getCalledValue();
19401942 PointerType *PTy = cast(Operand->getType());
19741976
19751977 Out << ')';
19761978 if (PAL.hasAttributes(AttributeSet::FunctionIndex))
1977 Out << ' ' << PAL.getAsString(AttributeSet::FunctionIndex);
1979 Out << " #" << Machine.getAttributeGroupSlot(PAL.getFnAttributes());
19781980
19791981 Out << "\n to ";
19801982 writeOperand(II->getNormalDest(), true);
66
77 ; CHECK: define <8 x i16> @test0(i8* noalias %p, i8* noalias %q, <8 x i16> %y) {
88 ; CHECK-NEXT: entry:
9 ; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) nounwind
9 ; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) [[ATTR:#[0-9]+]]
1010 ; CHECK-NEXT: call void @llvm.arm.neon.vst1.v8i16(i8* %q, <8 x i16> %y, i32 16)
1111 ; CHECK-NEXT: %c = add <8 x i16> %a, %a
1212 define <8 x i16> @test0(i8* noalias %p, i8* noalias %q, <8 x i16> %y) {
2121 ; CHECK: define <8 x i16> @test1(i8* %p, <8 x i16> %y) {
2222 ; CHECK-NEXT: entry:
2323 ; CHECK-NEXT: %q = getelementptr i8* %p, i64 16
24 ; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) nounwind
24 ; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) [[ATTR]]
2525 ; CHECK-NEXT: call void @llvm.arm.neon.vst1.v8i16(i8* %q, <8 x i16> %y, i32 16)
2626 ; CHECK-NEXT: %c = add <8 x i16> %a, %a
2727 define <8 x i16> @test1(i8* %p, <8 x i16> %y) {
3838 declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind
3939
4040 ; CHECK: attributes #0 = { nounwind readonly }
41 ; CHECK: attributes #1 = { nounwind }
41 ; CHECK: attributes [[ATTR]] = { nounwind }
33
44 ; CHECK: @test
55 ; CHECK: entry
6 ; CHECK: %tmp0 = call i32 @TestConst(i32 5) readnone
7 ; CHECK-NEXT: %tmp1 = call i32 @TestPure(i32 6) readonly
6 ; CHECK: %tmp0 = call i32 @TestConst(i32 5) [[READNONE:#[0-9]+]]
7 ; CHECK-NEXT: %tmp1 = call i32 @TestPure(i32 6) [[READONLY:#[0-9]+]]
88 ; CHECK-NEXT: %tmp2 = call i32 @TestNone(i32 7)
99 ; CHECK-NEXT: store i32 1, i32* @g
10 ; CHECK-NEXT: %tmp5 = call i32 @TestPure(i32 6) readonly
10 ; CHECK-NEXT: %tmp5 = call i32 @TestPure(i32 6) [[READONLY]]
1111 ; CHECK-NEXT: %tmp7 = call i32 @TestNone(i32 7)
1212 ; CHECK-NEXT: %tmp8 = call i32 @TestNone(i32 7)
1313 ; CHECK-NEXT: %sum0 = add i32 %tmp0, %tmp1
4949
5050 declare i32 @TestNone(i32)
5151
52 ; CHECK: attributes #0 = { readnone }
53 ; CHECK: attributes #1 = { readonly }
52 ; CHECK: attributes [[READNONE]] = { readnone }
53 ; CHECK: attributes [[READONLY]] = { readonly }
66
77 ; CHECK: define <8 x i16> @test0(i8* %p, i8* %q, <8 x i16> %y) {
88 ; CHECK-NEXT: entry:
9 ; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) nounwind
9 ; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) [[NUW:#[0-9]+]]
1010 ; CHECK-NEXT: call void @llvm.arm.neon.vst1.v8i16(i8* %q, <8 x i16> %y, i32 16)
1111 ; CHECK-NEXT: %c = add <8 x i16> %a, %a
1212 define <8 x i16> @test0(i8* %p, i8* %q, <8 x i16> %y) {
2222 declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind
2323
2424 ; CHECK: attributes #0 = { nounwind readonly }
25 ; CHECK: attributes #1 = { nounwind }
25 ; CHECK: attributes [[NUW]] = { nounwind }
2626
2727 !0 = metadata !{metadata !"tbaa root", null}
2828 !1 = metadata !{metadata !"A", metadata !0}
1010 entry:
1111 %x_addr = alloca i32
1212 store i32 %x, i32* %x_addr, align 4
13 ; CHECK: %tmp1 = call i32 @deref(i32 %x_addr.val) nounwind
13 ; CHECK: %tmp1 = call i32 @deref(i32 %x_addr.val) [[NUW:#[0-9]+]]
1414 %tmp1 = call i32 @deref( i32* %x_addr ) nounwind
1515 ret i32 %tmp1
1616 }
1717
18 ; CHECK: attributes #0 = { nounwind }
18 ; CHECK: attributes [[NUW]] = { nounwind }
33
44 @g = global i8 0
55
6 ; CHECK: define internal void @foo(i8 signext %y) #0
6 ; CHECK: define internal void @foo(i8 signext %y) [[NUW:#[0-9]+]]
77
88 define internal zeroext i8 @foo(i8* inreg %p, i8 signext %y, ... ) nounwind {
99 store i8 %y, i8* @g
1111 }
1212
1313 define i32 @bar() {
14 ; CHECK: call void @foo(i8 signext 1) nounwind
14 ; CHECK: call void @foo(i8 signext 1) [[NUW]]
1515 %A = call zeroext i8(i8*, i8, ...)* @foo(i8* inreg null, i8 signext 1, %struct* byval null ) nounwind
1616 ret i32 0
1717 }
1818
19 ; CHECK: attributes #0 = { nounwind }
19 ; CHECK: attributes [[NUW]] = { nounwind }
77 call void @llvm.dbg.value(metadata !{i32 %len}, i64 0, metadata !10)
88 call void @llvm.dbg.value(metadata !{i32 %hash}, i64 0, metadata !11)
99 call void @llvm.dbg.value(metadata !{i32 %flags}, i64 0, metadata !12)
10 ; CHECK: call fastcc i8* @add_name_internal(i8* %name, i32 %hash) nounwind, !dbg !13
10 ; CHECK: call fastcc i8* @add_name_internal(i8* %name, i32 %hash) [[NUW:#[0-9]+]], !dbg !13
1111 %0 = call fastcc i8* @add_name_internal(i8* %name, i32 %len, i32 %hash, i8 zeroext 0, i32 %flags) nounwind, !dbg !13 ; [#uses=1]
1212 ret i8* %0, !dbg !13
1313 }
4040 ; CHECK: attributes #0 = { nounwind ssp }
4141 ; CHECK: attributes #1 = { nounwind readnone }
4242 ; CHECK: attributes #2 = { noinline nounwind ssp }
43 ; CHECK: attributes [[NUW]] = { nounwind }
4344
4445 !0 = metadata !{i32 524545, metadata !1, metadata !"name", metadata !2, i32 8, metadata !6} ; [ DW_TAG_arg_variable ]
4546 !1 = metadata !{i32 524334, i32 0, metadata !2, metadata !"vfs_addname", metadata !"vfs_addname", metadata !"vfs_addname", metadata !2, i32 12, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i1 false} ; [ DW_TAG_subprogram ]
55
66 ; CHECK: define i32 @main() #0 {
77 ; CHECK-NEXT: entry:
8 ; CHECK-NEXT: %call2 = tail call i32 @wwrite(i64 0) nounwind
8 ; CHECK-NEXT: %call2 = tail call i32 @wwrite(i64 0) [[NUW:#[0-9]+]]
99 ; CHECK-NEXT: ret i32 123
1010
1111 define i32 @main() noreturn nounwind {
3030
3131 ; CHECK: attributes #0 = { noreturn nounwind }
3232 ; CHECK: attributes #1 = { nounwind readnone }
33 ; CHECK: attributes [[NUW]] = { nounwind }
329329 ; CHECK-NEXT: br label %[[JOIN]]
330330 ; CHECK: [[JOIN]]:
331331 ; CHECK-NEXT: phi { i8*, i32 }
332 ; CHECK-NEXT: call void @opaque() nounwind
332 ; CHECK-NEXT: call void @opaque() [[NUW:#[0-9]+]]
333333 ; CHECK-NEXT: br label %[[FIX:[^\s]+]]
334334 ; CHECK: lpad:
335335 ; CHECK-NEXT: landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
339339 ; CHECK-NEXT: [[T1:%.*]] = phi i32 [ 0, %[[JOIN]] ], [ 1, %lpad ]
340340 ; CHECK-NEXT: call void @use(i32 [[T1]])
341341 ; CHECK-NEXT: call void @_ZSt9terminatev()
342
343 ; CHECK: attributes [[NUW]] = { nounwind }
344 ; CHECK: attributes #1 = { nounwind readnone }
345 ; CHECK: attributes #2 = { ssp uwtable }
346 ; CHECK: attributes #3 = { noreturn nounwind }
4949 %b = add <4 x i32> zeroinitializer, %a
5050 ret <4 x i32> %b
5151 ; CHECK: entry:
52 ; CHECK-NEXT: %a = tail call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x i16> , <4 x i16> %x) nounwind
52 ; CHECK-NEXT: %a = tail call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x i16> , <4 x i16> %x) [[NUW:#[0-9]+]]
5353 ; CHECK-NEXT: ret <4 x i32> %a
5454 }
5555
6565
6666 declare <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x i16>, <4 x i16>) nounwind readnone
6767 declare <4 x i32> @llvm.arm.neon.vmullu.v4i32(<4 x i16>, <4 x i16>) nounwind readnone
68
69 ; CHECK: attributes #0 = { nounwind readnone ssp }
70 ; CHECK: attributes #1 = { nounwind readnone }
71 ; CHECK: attributes [[NUW]] = { nounwind }
423423 i8* getelementptr (%t1* bitcast (%t0* @s to %t1*), i32 0, i32 1, i32 0)) nounwind
424424 ret i32 0
425425 ; CHECK: @test35
426 ; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i64 0, i64 0), i8* getelementptr inbounds (%t0* @s, i64 0, i32 1, i64 0)) nounwind
426 ; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i64 0, i64 0), i8* getelementptr inbounds (%t0* @s, i64 0, i32 1, i64 0)) [[NUW:#[0-9]+]]
427427 }
428428
429429 ; Instcombine should constant-fold the GEP so that indices that have
507507 ; CHECK: getelementptr inbounds %struct.ham* %arg, i64 0, i32 2
508508 ; CHECK: getelementptr inbounds i8* %tmp3, i64 -8
509509 }
510
511 ; CHECK: attributes [[NUW]] = { nounwind }
2929 define float @test_simplify3(float %x) {
3030 ; CHECK: @test_simplify3
3131 %retval = call float @powf(float 2.0, float %x)
32 ; CHECK-NEXT: [[EXP2F:%[a-z0-9]+]] = call float @exp2f(float %x) nounwind readonly
32 ; CHECK-NEXT: [[EXP2F:%[a-z0-9]+]] = call float @exp2f(float %x) [[NUW_RO:#[0-9]+]]
3333 ret float %retval
3434 ; CHECK-NEXT: ret float [[EXP2F]]
3535 }
3737 define double @test_simplify4(double %x) {
3838 ; CHECK: @test_simplify4
3939 %retval = call double @pow(double 2.0, double %x)
40 ; CHECK-NEXT: [[EXP2:%[a-z0-9]+]] = call double @exp2(double %x) nounwind readonly
40 ; CHECK-NEXT: [[EXP2:%[a-z0-9]+]] = call double @exp2(double %x) [[NUW_RO]]
4141 ret double %retval
4242 ; CHECK-NEXT: ret double [[EXP2]]
4343 }
6363 define float @test_simplify7(float %x) {
6464 ; CHECK: @test_simplify7
6565 %retval = call float @powf(float %x, float 0.5)
66 ; CHECK-NEXT: [[SQRTF:%[a-z0-9]+]] = call float @sqrtf(float %x) nounwind readonly
67 ; CHECK-NEXT: [[FABSF:%[a-z0-9]+]] = call float @fabsf(float [[SQRTF]]) nounwind readonly
66 ; CHECK-NEXT: [[SQRTF:%[a-z0-9]+]] = call float @sqrtf(float %x) [[NUW_RO]]
67 ; CHECK-NEXT: [[FABSF:%[a-z0-9]+]] = call float @fabsf(float [[SQRTF]]) [[NUW_RO]]
6868 ; CHECK-NEXT: [[FCMP:%[a-z0-9]+]] = fcmp oeq float %x, 0xFFF0000000000000
6969 ; CHECK-NEXT: [[SELECT:%[a-z0-9]+]] = select i1 [[FCMP]], float 0x7FF0000000000000, float [[FABSF]]
7070 ret float %retval
7474 define double @test_simplify8(double %x) {
7575 ; CHECK: @test_simplify8
7676 %retval = call double @pow(double %x, double 0.5)
77 ; CHECK-NEXT: [[SQRT:%[a-z0-9]+]] = call double @sqrt(double %x) nounwind readonly
78 ; CHECK-NEXT: [[FABS:%[a-z0-9]+]] = call double @fabs(double [[SQRT]]) nounwind readonly
77 ; CHECK-NEXT: [[SQRT:%[a-z0-9]+]] = call double @sqrt(double %x) [[NUW_RO]]
78 ; CHECK-NEXT: [[FABS:%[a-z0-9]+]] = call double @fabs(double [[SQRT]]) [[NUW_RO]]
7979 ; CHECK-NEXT: [[FCMP:%[a-z0-9]+]] = fcmp oeq double %x, 0xFFF0000000000000
8080 ; CHECK-NEXT: [[SELECT:%[a-z0-9]+]] = select i1 [[FCMP]], double 0x7FF0000000000000, double [[FABS]]
8181 ret double %retval
149149 ret double %retval
150150 ; CHECK-NEXT: ret double [[RECIPROCAL]]
151151 }
152
153 ; CHECK: attributes [[NUW_RO]] = { nounwind readonly }
496496 br label %l3
497497
498498 l3:
499 ; CHECK: call void @g() noduplicate
500 ; CHECK-NOT: call void @g() noduplicate
499 ; CHECK: call void @g() [[NOD:#[0-9]+]]
500 ; CHECK-NOT: call void @g() [[NOD]]
501501 call void @g() noduplicate
502502 %y = icmp ult i32 %p, 5
503503 br i1 %y, label %l4, label %l5
511511 ret void
512512 ; CHECK: }
513513 }
514
515 ; CHECK: attributes [[NOD]] = { noduplicate }
1818 ; CHECK-NEXT: i32 1, label %inc.us
1919
2020 ; CHECK: inc.us: ; preds = %loop_begin.us
21 ; CHECK-NEXT: call void @incf() noreturn nounwind
21 ; CHECK-NEXT: call void @incf() [[NOR_NUW:#[0-9]+]]
2222 ; CHECK-NEXT: br label %loop_begin.backedge.us
2323
2424 ; CHECK: .split: ; preds = %..split_crit_edge
3939 ; CHECK-NEXT: ]
4040
4141 ; CHECK: dec.us3: ; preds = %loop_begin.us1
42 ; CHECK-NEXT: call void @decf() noreturn nounwind
42 ; CHECK-NEXT: call void @decf() [[NOR_NUW]]
4343 ; CHECK-NEXT: br label %loop_begin.backedge.us5
4444
4545 ; CHECK: .split.split: ; preds = %.split..split.split_crit_edge
8888
8989 declare void @incf() noreturn
9090 declare void @decf() noreturn
91
92 ; CHECK: attributes #0 = { noreturn }
93 ; CHECK: attributes [[NOR_NUW]] = { noreturn nounwind }
2424 ; CHECK-NEXT: ]
2525
2626 ; CHECK: inc.us: ; preds = %second_switch.us, %loop_begin.us
27 ; CHECK-NEXT: call void @incf() noreturn nounwind
27 ; CHECK-NEXT: call void @incf() [[NOR_NUW:#[0-9]+]]
2828 ; CHECK-NEXT: br label %loop_begin.backedge.us
2929
3030 ; CHECK: .split: ; preds = %..split_crit_edge
4444 ; CHECK-NEXT: ]
4545
4646 ; CHECK: inc: ; preds = %loop_begin.inc_crit_edge, %second_switch
47 ; CHECK-NEXT: call void @incf() noreturn nounwind
47 ; CHECK-NEXT: call void @incf() [[NOR_NUW]]
4848 ; CHECK-NEXT: br label %loop_begin.backedge
4949
5050 define i32 @test(i32* %var) {
8181
8282 declare void @incf() noreturn
8383 declare void @decf() noreturn
84
85 ; CHECK: attributes #0 = { noreturn }
86 ; CHECK: attributes [[NOR_NUW]] = { noreturn nounwind }
2929 ; CHECK-NEXT: i32 1, label %inc.us.us
3030
3131 ; CHECK: inc.us.us: ; preds = %second_switch.us.us, %loop_begin.us.us
32 ; CHECK-NEXT: call void @incf() noreturn nounwind
32 ; CHECK-NEXT: call void @incf() [[NOR_NUW:#[0-9]+]]
3333 ; CHECK-NEXT: br label %loop_begin.backedge.us.us
3434
3535 ; CHECK: .split.us.split: ; preds = %.split.us..split.us.split_crit_edge
4949 ; CHECK-NEXT: br i1 true, label %us-unreachable8, label %inc.us
5050
5151 ; CHECK: inc.us: ; preds = %second_switch.us.inc.us_crit_edge, %loop_begin.us
52 ; CHECK-NEXT: call void @incf() noreturn nounwind
52 ; CHECK-NEXT: call void @incf() [[NOR_NUW]]
5353 ; CHECK-NEXT: br label %loop_begin.backedge.us
5454
5555 ; CHECK: .split: ; preds = %..split_crit_edge
7474 ; CHECK-NEXT: ]
7575
7676 ; CHECK: inc.us4: ; preds = %loop_begin.inc_crit_edge.us, %second_switch.us3
77 ; CHECK-NEXT: call void @incf() noreturn nounwind
77 ; CHECK-NEXT: call void @incf() [[NOR_NUW]]
7878 ; CHECK-NEXT: br label %loop_begin.backedge.us6
7979
8080 ; CHECK: loop_begin.inc_crit_edge.us: ; preds = %loop_begin.us1
135135
136136 declare void @incf() noreturn
137137 declare void @decf() noreturn
138
139 ; CHECK: attributes #0 = { noreturn }
140 ; CHECK: attributes [[NOR_NUW]] = { noreturn nounwind }
2020 ; CHECK-NEXT: br label %cond.end.us
2121
2222 ; CHECK: abort0.split:
23 ; CHECK-NEXT: call void @end0() noreturn nounwind
23 ; CHECK-NEXT: call void @end0() [[NOR_NUW:#[0-9]+]]
2424 ; CHECK-NEXT: unreachable
2525
2626 ; CHECK: abort1:
27 ; CHECK-NEXT: call void @end1() noreturn nounwind
27 ; CHECK-NEXT: call void @end1() [[NOR_NUW]]
2828 ; CHECK-NEXT: unreachable
2929
3030 ; CHECK: }
5050
5151 declare void @end0() noreturn
5252 declare void @end1() noreturn
53
54 ; CHECK: attributes #0 = { nounwind }
55 ; CHECK: attributes #1 = { noreturn }
56 ; CHECK: attributes [[NOR_NUW]] = { noreturn nounwind }
122122 %call = call i32 @g(%struct.p* align 8 byval %agg.tmp) nounwind
123123 ret i32 %call
124124 ; CHECK: @test7
125 ; CHECK: call i32 @g(%struct.p* byval align 8 %q) nounwind
125 ; CHECK: call i32 @g(%struct.p* byval align 8 %q) [[NUW:#[0-9]+]]
126126 }
127127
128128 declare i32 @g(%struct.p* align 8 byval)
169169
170170 declare void @f1(%struct.big* sret)
171171 declare void @f2(%struct.big*)
172
173 ; CHECK: attributes [[NUW]] = { nounwind }
174 ; CHECK: attributes #1 = { nounwind ssp }
175 ; CHECK: attributes #2 = { nounwind ssp uwtable }
3737 }
3838
3939 ; CHECK: define internal void @_GLOBAL__I_y()
40 ; CHECK: %0 = call i8* @objc_autoreleasePoolPush() nounwind
41 ; CHECK: call void @objc_autoreleasePoolPop(i8* %0) nounwind
40 ; CHECK: %0 = call i8* @objc_autoreleasePoolPush() [[NUW:#[0-9]+]]
41 ; CHECK: call void @objc_autoreleasePoolPop(i8* %0) [[NUW]]
4242 ; CHECK: }
4343 define internal void @_GLOBAL__I_y() {
4444 entry:
5050
5151 declare i8* @objc_autoreleasePoolPush()
5252 declare void @objc_autoreleasePoolPop(i8*)
53
54 ; CHECK: attributes #0 = { nounwind }
9191
9292 ; CHECK: define void @test1b(
9393 ; CHECK: entry:
94 ; CHECK: tail call i8* @objc_retain(i8* %x) nounwind
94 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW:#[0-9]+]]
9595 ; CHECK-NOT: @objc_
9696 ; CHECK: if.end5:
97 ; CHECK: tail call void @objc_release(i8* %x) nounwind, !clang.imprecise_release !0
97 ; CHECK: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release !0
9898 ; CHECK-NOT: @objc_
9999 ; CHECK: }
100100 define void @test1b(i8* %x, i1 %p, i1 %q) {
403403 ; a stack argument.
404404
405405 ; CHECK: define void @test11(
406 ; CHECK: tail call i8* @objc_retain(i8* %x) nounwind
407 ; CHECK: call i8* @objc_autorelease(i8* %0) nounwind
406 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
407 ; CHECK: call i8* @objc_autorelease(i8* %0) [[NUW]]
408408 ; CHECK: }
409409 define void @test11(i8* %x) nounwind {
410410 entry:
430430 ; Same as test11 but the value is returned. Do an RV optimization.
431431
432432 ; CHECK: define i8* @test11b(
433 ; CHECK: tail call i8* @objc_retain(i8* %x) nounwind
434 ; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %0) nounwind
433 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
434 ; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %0) [[NUW]]
435435 ; CHECK: }
436436 define i8* @test11b(i8* %x) nounwind {
437437 entry:
461461 ; Trivial retain,autorelease pair. Don't delete!
462462
463463 ; CHECK: define void @test13(
464 ; CHECK: tail call i8* @objc_retain(i8* %x) nounwind
465 ; CHECK: tail call i8* @objc_retain(i8* %x) nounwind
464 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
465 ; CHECK: tail call i8* @objc_retain(i8* %x) [[NUW]]
466466 ; CHECK: @use_pointer(i8* %x)
467 ; CHECK: call i8* @objc_autorelease(i8* %x) nounwind
467 ; CHECK: call i8* @objc_autorelease(i8* %x) [[NUW]]
468468 ; CHECK: }
469469 define void @test13(i8* %x, i64 %n) {
470470 entry:
715715 ; Bitcast insertion
716716
717717 ; CHECK: define void @test20(
718 ; CHECK: %tmp1 = tail call i8* @objc_retain(i8* %tmp) nounwind
718 ; CHECK: %tmp1 = tail call i8* @objc_retain(i8* %tmp) [[NUW]]
719719 ; CHECK-NEXT: invoke
720720 define void @test20(double* %self) {
721721 if.then12:
979979 ; CHECK: call i8* @objc_retain(
980980 ; CHECK: call void @callee()
981981 ; CHECK: store
982 ; CHECK: call void @objc_release(i8* %p) nounwind, !clang.imprecise_release
982 ; CHECK: call void @objc_release(i8* %p) [[NUW]], !clang.imprecise_release
983983 ; CHECK: done:
984984 ; CHECK-NOT: @objc_
985985 ; CHECK: }
14491449 ; Don't delete retain and autorelease here.
14501450
14511451 ; CHECK: define void @test46(
1452 ; CHECK: tail call i8* @objc_retain(i8* %p) nounwind
1452 ; CHECK: tail call i8* @objc_retain(i8* %p) [[NUW]]
14531453 ; CHECK: true:
1454 ; CHECK: call i8* @objc_autorelease(i8* %p) nounwind
1454 ; CHECK: call i8* @objc_autorelease(i8* %p) [[NUW]]
14551455 define void @test46(i8* %p, i1 %a) {
14561456 entry:
14571457 call i8* @objc_retain(i8* %p)
15641564
15651565 ; CHECK: define void @test54(
15661566 ; CHECK: call i8* @returner()
1567 ; CHECK-NEXT: call void @objc_release(i8* %t) nounwind, !clang.imprecise_release !0
1567 ; CHECK-NEXT: call void @objc_release(i8* %t) [[NUW]], !clang.imprecise_release !0
15681568 ; CHECK-NEXT: ret void
15691569 define void @test54() {
15701570 %t = call i8* @returner()
15941594 ; CHECK: define void @test56(
15951595 ; CHECK-NOT: @objc
15961596 ; CHECK: if.then:
1597 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) nounwind
1597 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) [[NUW]]
15981598 ; CHECK-NEXT: tail call void @use_pointer(i8* %x)
15991599 ; CHECK-NEXT: tail call void @use_pointer(i8* %x)
1600 ; CHECK-NEXT: tail call void @objc_release(i8* %x) nounwind, !clang.imprecise_release !0
1600 ; CHECK-NEXT: tail call void @objc_release(i8* %x) [[NUW]], !clang.imprecise_release !0
16011601 ; CHECK-NEXT: br label %if.end
16021602 ; CHECK-NOT: @objc
16031603 ; CHECK: }
16291629 ; CHECK-NEXT: entry:
16301630 ; CHECK-NEXT: call void @use_pointer(i8* %x)
16311631 ; CHECK-NEXT: call void @use_pointer(i8* %x)
1632 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) nounwind
1632 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) [[NUW]]
16331633 ; CHECK-NEXT: call void @use_pointer(i8* %x)
16341634 ; CHECK-NEXT: call void @use_pointer(i8* %x)
1635 ; CHECK-NEXT: call void @objc_release(i8* %x) nounwind
1635 ; CHECK-NEXT: call void @objc_release(i8* %x) [[NUW]]
16361636 ; CHECK-NEXT: ret void
16371637 ; CHECK-NEXT: }
16381638 define void @test57(i8* %x) nounwind {
16721672
16731673 ; CHECK: define void @test59(
16741674 ; CHECK-NEXT: entry:
1675 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) nounwind
1675 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) [[NUW]]
16761676 ; CHECK-NEXT: call void @use_pointer(i8* %x)
16771677 ; CHECK-NEXT: call void @use_pointer(i8* %x)
1678 ; CHECK-NEXT: call void @objc_release(i8* %x) nounwind
1678 ; CHECK-NEXT: call void @objc_release(i8* %x) [[NUW]]
16791679 ; CHECK-NEXT: ret void
16801680 ; CHECK-NEXT: }
16811681 define void @test59(i8* %x) nounwind {
18741874 ; rdar://11931823
18751875
18761876 ; CHECK: define void @test66(
1877 ; CHECK: %tmp7 = tail call i8* @objc_retain(i8* %cond) nounwind
1878 ; CHECK: tail call void @objc_release(i8* %cond) nounwind
1877 ; CHECK: %tmp7 = tail call i8* @objc_retain(i8* %cond) [[NUW]]
1878 ; CHECK: tail call void @objc_release(i8* %cond) [[NUW]]
18791879 ; CHECK: }
18801880 define void @test66(i8* %tmp5, i8* %bar, i1 %tobool, i1 %tobool1, i8* %call) {
18811881 entry:
22232223 !0 = metadata !{}
22242224
22252225 declare i32 @__gxx_personality_v0(...)
2226
2227 ; CHECK: attributes #0 = { nounwind readnone }
2228 ; CHECK: attributes [[NUW]] = { nounwind }
8787
8888 ; CHECK: define void @test3(i8* %a) #0 {
8989 ; CHECK-NEXT: entry:
90 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
90 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) [[NUW:#[0-9]+]]
9191 ; CHECK-NEXT: br label %loop
9292 ; CHECK-NOT: @objc_
9393 ; CHECK: exit:
113113
114114 ; CHECK: define void @test4(i8* %a) #0 {
115115 ; CHECK-NEXT: entry:
116 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
116 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) [[NUW]]
117117 ; CHECK-NEXT: br label %loop
118118 ; CHECK-NOT: @objc_
119119 ; CHECK: exit:
143143
144144 ; CHECK: define void @test5(i8* %a) #0 {
145145 ; CHECK-NEXT: entry:
146 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
146 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) [[NUW]]
147147 ; CHECK-NEXT: call void @callee()
148148 ; CHECK-NEXT: br label %loop
149149 ; CHECK-NOT: @objc_
177177
178178 ; CHECK: define void @test6(i8* %a) #0 {
179179 ; CHECK-NEXT: entry:
180 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
180 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) [[NUW]]
181181 ; CHECK-NEXT: br label %loop
182182 ; CHECK-NOT: @objc_
183183 ; CHECK: exit:
210210
211211 ; CHECK: define void @test7(i8* %a) #0 {
212212 ; CHECK-NEXT: entry:
213 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
213 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) [[NUW]]
214214 ; CHECK-NEXT: call void @callee()
215215 ; CHECK-NEXT: br label %loop
216216 ; CHECK-NOT: @objc_
243243
244244 ; CHECK: define void @test8(i8* %a) #0 {
245245 ; CHECK-NEXT: entry:
246 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
246 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) [[NUW]]
247247 ; CHECK-NEXT: br label %loop
248248 ; CHECK-NOT: @objc_
249249 ; CHECK: exit:
363363
364364 ; CHECK: define void @test12(i8* %a) #0 {
365365 ; CHECK-NEXT: entry:
366 ; CHECK-NEXT: %outer = tail call i8* @objc_retain(i8* %a) nounwind
367 ; CHECK-NEXT: %inner = tail call i8* @objc_retain(i8* %a) nounwind
368 ; CHECK-NEXT: br label %loop
369 ; CHECK-NOT: @objc_
370 ; CHECK: exit:
371 ; CHECK-NEXT: call void @objc_release(i8* %a) nounwind
372 ; CHECK-NEXT: call void @objc_release(i8* %a) nounwind, !clang.imprecise_release !0
366 ; CHECK-NEXT: %outer = tail call i8* @objc_retain(i8* %a) [[NUW]]
367 ; CHECK-NEXT: %inner = tail call i8* @objc_retain(i8* %a) [[NUW]]
368 ; CHECK-NEXT: br label %loop
369 ; CHECK-NOT: @objc_
370 ; CHECK: exit:
371 ; CHECK-NEXT: call void @objc_release(i8* %a) [[NUW]]
372 ; CHECK-NEXT: call void @objc_release(i8* %a) [[NUW]], !clang.imprecise_release !0
373373 ; CHECK-NEXT: ret void
374374 ; CHECK-NEXT: }
375375 define void @test12(i8* %a) nounwind {
393393 ret void
394394 }
395395
396 ; CHECK: attributes #0 = { nounwind }
396 ; CHECK: attributes [[NUW]] = { nounwind }
397397
398398 !0 = metadata !{}
22 ; CHECK: %call = tail call i32* @qux()
33 ; CHECK-NEXT: %tcall = bitcast i32* %call to i8*
44 ; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue", ""()
5 ; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %tcall) nounwind
5 ; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %tcall) [[NUW:#[0-9]+]]
66
77 define void @foo() {
88 entry:
2020 !clang.arc.retainAutoreleasedReturnValueMarker = !{!0}
2121
2222 !0 = metadata !{metadata !"mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue"}
23
24 ; CHECK: attributes [[NUW]] = { nounwind }
99
1010 ; CHECK: define void @test0(
1111 ; CHECK: entry:
12 ; CHECK-NEXT: tail call void @objc_storeStrong(i8** @x, i8* %p) nounwind
12 ; CHECK-NEXT: tail call void @objc_storeStrong(i8** @x, i8* %p) [[NUW:#[0-9]+]]
1313 ; CHECK-NEXT: ret void
1414 define void @test0(i8* %p) {
1515 entry:
2424
2525 ; CHECK: define void @test1(i8* %p) {
2626 ; CHECK-NEXT: entry:
27 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) nounwind
27 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) [[NUW]]
2828 ; CHECK-NEXT: %tmp = load volatile i8** @x, align 8
2929 ; CHECK-NEXT: store i8* %0, i8** @x, align 8
30 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) nounwind
30 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) [[NUW]]
3131 ; CHECK-NEXT: ret void
3232 ; CHECK-NEXT: }
3333 define void @test1(i8* %p) {
4343
4444 ; CHECK: define void @test2(i8* %p) {
4545 ; CHECK-NEXT: entry:
46 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) nounwind
46 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) [[NUW]]
4747 ; CHECK-NEXT: %tmp = load i8** @x, align 8
4848 ; CHECK-NEXT: store volatile i8* %0, i8** @x, align 8
49 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) nounwind
49 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) [[NUW]]
5050 ; CHECK-NEXT: ret void
5151 ; CHECK-NEXT: }
5252 define void @test2(i8* %p) {
6363
6464 ; CHECK: define void @test3(i8* %newValue) {
6565 ; CHECK-NEXT: entry:
66 ; CHECK-NEXT: %x0 = tail call i8* @objc_retain(i8* %newValue) nounwind
66 ; CHECK-NEXT: %x0 = tail call i8* @objc_retain(i8* %newValue) [[NUW]]
6767 ; CHECK-NEXT: %x1 = load i8** @x, align 8
6868 ; CHECK-NEXT: store i8* %x0, i8** @x, align 8
6969 ; CHECK-NEXT: tail call void @use_pointer(i8* %x1), !clang.arc.no_objc_arc_exceptions !0
70 ; CHECK-NEXT: tail call void @objc_release(i8* %x1) nounwind, !clang.imprecise_release !0
70 ; CHECK-NEXT: tail call void @objc_release(i8* %x1) [[NUW]], !clang.imprecise_release !0
7171 ; CHECK-NEXT: ret void
7272 ; CHECK-NEXT: }
7373 define void @test3(i8* %newValue) {
8484
8585 ; CHECK: define i1 @test4(i8* %newValue, i8* %foo) {
8686 ; CHECK-NEXT: entry:
87 ; CHECK-NEXT: %x0 = tail call i8* @objc_retain(i8* %newValue) nounwind
87 ; CHECK-NEXT: %x0 = tail call i8* @objc_retain(i8* %newValue) [[NUW]]
8888 ; CHECK-NEXT: %x1 = load i8** @x, align 8
8989 ; CHECK-NEXT: store i8* %x0, i8** @x, align 8
9090 ; CHECK-NEXT: %t = icmp eq i8* %x1, %foo
91 ; CHECK-NEXT: tail call void @objc_release(i8* %x1) nounwind, !clang.imprecise_release !0
91 ; CHECK-NEXT: tail call void @objc_release(i8* %x1) [[NUW]], !clang.imprecise_release !0
9292 ; CHECK-NEXT: ret i1 %t
9393 ; CHECK-NEXT: }
9494 define i1 @test4(i8* %newValue, i8* %foo) {
105105
106106 ; CHECK: define i1 @test5(i8* %newValue, i8* %foo) {
107107 ; CHECK: %t = icmp eq i8* %x1, %foo
108 ; CHECK: tail call void @objc_storeStrong(i8** @x, i8* %newValue) nounwind
108 ; CHECK: tail call void @objc_storeStrong(i8** @x, i8* %newValue) [[NUW]]
109109 define i1 @test5(i8* %newValue, i8* %foo) {
110110 entry:
111111 %x0 = tail call i8* @objc_retain(i8* %newValue) nounwind
120120
121121 ; CHECK: define i1 @test6(i8* %newValue, i8* %foo) {
122122 ; CHECK: %t = icmp eq i8* %x1, %foo
123 ; CHECK: tail call void @objc_storeStrong(i8** @x, i8* %newValue) nounwind
123 ; CHECK: tail call void @objc_storeStrong(i8** @x, i8* %newValue) [[NUW]]
124124 define i1 @test6(i8* %newValue, i8* %foo) {
125125 entry:
126126 %x0 = tail call i8* @objc_retain(i8* %newValue) nounwind
135135
136136 ; CHECK: define void @test7(
137137 ; CHECK-NEXT: entry:
138 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) nounwind
138 ; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) [[NUW]]
139139 ; CHECK-NEXT: %tmp = load i8** @x, align 8
140 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) nounwind
140 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) [[NUW]]
141141 ; CHECK-NEXT: ret void
142142 ; CHECK-NEXT: }
143143 define void @test7(i8* %p) {
154154 ; CHECK-NEXT: entry:
155155 ; CHECK-NEXT: %tmp = load i8** @x, align 8
156156 ; CHECK-NEXT: store i8* %p, i8** @x, align 8
157 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) nounwind
157 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) [[NUW]]
158158 ; CHECK-NEXT: ret void
159159 ; CHECK-NEXT: }
160160 define void @test8(i8* %p) {
166166 }
167167
168168 !0 = metadata !{}
169
170 ; CHECK: attributes [[NUW]] = { nounwind }
6868 ; CHECK: define void @_Z6doTestP8NSString() {
6969 ; CHECK: invoke.cont: ; preds = %entry
7070 ; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue", ""()
71 ; CHECK-NEXT: %tmp = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind
71 ; CHECK-NEXT: %tmp = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call) [[NUW:#[0-9]+]]
7272 define void @_Z6doTestP8NSString() {
7373 entry:
7474 %call = invoke i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* ()*)()
8787 !clang.arc.retainAutoreleasedReturnValueMarker = !{!0}
8888
8989 !0 = metadata !{metadata !"mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue"}
90
91 ; CHECK: attributes #0 = { optsize }
92 ; CHECK: attributes [[NUW]] = { nounwind }
3333 ; Merge objc_retain and objc_autorelease into objc_retainAutorelease.
3434
3535 ; CHECK: define void @test2(
36 ; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) nounwind
36 ; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) [[NUW:#[0-9]+]]
3737 ; CHECK: }
3838 define void @test2(i8* %x) nounwind {
3939 entry:
4646 ; Same as test2 but the value is returned. Do an RV optimization.
4747
4848 ; CHECK: define i8* @test2b(
49 ; CHECK: tail call i8* @objc_retainAutoreleaseReturnValue(i8* %x) nounwind
49 ; CHECK: tail call i8* @objc_retainAutoreleaseReturnValue(i8* %x) [[NUW]]
5050 ; CHECK: }
5151 define i8* @test2b(i8* %x) nounwind {
5252 entry:
5858 ; Merge a retain,autorelease pair around a call.
5959
6060 ; CHECK: define void @test3(
61 ; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) nounwind
61 ; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) [[NUW]]
6262 ; CHECK: @use_pointer(i8* %0)
6363 ; CHECK: }
6464 define void @test3(i8* %x, i64 %n) {
7474
7575 ; CHECK: define void @test4(
7676 ; CHECK-NEXT: entry:
77 ; CHECK-NEXT: @objc_retainAutorelease(i8* %x) nounwind
77 ; CHECK-NEXT: @objc_retainAutorelease(i8* %x) [[NUW]]
7878 ; CHECK-NEXT: @use_pointer
7979 ; CHECK-NEXT: @objc_release
8080 ; CHECK-NEXT: ret void
9191 ; Don't merge retain and autorelease if they're not control-equivalent.
9292
9393 ; CHECK: define void @test5(
94 ; CHECK: tail call i8* @objc_retain(i8* %p) nounwind
94 ; CHECK: tail call i8* @objc_retain(i8* %p) [[NUW]]
9595 ; CHECK: true:
96 ; CHECK: call i8* @objc_autorelease(i8* %0) nounwind
96 ; CHECK: call i8* @objc_autorelease(i8* %0) [[NUW]]
9797 ; CHECK: }
9898 define void @test5(i8* %p, i1 %a) {
9999 entry:
118118 ; Those entrypoints don't exist yet though.
119119
120120 ; CHECK: define i8* @test6(
121 ; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %p) nounwind
122 ; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %1) nounwind
121 ; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %p) [[NUW]]
122 ; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %1) [[NUW]]
123123 ; CHECK: }
124124 define i8* @test6() {
125125 %p = call i8* @returner()
160160 %retval = phi i8* [ %c, %if.then ], [ null, %entry ]
161161 ret i8* %retval
162162 }
163
164 ; CHECK: attributes [[NUW]] = { nounwind }
4141 ; CHECK: call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %tmp2, i8* %tmp1)
4242 %call = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %tmp2, i8* %tmp1), !dbg !37, !clang.arc.no_objc_arc_exceptions !38
4343 call void @llvm.dbg.value(metadata !{i8* %call}, i64 0, metadata !12), !dbg !37
44 ; CHECK: call i8* @objc_retain(i8* %call) nounwind
44 ; CHECK: call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]]
4545 %tmp3 = call i8* @objc_retain(i8* %call) nounwind, !dbg !39
4646 call void @llvm.dbg.value(metadata !{i8* %call}, i64 0, metadata !25), !dbg !39
4747 invoke fastcc void @ThrowFunc(i8* %call)
102102 declare void @NSLog(i8*, ...)
103103
104104 declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
105
106 ; CHECK: attributes #0 = { ssp uwtable }
107 ; CHECK: attributes #1 = { nounwind readnone }
108 ; CHECK: attributes #2 = { nonlazybind }
109 ; CHECK: attributes #3 = { noinline ssp uwtable }
110 ; CHECK: attributes [[NUW]] = { nounwind }
105111
106112 !llvm.dbg.cu = !{!0}
107113 !llvm.module.flags = !{!33, !34, !35, !36}
99 ; with the objc_storeWeak call.
1010
1111 ; CHECK: define void @test0(
12 ; CHECK: %tmp7 = call i8* @objc_retainBlock(i8* %tmp6) nounwind, !clang.arc.copy_on_escape !0
13 ; CHECK: call void @objc_release(i8* %tmp7) nounwind, !clang.imprecise_release !0
12 ; CHECK: %tmp7 = call i8* @objc_retainBlock(i8* %tmp6) [[NUW:#[0-9]+]], !clang.arc.copy_on_escape !0
13 ; CHECK: call void @objc_release(i8* %tmp7) [[NUW]], !clang.imprecise_release !0
1414 ; CHECK: }
1515 define void @test0() nounwind {
1616 entry:
128128 declare void @objc_release(i8*)
129129
130130 !0 = metadata !{}
131
132 ; CHECK: attributes [[NUW]] = { nounwind }
133 ; CHECK: attributes #1 = { nounwind ssp }
1111
1212 ; CHECK: define void @test0(
1313 ; CHECK: invoke.cont:
14 ; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0
14 ; CHECK: call void @objc_release(i8* %zipFile) [[NUW:#[0-9]+]], !clang.imprecise_release !0
1515 ; CHECK: ret void
1616 ; CHECK: lpad:
17 ; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0
17 ; CHECK: call void @objc_release(i8* %zipFile) [[NUW]], !clang.imprecise_release !0
1818 ; CHECK: ret void
1919 define void @test0(i8* %zipFile) {
2020 entry:
3838
3939 ; CHECK: define void @test1(
4040 ; CHECK: invoke.cont:
41 ; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0
41 ; CHECK: call void @objc_release(i8* %zipFile) [[NUW]], !clang.imprecise_release !0
4242 ; CHECK: call void @callee()
4343 ; CHECK: br label %done
4444 ; CHECK: lpad:
45 ; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0
45 ; CHECK: call void @objc_release(i8* %zipFile) [[NUW]], !clang.imprecise_release !0
4646 ; CHECK: call void @callee()
4747 ; CHECK: br label %done
4848 ; CHECK: done:
107107
108108 ; CHECK: define void @test3(
109109 ; CHECK: if.end:
110 ; CHECK-NEXT: call void @objc_release(i8* %p) nounwind
110 ; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]]
111111 ; CHECK-NEXT: ret void
112112 define void @test3(i8* %p, i1 %b) {
113113 entry:
139139 ; CHECK: lpad:
140140 ; CHECK-NEXT: %r = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
141141 ; CHECK-NEXT: cleanup
142 ; CHECK-NEXT: call void @objc_release(i8* %p) nounwind
142 ; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]]
143143 ; CHECK-NEXT: ret void
144144 ; CHECK: if.end:
145 ; CHECK-NEXT: call void @objc_release(i8* %p) nounwind
145 ; CHECK-NEXT: call void @objc_release(i8* %p) [[NUW]]
146146 ; CHECK-NEXT: ret void
147147 define void @test4(i8* %p, i1 %b) {
148148 entry:
214214 declare i32 @__gxx_personality_v0(...)
215215 declare i32 @__objc_personality_v0(...)
216216
217 ; CHECK: attributes [[NUW]] = { nounwind }
218
217219 !0 = metadata !{}
33 ; and various scary looking things and fold it into an objc_retainAutorelease.
44
55 ; CHECK: bb57:
6 ; CHECK: tail call i8* @objc_retainAutorelease(i8* %tmp71x) nounwind
6 ; CHECK: tail call i8* @objc_retainAutorelease(i8* %tmp71x) [[NUW:#[0-9]+]]
77 ; CHECK: bb99:
88
99 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"
218218 tail call void @objc_release(i8* %tmp107) nounwind
219219 ret %14* %tmp106
220220 }
221
222 ; CHECK: attributes [[NUW]] = { nounwind }
769769 @__block_d_tmp5 = external hidden constant { i64, i64, i8*, i8*, i8*, i8* }
770770
771771 ; CHECK: define void @test11(
772 ; CHECK: tail call i8* @objc_retain(i8* %call) nounwind
773 ; CHECK: tail call i8* @objc_retain(i8* %call) nounwind
774 ; CHECK: call void @objc_release(i8* %call) nounwind, !clang.imprecise_release !0
772 ; CHECK: tail call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]]
773 ; CHECK: tail call i8* @objc_retain(i8* %call) [[NUW]]
774 ; CHECK: call void @objc_release(i8* %call) [[NUW]], !clang.imprecise_release !0
775775 ; CHECK: }
776776 define void @test11() {
777777 entry:
819819 call void @objc_release(i8* %call) nounwind, !clang.imprecise_release !0
820820 ret void
821821 }
822
823 ; CHECK: attributes [[NUW]] = { nounwind }
824 ; CHECK: attributes #1 = { nonlazybind }
88 @"\01L_OBJC_SELECTOR_REFERENCES_" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"
99
1010 ; CHECK: define void @test(
11 ; CHECK: %3 = call i8* @objc_retainBlock(i8* %2) nounwind
11 ; CHECK: %3 = call i8* @objc_retainBlock(i8* %2) [[NUW:#[0-9]+]]
1212 ; CHECK: @objc_msgSend
1313 ; CHECK-NEXT: @objc_release(i8* %3)
1414 define void @test(%0* %array) uwtable {
8686
8787 declare void @objc_release(i8*)
8888
89 ; CHECK: attributes #0 = { uwtable }
90 ; CHECK: attributes #1 = { nonlazybind }
91 ; CHECK: attributes [[NUW]] = { nounwind }
92
8993 !0 = metadata !{}
33 ; objc_retainBlock stores into %repeater so the load from after the
44 ; call isn't forwardable from the store before the call.
55
6 ; CHECK: %tmp16 = call i8* @objc_retainBlock(i8* %tmp15) nounwind
6 ; CHECK: %tmp16 = call i8* @objc_retainBlock(i8* %tmp15) [[NUW:#[0-9]+]]
77 ; CHECK: %tmp17 = bitcast i8* %tmp16 to void ()*
88 ; CHECK: %tmp18 = load %struct.__block_byref_repeater** %byref.forwarding, align 8
99 ; CHECK: %repeater12 = getelementptr inbounds %struct.__block_byref_repeater* %tmp18, i64 0, i32 6
3636 }
3737
3838 declare i8* @objc_retainBlock(i8*)
39
40 ; CHECK: attributes #0 = { noreturn }
41 ; CHECK: attributes [[NUW]] = { nounwind }
2727 ; optimization possible.
2828
2929 ; CHECK: define void @test0_no_metadata(i8* %tmp) {
30 ; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind
31 ; CHECK: tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
30 ; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW:#[0-9]+]]
31 ; CHECK: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
3232 ; CHECK: }
3333 define void @test0_no_metadata(i8* %tmp) {
3434 entry:
4242 ; optimization possible.
4343
4444 ; CHECK: define void @test0_escape(i8* %tmp, i8** %z) {
45 ; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind, !clang.arc.copy_on_escape !0
46 ; CHECK: tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
45 ; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]], !clang.arc.copy_on_escape !0
46 ; CHECK: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
4747 ; CHECK: }
4848 define void @test0_escape(i8* %tmp, i8** %z) {
4949 entry:
5757 ; Same as test0_escape, but there's no intervening call.
5858
5959 ; CHECK: define void @test0_just_escape(i8* %tmp, i8** %z) {
60 ; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind, !clang.arc.copy_on_escape !0
61 ; CHECK: tail call void @objc_release(i8* %tmp2) nounwind, !clang.imprecise_release !0
60 ; CHECK: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]], !clang.arc.copy_on_escape !0
61 ; CHECK: tail call void @objc_release(i8* %tmp2) [[NUW]], !clang.imprecise_release !0
6262 ; CHECK: }
6363 define void @test0_just_escape(i8* %tmp, i8** %z) {
6464 entry:
7272
7373 ; CHECK: define void @test1(i8* %tmp) {
7474 ; CHECK-NOT: @objc
75 ; CHECK: tail call i8* @objc_retain(i8* %tmp) nounwind
75 ; CHECK: tail call i8* @objc_retain(i8* %tmp) [[NUW]]
7676 ; CHECK-NOT: @objc
77 ; CHECK: tail call void @objc_release(i8* %tmp) nounwind, !clang.imprecise_release !0
77 ; CHECK: tail call void @objc_release(i8* %tmp) [[NUW]], !clang.imprecise_release !0
7878 ; CHECK-NOT: @objc
7979 ; CHECK: }
8080 define void @test1(i8* %tmp) {
9494
9595 ; CHECK: define void @test1_no_metadata(i8* %tmp) {
9696 ; CHECK-NEXT: entry:
97 ; CHECK-NEXT: tail call i8* @objc_retainBlock(i8* %tmp) nounwind
97 ; CHECK-NEXT: tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]]
9898 ; CHECK-NEXT: @use_pointer(i8* %tmp2)
9999 ; CHECK-NEXT: @use_pointer(i8* %tmp2)
100 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) nounwind, !clang.imprecise_release !0
100 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) [[NUW]], !clang.imprecise_release !0
101101 ; CHECK-NOT: @objc
102102 ; CHECK: }
103103 define void @test1_no_metadata(i8* %tmp) {
117117
118118 ; CHECK: define void @test1_escape(i8* %tmp, i8** %z) {
119119 ; CHECK-NEXT: entry:
120 ; CHECK-NEXT: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) nounwind, !clang.arc.copy_on_escape !0
120 ; CHECK-NEXT: %tmp2 = tail call i8* @objc_retainBlock(i8* %tmp) [[NUW]], !clang.arc.copy_on_escape !0
121121 ; CHECK-NEXT: store i8* %tmp2, i8** %z
122122 ; CHECK-NEXT: @use_pointer(i8* %tmp2)
123123 ; CHECK-NEXT: @use_pointer(i8* %tmp2)
124 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) nounwind, !clang.imprecise_release !0
124 ; CHECK-NEXT: tail call void @objc_release(i8* %tmp) [[NUW]], !clang.imprecise_release !0
125125 ; CHECK-NOT: @objc
126126 ; CHECK: }
127127 define void @test1_escape(i8* %tmp, i8** %z) {
135135 tail call void @objc_release(i8* %tmp) nounwind, !clang.imprecise_release !0
136136 ret void
137137 }
138
139 ; CHECK: attributes [[NUW]] = { nounwind }
1212
1313 ; CHECK: define i8* @test0(i8* %p) {
1414 ; CHECK-NEXT: entry:
15 ; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleaseReturnValue(i8* %p) nounwind
15 ; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleaseReturnValue(i8* %p) [[NUW:#[0-9]+]]
1616 ; CHECK-NEXT: ret i8* %0
1717 ; CHECK-NEXT: }
1818
6464 declare i32 @__gxx_personality_v0(...)
6565
6666 !0 = metadata !{}
67
68 ; CHECK: attributes [[NUW]] = { nounwind }
5656
5757 ; CHECK: define void @test3(i8** %p) {
5858 ; CHECK-NEXT: %x = call i8* @objc_loadWeak(i8** %p)
59 ; CHECK-NEXT: call void @use_pointer(i8* %x) readonly
59 ; CHECK-NEXT: call void @use_pointer(i8* %x) [[RO:#[0-9]+]]
6060 ; CHECK-NEXT: %1 = tail call i8* @objc_retain(i8* %x)
6161 ; CHECK-NEXT: call void @use_pointer(i8* %x)
6262 ; CHECK-NEXT: ret void
7373
7474 ; CHECK: define void @test4(i8** %p) {
7575 ; CHECK-NEXT: %x = call i8* @objc_loadWeak(i8** %p)
76 ; CHECK-NEXT: call void @use_pointer(i8* %x) readonly
76 ; CHECK-NEXT: call void @use_pointer(i8* %x) [[RO]]
7777 ; CHECK-NEXT: call void @callee()
7878 ; CHECK-NEXT: %y = call i8* @objc_loadWeak(i8** %p)
7979 ; CHECK-NEXT: call void @use_pointer(i8* %y)
132132 call void @use_pointer(i8* %y)
133133 ret void
134134 }
135
136 ; CHECK: attributes #0 = { nounwind }
137 ; CHECK: attributes [[RO]] = { readonly }
2828 ; CHECK: define void @test0(
2929 ; CHECK-NEXT: entry:
3030 ; CHECK-NEXT: %x = call i8* @returner
31 ; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %x) nounwind
31 ; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %x) [[NUW:#[0-9]+]]
3232 ; CHECK: t:
3333 ; CHECK-NOT: @objc_
3434 ; CHECK: return:
158158 ; Apply the RV optimization.
159159
160160 ; CHECK: define i8* @test10(i8* %p)
161 ; CHECK: tail call i8* @objc_retain(i8* %p) nounwind
162 ; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %p) nounwind
161 ; CHECK: tail call i8* @objc_retain(i8* %p) [[NUW]]
162 ; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %p) [[NUW]]
163163 ; CHECK-NEXT: ret i8* %p
164164 define i8* @test10(i8* %p) {
165165 %1 = call i8* @objc_retain(i8* %p)
214214 ; argument is not a return value.
215215
216216 ; CHECK: define void @test14(
217 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %p) nounwind
217 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %p) [[NUW]]
218218 ; CHECK-NEXT: ret void
219219 define void @test14(i8* %p) {
220220 call i8* @objc_retainAutoreleasedReturnValue(i8* %p)
226226
227227 ; CHECK: define void @test15(
228228 ; CHECK-NEXT: %y = call i8* @returner()
229 ; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) nounwind
229 ; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) [[NUW]]
230230 ; CHECK-NEXT: ret void
231231 define void @test15() {
232232 %y = call i8* @returner()
239239
240240 ; CHECK: define void @test16(
241241 ; CHECK-NEXT: %y = call i8* @returner()
242 ; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) nounwind
242 ; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) [[NUW]]
243243 ; CHECK-NEXT: ret void
244244 define void @test16() {
245245 %y = call i8* @returner()
251251 ; argument is not a return value.
252252
253253 ; CHECK: define void @test17(
254 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) nounwind
254 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) [[NUW]]
255255 ; CHECK-NEXT: ret void
256256 define void @test17(i8* %y) {
257257 call i8* @objc_retain(i8* %y)
264264 ; CHECK: define void @test18(
265265 ; CHECK-NEXT: %y = call i8* @returner()
266266 ; CHECK-NEXT: call void @callee()
267 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) nounwind
267 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) [[NUW]]
268268 ; CHECK-NEXT: ret void
269269 define void @test18() {
270270 %y = call i8* @returner()
322322 ; Convert autoreleaseRV to autorelease.
323323
324324 ; CHECK: define void @test23(
325 ; CHECK: call i8* @objc_autorelease(i8* %p) nounwind
325 ; CHECK: call i8* @objc_autorelease(i8* %p) [[NUW]]
326326 define void @test23(i8* %p) {
327327 store i8 0, i8* %p
328328 call i8* @objc_autoreleaseReturnValue(i8* %p)
339339 %s = bitcast i8* %p to {}*
340340 ret {}* %s
341341 }
342
343 ; CHECK: attributes [[NUW]] = { nounwind }
33 ; rdar://11256239
44
55 ; CHECK: define void @test0
6 ; CHECK: call i8* @objc_retain(i8* %call) nounwind
7 ; CHECK: call i8* @objc_retain(i8* %call) nounwind
8 ; CHECK: call i8* @objc_retain(i8* %cond) nounwind
9 ; CHECK: call void @objc_release(i8* %call) nounwind
10 ; CHECK: call void @objc_release(i8* %call) nounwind
11 ; CHECK: call void @objc_release(i8* %cond) nounwind
6 ; CHECK: call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]]
7 ; CHECK: call i8* @objc_retain(i8* %call) [[NUW]]
8 ; CHECK: call i8* @objc_retain(i8* %cond) [[NUW]]
9 ; CHECK: call void @objc_release(i8* %call) [[NUW]]
10 ; CHECK: call void @objc_release(i8* %call) [[NUW]]
11 ; CHECK: call void @objc_release(i8* %cond) [[NUW]]
1212 define void @test0() {
1313 entry:
1414 br label %while.body
4545 declare void @use_pointer(i8*)
4646
4747 !0 = metadata !{}
48
49 ; CHECK: attributes [[NUW]] = { nounwind }
1818 ; CHECK: define void @foo() {
1919 ; CHECK-NEXT: entry:
2020 ; CHECK-NEXT: %call = call i8* @bar()
21 ; CHECK-NEXT: call void @use(i8* %call) nounwind
21 ; CHECK-NEXT: call void @use(i8* %call) [[NUW:#[0-9]+]]
2222 ; CHECK-NEXT: ret void
2323 ; CHECK-NEXT: }
2424 define void @foo() {
8383 declare void @use(i8*) nounwind
8484 declare void @objc_destroyWeak(i8**)
8585
86 ; CHECK: attributes #0 = { nounwind }
86 ; CHECK: attributes [[NUW]] = { nounwind }
8787
8888 !0 = metadata !{}
6666
6767 ; CHECK: func.exit:
6868 ; CHECK-NOT: load
69 ; CHECK: %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i64 0, i64 0), i32 %tmp) nounwind
69 ; CHECK: %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i64 0, i64 0), i32 %tmp) [[NUW:#[0-9]+]]
7070 func.exit: ; preds = %while.body.i.func.exit_crit_edge, %while.cond.i.func.exit_crit_edge
7171 %tmp3 = load i32* %x.i, align 4
7272 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i64 0, i64 0), i32 %tmp3) nounwind
7474 }
7575
7676 declare i32 @printf(i8* nocapture, ...) nounwind
77
78 ; CHECK: attributes #0 = { nounwind uwtable }
79 ; CHECK: attributes [[NUW]] = { nounwind }
3434 ; CHECK: @bar
3535 entry:
3636 ; CHECK-NEXT: entry:
37 ; CHECK-NEXT: tail call void @bees.a() nounwind
37 ; CHECK-NEXT: tail call void @bees.a() [[NUW:#[0-9]+]]
3838 ; CHECK-NEXT: ret i32 0
3939 %lt = icmp slt i64 %x, %y
4040 %qux = select i1 %lt, i32 0, i32 2
6060 ; CHECK: @bazz
6161 entry:
6262 ; CHECK-NEXT: entry:
63 ; CHECK-NEXT: tail call void @bees.b() nounwind
63 ; CHECK-NEXT: tail call void @bees.b() [[NUW]]
6464 ; CHECK-NEXT: ret void
6565 %lt = icmp slt i64 %x, %y
6666 %qux = select i1 %lt, i32 10, i32 12
8585 ; CHECK: @quux
8686 entry:
8787 ; CHECK-NEXT: entry:
88 ; CHECK-NEXT: tail call void @bees.a() nounwind
88 ; CHECK-NEXT: tail call void @bees.a() [[NUW]]
8989 ; CHECK-NEXT: ret void
9090 %lt = icmp slt i64 %x, %y
9191 %qux = select i1 %lt, i32 0, i32 0
135135 declare void @llvm.trap() nounwind noreturn
136136 declare void @bees.a() nounwind
137137 declare void @bees.b() nounwind
138
139 ; CHECK: attributes [[NUW]] = { nounwind }
140 ; CHECK: attributes #1 = { noreturn nounwind }