From a16546a70bc8cdf609e9e10beb20925e54a88d77 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 17 Jun 2011 17:37:13 +0000 Subject: Stop accepting and ignoring attributes in function types. Attributes are applied to functions and call/invokes, not to types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133266 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/LLParser.cpp | 14 ++++---------- test/CodeGen/X86/2007-10-15-CoalescerCrash.ll | 2 +- test/Feature/paramattrs.ll | 6 +++--- test/Integer/paramattrs_bt.ll | 19 ------------------- test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll | 2 +- test/Transforms/InstCombine/2007-09-11-Trampoline.ll | 2 +- .../InstCombine/2007-11-25-CompatibleAttributes.ll | 2 +- 7 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 test/Integer/paramattrs_bt.ll diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 01b3877..a9d3c94 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -1559,22 +1559,16 @@ bool LLParser::ParseFunctionType(PATypeHolder &Result) { std::vector ArgList; bool isVarArg; - unsigned Attrs; - if (ParseArgumentList(ArgList, isVarArg, true) || - // FIXME: Allow, but ignore attributes on function types! - // FIXME: Remove in LLVM 3.0 - ParseOptionalAttrs(Attrs, 2)) + if (ParseArgumentList(ArgList, isVarArg, true)) return true; // Reject names on the arguments lists. for (unsigned i = 0, e = ArgList.size(); i != e; ++i) { if (!ArgList[i].Name.empty()) return Error(ArgList[i].Loc, "argument name invalid in function type"); - if (!ArgList[i].Attrs != 0) { - // Allow but ignore attributes on function types; this permits - // auto-upgrade. - // FIXME: REJECT ATTRIBUTES ON FUNCTION TYPES in LLVM 3.0 - } + if (ArgList[i].Attrs != 0) + return Error(ArgList[i].Loc, + "argument attributes invalid in function type"); } std::vector ArgListTy; diff --git a/test/CodeGen/X86/2007-10-15-CoalescerCrash.ll b/test/CodeGen/X86/2007-10-15-CoalescerCrash.ll index c68628d..2b56b4e 100644 --- a/test/CodeGen/X86/2007-10-15-CoalescerCrash.ll +++ b/test/CodeGen/X86/2007-10-15-CoalescerCrash.ll @@ -362,7 +362,7 @@ bb1159: ; preds = %cond_next1150 cond_true1169: ; preds = %bb1159 %tmp11741175 = trunc i64 %lsum.11225.0 to i32 ; [#uses=1] - %tmp1178 = tail call i32 (%struct._IO_FILE* noalias , i8* noalias , ...)* @fprintf( %struct._IO_FILE* noalias %file , i8* getelementptr ([49 x i8]* @.str32, i32 0, i64 0) , i32 %tmp11741175, i32 0 ) ; [#uses=0] + %tmp1178 = tail call i32 (%struct._IO_FILE* , i8* , ...)* @fprintf( %struct._IO_FILE* noalias %file , i8* getelementptr ([49 x i8]* @.str32, i32 0, i64 0) , i32 %tmp11741175, i32 0 ) ; [#uses=0] ret void UnifiedReturnBlock: ; preds = %bb1159 diff --git a/test/Feature/paramattrs.ll b/test/Feature/paramattrs.ll index 91aa460..9860f5a 100644 --- a/test/Feature/paramattrs.ll +++ b/test/Feature/paramattrs.ll @@ -2,8 +2,8 @@ ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll ; RUN: diff %t1.ll %t2.ll -%ZFunTy = type i32(i8 zeroext) -%SFunTy = type i32(i8 signext) +%ZFunTy = type i32(i8) +%SFunTy = type i32(i8) declare signext i16 @"test"(i16 signext %arg) declare zeroext i8 @"test2" (i16 zeroext %a2) @@ -14,7 +14,7 @@ declare void @exit(i32) noreturn nounwind define i32 @main(i32 inreg %argc, i8 ** inreg %argv) nounwind { %val = trunc i32 %argc to i16 - %res1 = call signext i16 (i16 signext) *@test(i16 signext %val) + %res1 = call signext i16 (i16 ) *@test(i16 signext %val) %two = add i16 %res1, %res1 %res2 = call zeroext i8 @test2(i16 zeroext %two ) %retVal = sext i16 %two to i32 diff --git a/test/Integer/paramattrs_bt.ll b/test/Integer/paramattrs_bt.ll deleted file mode 100644 index 6db9a53..0000000 --- a/test/Integer/paramattrs_bt.ll +++ /dev/null @@ -1,19 +0,0 @@ -; RUN: llvm-as < %s | llvm-dis > %t1.ll -; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll -; RUN: diff %t1.ll %t2.ll - -%ZFunTy = type i33(i8 zeroext) -%SFunTy = type i33(i8 signext) - -declare signext i16 @"test"(i16 signext %arg) -declare zeroext i8 @"test2" (i16 zeroext %a2) - - -define i33 @main(i33 %argc, i8 **%argv) { - %val = trunc i33 %argc to i16 - %res = call signext i16 (i16 signext) *@test(i16 signext %val) - %two = add i16 %res, %res - %res2 = call zeroext i8 @test2(i16 zeroext %two ) - %retVal = sext i16 %two to i33 - ret i33 %retVal -} diff --git a/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll index 1c24df3..15988b6 100644 --- a/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll +++ b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll @@ -3,7 +3,7 @@ define void @blah(i16* %tmp10) { entry: - call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16* sret )*)( i16* sret %tmp10 ) + call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16*)*)( i16* sret %tmp10 ) ret void } diff --git a/test/Transforms/InstCombine/2007-09-11-Trampoline.ll b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll index d8f3d97..6190aa9 100644 --- a/test/Transforms/InstCombine/2007-09-11-Trampoline.ll +++ b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll @@ -15,7 +15,7 @@ entry: %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; [#uses=1] store i32 %n, i32* %tmp3, align 8 %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; [#uses=1] - %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* nest , i32)* @f to i8*), i8* %FRAME.06 ) ; [#uses=1] + %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* , i32)* @f to i8*), i8* %FRAME.06 ) ; [#uses=1] %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; [#uses=1] %tmp89 = bitcast i8* %tramp to i32 (i32)* ; [#uses=2] store i32 (i32)* %tmp89, i32 (i32)** %tmp7, align 8 diff --git a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll index 2109d34..e3192a9 100644 --- a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll +++ b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll @@ -5,7 +5,7 @@ define i32 @main(i32 %argc, i8** %argv) { entry: - %tmp32 = tail call i32 (i8* noalias , ...) * bitcast (i32 (i8*, ...) nounwind * @printf to i32 (i8* noalias , ...) nounwind *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; [#uses=0] + %tmp32 = tail call i32 (i8* , ...) * bitcast (i32 (i8*, ...) * @printf to i32 (i8* , ...) *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; [#uses=0] ret i32 undef } -- cgit v1.1