Implement feature: InstCombine/2003-11-13-ConstExprCastCall.ll
[oota-llvm.git] / lib / Transforms / Scalar / InstructionCombining.cpp
index 8522b610e1378093eaa6c52e260dbb917aa5145e..db178b3d1fdbc808ba95453858ccecbe3925c9c2 100644 (file)
@@ -1801,7 +1801,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
   const Type *OldRetTy = Caller->getType();
 
   if (Callee->isExternal() &&
-      !OldRetTy->isLosslesslyConvertibleTo(FT->getReturnType()))
+      !OldRetTy->isLosslesslyConvertibleTo(FT->getReturnType()) &&
+      !Caller->use_empty())
     return false;   // Cannot transform this return value...
 
   unsigned NumActualArgs = unsigned(CS.arg_end()-CS.arg_begin());