AsmParser: Call instructions can't have an alignment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230193 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2015-02-23 00:01:32 +00:00
parent 15cf92437a
commit dad44db24c
2 changed files with 19 additions and 2 deletions

View File

@ -4732,10 +4732,14 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
if (I != E) if (I != E)
return Error(CallLoc, "not enough parameters specified for call"); 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(), Attrs.push_back(AttributeSet::get(RetType->getContext(),
AttributeSet::FunctionIndex, AttributeSet::FunctionIndex,
FnAttrs)); FnAttrs));
}
// Finish off the Attribute and check them // Finish off the Attribute and check them
AttributeSet PAL = AttributeSet::get(Context, Attrs); AttributeSet PAL = AttributeSet::get(Context, Attrs);
@ -5145,10 +5149,14 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
if (I != E) if (I != E)
return Error(CallLoc, "not enough parameters specified for call"); 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(), Attrs.push_back(AttributeSet::get(RetType->getContext(),
AttributeSet::FunctionIndex, AttributeSet::FunctionIndex,
FnAttrs)); FnAttrs));
}
// Finish off the Attribute and check them // Finish off the Attribute and check them
AttributeSet PAL = AttributeSet::get(Context, Attrs); AttributeSet PAL = AttributeSet::get(Context, Attrs);

View File

@ -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
}