aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 0df0466112..5207ea52f4 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -937,7 +937,8 @@ void GetElementPtrInst::init(Value *Ptr, Value *Idx) {
GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
const std::string &Name, Instruction *InBe)
- : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx))),
+ : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)),
+ cast<PointerType>(Ptr->getType())->getAddressSpace()),
GetElementPtr, 0, 0, InBe) {
init(Ptr, Idx);
setName(Name);
@@ -945,7 +946,8 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
const std::string &Name, BasicBlock *IAE)
- : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx))),
+ : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)),
+ cast<PointerType>(Ptr->getType())->getAddressSpace()),
GetElementPtr, 0, 0, IAE) {
init(Ptr, Idx);
setName(Name);