Fix Transforms/InstCombine/2007-05-18-CastFoldBug.ll, a bug that devastates

objc code due to the way the FE lowers objc message sends.

llvm-svn: 37256
This commit is contained in:
Chris Lattner 2007-05-19 06:51:32 +00:00
parent faa31904e4
commit a655a157a0
1 changed files with 8 additions and 0 deletions

View File

@ -7773,6 +7773,14 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
const FunctionType *FT = Callee->getFunctionType();
const Type *OldRetTy = Caller->getType();
const FunctionType *ActualFT =
cast<FunctionType>(cast<PointerType>(CE->getType())->getElementType());
// If the parameter attributes don't match up, don't do the xform. We don't
// want to lose an sret attribute or something.
if (FT->getParamAttrs() != ActualFT->getParamAttrs())
return false;
// Check to see if we are changing the return type...
if (OldRetTy != FT->getReturnType()) {
if (Callee->isDeclaration() && !Caller->use_empty() &&