1 //===- LoopDeletion.h - Loop Deletion -------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file provides the interface for the Loop Deletion Pass. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_TRANSFORMS_SCALAR_LOOPDELETION_H 15 #define LLVM_TRANSFORMS_SCALAR_LOOPDELETION_H 16 17 #include "llvm/Analysis/LoopInfo.h" 18 #include "llvm/Analysis/ScalarEvolution.h" 19 #include "llvm/IR/PassManager.h" 20 21 namespace llvm { 22 23 class LoopDeletionPass : public PassInfoMixin<LoopDeletionPass> { 24 public: LoopDeletionPass()25 LoopDeletionPass() {} 26 PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &AM); 27 bool runImpl(Loop *L, DominatorTree &DT, ScalarEvolution &SE, 28 LoopInfo &loopInfo); 29 30 private: 31 bool isLoopDead(Loop *L, ScalarEvolution &SE, 32 SmallVectorImpl<BasicBlock *> &exitingBlocks, 33 SmallVectorImpl<BasicBlock *> &exitBlocks, bool &Changed, 34 BasicBlock *Preheader); 35 }; 36 } 37 38 #endif // LLVM_TRANSFORMS_SCALAR_LOOPDELETION_H 39