diff options
author | Duncan Sands <baldrick@free.fr> | 2007-11-25 14:10:56 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2007-11-25 14:10:56 +0000 |
commit | 185eeac0f8ebc3ea9cf34068aab18b035625b2c0 (patch) | |
tree | b557792504bf6ad728cadf0cae4d49e07c15d5a8 /llvm/lib/Transforms | |
parent | f7121af96d0bf6352b6b8171aec7d7b8ebe9769d (diff) | |
download | bcm5719-llvm-185eeac0f8ebc3ea9cf34068aab18b035625b2c0.tar.gz bcm5719-llvm-185eeac0f8ebc3ea9cf34068aab18b035625b2c0.zip |
Fix PR1816. If a bitcast of a function only exists because of a
trivial difference in function attributes, allow calls to it to
be converted to direct calls. Based on a patch by Török Edwin.
While there, move the various lists of mutually incompatible
parameters etc out of the verifier and into ParameterAttributes.h.
llvm-svn: 44315
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 5537631eef9..85fd2c3bdb7 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7990,11 +7990,12 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { 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()) + // If the parameter attributes are not compatible, don't do the xform. We + // don't want to lose an sret attribute or something. + if (!ParamAttrsList::areCompatible(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() && |