Remove support for NOT instruction
[oota-llvm.git] / lib / Transforms / Scalar / LICM.cpp
index 99ee45e3cd76353e8a50dd1d052d775230185e8f..8bcb227e74b14c542b1e78dcb966fda4b638ad38 100644 (file)
@@ -34,14 +34,12 @@ static Statistic<> NumHoistedPH("licm\t\t- Number of insts hoisted to a loop "
 
 namespace {
   struct LICM : public FunctionPass, public InstVisitor<LICM> {
-    const char *getPassName() const { return "Loop Invariant Code Motion"; }
-
     virtual bool runOnFunction(Function &F);
 
     // This transformation requires natural loop information...
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.preservesCFG();
-      AU.addRequired(LoopInfo::ID); 
+      AU.addRequired<LoopInfo>();
     }
 
   private:
@@ -86,15 +84,13 @@ namespace {
     // the specified instruction types are hoisted.
     //
     friend class InstVisitor<LICM>;
-    void visitUnaryOperator(Instruction &I) {
-      if (isLoopInvariant(I.getOperand(0))) hoist(I);
-    }
     void visitBinaryOperator(Instruction &I) {
       if (isLoopInvariant(I.getOperand(0)) && isLoopInvariant(I.getOperand(1)))
         hoist(I);
     }
-
-    void visitCastInst(CastInst &I) { visitUnaryOperator((Instruction&)I); }
+    void visitCastInst(CastInst &I) {
+      if (isLoopInvariant(I.getOperand(0))) hoist((Instruction&)I);
+    }
     void visitShiftInst(ShiftInst &I) { visitBinaryOperator((Instruction&)I); }
 
     void visitGetElementPtrInst(GetElementPtrInst &GEPI) {
@@ -104,6 +100,8 @@ namespace {
       hoist(I);
     }
   };
+
+  RegisterOpt<LICM> X("licm", "Loop Invariant Code Motion");
 }
 
 Pass *createLICMPass() { return new LICM(); }