[gardening] Always create new SILArguments using SILBasicBlock::createArgument instead of inline placement new.

The reasoning here is the same as in e42bf07.
This commit is contained in:
Michael Gottesman
2016-11-25 00:58:49 -06:00
parent a998d98924
commit 0a8c54d04f
33 changed files with 97 additions and 132 deletions

View File

@@ -585,7 +585,6 @@ PromotedParamCloner::initCloned(SILFunction *Orig, IsFragile_t Fragile,
void
PromotedParamCloner::populateCloned() {
SILFunction *Cloned = getCloned();
SILModule &M = Cloned->getModule();
// Create arguments for the entry block
SILBasicBlock *OrigEntryBB = &*Orig->begin();
@@ -597,8 +596,8 @@ PromotedParamCloner::populateCloned() {
// Create a new argument with the promoted type.
auto promotedTy = (*I)->getType().castTo<SILBoxType>()
->getBoxedAddressType();
auto promotedArg = new (M)
SILArgument(ClonedEntryBB, promotedTy, (*I)->getDecl());
auto *promotedArg =
ClonedEntryBB->createArgument(promotedTy, (*I)->getDecl());
PromotedParameters.insert(*I);
// Map any projections of the box to the promoted argument.
@@ -611,7 +610,7 @@ PromotedParamCloner::populateCloned() {
} else {
// Create a new argument which copies the original argument.
SILValue MappedValue =
new (M) SILArgument(ClonedEntryBB, (*I)->getType(), (*I)->getDecl());
ClonedEntryBB->createArgument((*I)->getType(), (*I)->getDecl());
ValueMap.insert(std::make_pair(*I, MappedValue));
}
++ArgNo;