Implement feature: InstCombine/2003-11-13-ConstExprCastCall.ll
authorChris Lattner <sabre@nondot.org>
Thu, 13 Nov 2003 19:17:02 +0000 (19:17 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 13 Nov 2003 19:17:02 +0000 (19:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9981 91177308-0d34-0410-b5e6-96231b3b80d8

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());