Stop accepting and ignoring attributes in function types. Attributes are applied
authorChris Lattner <sabre@nondot.org>
Fri, 17 Jun 2011 17:37:13 +0000 (17:37 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 17 Jun 2011 17:37:13 +0000 (17:37 +0000)
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
test/CodeGen/X86/2007-10-15-CoalescerCrash.ll
test/Feature/paramattrs.ll
test/Integer/paramattrs_bt.ll [deleted file]
test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll
test/Transforms/InstCombine/2007-09-11-Trampoline.ll
test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll

index 01b3877adb60c016204227553caf4186c1f99800..a9d3c94391cb96f579ac3b2a44d36b5ae733d209 100644 (file)
@@ -1559,22 +1559,16 @@ bool LLParser::ParseFunctionType(PATypeHolder &Result) {
 
   std::vector<ArgInfo> 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<const Type*> ArgListTy;
index c68628d1f7951791719d3b872923d49654a8fd1e..2b56b4ea71298d3ffdf53346fda677f399de5692 100644 (file)
@@ -362,7 +362,7 @@ bb1159:             ; preds = %cond_next1150
 
 cond_true1169:         ; preds = %bb1159
        %tmp11741175 = trunc i64 %lsum.11225.0 to i32           ; <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 )                ; <i32> [#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 )              ; <i32> [#uses=0]
        ret void
 
 UnifiedReturnBlock:            ; preds = %bb1159
index 91aa460eb0e40c1a8161eb298f80830b0c661e0b..9860f5a6a5bf4f0d7f1c61115f278621228de3f6 100644 (file)
@@ -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 (file)
index 6db9a53..0000000
+++ /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
-}
index 1c24df3844632d8552291239d65aa6920b06656b..15988b6dd99ad1f50ee38e671793038c0c443bcb 100644 (file)
@@ -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
 }
 
index d8f3d97017ba291965ad816def2eb82c220fb1c5..6190aa92805bf0906d1c104dfb454b03676c2bd9 100644 (file)
@@ -15,7 +15,7 @@ entry:
        %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0                ; <i32*> [#uses=1]
        store i32 %n, i32* %tmp3, align 8
        %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8*         ; <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 )             ; <i8*> [#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 )          ; <i8*> [#uses=1]
        %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1                ; <i32 (i32)**> [#uses=1]
        %tmp89 = bitcast i8* %tramp to i32 (i32)*               ; <i32 (i32)*> [#uses=2]
        store i32 (i32)* %tmp89, i32 (i32)** %tmp7, align 8
index 2109d3420fb98d40471fe1c0eba54cc997e1201c..e3192a990ba0818d9a548e3a2a8ea4cbb611361d 100644 (file)
@@ -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           ; <i32> [#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                 ; <i32> [#uses=0]
        ret i32 undef
 }