Enable RLE on OSSA

This commit is contained in:
Meghana Gupta
2021-01-04 17:39:15 -08:00
parent 2384678cf3
commit 66ef200105
10 changed files with 3244 additions and 46 deletions

View File

@@ -38,9 +38,9 @@ void LSValue::expand(SILValue Base, SILModule *M, TypeExpansionContext context,
}
}
void
LSValue::reduceInner(LSLocation &Base, SILModule *M, LSLocationValueMap &Values,
SILInstruction *InsertPt) {
void LSValue::reduceInner(LSLocation &Base, SILModule *M,
LSLocationValueMap &Values, SILInstruction *InsertPt,
JointPostDominanceSetComputer *jointPostDomComputer) {
TypeExpansionContext context(*InsertPt->getFunction());
// If this is a class reference type, we have reached end of the type tree.
@@ -60,7 +60,7 @@ LSValue::reduceInner(LSLocation &Base, SILModule *M, LSLocationValueMap &Values,
// This is not a leaf node, reduce the next level node one by one.
for (auto &X : NextLevel) {
LSValue::reduceInner(X, M, Values, InsertPt);
LSValue::reduceInner(X, M, Values, InsertPt, jointPostDomComputer);
}
// This is NOT a leaf node, we need to construct a value for it.
@@ -109,7 +109,7 @@ LSValue::reduceInner(LSLocation &Base, SILModule *M, LSLocationValueMap &Values,
//
llvm::SmallVector<SILValue, 8> Vals;
for (auto &X : NextLevel) {
Vals.push_back(Values[X].materialize(InsertPt));
Vals.push_back(Values[X].materialize(InsertPt, jointPostDomComputer));
}
SILBuilder Builder(InsertPt);
Builder.setCurrentDebugScope(InsertPt->getFunction()->getDebugScope());
@@ -120,21 +120,23 @@ LSValue::reduceInner(LSLocation &Base, SILModule *M, LSLocationValueMap &Values,
Builder, RegularLocation::getAutoGeneratedLocation(),
Base.getType(M, context).getObjectType(), Vals);
auto AvailVal = makeNewValueAvailable(AI.get(), InsertPt->getParentBlock(),
jointPostDomComputer);
// This is the Value for the current base.
ProjectionPath P(Base.getType(M, context));
Values[Base] = LSValue(SILValue(AI.get()), P);
Values[Base] = LSValue(AvailVal, P);
removeLSLocations(Values, NextLevel);
}
SILValue
LSValue::reduce(LSLocation &Base, SILModule *M, LSLocationValueMap &Values,
SILInstruction *InsertPt) {
LSValue::reduceInner(Base, M, Values, InsertPt);
SILValue LSValue::reduce(LSLocation &Base, SILModule *M,
LSLocationValueMap &Values, SILInstruction *InsertPt,
JointPostDominanceSetComputer *jointPostDomComputer) {
LSValue::reduceInner(Base, M, Values, InsertPt, jointPostDomComputer);
// Finally materialize and return the forwarding SILValue.
return Values.begin()->second.materialize(InsertPt);
return Values.begin()->second.materialize(InsertPt, jointPostDomComputer);
}
//===----------------------------------------------------------------------===//
// LSLocation
//===----------------------------------------------------------------------===//