The transform that tries to turn calls to bitcast functions into

direct calls bails out unless caller and callee have essentially
equivalent parameter attributes.  This is illogical - the callee's
attributes should be of no relevance here.  Rework the logic, which
incidentally fixes a crash when removed arguments have attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands
2008-01-06 18:27:01 +00:00
parent a9d0c9dc58
commit ad9a9e1559
6 changed files with 97 additions and 90 deletions

View File

@@ -418,22 +418,10 @@ void Verifier::VerifyParamAttrs(const FunctionType *FT,
Attrs->getParamAttrsText(MutI) + "are incompatible!", V);
}
uint16_t IType = Attr & ParamAttr::IntegerTypeOnly;
Assert1(!IType || FT->getParamType(Idx-1)->isInteger(),
"Attribute " + Attrs->getParamAttrsText(IType) +
"should only apply to Integer type!", V);
uint16_t PType = Attr & ParamAttr::PointerTypeOnly;
Assert1(!PType || isa<PointerType>(FT->getParamType(Idx-1)),
"Attribute " + Attrs->getParamAttrsText(PType) +
"should only apply to Pointer type!", V);
if (Attr & ParamAttr::ByVal) {
const PointerType *Ty =
dyn_cast<PointerType>(FT->getParamType(Idx-1));
Assert1(!Ty || isa<StructType>(Ty->getElementType()),
"Attribute byval should only apply to pointer to structs!", V);
}
uint16_t IType = ParamAttr::incompatibleWithType(FT->getParamType(Idx-1),
Attr);
Assert1(!IType, "Wrong type for attribute " +
Attrs->getParamAttrsText(IType), V);
if (Attr & ParamAttr::Nest) {
Assert1(!SawNest, "More than one parameter has attribute nest!", V);