[llvm] r230193 - AsmParser: Call instructions can't have an alignment

David Majnemer david.majnemer at gmail.com
Sun Feb 22 16:01:32 PST 2015


Author: majnemer
Date: Sun Feb 22 18:01:32 2015
New Revision: 230193

URL: http://llvm.org/viewvc/llvm-project?rev=230193&view=rev
Log:
AsmParser: Call instructions can't have an alignment

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

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=230193&r1=230192&r2=230193&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Sun Feb 22 18:01:32 2015
@@ -4732,10 +4732,14 @@ bool LLParser::ParseInvoke(Instruction *
   if (I != E)
     return Error(CallLoc, "not enough parameters specified for call");
 
-  if (FnAttrs.hasAttributes())
+  if (FnAttrs.hasAttributes()) {
+    if (FnAttrs.hasAlignmentAttr())
+      return Error(CallLoc, "invoke instructions may not have an alignment");
+
     Attrs.push_back(AttributeSet::get(RetType->getContext(),
                                       AttributeSet::FunctionIndex,
                                       FnAttrs));
+  }
 
   // Finish off the Attribute and check them
   AttributeSet PAL = AttributeSet::get(Context, Attrs);
@@ -5145,10 +5149,14 @@ bool LLParser::ParseCall(Instruction *&I
   if (I != E)
     return Error(CallLoc, "not enough parameters specified for call");
 
-  if (FnAttrs.hasAttributes())
+  if (FnAttrs.hasAttributes()) {
+    if (FnAttrs.hasAlignmentAttr())
+      return Error(CallLoc, "call instructions may not have an alignment");
+
     Attrs.push_back(AttributeSet::get(RetType->getContext(),
                                       AttributeSet::FunctionIndex,
                                       FnAttrs));
+  }
 
   // Finish off the Attribute and check them
   AttributeSet PAL = AttributeSet::get(Context, Attrs);

Added: llvm/trunk/test/Assembler/call-invalid-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/call-invalid-1.ll?rev=230193&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/call-invalid-1.ll (added)
+++ llvm/trunk/test/Assembler/call-invalid-1.ll Sun Feb 22 18:01:32 2015
@@ -0,0 +1,9 @@
+; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+
+declare void @f()
+
+define void @g() {
+  call void @f() align 8
+; CHECK: error: call instructions may not have an alignment
+  ret void
+}





More information about the llvm-commits mailing list