case Instruction::Load: {
LoadInst *LI = cast<LoadInst>(I);
- if (LI->hasIndices() && !AllIndicesZero(LI)) {
- // We can't convert a load expression if it has indices... unless they are
- // all zero.
- return false;
- }
-
if (!ExpressionConvertableToType(LI->getPointerOperand(),
PointerType::get(Ty), CTMap))
return false;
case Instruction::Load: {
LoadInst *LI = cast<LoadInst>(I);
- assert(!LI->hasIndices() || AllIndicesZero(LI));
Res = new LoadInst(Constant::getNullValue(PointerType::get(Ty)), Name);
VMC.ExprMap[I] = Res;
if (const PointerType *PT = dyn_cast<PointerType>(Ty)) {
LoadInst *LI = cast<LoadInst>(I);
- if (LI->hasIndices() && !AllIndicesZero(LI))
- return false;
-
const Type *LoadedTy = PT->getElementType();
// They could be loading the first element of a composite type...
case Instruction::Store: {
StoreInst *SI = cast<StoreInst>(I);
- if (SI->hasIndices()) return false;
if (V == I->getOperand(0)) {
ValueTypeCache::iterator CTMI = CTMap.find(I->getOperand(1));
if (StoreInst *SI = dyn_cast<StoreInst>(&*II)) {
assert(valuesStoredInFunction &&
"Should not be printing a store instruction at function exit");
- LoadInst *LI = new LoadInst(SI->getPointerOperand(), SI->copyIndices(),
- "reload."+SI->getPointerOperand()->getName());
+ LoadInst *LI = new LoadInst(SI->getPointerOperand(), "reload." +
+ SI->getPointerOperand()->getName());
InsertPos = ++BB->getInstList().insert(InsertPos, LI);
valuesStoredInFunction->push_back(LI);
}
if (Value *CastSrc = CI->getOperand(0)) // CSPT = CastSrcPointerType
if (const PointerType *CSPT = dyn_cast<PointerType>(CastSrc->getType()))
// convertable types?
- if (Val->getType()->isLosslesslyConvertableTo(CSPT->getElementType()) &&
- !SI->hasIndices()) { // No subscripts yet!
+ if (Val->getType()->isLosslesslyConvertableTo(CSPT->getElementType())) {
PRINT_PEEPHOLE3("st-src-cast:in ", Pointer, Val, SI);
// Insert the new T cast instruction... stealing old T's name
if (Value *CastSrc = CI->getOperand(0)) // CSPT = CastSrcPointerType
if (const PointerType *CSPT = dyn_cast<PointerType>(CastSrc->getType()))
// convertable types?
- if (PtrElType->isLosslesslyConvertableTo(CSPT->getElementType()) &&
- !LI->hasIndices()) { // No subscripts yet!
+ if (PtrElType->isLosslesslyConvertableTo(CSPT->getElementType())) {
PRINT_PEEPHOLE2("load-src-cast:in ", Pointer, LI);
// Create the new load instruction... loading the pre-casted value