summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp33
-rw-r--r--llvm/lib/IR/AsmWriter.cpp4
2 files changed, 16 insertions, 21 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index a4bbcfcefd5..f29ceddf643 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -707,7 +707,8 @@ bool LLParser::ParseAlias(const std::string &Name, LocTy NameLoc,
/// OptionalThreadLocal OptionalAddrSpace OptionalUnNammedAddr
/// OptionalExternallyInitialized GlobalType Type Const
///
-/// Everything through visibility has been parsed already.
+/// Everything up to and including OptionalDLLStorageClass has been parsed
+/// already.
///
bool LLParser::ParseGlobal(const std::string &Name, LocTy NameLoc,
unsigned Linkage, bool HasLinkage,
@@ -4071,33 +4072,27 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
//===----------------------------------------------------------------------===//
/// ParseAlloc
-/// ::= 'alloca' Type (',' 'inalloca')? (',' TypeAndValue)? (',' OptionalInfo)?
+/// ::= 'alloca' 'inalloca'? Type (',' TypeAndValue)? (',' 'align' i32)?
int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
Value *Size = 0;
LocTy SizeLoc;
unsigned Alignment = 0;
- bool IsInAlloca = false;
Type *Ty = 0;
+
+ bool IsInAlloca = EatIfPresent(lltok::kw_inalloca);
+
if (ParseType(Ty)) return true;
bool AteExtraComma = false;
if (EatIfPresent(lltok::comma)) {
- bool HaveComma = true;
- if (EatIfPresent(lltok::kw_inalloca)) {
- IsInAlloca = true;
- HaveComma = EatIfPresent(lltok::comma);
- }
-
- if (HaveComma) {
- if (Lex.getKind() == lltok::kw_align) {
- if (ParseOptionalAlignment(Alignment)) return true;
- } else if (Lex.getKind() == lltok::MetadataVar) {
- AteExtraComma = true;
- } else {
- if (ParseTypeAndValue(Size, SizeLoc, PFS) ||
- ParseOptionalCommaAlign(Alignment, AteExtraComma))
- return true;
- }
+ if (Lex.getKind() == lltok::kw_align) {
+ if (ParseOptionalAlignment(Alignment)) return true;
+ } else if (Lex.getKind() == lltok::MetadataVar) {
+ AteExtraComma = true;
+ } else {
+ if (ParseTypeAndValue(Size, SizeLoc, PFS) ||
+ ParseOptionalCommaAlign(Alignment, AteExtraComma))
+ return true;
}
}
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 8a25ff8a979..c9ea49b2224 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1946,9 +1946,9 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
} else if (const AllocaInst *AI = dyn_cast<AllocaInst>(&I)) {
Out << ' ';
- TypePrinter.print(AI->getAllocatedType(), Out);
if (AI->isUsedWithInAlloca())
- Out << ", inalloca";
+ Out << "inalloca ";
+ TypePrinter.print(AI->getAllocatedType(), Out);
if (!AI->getArraySize() || AI->isArrayAllocation()) {
Out << ", ";
writeOperand(AI->getArraySize(), true);
OpenPOWER on IntegriCloud