// This transformation requires natural loop information...
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.preservesCFG();
+ AU.addRequiredID(LoopPreheadersID);
AU.addRequired<LoopInfo>();
AU.addRequired<AliasAnalysis>();
}
}
void visitShiftInst(ShiftInst &I) { visitBinaryOperator((Instruction&)I); }
- void visitLoadInst(LoadInst &LI) {
- if (isLoopInvariant(LI.getOperand(0)) &&
- !pointerInvalidatedByLoop(LI.getOperand(0)))
- hoist(LI);
- }
+ void visitLoadInst(LoadInst &LI);
void visitGetElementPtrInst(GetElementPtrInst &GEPI) {
Instruction &I = (Instruction&)GEPI;
Changed = true;
}
+
+void LICM::visitLoadInst(LoadInst &LI) {
+ if (isLoopInvariant(LI.getOperand(0)) &&
+ !pointerInvalidatedByLoop(LI.getOperand(0)))
+ hoist(LI);
+
+}
+
// pointerInvalidatedByLoop - Return true if the body of this loop may store
// into the memory location pointed to by V.
//