summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-07-16 01:34:27 +0000
committerReid Kleckner <reid@kleckner.net>2014-07-16 01:34:27 +0000
commit56b56ea15bd8687d9a9f1279c91eb0939cee7a56 (patch)
treedb18a11c0d573cda0b929752f346dce0905a72aa /llvm/lib/Bitcode/Reader
parentb4db99c76ab3b0eed1a90b142aa420960adb2ae4 (diff)
downloadbcm5719-llvm-56b56ea15bd8687d9a9f1279c91eb0939cee7a56.tar.gz
bcm5719-llvm-56b56ea15bd8687d9a9f1279c91eb0939cee7a56.zip
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
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 192f7538da8..e7de539a325 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<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;
}
OpenPOWER on IntegriCloud