[llvm] 7b7d3b2 - [AsmParser] Remove some redundant checks for align attributes

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 00:55:25 PDT 2022


Author: Nikita Popov
Date: 2022-10-11T09:53:08+02:00
New Revision: 7b7d3b20ffec9f0af0534178117a7e0c250f6a79

URL: https://github.com/llvm/llvm-project/commit/7b7d3b20ffec9f0af0534178117a7e0c250f6a79
DIFF: https://github.com/llvm/llvm-project/commit/7b7d3b20ffec9f0af0534178117a7e0c250f6a79.diff

LOG: [AsmParser] Remove some redundant checks for align attributes

The verifier already has a more general check that the attribute is
legal for the position it is used in.

Added: 
    

Modified: 
    llvm/lib/AsmParser/LLParser.cpp
    llvm/test/Assembler/call-invalid-1.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index db848f4b6ca9e..9b6c6d8df5865 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -6506,9 +6506,6 @@ bool LLParser::parseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
   if (I != E)
     return error(CallLoc, "not enough parameters specified for call");
 
-  if (FnAttrs.hasAlignmentAttr())
-    return error(CallLoc, "invoke instructions may not have an alignment");
-
   // Finish off the Attribute and check them
   AttributeList PAL =
       AttributeList::get(Context, AttributeSet::get(Context, FnAttrs),
@@ -6822,9 +6819,6 @@ bool LLParser::parseCallBr(Instruction *&Inst, PerFunctionState &PFS) {
   if (I != E)
     return error(CallLoc, "not enough parameters specified for call");
 
-  if (FnAttrs.hasAlignmentAttr())
-    return error(CallLoc, "callbr instructions may not have an alignment");
-
   // Finish off the Attribute and check them
   AttributeList PAL =
       AttributeList::get(Context, AttributeSet::get(Context, FnAttrs),
@@ -7220,9 +7214,6 @@ bool LLParser::parseCall(Instruction *&Inst, PerFunctionState &PFS,
   if (I != E)
     return error(CallLoc, "not enough parameters specified for call");
 
-  if (FnAttrs.hasAlignmentAttr())
-    return error(CallLoc, "call instructions may not have an alignment");
-
   // Finish off the Attribute and check them
   AttributeList PAL =
       AttributeList::get(Context, AttributeSet::get(Context, FnAttrs),

diff  --git a/llvm/test/Assembler/call-invalid-1.ll b/llvm/test/Assembler/call-invalid-1.ll
index 4a12b14a5edb4..1d48bf6746f44 100644
--- a/llvm/test/Assembler/call-invalid-1.ll
+++ b/llvm/test/Assembler/call-invalid-1.ll
@@ -4,6 +4,6 @@ declare void @f()
 
 define void @g() {
   call void @f() align 8
-; CHECK: error: call instructions may not have an alignment
+; CHECK: Attribute 'align 8' does not apply to functions!
   ret void
 }


        


More information about the llvm-commits mailing list