Rename SILCloner doPostProcess and foldValue to recordClonedInstruction and recordFoldedValue.

This commit is contained in:
Andrew Trick
2018-10-10 18:01:12 -07:00
parent c781d78782
commit 9e440d13a6
5 changed files with 690 additions and 734 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -135,7 +135,8 @@ public:
using SILClonerWithScopes<ImplClass>::getTypeInClonedContext;
using SILClonerWithScopes<ImplClass>::getOpType;
using SILClonerWithScopes<ImplClass>::getOpBasicBlock;
using SILClonerWithScopes<ImplClass>::doPostProcess;
using SILClonerWithScopes<ImplClass>::recordClonedInstruction;
using SILClonerWithScopes<ImplClass>::recordFoldedValue;
using SILClonerWithScopes<ImplClass>::addBlockWithUnreachable;
using SILClonerWithScopes<ImplClass>::OpenedArchetypesTracker;
@@ -192,7 +193,7 @@ protected:
Helper.getArguments(), Inst->isNonThrowing(),
GenericSpecializationInformation::create(
Inst, getBuilder()));
doPostProcess(Inst, N);
recordClonedInstruction(Inst, N);
}
void visitTryApplyInst(TryApplyInst *Inst) {
@@ -204,7 +205,7 @@ protected:
getOpBasicBlock(Inst->getErrorBB()),
GenericSpecializationInformation::create(
Inst, getBuilder()));
doPostProcess(Inst, N);
recordClonedInstruction(Inst, N);
}
void visitPartialApplyInst(PartialApplyInst *Inst) {
@@ -216,7 +217,7 @@ protected:
Helper.getSubstitutions(), Helper.getArguments(), ParamConvention,
GenericSpecializationInformation::create(
Inst, getBuilder()));
doPostProcess(Inst, N);
recordClonedInstruction(Inst, N);
}
/// Attempt to simplify a conditional checked cast.
@@ -257,7 +258,7 @@ protected:
// there is no need for an upcast and we can just use the operand.
if (getOpType(Upcast->getType()) ==
getOpValue(Upcast->getOperand())->getType()) {
super::foldValue(SILValue(Upcast), getOpValue(Upcast->getOperand()));
recordFoldedValue(SILValue(Upcast), getOpValue(Upcast->getOperand()));
return;
}
super::visitUpcastInst(Upcast);
@@ -267,7 +268,7 @@ protected:
// If the substituted type is trivial, ignore the copy.
SILType copyTy = getOpType(Copy->getType());
if (copyTy.isTrivial(Copy->getModule())) {
super::foldValue(SILValue(Copy), getOpValue(Copy->getOperand()));
recordFoldedValue(SILValue(Copy), getOpValue(Copy->getOperand()));
return;
}
super::visitCopyValueInst(Copy);

View File

@@ -376,10 +376,10 @@ public:
auto *BlockArg = DestBB->createPhiArgument(
DestPHIArg->getType(), DestPHIArg->getOwnershipKind());
// Since we don't call any CFG cloning entry point, we can call
// `foldValue` immediately as if cloning has already started. This simply
// avoids handling AvailVals during `remap` or defining a custom
// `recordFoldedValue` immediately as if cloning has already started. This
// simply avoids handling AvailVals during `remap` or defining a custom
// visitSILPhiArgument().
foldValue(DestPHIArg, BlockArg);
recordFoldedValue(DestPHIArg, BlockArg);
AvailVals.push_back(std::make_pair(DestPHIArg, BlockArg));
}
@@ -426,10 +426,10 @@ class BasicBlockCloner : public BaseThreadingCloner {
// replaced with the BBArgs of the DestBB.
for (unsigned i = 0, e = FromBB->args_size(); i != e; ++i) {
// Since we don't call any CFG cloning entry point, we can call
// `foldValue` immediately as if cloning has already started. This
// simply avoids handling AvailVals during `remap` or defining a custom
// visitSILPhiArgument().
foldValue(FromBB->getArgument(i), DestBB->getArgument(i));
// `recordFoldedValue` immediately as if cloning has already
// started. This simply avoids handling AvailVals during `remap` or
// defining a custom visitSILPhiArgument().
recordFoldedValue(FromBB->getArgument(i), DestBB->getArgument(i));
AvailVals.push_back(
std::make_pair(FromBB->getArgument(i), DestBB->getArgument(i)));
}

View File

@@ -643,7 +643,7 @@ void ClosureCloner::visitLoadBorrowInst(LoadBorrowInst *LI) {
// We assume that the value is already guaranteed.
assert(Val.getOwnershipKind().isTrivialOr(ValueOwnershipKind::Guaranteed) &&
"Expected argument value to be guaranteed");
foldValue(LI, Val);
recordFoldedValue(LI, Val);
return;
}
@@ -668,7 +668,7 @@ void ClosureCloner::visitLoadInst(LoadInst *LI) {
&& LI->getOwnershipQualifier() == LoadOwnershipQualifier::Copy) {
Val = getBuilder().createCopyValue(LI->getLoc(), Val);
}
foldValue(LI, Val);
recordFoldedValue(LI, Val);
return;
}
@@ -694,7 +694,7 @@ void ClosureCloner::visitLoadInst(LoadInst *LI) {
&& LI->getOwnershipQualifier() == LoadOwnershipQualifier::Copy) {
Val = getBuilder().createCopyValue(LI->getLoc(), Val);
}
foldValue(LI, Val);
recordFoldedValue(LI, Val);
return;
}
SILCloner<ClosureCloner>::visitLoadInst(LI);

View File

@@ -726,7 +726,7 @@ void PromotedParamCloner::visitProjectBoxInst(ProjectBoxInst *Inst) {
// Its uses will be replaced by the promoted address.
if (OrigPromotedParameters.count(Inst->getOperand())) {
auto *origArg = cast<SILFunctionArgument>(Inst->getOperand());
foldValue(Inst, NewPromotedArgs[origArg->getIndex()]);
recordFoldedValue(Inst, NewPromotedArgs[origArg->getIndex()]);
return;
}