[IR][AutoUpgrade] Drop alignment from non-pointer parameters and returns
This is a follow-up of D102201. After some discussion, it is a better idea to upgrade all invalid uses of alignment attributes on function return values and parameters, not just limited to void function return types. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D102726
This commit is contained in:
@@ -5629,10 +5629,15 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove align from return attribute on CallInst.
|
||||
if (auto *CI = dyn_cast<CallInst>(&I)) {
|
||||
if (CI->getFunctionType()->getReturnType()->isVoidTy())
|
||||
CI->removeAttribute(0, Attribute::Alignment);
|
||||
// Remove incompatible attributes on function calls.
|
||||
if (auto *CI = dyn_cast<CallBase>(&I)) {
|
||||
CI->removeAttributes(AttributeList::ReturnIndex,
|
||||
AttributeFuncs::typeIncompatible(
|
||||
CI->getFunctionType()->getReturnType()));
|
||||
|
||||
for (unsigned ArgNo = 0; ArgNo < CI->arg_size(); ++ArgNo)
|
||||
CI->removeParamAttrs(ArgNo, AttributeFuncs::typeIncompatible(
|
||||
CI->getArgOperand(ArgNo)->getType()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user