Remove dependence on structure index type. s/MT/FT
authorChris Lattner <sabre@nondot.org>
Fri, 9 Jan 2004 06:02:51 +0000 (06:02 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 9 Jan 2004 06:02:51 +0000 (06:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10726 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/MutateStructTypes.cpp

index 41835adb4871adcd79d685643e1b6b0622fa2074..e2c362f3ab244cba7b74fdfc29e99c6f962a61b6 100644 (file)
@@ -56,15 +56,15 @@ const Type *MutateStructTypes::ConvertType(const Type *Ty) {
 
   switch (Ty->getPrimitiveID()) {
   case Type::FunctionTyID: {
-    const FunctionType *MT = cast<FunctionType>(Ty);
-    const Type *RetTy = ConvertType(MT->getReturnType());
+    const FunctionType *FT = cast<FunctionType>(Ty);
+    const Type *RetTy = ConvertType(FT->getReturnType());
     std::vector<const Type*> ArgTypes;
 
-    for (FunctionType::ParamTypes::const_iterator I = MT->getParamTypes().begin(),
-           E = MT->getParamTypes().end(); I != E; ++I)
+    for (FunctionType::ParamTypes::const_iterator I = FT->getParamTypes().begin(),
+           E = FT->getParamTypes().end(); I != E; ++I)
       ArgTypes.push_back(ConvertType(*I));
     
-    DestTy = FunctionType::get(RetTy, ArgTypes, MT->isVarArg());
+    DestTy = FunctionType::get(RetTy, ArgTypes, FT->isVarArg());
     break;
   }
   case Type::StructTyID: {
@@ -123,7 +123,7 @@ void MutateStructTypes::AdjustIndices(const CompositeType *OldTy,
       assert(ElNum < I->second.second.size());
       // Apply the XForm specified by Transforms map...
       unsigned NewElNum = I->second.second[ElNum];
-      Idx[i] = ConstantUInt::get(Type::UByteTy, NewElNum);
+      Idx[i] = ConstantUInt::get(Idx[i]->getType(), NewElNum);
     }
   }