Remove support for NOT instruction
[oota-llvm.git] / lib / Transforms / Scalar / SCCP.cpp
index b721ca0965c64611eeee27c501a53702e5d2612d..61f41e140b1a11a0b3811858ef974b93b291911a 100644 (file)
@@ -18,7 +18,6 @@
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/ConstantHandling.h"
 #include "llvm/Function.h"
-#include "llvm/BasicBlock.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iMemory.h"
 #include "llvm/iTerminators.h"
@@ -29,7 +28,6 @@
 #include "Support/StatisticReporter.h"
 #include <algorithm>
 #include <set>
-#include <iostream>
 using std::cerr;
 
 static Statistic<> NumInstRemoved("sccp\t\t- Number of instructions removed");
@@ -179,8 +177,7 @@ private:
   void visitReturnInst(ReturnInst &I) { /*does not have an effect*/ }
   void visitTerminatorInst(TerminatorInst &TI);
 
-  void visitUnaryOperator(Instruction &I);
-  void visitCastInst(CastInst &I) { visitUnaryOperator(I); }
+  void visitCastInst(CastInst &I);
   void visitBinaryOperator(Instruction &I);
   void visitShiftInst(ShiftInst &I) { visitBinaryOperator(I); }
 
@@ -478,15 +475,14 @@ void SCCP::visitTerminatorInst(TerminatorInst &TI) {
     }
 }
 
-void SCCP::visitUnaryOperator(Instruction &I) {
+void SCCP::visitCastInst(CastInst &I) {
   Value *V = I.getOperand(0);
   InstVal &VState = getValueState(V);
   if (VState.isOverdefined()) {        // Inherit overdefinedness of operand
     markOverdefined(&I);
   } else if (VState.isConstant()) {    // Propogate constant value
-    Constant *Result = isa<CastInst>(I)
-      ? ConstantFoldCastInstruction(VState.getConstant(), I.getType())
-      : ConstantFoldUnaryInstruction(I.getOpcode(), VState.getConstant());
+    Constant *Result =
+      ConstantFoldCastInstruction(VState.getConstant(), I.getType());
 
     if (Result) {
       // This instruction constant folds!