summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Instructions.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-04-29 23:00:35 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-04-29 23:00:35 +0000
commitbf0a42ac09f45b05345f4f1eba0bd20500681575 (patch)
treea2c4b8b5f64ac6940cf41e1708d7b49d2851d83d /llvm/lib/IR/Instructions.cpp
parentc1592658d574e5fe693fc4ba2cd7537b1b72671e (diff)
downloadbcm5719-llvm-bf0a42ac09f45b05345f4f1eba0bd20500681575.tar.gz
bcm5719-llvm-bf0a42ac09f45b05345f4f1eba0bd20500681575.zip
[opaque pointer type] Store the value type of an alloca
llvm-svn: 236175
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r--llvm/lib/IR/Instructions.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index aa878ea436e..e46db2c4850 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -864,8 +864,9 @@ AllocaInst::AllocaInst(Type *Ty, Value *ArraySize, const Twine &Name,
AllocaInst::AllocaInst(Type *Ty, Value *ArraySize, unsigned Align,
const Twine &Name, Instruction *InsertBefore)
- : UnaryInstruction(PointerType::getUnqual(Ty), Alloca,
- getAISize(Ty->getContext(), ArraySize), InsertBefore) {
+ : UnaryInstruction(PointerType::getUnqual(Ty), Alloca,
+ getAISize(Ty->getContext(), ArraySize), InsertBefore),
+ AllocatedType(Ty) {
setAlignment(Align);
assert(!Ty->isVoidTy() && "Cannot allocate void!");
setName(Name);
@@ -873,8 +874,9 @@ AllocaInst::AllocaInst(Type *Ty, Value *ArraySize, unsigned Align,
AllocaInst::AllocaInst(Type *Ty, Value *ArraySize, unsigned Align,
const Twine &Name, BasicBlock *InsertAtEnd)
- : UnaryInstruction(PointerType::getUnqual(Ty), Alloca,
- getAISize(Ty->getContext(), ArraySize), InsertAtEnd) {
+ : UnaryInstruction(PointerType::getUnqual(Ty), Alloca,
+ getAISize(Ty->getContext(), ArraySize), InsertAtEnd),
+ AllocatedType(Ty) {
setAlignment(Align);
assert(!Ty->isVoidTy() && "Cannot allocate void!");
setName(Name);
@@ -899,10 +901,6 @@ bool AllocaInst::isArrayAllocation() const {
return true;
}
-Type *AllocaInst::getAllocatedType() const {
- return getType()->getElementType();
-}
-
/// isStaticAlloca - Return true if this alloca is in the entry block of the
/// function and is a constant size. If so, the code generator will fold it
/// into the prolog/epilog code, so it is basically free.
OpenPOWER on IntegriCloud