/// This reordering exposes to optimizeMemoryInstruction more
/// optimization opportunities on loads and stores.
///
- /// If this function succesfully hoists an eliminable addrspacecast or V is
+ /// If this function successfully hoists an eliminable addrspacecast or V is
/// already such an addrspacecast, it returns the transformed value (which is
/// guaranteed to be an addrspacecast); otherwise, it returns nullptr.
Value *hoistAddrSpaceCastFrom(Value *V, int Depth = 0);
return false;
bool Changed = false;
- for (Function::iterator B = F.begin(), BE = F.end(); B != BE; ++B) {
- for (BasicBlock::iterator I = B->begin(), IE = B->end(); I != IE; ++I) {
+ for (BasicBlock &B : F) {
+ for (Instruction &I : B) {
if (isa<LoadInst>(I)) {
// V = load P
- Changed |= optimizeMemoryInstruction(I, 0);
+ Changed |= optimizeMemoryInstruction(&I, 0);
} else if (isa<StoreInst>(I)) {
// store V, P
- Changed |= optimizeMemoryInstruction(I, 1);
+ Changed |= optimizeMemoryInstruction(&I, 1);
}
}
}