Instcombine PHI's of the form %PN = phi PN, X into X and
[oota-llvm.git] / lib / Transforms / Scalar / LICM.cpp
index 1f743efe9bf1c06f4125dd31a7adcf4ca801335b..1cb899bf6e2bc41910e5fbfd2eca0bcd05275058 100644 (file)
@@ -84,15 +84,14 @@ 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 &CI) {
+      Instruction &I = (Instruction&)CI;
+      if (isLoopInvariant(I.getOperand(0))) hoist(I);
+    }
     void visitShiftInst(ShiftInst &I) { visitBinaryOperator((Instruction&)I); }
 
     void visitGetElementPtrInst(GetElementPtrInst &GEPI) {