diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index be3868dca8c..79d79011f4b 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -5681,8 +5681,10 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { // Check to see if we are changing the return type... if (OldRetTy != FT->getReturnType()) { if (Callee->isExternal() && - !OldRetTy->isLosslesslyConvertibleTo(FT->getReturnType()) && - !Caller->use_empty()) + !(OldRetTy->isLosslesslyConvertibleTo(FT->getReturnType()) || + (isa(FT->getReturnType()) && + OldRetTy->isLosslesslyConvertibleTo(TD->getIntPtrType()))) + && !Caller->use_empty()) return false; // Cannot transform this return value... // If the callsite is an invoke instruction, and the return value is used by