diff options
author | Chris Lattner <sabre@nondot.org> | 2002-09-26 16:19:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-09-26 16:19:31 +0000 |
commit | eb53ae4f2dc39e75e725b21b52d77d29cf1c11c9 (patch) | |
tree | 0c638998baa714970d51f5ff50ca1618e4556381 /lib/Transforms | |
parent | c178d9459a0e659bedbc1b3c79459ee168453376 (diff) |
Loop invariant code motion now depends on the LoopPreheader pass. Dead code
has not yet been removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3945 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LICM.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 7bae9fd18a..f67fa6c649 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -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. // |