diff options
| author | Duncan Sands <baldrick@free.fr> | 2008-01-07 17:16:06 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2008-01-07 17:16:06 +0000 |
| commit | 6c3470efdc59245707c56ad92ab8355afdac2c62 (patch) | |
| tree | 77b2dcecfd33686814466ce48d121cbdb6f37217 /lib/Transforms/Scalar/InstructionCombining.cpp | |
| parent | 30d15751c8f9d905c1402d9ff84acdcb2265bb8c (diff) | |
| download | external_llvm-6c3470efdc59245707c56ad92ab8355afdac2c62.zip external_llvm-6c3470efdc59245707c56ad92ab8355afdac2c62.tar.gz external_llvm-6c3470efdc59245707c56ad92ab8355afdac2c62.tar.bz2 | |
Small cleanup for handling of type/parameter attribute
incompatibility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
| -rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 3d37bcd..19f86f9 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -8097,10 +8097,11 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { FT->getReturnType() != Type::VoidTy) return false; // Cannot transform this return value. - if (!Caller->use_empty() && CallerPAL && - ParamAttr::incompatibleWithType(FT->getReturnType(), - CallerPAL->getParamAttrs(0))) - return false; // Attribute not compatible with transformed value. + if (CallerPAL && !Caller->use_empty()) { + uint16_t RAttrs = CallerPAL->getParamAttrs(0); + if (RAttrs & ParamAttr::typeIncompatible(FT->getReturnType())) + return false; // Attribute not compatible with transformed value. + } // If the callsite is an invoke instruction, and the return value is used by // a PHI node in a successor, we cannot change the return type of the call @@ -8127,9 +8128,11 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { if (!CastInst::isCastable(ActTy, ParamTy)) return false; // Cannot transform this parameter value. - if (CallerPAL && - ParamAttr::incompatibleWithType(ParamTy, CallerPAL->getParamAttrs(i+1))) - return false; // Attribute not compatible with transformed value. + if (CallerPAL) { + uint16_t PAttrs = CallerPAL->getParamAttrs(i + 1); + if (PAttrs & ParamAttr::typeIncompatible(ParamTy)) + return false; // Attribute not compatible with transformed value. + } ConstantInt *c = dyn_cast<ConstantInt>(*AI); // Some conversions are safe even if we do not have a body. @@ -8168,7 +8171,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { // If the return value is not being used, the type may not be compatible // with the existing attributes. Wipe out any problematic attributes. - RAttrs &= ~ParamAttr::incompatibleWithType(FT->getReturnType(), RAttrs); + RAttrs &= ~ParamAttr::typeIncompatible(FT->getReturnType()); // Add the new return attributes. if (RAttrs) |
