Implemented constant propogation of cast instructions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1064 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 101e892..70d52a6 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -442,9 +442,10 @@
     if (VState.isOverdefined()) {        // Inherit overdefinedness of operand
       markOverdefined(I);
     } else if (VState.isConstant()) {    // Propogate constant value
-      ConstPoolVal *Result = 
-	opt::ConstantFoldUnaryInstruction(I->getOpcode(), 
-					  VState.getConstant());
+      ConstPoolVal *Result = isa<CastInst>(I)
+        ? opt::ConstantFoldCastInstruction(VState.getConstant(), I->getType())
+        : opt::ConstantFoldUnaryInstruction(I->getOpcode(), 
+                                            VState.getConstant());
 
       if (Result) {
 	// This instruction constant folds!