From dad44db24cc7a19acede51f85c77535cef1bac79 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 23 Feb 2015 00:01:32 +0000 Subject: [PATCH] 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 --- lib/AsmParser/LLParser.cpp | 12 ++++++++++-- test/Assembler/call-invalid-1.ll | 9 +++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 test/Assembler/call-invalid-1.ll diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index b009dae1880..f8eb1305ccd 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -4732,10 +4732,14 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) { 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 *&Inst, PerFunctionState &PFS, 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); diff --git a/test/Assembler/call-invalid-1.ll b/test/Assembler/call-invalid-1.ll new file mode 100644 index 00000000000..4a12b14a5ed --- /dev/null +++ b/test/Assembler/call-invalid-1.ll @@ -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 +}