llvm-svn: 30535
This commit is contained in:
Andrew Lenharth 2006-09-20 15:37:57 +00:00
parent f007f21c8a
commit 44cb67af5c
1 changed files with 8 additions and 12 deletions

View File

@ -1603,18 +1603,14 @@ FoundSExt:
CI = dyn_cast<CastInst>(RHS); CI = dyn_cast<CastInst>(RHS);
Other = LHS; Other = LHS;
} }
if (CI) { if (CI && CI->getType()->isSized() &&
const Type *UIntPtrTy = TD->getIntPtrType(); (CI->getType()->getPrimitiveSize() ==
const Type *SIntPtrTy = UIntPtrTy->getSignedVersion(); TD->getIntPtrType()->getPrimitiveSize())
if((CI->getType() == UIntPtrTy || CI->getType() == SIntPtrTy) && isa<PointerType>(CI->getOperand(0)->getType())) {
&& isa<PointerType>(CI->getOperand(0)->getType())) { Value* I2 = InsertCastBefore(CI->getOperand(0),
Instruction* I2 = new CastInst(CI->getOperand(0), PointerType::get(Type::SByteTy), I);
PointerType::get(Type::SByteTy), "ctg", &I); I2 = InsertNewInstBefore(new GetElementPtrInst(I2, Other, "ctg2"), I);
WorkList.push_back(I2); return new CastInst(I2, CI->getType());
I2 = new GetElementPtrInst(I2, Other, "ctg", &I);
WorkList.push_back(I2);
return new CastInst(I2, CI->getType());
}
} }
} }