Skip to content

Commit cda4eba

Browse files
committed
[rbi] Rename functionArgPartition -> initialEntryBlockPartition.
While bringing up @rjmccall on rbi, our discussions showed that the name functionArgPartition was misleading to someone who hadn't worked on the pass before. It became clear that initialEntryBlockPartition would be a better name that would make it clearer/easy to understand.
1 parent 4b5d519 commit cda4eba

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

lib/SILOptimizer/Analysis/RegionAnalysis.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,8 +1917,11 @@ class PartitionOpTranslator {
19171917

19181918
SILFunction *function;
19191919

1920-
/// A cache of argument IDs.
1921-
std::optional<Partition> functionArgPartition;
1920+
/// The initial partition of the entry block.
1921+
///
1922+
/// This contains a single region for non-sending parameters as well as
1923+
/// separate regions for each sending parameter.
1924+
std::optional<Partition> initialEntryBlockPartition;
19221925

19231926
/// A builder struct that we use to convert individual instructions into lists
19241927
/// of PartitionOps.
@@ -1983,7 +1986,7 @@ class PartitionOpTranslator {
19831986
PartitionOpTranslator(SILFunction *function, PostOrderFunctionInfo *pofi,
19841987
RegionAnalysisValueMap &valueMap,
19851988
IsolationHistory::Factory &historyFactory)
1986-
: function(function), functionArgPartition(), builder(),
1989+
: function(function), initialEntryBlockPartition(), builder(),
19871990
partialApplyReachabilityDataflow(function, valueMap, pofi),
19881991
valueMap(valueMap) {
19891992
builder.translator = this;
@@ -2006,8 +2009,8 @@ class PartitionOpTranslator {
20062009
auto functionArguments = function->getArguments();
20072010
if (functionArguments.empty()) {
20082011
REGIONBASEDISOLATION_LOG(llvm::dbgs() << " None.\n");
2009-
functionArgPartition = Partition::singleRegion(SILLocation::invalid(), {},
2010-
historyFactory.get());
2012+
initialEntryBlockPartition = Partition::singleRegion(
2013+
SILLocation::invalid(), {}, historyFactory.get());
20112014
return;
20122015
}
20132016

@@ -2044,10 +2047,10 @@ class PartitionOpTranslator {
20442047
}
20452048
}
20462049

2047-
functionArgPartition = Partition::singleRegion(
2050+
initialEntryBlockPartition = Partition::singleRegion(
20482051
SILLocation::invalid(), nonSendableJoinedIndices, historyFactory.get());
20492052
for (Element elt : nonSendableSeparateIndices) {
2050-
functionArgPartition->trackNewElement(elt);
2053+
initialEntryBlockPartition->trackNewElement(elt);
20512054
}
20522055
}
20532056

@@ -2116,8 +2119,10 @@ class PartitionOpTranslator {
21162119
public:
21172120
/// Return the partition consisting of all function arguments.
21182121
///
2119-
/// Used to initialize the entry blocko of our analysis.
2120-
const Partition &getEntryPartition() const { return *functionArgPartition; }
2122+
/// Used to initialize the initial partition of the entry block of the CFG.
2123+
const Partition &getInitialEntryPartition() const {
2124+
return *initialEntryBlockPartition;
2125+
}
21212126

21222127
/// Get the results of an apply instruction.
21232128
///
@@ -4139,7 +4144,7 @@ RegionAnalysisFunctionInfo::RegionAnalysisFunctionInfo(
41394144
}
41404145
// Set our entry partition to have the "entry partition".
41414146
(*blockStates)[fn->getEntryBlock()].entryPartition =
4142-
translator->getEntryPartition();
4147+
translator->getInitialEntryPartition();
41434148
runDataflow();
41444149
}
41454150

0 commit comments

Comments
 (0)