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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213118 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner
2014-07-16 01:34:27 +00:00
parent 99ecd0bf08
commit 55a421f98d
4 changed files with 34 additions and 5 deletions

View File

@ -2889,10 +2889,14 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
dyn_cast_or_null<PointerType>(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;
}