getresult type is the type of indexed aggregate element
llvm-svn: 47392
diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h
index c061a4a..b6d5de0 100644
--- a/llvm/include/llvm/Instructions.h
+++ b/llvm/include/llvm/Instructions.h
@@ -2367,11 +2367,6 @@
virtual GetResultInst *clone() const;
- // getType - Get aggregate value element type
- inline const Type *getType() const {
- return Aggr->getType();
- }
-
inline Value *getAggregateValue() {
return getOperand(0);
}
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);