[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LICM.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Sep 26 11:20:01 PDT 2002
Changes in directory llvm/lib/Transforms/Scalar:
LICM.cpp updated: 1.12 -> 1.13
---
Log message:
Loop invariant code motion now depends on the LoopPreheader pass. Dead code
has not yet been removed.
---
Diffs of the changes:
Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.12 llvm/lib/Transforms/Scalar/LICM.cpp:1.13
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.12 Tue Sep 10 17:38:47 2002
+++ llvm/lib/Transforms/Scalar/LICM.cpp Thu Sep 26 11:19:31 2002
@@ -42,6 +42,7 @@
// 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 @@
}
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;
@@ -274,6 +271,14 @@
}
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
More information about the llvm-commits
mailing list