llvm.org GIT mirror llvm / 7ab6c76
Modify the LLVM assembly output so that it uses references to represent function attributes. This makes the LLVM assembly look better. E.g.: define void @foo() #0 { ret void } attributes #0 = { nounwind noinline ssp } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175605 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 6 years ago
28 changed file(s) with 244 addition(s) and 164 deletion(s). Raw diff Collapse all Expand all
6565 return 0;
6666 }
6767
68 static void PrintCallingConv(unsigned cc, raw_ostream &Out)
69 {
68 static void PrintCallingConv(unsigned cc, raw_ostream &Out) {
7069 switch (cc) {
71 case CallingConv::Fast: Out << "fastcc"; break;
72 case CallingConv::Cold: Out << "coldcc"; break;
73 case CallingConv::X86_StdCall: Out << "x86_stdcallcc"; break;
74 case CallingConv::X86_FastCall: Out << "x86_fastcallcc"; break;
75 case CallingConv::X86_ThisCall: Out << "x86_thiscallcc"; break;
76 case CallingConv::Intel_OCL_BI: Out << "intel_ocl_bicc"; break;
77 case CallingConv::ARM_APCS: Out << "arm_apcscc"; break;
78 case CallingConv::ARM_AAPCS: Out << "arm_aapcscc"; break;
79 case CallingConv::ARM_AAPCS_VFP:Out << "arm_aapcs_vfpcc"; break;
80 case CallingConv::MSP430_INTR: Out << "msp430_intrcc"; break;
81 case CallingConv::PTX_Kernel: Out << "ptx_kernel"; break;
82 case CallingConv::PTX_Device: Out << "ptx_device"; break;
83 default: Out << "cc" << cc; break;
70 default: Out << "cc" << cc; break;
71 case CallingConv::Fast: Out << "fastcc"; break;
72 case CallingConv::Cold: Out << "coldcc"; break;
73 case CallingConv::X86_StdCall: Out << "x86_stdcallcc"; break;
74 case CallingConv::X86_FastCall: Out << "x86_fastcallcc"; break;
75 case CallingConv::X86_ThisCall: Out << "x86_thiscallcc"; break;
76 case CallingConv::Intel_OCL_BI: Out << "intel_ocl_bicc"; break;
77 case CallingConv::ARM_APCS: Out << "arm_apcscc"; break;
78 case CallingConv::ARM_AAPCS: Out << "arm_aapcscc"; break;
79 case CallingConv::ARM_AAPCS_VFP: Out << "arm_aapcs_vfpcc"; break;
80 case CallingConv::MSP430_INTR: Out << "msp430_intrcc"; break;
81 case CallingConv::PTX_Kernel: Out << "ptx_kernel"; break;
82 case CallingConv::PTX_Device: Out << "ptx_device"; break;
8483 }
8584 }
8685
509508 CreateModuleSlot(I);
510509
511510 // Add all the function attributes to the table.
511 // FIXME: Add attributes of other objects?
512512 AttributeSet FnAttrs = I->getAttributes().getFnAttributes();
513513 if (FnAttrs.hasAttributes(AttributeSet::FunctionIndex))
514514 CreateAttributeSetSlot(FnAttrs);
16611661 if (F->hasUnnamedAddr())
16621662 Out << " unnamed_addr";
16631663 if (Attrs.hasAttributes(AttributeSet::FunctionIndex))
1664 Out << ' ' << Attrs.getAsString(AttributeSet::FunctionIndex);
1664 Out << " #" << Machine.getAttributeGroupSlot(Attrs.getFnAttributes());
16651665 if (F->hasSection()) {
16661666 Out << " section \"";
16671667 PrintEscapedString(F->getSection(), Out);
3636
3737 declare <8 x i16> @llvm.arm.neon.vld1.v8i16(i8*, i32) nounwind readonly
3838 declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind
39
40 ; CHECK: attributes #0 = { nounwind readonly }
41 ; CHECK: attributes #1 = { nounwind }
4848 declare i32 @TestPure(i32) readonly
4949
5050 declare i32 @TestNone(i32)
51
52 ; CHECK: attributes #0 = { readnone }
53 ; CHECK: attributes #1 = { readonly }
88 ; invalid, as it's possible that this only happens after optimization on a
99 ; code path which isn't ever executed.
1010
11 ; CHECK: define void @test0_yes(i32* nocapture %p) nounwind readnone {
11 ; CHECK: define void @test0_yes(i32* nocapture %p) #0 {
1212 define void @test0_yes(i32* %p) nounwind {
1313 store i32 0, i32* %p, !tbaa !1
1414 ret void
1515 }
1616
17 ; CHECK: define void @test0_no(i32* nocapture %p) nounwind {
17 ; CHECK: define void @test0_no(i32* nocapture %p) #1 {
1818 define void @test0_no(i32* %p) nounwind {
1919 store i32 0, i32* %p, !tbaa !2
2020 ret void
2323 ; Add the readonly attribute, since there's just a call to a function which
2424 ; TBAA says doesn't modify any memory.
2525
26 ; CHECK: define void @test1_yes(i32* nocapture %p) nounwind readonly {
26 ; CHECK: define void @test1_yes(i32* nocapture %p) #2 {
2727 define void @test1_yes(i32* %p) nounwind {
2828 call void @callee(i32* %p), !tbaa !1
2929 ret void
3030 }
3131
32 ; CHECK: define void @test1_no(i32* %p) nounwind {
32 ; CHECK: define void @test1_no(i32* %p) #1 {
3333 define void @test1_no(i32* %p) nounwind {
3434 call void @callee(i32* %p), !tbaa !2
3535 ret void
4242 ; This is unusual, since the function is memcpy, but as above, this
4343 ; isn't necessarily invalid.
4444
45 ; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind readnone {
45 ; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) #0 {
4646 define void @test2_yes(i8* %p, i8* %q, i64 %n) nounwind {
4747 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !1
4848 ret void
4949 }
5050
51 ; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind {
51 ; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) #1 {
5252 define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind {
5353 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !2
5454 ret void
5656
5757 ; Similar to the others, va_arg only accesses memory through its operand.
5858
59 ; CHECK: define i32 @test3_yes(i8* nocapture %p) nounwind readnone {
59 ; CHECK: define i32 @test3_yes(i8* nocapture %p) #0 {
6060 define i32 @test3_yes(i8* %p) nounwind {
6161 %t = va_arg i8* %p, i32, !tbaa !1
6262 ret i32 %t
6363 }
6464
65 ; CHECK: define i32 @test3_no(i8* nocapture %p) nounwind {
65 ; CHECK: define i32 @test3_no(i8* nocapture %p) #1 {
6666 define i32 @test3_no(i8* %p) nounwind {
6767 %t = va_arg i8* %p, i32, !tbaa !2
6868 ret i32 %t
7171 declare void @callee(i32* %p) nounwind
7272 declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i32, i1) nounwind
7373
74 ; CHECK: attributes #0 = { nounwind readnone }
75 ; CHECK: attributes #1 = { nounwind }
76 ; CHECK: attributes #2 = { nounwind readonly }
77
7478 ; Root note.
7579 !0 = metadata !{ }
7680
2121 declare <8 x i16> @llvm.arm.neon.vld1.v8i16(i8*, i32) nounwind readonly
2222 declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind
2323
24 ; CHECK: attributes #0 = { nounwind readonly }
25 ; CHECK: attributes #1 = { nounwind }
26
2427 !0 = metadata !{metadata !"tbaa root", null}
2528 !1 = metadata !{metadata !"A", metadata !0}
2629 !2 = metadata !{metadata !"B", metadata !0}
0 ; Test function attributes
11 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
22
3 ; CHECK: define void @fn1() alwaysinline
3 ; CHECK: define void @fn1() #0
44 define void @fn1() alwaysinline {
55 ret void
66 }
77
8 ; CHECK: define void @fn2() noinline
8 ; CHECK: define void @fn2() #1
99 define void @fn2() noinline {
1010 ret void
1111 }
1212
1313 ; CHECK: define void @fn3()
14 ; CHECK-NOT: define void @fn3(){{.*}}inline
14 ; CHECK-NOT: define void @fn3() #{{.*}}
1515 define void @fn3() {
1616 ret void
1717 }
18
19 ; CHECK: attributes #0 = { alwaysinline }
20 ; CHECK: attributes #1 = { noinline }
1414
1515 ; CHECK: @bar.d = internal unnamed_addr constant %struct.foobar zeroinitializer, align 4
1616 ; CHECK: @foo.d = internal constant %struct.foobar zeroinitializer, align 4
17 ; CHECK: define i32 @main() unnamed_addr nounwind ssp {
17 ; CHECK: define i32 @main() unnamed_addr #0 {
18
19 ; CHECK: attributes #0 = { nounwind ssp }
1313 }
1414
1515 define void @f3() noreturn
16 ; CHECK: define void @f3() noreturn
16 ; CHECK: define void @f3() #0
1717 {
1818 ret void;
1919 }
3131 }
3232
3333 define void @f6() nounwind
34 ; CHECK: define void @f6() nounwind
34 ; CHECK: define void @f6() #1
3535 {
3636 ret void;
3737 }
5555 }
5656
5757 define void @f10() readnone
58 ; CHECK: define void @f10() readnone
58 ; CHECK: define void @f10() #2
5959 {
6060 ret void;
6161 }
6262
6363 define void @f11() readonly
64 ; CHECK: define void @f11() readonly
64 ; CHECK: define void @f11() #3
6565 {
6666 ret void;
6767 }
6868
6969 define void @f12() noinline
70 ; CHECK: define void @f12() noinline
70 ; CHECK: define void @f12() #4
7171 {
7272 ret void;
7373 }
7474
7575 define void @f13() alwaysinline
76 ; CHECK: define void @f13() alwaysinline
76 ; CHECK: define void @f13() #5
7777 {
7878 ret void;
7979 }
8080
8181 define void @f14() optsize
82 ; CHECK: define void @f14() optsize
82 ; CHECK: define void @f14() #6
8383 {
8484 ret void;
8585 }
8686
8787 define void @f15() ssp
88 ; CHECK: define void @f15() ssp
88 ; CHECK: define void @f15() #7
8989 {
9090 ret void;
9191 }
9292
9393 define void @f16() sspreq
94 ; CHECK: define void @f16() sspreq
94 ; CHECK: define void @f16() #8
9595 {
9696 ret void;
9797 }
109109 }
110110
111111 define void @f19() noredzone
112 ; CHECK: define void @f19() noredzone
112 ; CHECK: define void @f19() #9
113113 {
114114 ret void;
115115 }
116116
117117 define void @f20() noimplicitfloat
118 ; CHECK: define void @f20() noimplicitfloat
118 ; CHECK: define void @f20() #10
119119 {
120120 ret void;
121121 }
122122
123123 define void @f21() naked
124 ; CHECK: define void @f21() naked
124 ; CHECK: define void @f21() #11
125125 {
126126 ret void;
127127 }
128128
129129 define void @f22() inlinehint
130 ; CHECK: define void @f22() inlinehint
130 ; CHECK: define void @f22() #12
131131 {
132132 ret void;
133133 }
134134
135135 define void @f23() alignstack(4)
136 ; CHECK: define void @f23() alignstack(4)
136 ; CHECK: define void @f23() #13
137137 {
138138 ret void;
139139 }
140140
141141 define void @f24() returns_twice
142 ; CHECK: define void @f24() returns_twice
142 ; CHECK: define void @f24() #14
143143 {
144144 ret void;
145145 }
146146
147147 define void @f25() uwtable
148 ; CHECK: define void @f25() uwtable
148 ; CHECK: define void @f25() #15
149149 {
150150 ret void;
151151 }
152152
153153 define void @f26() nonlazybind
154 ; CHECK: define void @f26() nonlazybind
154 ; CHECK: define void @f26() #16
155155 {
156156 ret void;
157157 }
158158
159159 define void @f27() address_safety
160 ; CHECK: define void @f27() address_safety
160 ; CHECK: define void @f27() #17
161161 {
162162 ret void;
163163 }
164164 define void @f28() thread_safety
165 ; CHECK: define void @f28() thread_safety
165 ; CHECK: define void @f28() #18
166166 {
167167 ret void;
168168 }
169169 define void @f29() uninitialized_checks
170 ; CHECK: define void @f29() uninitialized_checks
170 ; CHECK: define void @f29() #19
171171 {
172172 ret void;
173173 }
174174
175175 define void @f30() "cpu"="cortex-a8"
176 ; CHECK: define void @f30() "cpu"="cortex-a8"
176 ; CHECK: define void @f30() #20
177177 {
178178 ret void;
179179 }
1212 ret i32 %add2
1313 }
1414
15 ; CHECK: declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) nounwind readnone
16 ; CHECK: declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone
17 ; CHECK: declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) nounwind readnone
15 ; CHECK: declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) #1
16 ; CHECK: declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) #1
17 ; CHECK: declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) #1
1818
1919 declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) nounwind readnone
2020 declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone
2121 declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) nounwind readnone
22
23 ; CHECK: attributes #0 = { nounwind }
24 ; CHECK: attributes #1 = { nounwind readnone }
1212 ret i32 %add2
1313 }
1414
15 ; CHECK: declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) nounwind readnone
16 ; CHECK: declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone
17 ; CHECK: declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) nounwind readnone
15 ; CHECK: declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) #1
16 ; CHECK: declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) #1
17 ; CHECK: declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) #1
1818
1919 declare i32 @llvm.x86.sse41.ptestc(<4 x float>, <4 x float>) nounwind readnone
2020 declare i32 @llvm.x86.sse41.ptestz(<4 x float>, <4 x float>) nounwind readnone
2121 declare i32 @llvm.x86.sse41.ptestnzc(<4 x float>, <4 x float>) nounwind readnone
22
23 ; CHECK: attributes #0 = { nounwind }
24 ; CHECK: attributes #1 = { nounwind readnone }
0 ; RUN: llvm-as < %s | llvm-dis > %t1.ll
1 ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
2 ; RUN: diff %t1.ll %t2.ll
3
4 @.str = private unnamed_addr constant [14 x i8] c"hello world!\0A\00", align 1
5
6 define void @foo() #0 {
7 entry:
8 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0))
9 ret void
10 }
11
12 declare i32 @printf(i8*, ...)
13
14 attributes #0 = { nounwind ssp uwtable }
6060 ; FIXME: test ALL the intrinsics in this file.
6161
6262 ; rdar://11542750
63 ; CHECK: declare void @llvm.trap() noreturn nounwind
63 ; CHECK: declare void @llvm.trap() #2
6464 declare void @llvm.trap()
6565
6666 define void @trap() {
6767 call void @llvm.trap()
6868 ret void
6969 }
70
71 ; CHECK: attributes #0 = { nounwind readnone }
72 ; CHECK: attributes #1 = { nounwind readonly }
73 ; CHECK: attributes #2 = { noreturn nounwind }
0 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
11
22 define void @test1() minsize {
3 ; CHECK: define void @test1() minsize
3 ; CHECK: define void @test1() #0
44 ret void
55 }
66
7 ; CHECK: attributes #0 = { minsize }
117117 ; Duplicate all of the above as function return values rather than
118118 ; global initializers.
119119
120 ; PLAIN: define i8* @goo8() nounwind {
120 ; PLAIN: define i8* @goo8() #0 {
121121 ; PLAIN: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) to i8*
122122 ; PLAIN: ret i8* %t
123123 ; PLAIN: }
124 ; PLAIN: define i1* @goo1() nounwind {
124 ; PLAIN: define i1* @goo1() #0 {
125125 ; PLAIN: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) to i1*
126126 ; PLAIN: ret i1* %t
127127 ; PLAIN: }
128 ; PLAIN: define i8* @foo8() nounwind {
128 ; PLAIN: define i8* @foo8() #0 {
129129 ; PLAIN: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) to i8*
130130 ; PLAIN: ret i8* %t
131131 ; PLAIN: }
132 ; PLAIN: define i1* @foo1() nounwind {
132 ; PLAIN: define i1* @foo1() #0 {
133133 ; PLAIN: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) to i1*
134134 ; PLAIN: ret i1* %t
135135 ; PLAIN: }
136 ; PLAIN: define i8* @hoo8() nounwind {
136 ; PLAIN: define i8* @hoo8() #0 {
137137 ; PLAIN: %t = bitcast i8* getelementptr (i8* null, i32 -1) to i8*
138138 ; PLAIN: ret i8* %t
139139 ; PLAIN: }
140 ; PLAIN: define i1* @hoo1() nounwind {
140 ; PLAIN: define i1* @hoo1() #0 {
141141 ; PLAIN: %t = bitcast i1* getelementptr (i1* null, i32 -1) to i1*
142142 ; PLAIN: ret i1* %t
143143 ; PLAIN: }
144 ; OPT: define i8* @goo8() nounwind {
144 ; OPT: define i8* @goo8() #0 {
145145 ; OPT: ret i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1)
146146 ; OPT: }
147 ; OPT: define i1* @goo1() nounwind {
147 ; OPT: define i1* @goo1() #0 {
148148 ; OPT: ret i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1)
149149 ; OPT: }
150 ; OPT: define i8* @foo8() nounwind {
150 ; OPT: define i8* @foo8() #0 {
151151 ; OPT: ret i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2)
152152 ; OPT: }
153 ; OPT: define i1* @foo1() nounwind {
153 ; OPT: define i1* @foo1() #0 {
154154 ; OPT: ret i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2)
155155 ; OPT: }
156 ; OPT: define i8* @hoo8() nounwind {
156 ; OPT: define i8* @hoo8() #0 {
157157 ; OPT: ret i8* getelementptr (i8* null, i32 -1)
158158 ; OPT: }
159 ; OPT: define i1* @hoo1() nounwind {
159 ; OPT: define i1* @hoo1() #0 {
160160 ; OPT: ret i1* getelementptr (i1* null, i32 -1)
161161 ; OPT: }
162 ; TO: define i8* @goo8() nounwind {
162 ; TO: define i8* @goo8() #0 {
163163 ; TO: ret i8* null
164164 ; TO: }
165 ; TO: define i1* @goo1() nounwind {
165 ; TO: define i1* @goo1() #0 {
166166 ; TO: ret i1* null
167167 ; TO: }
168 ; TO: define i8* @foo8() nounwind {
168 ; TO: define i8* @foo8() #0 {
169169 ; TO: ret i8* inttoptr (i64 -1 to i8*)
170170 ; TO: }
171 ; TO: define i1* @foo1() nounwind {
171 ; TO: define i1* @foo1() #0 {
172172 ; TO: ret i1* inttoptr (i64 -1 to i1*)
173173 ; TO: }
174 ; TO: define i8* @hoo8() nounwind {
174 ; TO: define i8* @hoo8() #0 {
175175 ; TO: ret i8* inttoptr (i64 -1 to i8*)
176176 ; TO: }
177 ; TO: define i1* @hoo1() nounwind {
177 ; TO: define i1* @hoo1() #0 {
178178 ; TO: ret i1* inttoptr (i64 -1 to i1*)
179179 ; TO: }
180180 ; SCEV: Classifying expressions for: @goo8
219219 ret i1* %t
220220 }
221221
222 ; PLAIN: define i64 @fa() nounwind {
222 ; PLAIN: define i64 @fa() #0 {
223223 ; PLAIN: %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64
224224 ; PLAIN: ret i64 %t
225225 ; PLAIN: }
226 ; PLAIN: define i64 @fb() nounwind {
226 ; PLAIN: define i64 @fb() #0 {
227227 ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr ({ i1, double }* null, i64 0, i32 1) to i64) to i64
228228 ; PLAIN: ret i64 %t
229229 ; PLAIN: }
230 ; PLAIN: define i64 @fc() nounwind {
230 ; PLAIN: define i64 @fc() #0 {
231231 ; PLAIN: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) to i64
232232 ; PLAIN: ret i64 %t
233233 ; PLAIN: }
234 ; PLAIN: define i64 @fd() nounwind {
234 ; PLAIN: define i64 @fd() #0 {
235235 ; PLAIN: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) to i64
236236 ; PLAIN: ret i64 %t
237237 ; PLAIN: }
238 ; PLAIN: define i64 @fe() nounwind {
238 ; PLAIN: define i64 @fe() #0 {
239239 ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr ({ double, float, double, double }* null, i64 0, i32 2) to i64) to i64
240240 ; PLAIN: ret i64 %t
241241 ; PLAIN: }
242 ; PLAIN: define i64 @ff() nounwind {
242 ; PLAIN: define i64 @ff() #0 {
243243 ; PLAIN: %t = bitcast i64 1 to i64
244244 ; PLAIN: ret i64 %t
245245 ; PLAIN: }
246 ; PLAIN: define i64 @fg() nounwind {
246 ; PLAIN: define i64 @fg() #0 {
247247 ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr ({ i1, double }* null, i64 0, i32 1) to i64) to i64
248248 ; PLAIN: ret i64 %t
249249 ; PLAIN: }
250 ; PLAIN: define i64 @fh() nounwind {
250 ; PLAIN: define i64 @fh() #0 {
251251 ; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) to i64
252252 ; PLAIN: ret i64 %t
253253 ; PLAIN: }
254 ; PLAIN: define i64 @fi() nounwind {
254 ; PLAIN: define i64 @fi() #0 {
255255 ; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr ({ i1, i1* }* null, i64 0, i32 1) to i64) to i64
256256 ; PLAIN: ret i64 %t
257257 ; PLAIN: }
258 ; OPT: define i64 @fa() nounwind {
258 ; OPT: define i64 @fa() #0 {
259259 ; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310)
260260 ; OPT: }
261 ; OPT: define i64 @fb() nounwind {
261 ; OPT: define i64 @fb() #0 {
262262 ; OPT: ret i64 ptrtoint (double* getelementptr ({ i1, double }* null, i64 0, i32 1) to i64)
263263 ; OPT: }
264 ; OPT: define i64 @fc() nounwind {
264 ; OPT: define i64 @fc() #0 {
265265 ; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2)
266266 ; OPT: }
267 ; OPT: define i64 @fd() nounwind {
267 ; OPT: define i64 @fd() #0 {
268268 ; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11)
269269 ; OPT: }
270 ; OPT: define i64 @fe() nounwind {
270 ; OPT: define i64 @fe() #0 {
271271 ; OPT: ret i64 ptrtoint (double* getelementptr ({ double, float, double, double }* null, i64 0, i32 2) to i64)
272272 ; OPT: }
273 ; OPT: define i64 @ff() nounwind {
273 ; OPT: define i64 @ff() #0 {
274274 ; OPT: ret i64 1
275275 ; OPT: }
276 ; OPT: define i64 @fg() nounwind {
276 ; OPT: define i64 @fg() #0 {
277277 ; OPT: ret i64 ptrtoint (double* getelementptr ({ i1, double }* null, i64 0, i32 1) to i64)
278278 ; OPT: }
279 ; OPT: define i64 @fh() nounwind {
279 ; OPT: define i64 @fh() #0 {
280280 ; OPT: ret i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
281281 ; OPT: }
282 ; OPT: define i64 @fi() nounwind {
282 ; OPT: define i64 @fi() #0 {
283283 ; OPT: ret i64 ptrtoint (i1** getelementptr ({ i1, i1* }* null, i64 0, i32 1) to i64)
284284 ; OPT: }
285 ; TO: define i64 @fa() nounwind {
285 ; TO: define i64 @fa() #0 {
286286 ; TO: ret i64 18480
287287 ; TO: }
288 ; TO: define i64 @fb() nounwind {
288 ; TO: define i64 @fb() #0 {
289289 ; TO: ret i64 8
290290 ; TO: }
291 ; TO: define i64 @fc() nounwind {
291 ; TO: define i64 @fc() #0 {
292292 ; TO: ret i64 16
293293 ; TO: }
294 ; TO: define i64 @fd() nounwind {
294 ; TO: define i64 @fd() #0 {
295295 ; TO: ret i64 88
296296 ; TO: }
297 ; TO: define i64 @fe() nounwind {
297 ; TO: define i64 @fe() #0 {
298298 ; TO: ret i64 16
299299 ; TO: }
300 ; TO: define i64 @ff() nounwind {
300 ; TO: define i64 @ff() #0 {
301301 ; TO: ret i64 1
302302 ; TO: }
303 ; TO: define i64 @fg() nounwind {
303 ; TO: define i64 @fg() #0 {
304304 ; TO: ret i64 8
305305 ; TO: }
306 ; TO: define i64 @fh() nounwind {
306 ; TO: define i64 @fh() #0 {
307307 ; TO: ret i64 8
308308 ; TO: }
309 ; TO: define i64 @fi() nounwind {
309 ; TO: define i64 @fi() #0 {
310310 ; TO: ret i64 8
311311 ; TO: }
312312 ; SCEV: Classifying expressions for: @fa
374374 ret i64 %t
375375 }
376376
377 ; PLAIN: define i64* @fM() nounwind {
377 ; PLAIN: define i64* @fM() #0 {
378378 ; PLAIN: %t = bitcast i64* getelementptr (i64* null, i32 1) to i64*
379379 ; PLAIN: ret i64* %t
380380 ; PLAIN: }
381 ; PLAIN: define i64* @fN() nounwind {
381 ; PLAIN: define i64* @fN() #0 {
382382 ; PLAIN: %t = bitcast i64* getelementptr ({ i64, i64 }* null, i32 0, i32 1) to i64*
383383 ; PLAIN: ret i64* %t
384384 ; PLAIN: }
385 ; PLAIN: define i64* @fO() nounwind {
385 ; PLAIN: define i64* @fO() #0 {
386386 ; PLAIN: %t = bitcast i64* getelementptr ([2 x i64]* null, i32 0, i32 1) to i64*
387387 ; PLAIN: ret i64* %t
388388 ; PLAIN: }
389 ; OPT: define i64* @fM() nounwind {
389 ; OPT: define i64* @fM() #0 {
390390 ; OPT: ret i64* getelementptr (i64* null, i32 1)
391391 ; OPT: }
392 ; OPT: define i64* @fN() nounwind {
392 ; OPT: define i64* @fN() #0 {
393393 ; OPT: ret i64* getelementptr ({ i64, i64 }* null, i32 0, i32 1)
394394 ; OPT: }
395 ; OPT: define i64* @fO() nounwind {
395 ; OPT: define i64* @fO() #0 {
396396 ; OPT: ret i64* getelementptr ([2 x i64]* null, i32 0, i32 1)
397397 ; OPT: }
398 ; TO: define i64* @fM() nounwind {
398 ; TO: define i64* @fM() #0 {
399399 ; TO: ret i64* inttoptr (i64 8 to i64*)
400400 ; TO: }
401 ; TO: define i64* @fN() nounwind {
401 ; TO: define i64* @fN() #0 {
402402 ; TO: ret i64* inttoptr (i64 8 to i64*)
403403 ; TO: }
404 ; TO: define i64* @fO() nounwind {
404 ; TO: define i64* @fO() #0 {
405405 ; TO: ret i64* inttoptr (i64 8 to i64*)
406406 ; TO: }
407407 ; SCEV: Classifying expressions for: @fM
427427 ret i64* %t
428428 }
429429
430 ; PLAIN: define i32* @fZ() nounwind {
430 ; PLAIN: define i32* @fZ() #0 {
431431 ; PLAIN: %t = bitcast i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1) to i32*
432432 ; PLAIN: ret i32* %t
433433 ; PLAIN: }
434 ; OPT: define i32* @fZ() nounwind {
434 ; OPT: define i32* @fZ() #0 {
435435 ; OPT: ret i32* getelementptr (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1)
436436 ; OPT: }
437 ; TO: define i32* @fZ() nounwind {
437 ; TO: define i32* @fZ() #0 {
438438 ; TO: ret i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 1)
439439 ; TO: }
440440 ; SCEV: Classifying expressions for: @fZ
445445 %t = bitcast i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1) to i32*
446446 ret i32* %t
447447 }
448
449 ; CHECK: attributes #0 = { nounwind }
0 ; RUN: opt < %s -argpromotion -S | FileCheck %s
11
2 ; CHECK: define internal i32 @deref(i32 %x.val) nounwind {
2 ; CHECK: define internal i32 @deref(i32 %x.val) #0 {
33 define internal i32 @deref(i32* %x) nounwind {
44 entry:
55 %tmp2 = load i32* %x, align 4
1414 %tmp1 = call i32 @deref( i32* %x_addr ) nounwind
1515 ret i32 %tmp1
1616 }
17
18 ; CHECK: attributes #0 = { nounwind }
123123 ; CHECK: ret double %R
124124 }
125125
126 ; CHECK: declare <2 x double> @llvm.fma.v2f64(<2 x double>, <2 x double>, <2 x double>) nounwind readnone
127 ; CHECK: declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) nounwind readnone
128 ; CHECK: declare <2 x double> @llvm.cos.v2f64(<2 x double>) nounwind readonly
129 ; CHECK: declare <2 x double> @llvm.powi.v2f64(<2 x double>, i32) nounwind readonly
126 ; CHECK: declare <2 x double> @llvm.fma.v2f64(<2 x double>, <2 x double>, <2 x double>) #0
127 ; CHECK: declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #0
128 ; CHECK: declare <2 x double> @llvm.cos.v2f64(<2 x double>) #1
129 ; CHECK: declare <2 x double> @llvm.powi.v2f64(<2 x double>, i32) #1
130130
131 ; CHECK: attributes #0 = { nounwind readnone }
132 ; CHECK: attributes #1 = { nounwind readonly }
33
44 @g = global i8 0
55
6 ; CHECK: define internal void @foo(i8 signext %y) nounwind
6 ; CHECK: define internal void @foo(i8 signext %y) #0
77
88 define internal zeroext i8 @foo(i8* inreg %p, i8 signext %y, ... ) nounwind {
99 store i8 %y, i8* @g
1515 %A = call zeroext i8(i8*, i8, ...)* @foo(i8* inreg null, i8 signext 1, %struct* byval null ) nounwind
1616 ret i32 0
1717 }
18
19 ; CHECK: attributes #0 = { nounwind }
1414
1515 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
1616
17 define internal fastcc i8* @add_name_internal(i8* %name, i32 %len, i32 %hash, i8 zeroext %extra, i32 %flags) nounwind noinline ssp {
17 define internal fastcc i8* @add_name_internal(i8* %name, i32 %len, i32 %hash, i8 zeroext %extra, i32 %flags) noinline nounwind ssp {
1818 entry:
1919 call void @llvm.dbg.value(metadata !{i8* %name}, i64 0, metadata !15)
2020 call void @llvm.dbg.value(metadata !{i32 %len}, i64 0, metadata !20)
3636 }
3737
3838 declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
39
40 ; CHECK: attributes #0 = { nounwind ssp }
41 ; CHECK: attributes #1 = { nounwind readnone }
42 ; CHECK: attributes #2 = { noinline nounwind ssp }
3943
4044 !0 = metadata !{i32 524545, metadata !1, metadata !"name", metadata !2, i32 8, metadata !6} ; [ DW_TAG_arg_variable ]
4145 !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 ]
None ; RUN: opt < %s -deadargelim -S > %t
1 ; RUN: grep "define internal zeroext i32 @test1() nounwind" %t
2 ; RUN: grep "define internal <{ i32, i32 }> @test2" %t
0 ; RUN: opt < %s -deadargelim -S | FileCheck %s
31
42 %Ty = type <{ i32, i32 }>
53
86 ; the function and then changing too much.
97
108 ; This checks if the return value attributes are not removed
9 ; CHECK: define internal zeroext i32 @test1() #0
1110 define internal zeroext i32 @test1(i32 %DEADARG1) nounwind {
1211 ret i32 1
1312 }
1413
1514 ; This checks if the struct doesn't get non-packed
15 ; CHECK: define internal <{ i32, i32 }> @test2
1616 define internal <{ i32, i32 }> @test2(i32 %DEADARG1) {
1717 ret <{ i32, i32 }> <{ i32 1, i32 2 }>
1818 }
2727 ret void
2828 }
2929
30 ; CHECK: attributes #0 = { nounwind }
0 ; RUN: opt < %s -basicaa -functionattrs -S | FileCheck %s
11 @x = global i32 0
22
3 ; CHECK: declare i32 @e() readnone
3 ; CHECK: declare i32 @e() #0
44 declare i32 @e() readnone
55
6 ; CHECK: define i32 @f() readnone
6 ; CHECK: define i32 @f() #0
77 define i32 @f() {
88 %tmp = call i32 @e( ) ; [#uses=1]
99 ret i32 %tmp
1010 }
1111
12 ; CHECK: define i32 @g() readnone
12 ; CHECK: define i32 @g() #0
1313 define i32 @g() readonly {
1414 ret i32 0
1515 }
1616
17 ; CHECK: define i32 @h() readnone
17 ; CHECK: define i32 @h() #0
1818 define i32 @h() readnone {
1919 %tmp = load i32* @x ; [#uses=1]
2020 ret i32 %tmp
2121 }
22
23 ; CHECK: attributes #0 = { readnone }
0 ; RUN: opt < %s -basicaa -functionattrs -S | FileCheck %s
11
2 ; CHECK: define i32 @f() readonly
2 ; CHECK: define i32 @f() #0
33 define i32 @f() {
44 entry:
55 %tmp = call i32 @e( )
66 ret i32 %tmp
77 }
88
9 ; CHECK: declare i32 @e() readonly
9 ; CHECK: declare i32 @e() #0
1010 declare i32 @e() readonly
11
12 ; CHECK: attributes #0 = { readonly }
22 ; Atomic load/store to local doesn't affect whether a function is
33 ; readnone/readonly.
44 define i32 @test1(i32 %x) uwtable ssp {
5 ; CHECK: define i32 @test1(i32 %x) readnone ssp uwtable {
5 ; CHECK: define i32 @test1(i32 %x) #0 {
66 entry:
77 %x.addr = alloca i32, align 4
88 store atomic i32 %x, i32* %x.addr seq_cst, align 4
1212
1313 ; A function with an Acquire load is not readonly.
1414 define i32 @test2(i32* %x) uwtable ssp {
15 ; CHECK: define i32 @test2(i32* nocapture %x) ssp uwtable {
15 ; CHECK: define i32 @test2(i32* nocapture %x) #1 {
1616 entry:
1717 %r = load atomic i32* %x seq_cst, align 4
1818 ret i32 %r
1919 }
2020
21 ; CHECK: attributes #0 = { readnone ssp uwtable }
22 ; CHECK: attributes #1 = { ssp uwtable }
33 ; IPSCCP should propagate the 0 argument, eliminate the switch, and propagate
44 ; the result.
55
6 ; CHECK: define i32 @main() noreturn nounwind {
6 ; CHECK: define i32 @main() #0 {
77 ; CHECK-NEXT: entry:
88 ; CHECK-NEXT: %call2 = tail call i32 @wwrite(i64 0) nounwind
99 ; CHECK-NEXT: ret i32 123
2727 return:
2828 ret i32 0
2929 }
30
31 ; CHECK: attributes #0 = { noreturn nounwind }
32 ; CHECK: attributes #1 = { nounwind readnone }
3838
3939 define void @inline_req_req() nounwind sspreq uwtable {
4040 entry:
41 ; CHECK: @inline_req_req() nounwind sspreq uwtable
41 ; CHECK: @inline_req_req() #0
4242 call void @fun_sspreq()
4343 ret void
4444 }
4545
4646 define void @inline_req_strong() nounwind sspstrong uwtable {
4747 entry:
48 ; CHECK: @inline_req_strong() nounwind sspreq uwtable
48 ; CHECK: @inline_req_strong() #0
4949 call void @fun_sspreq()
5050 ret void
5151 }
5252
5353 define void @inline_req_ssp() nounwind ssp uwtable {
5454 entry:
55 ; CHECK: @inline_req_ssp() nounwind sspreq uwtable
55 ; CHECK: @inline_req_ssp() #0
5656 call void @fun_sspreq()
5757 ret void
5858 }
5959
6060 define void @inline_req_nossp() nounwind uwtable {
6161 entry:
62 ; CHECK: @inline_req_nossp() nounwind sspreq uwtable
62 ; CHECK: @inline_req_nossp() #0
6363 call void @fun_sspreq()
6464 ret void
6565 }
6666
6767 define void @inline_strong_req() nounwind sspreq uwtable {
6868 entry:
69 ; CHECK: @inline_strong_req() nounwind sspreq uwtable
69 ; CHECK: @inline_strong_req() #0
7070 call void @fun_sspstrong()
7171 ret void
7272 }
7474
7575 define void @inline_strong_strong() nounwind sspstrong uwtable {
7676 entry:
77 ; CHECK: @inline_strong_strong() nounwind sspstrong uwtable
77 ; CHECK: @inline_strong_strong() #1
7878 call void @fun_sspstrong()
7979 ret void
8080 }
8181
8282 define void @inline_strong_ssp() nounwind ssp uwtable {
8383 entry:
84 ; CHECK: @inline_strong_ssp() nounwind sspstrong uwtable
84 ; CHECK: @inline_strong_ssp() #1
8585 call void @fun_sspstrong()
8686 ret void
8787 }
8888
8989 define void @inline_strong_nossp() nounwind uwtable {
9090 entry:
91 ; CHECK: @inline_strong_nossp() nounwind sspstrong uwtable
91 ; CHECK: @inline_strong_nossp() #1
9292 call void @fun_sspstrong()
9393 ret void
9494 }
9595
9696 define void @inline_ssp_req() nounwind sspreq uwtable {
9797 entry:
98 ; CHECK: @inline_ssp_req() nounwind sspreq uwtable
98 ; CHECK: @inline_ssp_req() #0
9999 call void @fun_ssp()
100100 ret void
101101 }
103103
104104 define void @inline_ssp_strong() nounwind sspstrong uwtable {
105105 entry:
106 ; CHECK: @inline_ssp_strong() nounwind sspstrong uwtable
106 ; CHECK: @inline_ssp_strong() #1
107107 call void @fun_ssp()
108108 ret void
109109 }
110110
111111 define void @inline_ssp_ssp() nounwind ssp uwtable {
112112 entry:
113 ; CHECK: @inline_ssp_ssp() nounwind ssp uwtable
113 ; CHECK: @inline_ssp_ssp() #2
114114 call void @fun_ssp()
115115 ret void
116116 }
117117
118118 define void @inline_ssp_nossp() nounwind uwtable {
119119 entry:
120 ; CHECK: @inline_ssp_nossp() nounwind ssp uwtable
120 ; CHECK: @inline_ssp_nossp() #2
121121 call void @fun_ssp()
122122 ret void
123123 }
124124
125125 define void @inline_nossp_req() nounwind uwtable sspreq {
126126 entry:
127 ; CHECK: @inline_nossp_req() nounwind sspreq uwtable
127 ; CHECK: @inline_nossp_req() #0
128128 call void @fun_nossp()
129129 ret void
130130 }
132132
133133 define void @inline_nossp_strong() nounwind sspstrong uwtable {
134134 entry:
135 ; CHECK: @inline_nossp_strong() nounwind sspstrong uwtable
135 ; CHECK: @inline_nossp_strong() #1
136136 call void @fun_nossp()
137137 ret void
138138 }
139139
140140 define void @inline_nossp_ssp() nounwind ssp uwtable {
141141 entry:
142 ; CHECK: @inline_nossp_ssp() nounwind ssp uwtable
142 ; CHECK: @inline_nossp_ssp() #2
143143 call void @fun_nossp()
144144 ret void
145145 }
146146
147147 define void @inline_nossp_nossp() nounwind uwtable {
148148 entry:
149 ; CHECK: @inline_nossp_nossp() nounwind uwtable
149 ; CHECK: @inline_nossp_nossp() #3
150150 call void @fun_nossp()
151151 ret void
152152 }
153153
154154 declare i32 @printf(i8*, ...)
155
156 ; CHECK: attributes #0 = { nounwind sspreq uwtable }
157 ; CHECK: attributes #1 = { nounwind sspstrong uwtable }
158 ; CHECK: attributes #2 = { nounwind ssp uwtable }
159 ; CHECK: attributes #3 = { nounwind uwtable }
33 ; Indvars and loop deletion should be able to eliminate all looping
44 ; in this testcase.
55
6 ; CHECK: define i32 @pmat(i32 %m, i32 %n, double* %y) nounwind {
6 ; CHECK: define i32 @pmat(i32 %m, i32 %n, double* %y) #0 {
77 ; CHECK-NEXT: entry:
88 ; CHECK-NEXT: ret i32 0
99 ; CHECK-NEXT: }
6262 w.e12:
6363 ret i32 0
6464 }
65
66 ; CHECK: attributes #0 = { nounwind }
8585
8686 ; Delete nested retain+release pairs around loops.
8787
88 ; CHECK: define void @test3(i8* %a) nounwind {
88 ; CHECK: define void @test3(i8* %a) #0 {
8989 ; CHECK-NEXT: entry:
9090 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
9191 ; CHECK-NEXT: br label %loop
111111 ret void
112112 }
113113
114 ; CHECK: define void @test4(i8* %a) nounwind {
114 ; CHECK: define void @test4(i8* %a) #0 {
115115 ; CHECK-NEXT: entry:
116116 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
117117 ; CHECK-NEXT: br label %loop
141141 ret void
142142 }
143143
144 ; CHECK: define void @test5(i8* %a) nounwind {
144 ; CHECK: define void @test5(i8* %a) #0 {
145145 ; CHECK-NEXT: entry:
146146 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
147147 ; CHECK-NEXT: call void @callee()
175175 ret void
176176 }
177177
178 ; CHECK: define void @test6(i8* %a) nounwind {
178 ; CHECK: define void @test6(i8* %a) #0 {
179179 ; CHECK-NEXT: entry:
180180 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
181181 ; CHECK-NEXT: br label %loop
208208 ret void
209209 }
210210
211 ; CHECK: define void @test7(i8* %a) nounwind {
211 ; CHECK: define void @test7(i8* %a) #0 {
212212 ; CHECK-NEXT: entry:
213213 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
214214 ; CHECK-NEXT: call void @callee()
241241 ret void
242242 }
243243
244 ; CHECK: define void @test8(i8* %a) nounwind {
244 ; CHECK: define void @test8(i8* %a) #0 {
245245 ; CHECK-NEXT: entry:
246246 ; CHECK-NEXT: tail call i8* @objc_retain(i8* %a) nounwind
247247 ; CHECK-NEXT: br label %loop
273273 ret void
274274 }
275275
276 ; CHECK: define void @test9(i8* %a) nounwind {
276 ; CHECK: define void @test9(i8* %a) #0 {
277277 ; CHECK-NEXT: entry:
278278 ; CHECK-NEXT: br label %loop
279279 ; CHECK-NOT: @objc_
302302 ret void
303303 }
304304
305 ; CHECK: define void @test10(i8* %a) nounwind {
305 ; CHECK: define void @test10(i8* %a) #0 {
306306 ; CHECK-NEXT: entry:
307307 ; CHECK-NEXT: br label %loop
308308 ; CHECK-NOT: @objc_
331331 ret void
332332 }
333333
334 ; CHECK: define void @test11(i8* %a) nounwind {
334 ; CHECK: define void @test11(i8* %a) #0 {
335335 ; CHECK-NEXT: entry:
336336 ; CHECK-NEXT: br label %loop
337337 ; CHECK-NOT: @objc_
361361
362362 ; Don't delete anything if they're not balanced.
363363
364 ; CHECK: define void @test12(i8* %a) nounwind {
364 ; CHECK: define void @test12(i8* %a) #0 {
365365 ; CHECK-NEXT: entry:
366366 ; CHECK-NEXT: %outer = tail call i8* @objc_retain(i8* %a) nounwind
367367 ; CHECK-NEXT: %inner = tail call i8* @objc_retain(i8* %a) nounwind
393393 ret void
394394 }
395395
396 ; CHECK: attributes #0 = { nounwind }
397
396398 !0 = metadata !{}
3838
3939 ; Eliminate unnecessary weak pointer copies in a block initialization.
4040
41 ; CHECK: define void @qux(i8* %me) nounwind {
41 ; CHECK: define void @qux(i8* %me) #0 {
4242 ; CHECK-NEXT: entry:
4343 ; CHECK-NEXT: %block = alloca %1, align 8
4444 ; CHECK-NOT: alloca
8383 declare void @use(i8*) nounwind
8484 declare void @objc_destroyWeak(i8**)
8585
86 ; CHECK: attributes #0 = { nounwind }
87
8688 !0 = metadata !{}
0 ; RUN: opt < %s -simplify-libcalls -S | FileCheck %s
11
2 ; CHECK: declare noalias i8* @fopen(i8* nocapture, i8* nocapture) nounwind
2 ; CHECK: declare noalias i8* @fopen(i8* nocapture, i8* nocapture) #0
33 declare i8* @fopen(i8*, i8*)
44
5 ; CHECK: declare i8 @strlen(i8* nocapture) nounwind readonly
5 ; CHECK: declare i8 @strlen(i8* nocapture) #1
66 declare i8 @strlen(i8*)
77
8 ; CHECK: declare noalias i32* @realloc(i32* nocapture, i32) nounwind
8 ; CHECK: declare noalias i32* @realloc(i32* nocapture, i32) #0
99 declare i32* @realloc(i32*, i32)
1010
1111 ; Test deliberately wrong declaration
1515 ; CHECK-NOT: strcpy{{.*}}nocapture
1616 ; CHECK-NOT: strcpy{{.*}}nounwind
1717 ; CHECK-NOT: strcpy{{.*}}readonly
18
19 ; CHECK: attributes #0 = { nounwind }
20 ; CHECK: attributes #1 = { nounwind readonly }