mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SILOptimizer] Preserve arg attrs at cloning.
Arguments are copied into new cloned functions in a number of places. Wherever that happens, be sure to transfer the attributes as well.
This commit is contained in:
@@ -799,6 +799,10 @@ PromotedParamCloner::populateCloned() {
|
||||
Cloned->getModule().Types, 0);
|
||||
auto *promotedArg =
|
||||
ClonedEntryBB->createFunctionArgument(promotedTy, (*I)->getDecl());
|
||||
promotedArg->setNoImplicitCopy(
|
||||
cast<SILFunctionArgument>(*I)->isNoImplicitCopy());
|
||||
promotedArg->setLifetimeAnnotation(
|
||||
cast<SILFunctionArgument>(*I)->getLifetimeAnnotation());
|
||||
OrigPromotedParameters.insert(*I);
|
||||
|
||||
NewPromotedArgs[ArgNo] = promotedArg;
|
||||
@@ -811,8 +815,13 @@ PromotedParamCloner::populateCloned() {
|
||||
entryArgs.push_back(SILValue());
|
||||
} else {
|
||||
// Create a new argument which copies the original argument.
|
||||
entryArgs.push_back(ClonedEntryBB->createFunctionArgument(
|
||||
(*I)->getType(), (*I)->getDecl()));
|
||||
auto *newArg = ClonedEntryBB->createFunctionArgument((*I)->getType(),
|
||||
(*I)->getDecl());
|
||||
newArg->setNoImplicitCopy(
|
||||
cast<SILFunctionArgument>(*I)->isNoImplicitCopy());
|
||||
newArg->setLifetimeAnnotation(
|
||||
cast<SILFunctionArgument>(*I)->getLifetimeAnnotation());
|
||||
entryArgs.push_back(newArg);
|
||||
}
|
||||
++ArgNo;
|
||||
++I;
|
||||
|
||||
Reference in New Issue
Block a user