diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-02-20 07:21:42 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-02-20 07:21:42 +0000 |
commit | 7ab6c76ad1cbf36284ca5b6bd5ee33c625fe3e60 (patch) | |
tree | 3cc081ac6ea575accea7f12c2353aa175dfd5025 | |
parent | 9030fc22dd73684901ecb749c9688e289bd1a777 (diff) |
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
28 files changed, 244 insertions, 164 deletions
diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp index d130a25b2e..3f32ac18e8 100644 --- a/lib/IR/AsmWriter.cpp +++ b/lib/IR/AsmWriter.cpp @@ -66,22 +66,21 @@ static const Module *getModuleFromVal(const Value *V) { return 0; } -static void PrintCallingConv(unsigned cc, raw_ostream &Out) -{ +static void PrintCallingConv(unsigned cc, raw_ostream &Out) { switch (cc) { - case CallingConv::Fast: Out << "fastcc"; break; - case CallingConv::Cold: Out << "coldcc"; break; - case CallingConv::X86_StdCall: Out << "x86_stdcallcc"; break; - case CallingConv::X86_FastCall: Out << "x86_fastcallcc"; break; - case CallingConv::X86_ThisCall: Out << "x86_thiscallcc"; break; - case CallingConv::Intel_OCL_BI: Out << "intel_ocl_bicc"; break; - case CallingConv::ARM_APCS: Out << "arm_apcscc"; break; - case CallingConv::ARM_AAPCS: Out << "arm_aapcscc"; break; - case CallingConv::ARM_AAPCS_VFP:Out << "arm_aapcs_vfpcc"; break; - case CallingConv::MSP430_INTR: Out << "msp430_intrcc"; break; - case CallingConv::PTX_Kernel: Out << "ptx_kernel"; break; - case CallingConv::PTX_Device: Out << "ptx_device"; break; - default: Out << "cc" << cc; break; + default: Out << "cc" << cc; break; + case CallingConv::Fast: Out << "fastcc"; break; + case CallingConv::Cold: Out << "coldcc"; break; + case CallingConv::X86_StdCall: Out << "x86_stdcallcc"; break; + case CallingConv::X86_FastCall: Out << "x86_fastcallcc"; break; + case CallingConv::X86_ThisCall: Out << "x86_thiscallcc"; break; + case CallingConv::Intel_OCL_BI: Out << "intel_ocl_bicc"; break; + case CallingConv::ARM_APCS: Out << "arm_apcscc"; break; + case CallingConv::ARM_AAPCS: Out << "arm_aapcscc"; break; + case CallingConv::ARM_AAPCS_VFP: Out << "arm_aapcs_vfpcc"; break; + case CallingConv::MSP430_INTR: Out << "msp430_intrcc"; break; + case CallingConv::PTX_Kernel: Out << "ptx_kernel"; break; + case CallingConv::PTX_Device: Out << "ptx_device"; break; } } @@ -510,6 +509,7 @@ void SlotTracker::processModule() { CreateModuleSlot(I); // Add all the function attributes to the table. + // FIXME: Add attributes of other objects? AttributeSet FnAttrs = I->getAttributes().getFnAttributes(); if (FnAttrs.hasAttributes(AttributeSet::FunctionIndex)) CreateAttributeSetSlot(FnAttrs); @@ -1662,7 +1662,7 @@ void AssemblyWriter::printFunction(const Function *F) { if (F->hasUnnamedAddr()) Out << " unnamed_addr"; if (Attrs.hasAttributes(AttributeSet::FunctionIndex)) - Out << ' ' << Attrs.getAsString(AttributeSet::FunctionIndex); + Out << " #" << Machine.getAttributeGroupSlot(Attrs.getFnAttributes()); if (F->hasSection()) { Out << " section \""; PrintEscapedString(F->getSection(), Out); diff --git a/test/Analysis/BasicAA/intrinsics.ll b/test/Analysis/BasicAA/intrinsics.ll index 59725cfded..1407efea35 100644 --- a/test/Analysis/BasicAA/intrinsics.ll +++ b/test/Analysis/BasicAA/intrinsics.ll @@ -37,3 +37,6 @@ entry: declare <8 x i16> @llvm.arm.neon.vld1.v8i16(i8*, i32) nounwind readonly declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind + +; CHECK: attributes #0 = { nounwind readonly } +; CHECK: attributes #1 = { nounwind } diff --git a/test/Analysis/BasicAA/pure-const-dce.ll b/test/Analysis/BasicAA/pure-const-dce.ll index 266e607b21..abdd7d3ee6 100644 --- a/test/Analysis/BasicAA/pure-const-dce.ll +++ b/test/Analysis/BasicAA/pure-const-dce.ll @@ -49,3 +49,6 @@ declare i32 @TestConst(i32) readnone declare i32 @TestPure(i32) readonly declare i32 @TestNone(i32) + +; CHECK: attributes #0 = { readnone } +; CHECK: attributes #1 = { readonly } diff --git a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll index 1ac59278e7..c6cc26a241 100644 --- a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll +++ b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll @@ -9,13 +9,13 @@ ; invalid, as it's possible that this only happens after optimization on a ; code path which isn't ever executed. -; CHECK: define void @test0_yes(i32* nocapture %p) nounwind readnone { +; CHECK: define void @test0_yes(i32* nocapture %p) #0 { define void @test0_yes(i32* %p) nounwind { store i32 0, i32* %p, !tbaa !1 ret void } -; CHECK: define void @test0_no(i32* nocapture %p) nounwind { +; CHECK: define void @test0_no(i32* nocapture %p) #1 { define void @test0_no(i32* %p) nounwind { store i32 0, i32* %p, !tbaa !2 ret void @@ -24,13 +24,13 @@ define void @test0_no(i32* %p) nounwind { ; Add the readonly attribute, since there's just a call to a function which ; TBAA says doesn't modify any memory. -; CHECK: define void @test1_yes(i32* nocapture %p) nounwind readonly { +; CHECK: define void @test1_yes(i32* nocapture %p) #2 { define void @test1_yes(i32* %p) nounwind { call void @callee(i32* %p), !tbaa !1 ret void } -; CHECK: define void @test1_no(i32* %p) nounwind { +; CHECK: define void @test1_no(i32* %p) #1 { define void @test1_no(i32* %p) nounwind { call void @callee(i32* %p), !tbaa !2 ret void @@ -43,13 +43,13 @@ define void @test1_no(i32* %p) nounwind { ; This is unusual, since the function is memcpy, but as above, this ; isn't necessarily invalid. -; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind readnone { +; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) #0 { define void @test2_yes(i8* %p, i8* %q, i64 %n) nounwind { call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !1 ret void } -; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind { +; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) #1 { define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind { call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !2 ret void @@ -57,13 +57,13 @@ define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind { ; Similar to the others, va_arg only accesses memory through its operand. -; CHECK: define i32 @test3_yes(i8* nocapture %p) nounwind readnone { +; CHECK: define i32 @test3_yes(i8* nocapture %p) #0 { define i32 @test3_yes(i8* %p) nounwind { %t = va_arg i8* %p, i32, !tbaa !1 ret i32 %t } -; CHECK: define i32 @test3_no(i8* nocapture %p) nounwind { +; CHECK: define i32 @test3_no(i8* nocapture %p) #1 { define i32 @test3_no(i8* %p) nounwind { %t = va_arg i8* %p, i32, !tbaa !2 ret i32 %t @@ -72,6 +72,10 @@ define i32 @test3_no(i8* %p) nounwind { declare void @callee(i32* %p) nounwind declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i32, i1) nounwind +; CHECK: attributes #0 = { nounwind readnone } +; CHECK: attributes #1 = { nounwind } +; CHECK: attributes #2 = { nounwind readonly } + ; Root note. !0 = metadata !{ } diff --git a/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll b/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll index 8f080e2108..e1d91ca427 100644 --- a/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll +++ b/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll @@ -22,6 +22,9 @@ entry: declare <8 x i16> @llvm.arm.neon.vld1.v8i16(i8*, i32) nounwind readonly declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind +; CHECK: attributes #0 = { nounwind readonly } +; CHECK: attributes #1 = { nounwind } + !0 = metadata !{metadata !"tbaa root", null} !1 = metadata !{metadata !"A", metadata !0} !2 = metadata !{metadata !"B", metadata !0} diff --git a/test/Assembler/2008-09-02-FunctionNotes.ll b/test/Assembler/2008-09-02-FunctionNotes.ll index 6971138aeb..11a0411ef7 100644 --- a/test/Assembler/2008-09-02-FunctionNotes.ll +++ b/test/Assembler/2008-09-02-FunctionNotes.ll @@ -1,18 +1,21 @@ ; Test function attributes ; RUN: llvm-as < %s | llvm-dis | FileCheck %s -; CHECK: define void @fn1() alwaysinline +; CHECK: define void @fn1() #0 define void @fn1() alwaysinline { ret void } -; CHECK: define void @fn2() noinline +; CHECK: define void @fn2() #1 define void @fn2() noinline { ret void } ; CHECK: define void @fn3() -; CHECK-NOT: define void @fn3(){{.*}}inline +; CHECK-NOT: define void @fn3() #{{.*}} define void @fn3() { ret void } + +; CHECK: attributes #0 = { alwaysinline } +; CHECK: attributes #1 = { noinline } diff --git a/test/Assembler/unnamed-addr.ll b/test/Assembler/unnamed-addr.ll index 3c94ca2130..35b3b39ce4 100644 --- a/test/Assembler/unnamed-addr.ll +++ b/test/Assembler/unnamed-addr.ll @@ -15,4 +15,6 @@ declare i32 @zed(%struct.foobar*, %struct.foobar*) ; CHECK: @bar.d = internal unnamed_addr constant %struct.foobar zeroinitializer, align 4 ; CHECK: @foo.d = internal constant %struct.foobar zeroinitializer, align 4 -; CHECK: define i32 @main() unnamed_addr nounwind ssp { +; CHECK: define i32 @main() unnamed_addr #0 { + +; CHECK: attributes #0 = { nounwind ssp } diff --git a/test/Bitcode/attributes.ll b/test/Bitcode/attributes.ll index 76fde786a4..764dc3f6ea 100644 --- a/test/Bitcode/attributes.ll +++ b/test/Bitcode/attributes.ll @@ -14,7 +14,7 @@ define void @f2(i8 signext) } define void @f3() noreturn -; CHECK: define void @f3() noreturn +; CHECK: define void @f3() #0 { ret void; } @@ -32,7 +32,7 @@ define void @f5(i8* sret) } define void @f6() nounwind -; CHECK: define void @f6() nounwind +; CHECK: define void @f6() #1 { ret void; } @@ -56,43 +56,43 @@ define void @f9(i8* nest) } define void @f10() readnone -; CHECK: define void @f10() readnone +; CHECK: define void @f10() #2 { ret void; } define void @f11() readonly -; CHECK: define void @f11() readonly +; CHECK: define void @f11() #3 { ret void; } define void @f12() noinline -; CHECK: define void @f12() noinline +; CHECK: define void @f12() #4 { ret void; } define void @f13() alwaysinline -; CHECK: define void @f13() alwaysinline +; CHECK: define void @f13() #5 { ret void; } define void @f14() optsize -; CHECK: define void @f14() optsize +; CHECK: define void @f14() #6 { ret void; } define void @f15() ssp -; CHECK: define void @f15() ssp +; CHECK: define void @f15() #7 { ret void; } define void @f16() sspreq -; CHECK: define void @f16() sspreq +; CHECK: define void @f16() #8 { ret void; } @@ -110,71 +110,71 @@ define void @f18(i8* nocapture) } define void @f19() noredzone -; CHECK: define void @f19() noredzone +; CHECK: define void @f19() #9 { ret void; } define void @f20() noimplicitfloat -; CHECK: define void @f20() noimplicitfloat +; CHECK: define void @f20() #10 { ret void; } define void @f21() naked -; CHECK: define void @f21() naked +; CHECK: define void @f21() #11 { ret void; } define void @f22() inlinehint -; CHECK: define void @f22() inlinehint +; CHECK: define void @f22() #12 { ret void; } define void @f23() alignstack(4) -; CHECK: define void @f23() alignstack(4) +; CHECK: define void @f23() #13 { ret void; } define void @f24() returns_twice -; CHECK: define void @f24() returns_twice +; CHECK: define void @f24() #14 { ret void; } define void @f25() uwtable -; CHECK: define void @f25() uwtable +; CHECK: define void @f25() #15 { ret void; } define void @f26() nonlazybind -; CHECK: define void @f26() nonlazybind +; CHECK: define void @f26() #16 { ret void; } define void @f27() address_safety -; CHECK: define void @f27() address_safety +; CHECK: define void @f27() #17 { ret void; } define void @f28() thread_safety -; CHECK: define void @f28() thread_safety +; CHECK: define void @f28() #18 { ret void; } define void @f29() uninitialized_checks -; CHECK: define void @f29() uninitialized_checks +; CHECK: define void @f29() #19 { ret void; } define void @f30() "cpu"="cortex-a8" -; CHECK: define void @f30() "cpu"="cortex-a8" +; CHECK: define void @f30() #20 { ret void; } diff --git a/test/Bitcode/ptest-new.ll b/test/Bitcode/ptest-new.ll index 276fb7ab6a..735cc9c1cc 100644 --- a/test/Bitcode/ptest-new.ll +++ b/test/Bitcode/ptest-new.ll @@ -13,10 +13,13 @@ entry: ret i32 %add2 } -; CHECK: declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) nounwind readnone -; CHECK: declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone -; CHECK: declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) nounwind readnone +; CHECK: declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) #1 +; CHECK: declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) #1 +; CHECK: declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) #1 declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) nounwind readnone declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) nounwind readnone + +; CHECK: attributes #0 = { nounwind } +; CHECK: attributes #1 = { nounwind readnone } diff --git a/test/Bitcode/ptest-old.ll b/test/Bitcode/ptest-old.ll index fc6ed8ef7b..fbe962fae5 100644 --- a/test/Bitcode/ptest-old.ll +++ b/test/Bitcode/ptest-old.ll @@ -13,10 +13,13 @@ entry: ret i32 %add2 } -; CHECK: declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) nounwind readnone -; CHECK: declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone -; CHECK: declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) nounwind readnone +; CHECK: declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) #1 +; CHECK: declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) #1 +; CHECK: declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) #1 declare i32 @llvm.x86.sse41.ptestc(<4 x float>, <4 x float>) nounwind readnone declare i32 @llvm.x86.sse41.ptestz(<4 x float>, <4 x float>) nounwind readnone declare i32 @llvm.x86.sse41.ptestnzc(<4 x float>, <4 x float>) nounwind readnone + +; CHECK: attributes #0 = { nounwind } +; CHECK: attributes #1 = { nounwind readnone } diff --git a/test/Feature/attributes.ll b/test/Feature/attributes.ll new file mode 100644 index 0000000000..7707d82be5 --- /dev/null +++ b/test/Feature/attributes.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llvm-dis > %t1.ll +; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll +; RUN: diff %t1.ll %t2.ll + +@.str = private unnamed_addr constant [14 x i8] c"hello world!\0A\00", align 1 + +define void @foo() #0 { +entry: + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) + ret void +} + +declare i32 @printf(i8*, ...) + +attributes #0 = { nounwind ssp uwtable } diff --git a/test/Feature/intrinsics.ll b/test/Feature/intrinsics.ll index 9e7dc6d410..28be053714 100644 --- a/test/Feature/intrinsics.ll +++ b/test/Feature/intrinsics.ll @@ -61,10 +61,14 @@ define void @libm() { ; FIXME: test ALL the intrinsics in this file. ; rdar://11542750 -; CHECK: declare void @llvm.trap() noreturn nounwind +; CHECK: declare void @llvm.trap() #2 declare void @llvm.trap() define void @trap() { call void @llvm.trap() ret void } + +; CHECK: attributes #0 = { nounwind readnone } +; CHECK: attributes #1 = { nounwind readonly } +; CHECK: attributes #2 = { noreturn nounwind } diff --git a/test/Feature/minsize_attr.ll b/test/Feature/minsize_attr.ll index 51b133c4bd..1f915b35a3 100644 --- a/test/Feature/minsize_attr.ll +++ b/test/Feature/minsize_attr.ll @@ -1,7 +1,8 @@ ; RUN: llvm-as < %s | llvm-dis | FileCheck %s define void @test1() minsize { -; CHECK: define void @test1() minsize +; CHECK: define void @test1() #0 ret void } +; CHECK: attributes #0 = { minsize } diff --git a/test/Other/constant-fold-gep.ll b/test/Other/constant-fold-gep.ll index eafb16e23e..0224e9f984 100644 --- a/test/Other/constant-fold-gep.ll +++ b/test/Other/constant-fold-gep.ll @@ -118,64 +118,64 @@ ; Duplicate all of the above as function return values rather than ; global initializers. -; PLAIN: define i8* @goo8() nounwind { +; PLAIN: define i8* @goo8() #0 { ; PLAIN: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) to i8* ; PLAIN: ret i8* %t ; PLAIN: } -; PLAIN: define i1* @goo1() nounwind { +; PLAIN: define i1* @goo1() #0 { ; PLAIN: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) to i1* ; PLAIN: ret i1* %t ; PLAIN: } -; PLAIN: define i8* @foo8() nounwind { +; PLAIN: define i8* @foo8() #0 { ; PLAIN: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) to i8* ; PLAIN: ret i8* %t ; PLAIN: } -; PLAIN: define i1* @foo1() nounwind { +; PLAIN: define i1* @foo1() #0 { ; PLAIN: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) to i1* ; PLAIN: ret i1* %t ; PLAIN: } -; PLAIN: define i8* @hoo8() nounwind { +; PLAIN: define i8* @hoo8() #0 { ; PLAIN: %t = bitcast i8* getelementptr (i8* null, i32 -1) to i8* ; PLAIN: ret i8* %t ; PLAIN: } -; PLAIN: define i1* @hoo1() nounwind { +; PLAIN: define i1* @hoo1() #0 { ; PLAIN: %t = bitcast i1* getelementptr (i1* null, i32 -1) to i1* ; PLAIN: ret i1* %t ; PLAIN: } -; OPT: define i8* @goo8() nounwind { +; OPT: define i8* @goo8() #0 { ; OPT: ret i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) ; OPT: } -; OPT: define i1* @goo1() nounwind { +; OPT: define i1* @goo1() #0 { ; OPT: ret i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) ; OPT: } -; OPT: define i8* @foo8() nounwind { +; OPT: define i8* @foo8() #0 { ; OPT: ret i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) ; OPT: } -; OPT: define i1* @foo1() nounwind { +; OPT: define i1* @foo1() #0 { ; OPT: ret i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) ; OPT: } -; OPT: define i8* @hoo8() nounwind { +; OPT: define i8* @hoo8() #0 { ; OPT: ret i8* getelementptr (i8* null, i32 -1) ; OPT: } -; OPT: define i1* @hoo1() nounwind { +; OPT: define i1* @hoo1() #0 { ; OPT: ret i1* getelementptr (i1* null, i32 -1) ; OPT: } -; TO: define i8* @goo8() nounwind { +; TO: define i8* @goo8() #0 { ; TO: ret i8* null ; TO: } -; TO: define i1* @goo1() nounwind { +; TO: define i1* @goo1() #0 { ; TO: ret i1* null ; TO: } -; TO: define i8* @foo8() nounwind { +; TO: define i8* @foo8() #0 { ; TO: ret i8* inttoptr (i64 -1 to i8*) ; TO: } -; TO: define i1* @foo1() nounwind { +; TO: define i1* @foo1() #0 { ; TO: ret i1* inttoptr (i64 -1 to i1*) ; TO: } -; TO: define i8* @hoo8() nounwind { +; TO: define i8* @hoo8() #0 { ; TO: ret i8* inttoptr (i64 -1 to i8*) ; TO: } -; TO: define i1* @hoo1() nounwind { +; TO: define i1* @hoo1() #0 { ; TO: ret i1* inttoptr (i64 -1 to i1*) ; TO: } ; SCEV: Classifying expressions for: @goo8 @@ -220,94 +220,94 @@ define i1* @hoo1() nounwind { ret i1* %t } -; PLAIN: define i64 @fa() nounwind { +; PLAIN: define i64 @fa() #0 { ; PLAIN: %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64 ; PLAIN: ret i64 %t ; PLAIN: } -; PLAIN: define i64 @fb() nounwind { +; PLAIN: define i64 @fb() #0 { ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr ({ i1, double }* null, i64 0, i32 1) to i64) to i64 ; PLAIN: ret i64 %t ; PLAIN: } -; PLAIN: define i64 @fc() nounwind { +; PLAIN: define i64 @fc() #0 { ; PLAIN: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) to i64 ; PLAIN: ret i64 %t ; PLAIN: } -; PLAIN: define i64 @fd() nounwind { +; PLAIN: define i64 @fd() #0 { ; PLAIN: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) to i64 ; PLAIN: ret i64 %t ; PLAIN: } -; PLAIN: define i64 @fe() nounwind { +; PLAIN: define i64 @fe() #0 { ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr ({ double, float, double, double }* null, i64 0, i32 2) to i64) to i64 ; PLAIN: ret i64 %t ; PLAIN: } -; PLAIN: define i64 @ff() nounwind { +; PLAIN: define i64 @ff() #0 { ; PLAIN: %t = bitcast i64 1 to i64 ; PLAIN: ret i64 %t ; PLAIN: } -; PLAIN: define i64 @fg() nounwind { +; PLAIN: define i64 @fg() #0 { ; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr ({ i1, double }* null, i64 0, i32 1) to i64) to i64 ; PLAIN: ret i64 %t ; PLAIN: } -; PLAIN: define i64 @fh() nounwind { +; PLAIN: define i64 @fh() #0 { ; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) to i64 ; PLAIN: ret i64 %t ; PLAIN: } -; PLAIN: define i64 @fi() nounwind { +; PLAIN: define i64 @fi() #0 { ; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr ({ i1, i1* }* null, i64 0, i32 1) to i64) to i64 ; PLAIN: ret i64 %t ; PLAIN: } -; OPT: define i64 @fa() nounwind { +; OPT: define i64 @fa() #0 { ; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) ; OPT: } -; OPT: define i64 @fb() nounwind { +; OPT: define i64 @fb() #0 { ; OPT: ret i64 ptrtoint (double* getelementptr ({ i1, double }* null, i64 0, i32 1) to i64) ; OPT: } -; OPT: define i64 @fc() nounwind { +; OPT: define i64 @fc() #0 { ; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) ; OPT: } -; OPT: define i64 @fd() nounwind { +; OPT: define i64 @fd() #0 { ; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) ; OPT: } -; OPT: define i64 @fe() nounwind { +; OPT: define i64 @fe() #0 { ; OPT: ret i64 ptrtoint (double* getelementptr ({ double, float, double, double }* null, i64 0, i32 2) to i64) ; OPT: } -; OPT: define i64 @ff() nounwind { +; OPT: define i64 @ff() #0 { ; OPT: ret i64 1 ; OPT: } -; OPT: define i64 @fg() nounwind { +; OPT: define i64 @fg() #0 { ; OPT: ret i64 ptrtoint (double* getelementptr ({ i1, double }* null, i64 0, i32 1) to i64) ; OPT: } -; OPT: define i64 @fh() nounwind { +; OPT: define i64 @fh() #0 { ; OPT: ret i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) ; OPT: } -; OPT: define i64 @fi() nounwind { +; OPT: define i64 @fi() #0 { ; OPT: ret i64 ptrtoint (i1** getelementptr ({ i1, i1* }* null, i64 0, i32 1) to i64) ; OPT: } -; TO: define i64 @fa() nounwind { +; TO: define i64 @fa() #0 { ; TO: ret i64 18480 ; TO: } -; TO: define i64 @fb() nounwind { +; TO: define i64 @fb() #0 { ; TO: ret i64 8 ; TO: } -; TO: define i64 @fc() nounwind { +; TO: define i64 @fc() #0 { ; TO: ret i64 16 ; TO: } -; TO: define i64 @fd() nounwind { +; TO: define i64 @fd() #0 { ; TO: ret i64 88 ; TO: } -; TO: define i64 @fe() nounwind { +; TO: define i64 @fe() #0 { ; TO: ret i64 16 ; TO: } -; TO: define i64 @ff() nounwind { +; TO: define i64 @ff() #0 { ; TO: ret i64 1 ; TO: } -; TO: define i64 @fg() nounwind { +; TO: define i64 @fg() #0 { ; TO: ret i64 8 ; TO: } -; TO: define i64 @fh() nounwind { +; TO: define i64 @fh() #0 { ; TO: ret i64 8 ; TO: } -; TO: define i64 @fi() nounwind { +; TO: define i64 @fi() #0 { ; TO: ret i64 8 ; TO: } ; SCEV: Classifying expressions for: @fa @@ -375,34 +375,34 @@ define i64 @fi() nounwind { ret i64 %t } -; PLAIN: define i64* @fM() nounwind { +; PLAIN: define i64* @fM() #0 { ; PLAIN: %t = bitcast i64* getelementptr (i64* null, i32 1) to i64* ; PLAIN: ret i64* %t ; PLAIN: } -; PLAIN: define i64* @fN() nounwind { +; PLAIN: define i64* @fN() #0 { ; PLAIN: %t = bitcast i64* getelementptr ({ i64, i64 }* null, i32 0, i32 1) to i64* ; PLAIN: ret i64* %t ; PLAIN: } -; PLAIN: define i64* @fO() nounwind { +; PLAIN: define i64* @fO() #0 { ; PLAIN: %t = bitcast i64* getelementptr ([2 x i64]* null, i32 0, i32 1) to i64* ; PLAIN: ret i64* %t ; PLAIN: } -; OPT: define i64* @fM() nounwind { +; OPT: define i64* @fM() #0 { ; OPT: ret i64* getelementptr (i64* null, i32 1) ; OPT: } -; OPT: define i64* @fN() nounwind { +; OPT: define i64* @fN() #0 { ; OPT: ret i64* getelementptr ({ i64, i64 }* null, i32 0, i32 1) ; OPT: } -; OPT: define i64* @fO() nounwind { +; OPT: define i64* @fO() #0 { ; OPT: ret i64* getelementptr ([2 x i64]* null, i32 0, i32 1) ; OPT: } -; TO: define i64* @fM() nounwind { +; TO: define i64* @fM() #0 { ; TO: ret i64* inttoptr (i64 8 to i64*) ; TO: } -; TO: define i64* @fN() nounwind { +; TO: define i64* @fN() #0 { ; TO: ret i64* inttoptr (i64 8 to i64*) ; TO: } -; TO: define i64* @fO() nounwind { +; TO: define i64* @fO() #0 { ; TO: ret i64* inttoptr (i64 8 to i64*) ; TO: } ; SCEV: Classifying expressions for: @fM @@ -428,14 +428,14 @@ define i64* @fO() nounwind { ret i64* %t } -; PLAIN: define i32* @fZ() nounwind { +; PLAIN: define i32* @fZ() #0 { ; PLAIN: %t = bitcast i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1) to i32* ; PLAIN: ret i32* %t ; PLAIN: } -; OPT: define i32* @fZ() nounwind { +; OPT: define i32* @fZ() #0 { ; OPT: ret i32* getelementptr (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1) ; OPT: } -; TO: define i32* @fZ() nounwind { +; TO: define i32* @fZ() #0 { ; TO: ret i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 1) ; TO: } ; SCEV: Classifying expressions for: @fZ @@ -446,3 +446,5 @@ define i32* @fZ() nounwind { %t = bitcast i32* getelementptr inbounds (i32* getelementptr inbounds ([3 x { i32, i32 }]* @ext, i64 0, i64 1, i32 0), i64 1) to i32* ret i32* %t } + +; CHECK: attributes #0 = { nounwind } diff --git a/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll b/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll index d81c8bd3fd..2387a10daf 100644 --- a/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll +++ b/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -argpromotion -S | FileCheck %s -; CHECK: define internal i32 @deref(i32 %x.val) nounwind { +; CHECK: define internal i32 @deref(i32 %x.val) #0 { define internal i32 @deref(i32* %x) nounwind { entry: %tmp2 = load i32* %x, align 4 @@ -15,3 +15,5 @@ entry: %tmp1 = call i32 @deref( i32* %x_addr ) nounwind ret i32 %tmp1 } + +; CHECK: attributes #0 = { nounwind } diff --git a/test/Transforms/BBVectorize/simple-int.ll b/test/Transforms/BBVectorize/simple-int.ll index d7b7d6b8fd..e4d51526ca 100644 --- a/test/Transforms/BBVectorize/simple-int.ll +++ b/test/Transforms/BBVectorize/simple-int.ll @@ -124,8 +124,10 @@ define double @test4(dou |