forked from OSchip/llvm-project
Fix regressions in InstCombine/call-cast-target.ll and InstCombine/2003-11-13-ConstExprCastCall.ll
llvm-svn: 32959
This commit is contained in:
parent
bb162f48ba
commit
7051d758de
|
@ -7208,7 +7208,10 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||||
// Check to see if we are changing the return type...
|
// Check to see if we are changing the return type...
|
||||||
if (OldRetTy != FT->getReturnType()) {
|
if (OldRetTy != FT->getReturnType()) {
|
||||||
if (Callee->isExternal() && !Caller->use_empty() &&
|
if (Callee->isExternal() && !Caller->use_empty() &&
|
||||||
OldRetTy != FT->getReturnType())
|
OldRetTy != FT->getReturnType() &&
|
||||||
|
// Conversion is ok if changing from pointer to int of same size.
|
||||||
|
!(isa<PointerType>(FT->getReturnType()) &&
|
||||||
|
TD->getIntPtrType() == OldRetTy))
|
||||||
return false; // Cannot transform this return value.
|
return false; // Cannot transform this return value.
|
||||||
|
|
||||||
// If the callsite is an invoke instruction, and the return value is used by
|
// If the callsite is an invoke instruction, and the return value is used by
|
||||||
|
@ -7235,6 +7238,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
||||||
ConstantInt *c = dyn_cast<ConstantInt>(*AI);
|
ConstantInt *c = dyn_cast<ConstantInt>(*AI);
|
||||||
//Either we can cast directly, or we can upconvert the argument
|
//Either we can cast directly, or we can upconvert the argument
|
||||||
bool isConvertible = ActTy == ParamTy ||
|
bool isConvertible = ActTy == ParamTy ||
|
||||||
|
(isa<PointerType>(ParamTy) && isa<PointerType>(ActTy)) ||
|
||||||
(ParamTy->isIntegral() && ActTy->isIntegral() &&
|
(ParamTy->isIntegral() && ActTy->isIntegral() &&
|
||||||
ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize()) ||
|
ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize()) ||
|
||||||
(c && ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize() &&
|
(c && ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize() &&
|
||||||
|
|
Loading…
Reference in New Issue