For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index 3aa7397..896c399 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -278,7 +278,15 @@
 /// mapping its operands through ValueMap if they are available.
 Constant *PruningFunctionCloner::
 ConstantFoldMappedInstruction(const Instruction *I) {
-  if (isa<BinaryOperator>(I) || isa<ShiftInst>(I)) {
+  if (isa<CmpInst>(I)) {
+    if (Constant *Op0 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(0),
+                                                            ValueMap)))
+      if (Constant *Op1 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(1),
+                                                              ValueMap)))
+        return ConstantExpr::getCompare(cast<CmpInst>(I)->getPredicate(), Op0, 
+                                        Op1);
+    return 0;
+  } else if (isa<BinaryOperator>(I) || isa<ShiftInst>(I))  {
     if (Constant *Op0 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(0),
                                                             ValueMap)))
       if (Constant *Op1 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(1),
@@ -295,7 +303,7 @@
     else
       return 0;  // All operands not constant!
 
-  return ConstantFoldInstOperands(I->getOpcode(), I->getType(), Ops);
+  return ConstantFoldInstOperands(I, Ops);
 }
 
 /// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto,