Loop invariant code motion now depends on the LoopPreheader pass. Dead code

has not yet been removed.

llvm-svn: 3945
This commit is contained in:
Chris Lattner 2002-09-26 16:19:31 +00:00
parent bedbd6bc16
commit d771fdfd75
1 changed files with 10 additions and 5 deletions

View File

@ -42,6 +42,7 @@ namespace {
// This transformation requires natural loop information...
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.preservesCFG();
AU.addRequiredID(LoopPreheadersID);
AU.addRequired<LoopInfo>();
AU.addRequired<AliasAnalysis>();
}
@ -104,11 +105,7 @@ namespace {
}
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;
@ -276,6 +273,14 @@ void LICM::hoist(Instruction &Inst) {
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.
//