getresult type is the type of indexed aggregate element
llvm-svn: 47392
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index d700902..c1e5833 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -2708,7 +2708,7 @@
GetResultInst::GetResultInst(Value *Aggregate, unsigned Index,
const std::string &Name,
Instruction *InsertBef)
- : Instruction(Aggr->getType(),
+ : Instruction(cast<StructType>(Aggregate->getType())->getElementType(Index),
GetResult, &Aggr, 1, InsertBef) {
assert(isValidOperands(Aggregate, Index) && "Invalid GetResultInst operands!");
Aggr.init(Aggregate, this);