getresult type is the type of indexed aggregate element
authorDevang Patel <dpatel@apple.com>
Wed, 20 Feb 2008 19:26:55 +0000 (19:26 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 20 Feb 2008 19:26:55 +0000 (19:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47392 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Instructions.h
lib/VMCore/Instructions.cpp

index c061a4a3fa62ce01f811be0893ad4a05107c3089..b6d5de0f525907d63695968120be90a7fcc985f3 100644 (file)
@@ -2367,11 +2367,6 @@ public:
   
   virtual GetResultInst *clone() const;
   
-  // getType - Get aggregate value element type
-  inline const Type *getType() const {
-    return Aggr->getType();
-  }
-  
   inline Value *getAggregateValue() {
     return getOperand(0);
   }
index d700902a256a7d3cb7ffa03bb0722988ed0858a9..c1e583375a2cc9a90856df9e20d08cd1cde0e4cf 100644 (file)
@@ -2708,7 +2708,7 @@ void SwitchInst::setSuccessorV(unsigned idx, BasicBlock *B) {
 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);