summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-04-28 16:51:01 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-04-28 16:51:01 +0000
commitbdb4910202adab8c538e06102dd65b79dbb84e41 (patch)
tree77acfe704be28db462e43068422c9d2746caacda /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parentba55804ea3f90e5fdac900d0bc5bdf61dd6ad877 (diff)
downloadbcm5719-llvm-bdb4910202adab8c538e06102dd65b79dbb84e41.tar.gz
bcm5719-llvm-bdb4910202adab8c538e06102dd65b79dbb84e41.zip
[opaque pointer type] Encode the allocated type of an alloca rather than its pointer result type.
llvm-svn: 235998
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index b6444b2d060..15b0106ef54 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1870,15 +1870,16 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
case Instruction::Alloca: {
Code = bitc::FUNC_CODE_INST_ALLOCA;
- Vals.push_back(VE.getTypeID(I.getType()));
+ const AllocaInst &AI = cast<AllocaInst>(I);
+ Vals.push_back(VE.getTypeID(AI.getAllocatedType()));
Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
Vals.push_back(VE.getValueID(I.getOperand(0))); // size.
- const AllocaInst &AI = cast<AllocaInst>(I);
unsigned AlignRecord = Log2_32(AI.getAlignment()) + 1;
assert(Log2_32(Value::MaximumAlignment) + 1 < 1 << 5 &&
"not enough bits for maximum alignment");
assert(AlignRecord < 1 << 5 && "alignment greater than 1 << 64");
AlignRecord |= AI.isUsedWithInAlloca() << 5;
+ AlignRecord |= 1 << 6;
Vals.push_back(AlignRecord);
break;
}
OpenPOWER on IntegriCloud