Serialization: Don't serialize contextual enum argument type

Storing this separately is unnecessary since we already
serialize the enum element's interface type. Also, this
eliminates one of the few remaining cases where we serialize
archetypes during AST serialization.
This commit is contained in:
Slava Pestov
2017-01-29 23:53:39 -08:00
parent 00bceec613
commit dca292c652
33 changed files with 102 additions and 97 deletions

View File

@@ -49,7 +49,7 @@ namespace {
static void createRefCountOpForPayload(SILBuilder &Builder, SILInstruction *I,
EnumElementDecl *EnumDecl,
SILValue DefOfEnum = SILValue()) {
assert(EnumDecl->hasArgumentType() &&
assert(EnumDecl->getArgumentInterfaceType() &&
"We assume enumdecl has an argument type");
SILModule &Mod = I->getModule();
@@ -753,7 +753,7 @@ static bool tryToSinkRefCountAcrossSwitch(SwitchEnumInst *Switch,
EnumElementDecl *Enum = Case.first;
SILBasicBlock *Succ = Case.second;
Builder.setInsertionPoint(&*Succ->begin());
if (Enum->hasArgumentType())
if (Enum->getArgumentInterfaceType())
createRefCountOpForPayload(Builder, &*RV, Enum, Switch->getOperand());
}
@@ -839,7 +839,7 @@ static bool tryToSinkRefCountAcrossSelectEnum(CondBranchInst *CondBr,
EnumElementDecl *Enum = Elts[i];
SILBasicBlock *Succ = i == 0 ? CondBr->getTrueBB() : CondBr->getFalseBB();
Builder.setInsertionPoint(&*Succ->begin());
if (Enum->hasArgumentType())
if (Enum->getArgumentInterfaceType())
createRefCountOpForPayload(Builder, &*I, Enum, SEI->getEnumOperand());
}
@@ -1302,7 +1302,7 @@ bool BBEnumTagDataflowState::visitRetainValueInst(RetainValueInst *RVI) {
return false;
// If we do not have any argument, kill the retain_value.
if (!(*FindResult)->second->hasArgumentType()) {
if (!(*FindResult)->second->getArgumentInterfaceType()) {
RVI->eraseFromParent();
return true;
}
@@ -1322,7 +1322,7 @@ bool BBEnumTagDataflowState::visitReleaseValueInst(ReleaseValueInst *RVI) {
return false;
// If we do not have any argument, just delete the release value.
if (!(*FindResult)->second->hasArgumentType()) {
if (!(*FindResult)->second->getArgumentInterfaceType()) {
RVI->eraseFromParent();
return true;
}
@@ -1413,7 +1413,7 @@ BBEnumTagDataflowState::hoistDecrementsIntoSwitchRegions(AliasAnalysis *AA) {
for (auto P : EnumBBCaseList) {
// If we don't have an argument for this case, there is nothing to
// do... continue...
if (!P.second->hasArgumentType())
if (!P.second->getArgumentInterfaceType())
continue;
// Otherwise create the release_value before the terminator of the
@@ -1478,7 +1478,7 @@ findRetainsSinkableFromSwitchRegionForEnum(
// If the case does not have an argument type, skip the predecessor since
// there will not be a retain to sink.
if (!Decl->hasArgumentType())
if (!Decl->getArgumentInterfaceType())
continue;
// Ok, we found a payloaded predecessor. Look backwards through the