diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 19 |
2 files changed, 13 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index 8e6a3b91c1f..3550d713525 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -505,7 +505,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { const Type *RetTy = FTy->getReturnType(); if (DeadRetVal.count(F)) { RetTy = Type::VoidTy; - RAttrs &= ~ParamAttr::incompatibleWithType(RetTy, RAttrs); + RAttrs &= ~ParamAttr::typeIncompatible(RetTy); DeadRetVal.erase(F); } @@ -561,7 +561,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { // The call return attributes. uint16_t RAttrs = PAL ? PAL->getParamAttrs(0) : 0; // Adjust in case the function was changed to return void. - RAttrs &= ~ParamAttr::incompatibleWithType(NF->getReturnType(), RAttrs); + RAttrs &= ~ParamAttr::typeIncompatible(NF->getReturnType()); if (RAttrs) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs)); diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 3d37bcd5890..19f86f9b9c4 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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) |

