[opaque pointer type] Track explicit GEP pointee type through in-memory IR
llvm-svn: 236510
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index e46db2c..3e68138 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -1243,10 +1243,11 @@
}
GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI)
- : Instruction(GEPI.getType(), GetElementPtr,
- OperandTraits<GetElementPtrInst>::op_end(this)
- - GEPI.getNumOperands(),
- GEPI.getNumOperands()) {
+ : Instruction(GEPI.getType(), GetElementPtr,
+ OperandTraits<GetElementPtrInst>::op_end(this) -
+ GEPI.getNumOperands(),
+ GEPI.getNumOperands()),
+ SourceElementType(GEPI.SourceElementType) {
std::copy(GEPI.op_begin(), GEPI.op_end(), op_begin());
SubclassOptionalData = GEPI.SubclassOptionalData;
}