From 56b56ea15bd8687d9a9f1279c91eb0939cee7a56 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 16 Jul 2014 01:34:27 +0000 Subject: Roundtrip the inalloca bit on allocas through bitcode This was an oversight in the original support. As it is, I stuffed this bit into the alignment. The alignment is stored in log2 form, so it doesn't need more than 5 bits, given that Value::MaximumAlignment is 1 << 29. Reviewers: nicholas Differential Revision: http://reviews.llvm.org/D3943 llvm-svn: 213118 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 192f753..e7de539 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2889,10 +2889,14 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) { dyn_cast_or_null(getTypeByID(Record[0])); Type *OpTy = getTypeByID(Record[1]); Value *Size = getFnValueByID(Record[2], OpTy); - unsigned Align = Record[3]; + unsigned AlignRecord = Record[3]; + bool InAlloca = AlignRecord & (1 << 5); + unsigned Align = AlignRecord & ((1 << 5) - 1); if (!Ty || !Size) return Error(InvalidRecord); - I = new AllocaInst(Ty->getElementType(), Size, (1 << Align) >> 1); + AllocaInst *AI = new AllocaInst(Ty->getElementType(), Size, (1 << Align) >> 1); + AI->setUsedWithInAlloca(InAlloca); + I = AI; InstructionList.push_back(I); break; } -- cgit v1.1