+ if (ElTy) break; // Found a number of zeros we can strip off!
+
+ // Otherwise, we can convert a GEP from one form to the other iff the
+ // current gep is of the form 'getelementptr sbyte*, long N
+ // and we could convert this to an appropriate GEP for the new type.
+ //
+ if (GEP->getNumOperands() == 2 &&
+ GEP->getOperand(1)->getType() == Type::LongTy &&
+ GEP->getType() == PointerType::get(Type::SByteTy)) {
+
+ // Do not Check to see if our incoming pointer can be converted
+ // to be a ptr to an array of the right type... because in more cases than
+ // not, it is simply not analyzable because of pointer/array
+ // discrepencies. To fix this, we will insert a cast before the GEP.
+ //
+
+ // Check to see if 'N' is an expression that can be converted to
+ // the appropriate size... if so, allow it.
+ //
+ std::vector<Value*> Indices;
+ const Type *ElTy = ConvertableToGEP(PTy, I->getOperand(1), Indices);
+ if (ElTy == PVTy) {
+ if (!ExpressionConvertableToType(I->getOperand(0),
+ PointerType::get(ElTy), CTMap))
+ return false; // Can't continue, ExConToTy might have polluted set!
+ break;
+ }
+ }
+
+ // Otherwise, it could be that we have something like this:
+ // getelementptr [[sbyte] *] * %reg115, long %reg138 ; [sbyte]**
+ // and want to convert it into something like this:
+ // getelemenptr [[int] *] * %reg115, long %reg138 ; [int]**
+ //
+ if (GEP->getNumOperands() == 2 &&
+ GEP->getOperand(1)->getType() == Type::LongTy &&
+ TD.getTypeSize(PTy->getElementType()) ==
+ TD.getTypeSize(GEP->getType()->getElementType())) {
+ const PointerType *NewSrcTy = PointerType::get(PVTy);
+ if (!ExpressionConvertableToType(I->getOperand(0), NewSrcTy, CTMap))
+ return false;
+ break;
+ }
+