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 | 827cde1c8319e51463007078a7ce3660ebc93036 (patch) | |
tree | a14ff574ff8b56c6eafd7d864d2cf756451a9d8d /lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | 789d34f8c3d78cf439f0da2f1ba7856bdaed01a4 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44315 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 5537631eef..85fd2c3bdb 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/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() && |