Skip to content

Commit 1ec1c0e

Browse files
committed
Remove all comments related to 'insertion points' in ARCSequenceOpts
Historically ARC code motion was also part of ARCSequenceOpts. Remove some stale comments regarding 'insertion points'
1 parent 21b91cd commit 1ec1c0e

File tree

4 files changed

+6
-24
lines changed

4 files changed

+6
-24
lines changed

lib/SILOptimizer/ARC/ARCMatchingSet.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ ARCMatchingSetBuilder::matchIncrementsToDecrements() {
6868
continue;
6969
}
7070

71-
// We need to be known safe over all increments/decrements we are matching
72-
// up to ignore insertion points.
7371
bool BUIsKnownSafe = (*BURefCountState)->second.isKnownSafe();
7472
LLVM_DEBUG(llvm::dbgs() << " BOTTOM UP KNOWNSAFE: "
7573
<< (BUIsKnownSafe ? "true" : "false") << "\n");
@@ -152,8 +150,6 @@ ARCMatchingSetBuilder::matchDecrementsToIncrements() {
152150
continue;
153151
}
154152

155-
// We need to be known safe over all increments/decrements we are matching
156-
// up to ignore insertion points.
157153
bool TDIsKnownSafe = (*TDRefCountState)->second.isKnownSafe();
158154
LLVM_DEBUG(llvm::dbgs() << " TOP DOWN KNOWNSAFE: "
159155
<< (TDIsKnownSafe ? "true" : "false") << "\n");
@@ -223,7 +219,7 @@ bool ARCMatchingSetBuilder::matchUpIncDecSetsForPtr() {
223219
LLVM_DEBUG(llvm::dbgs() << "Attempting to match up increments -> "
224220
"decrements:\n");
225221
// For each increment in our list of new increments, attempt to match them
226-
// up with decrements and gather the insertion points of the decrements.
222+
// up with decrements.
227223
auto Result = matchIncrementsToDecrements();
228224
if (!Result) {
229225
LLVM_DEBUG(llvm::dbgs() << " FAILED TO MATCH INCREMENTS -> "
@@ -287,8 +283,6 @@ bool ARCMatchingSetBuilder::matchUpIncDecSetsForPtr() {
287283
assert(MatchSet.Increments.empty() == MatchSet.Decrements.empty() &&
288284
"Match set without increments or decrements");
289285

290-
// If we do not have any insertion points but we do have increments, we must
291-
// be eliminating pairs.
292286
if (!MatchSet.Increments.empty())
293287
MatchedPair = true;
294288

lib/SILOptimizer/ARC/ARCRegionState.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static bool isARCSignificantTerminator(TermInst *TI) {
188188

189189
// Visit each one of our predecessor regions and see if any are blocks that can
190190
// use reference counted values. If any of them do, we advance the sequence for
191-
// the pointer and create an insertion point here. This state will be propagated
191+
// the pointer. This state will be propagated
192192
// into all of our predecessors, allowing us to be conservatively correct in all
193193
// cases.
194194
//
@@ -305,9 +305,8 @@ bool ARCRegionState::processBlockBottomUp(
305305

306306
// Now visit each one of our predecessor regions and see if any are blocks
307307
// that can use reference counted values. If any of them do, we advance the
308-
// sequence for the pointer and create an insertion point here. This state
309-
// will be propagated into all of our predecessors, allowing us to be
310-
// conservatively correct in all cases.
308+
// sequence for the pointer. This state will be propagated into all of our
309+
// predecessors, allowing us to be conservatively correct in all cases.
311310
processBlockBottomUpPredTerminators(R, AA, LRFI, SetFactory);
312311

313312
return NestingDetected;

lib/SILOptimizer/ARC/ARCSequenceOpts.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ llvm::cl::opt<bool> EnableLoopARC("enable-loop-arc", llvm::cl::init(false));
4545
// Code Motion
4646
//===----------------------------------------------------------------------===//
4747

48-
// This routine takes in the ARCMatchingSet \p MatchSet and inserts new
49-
// increments, decrements at the insertion points and adds the old increment,
50-
// decrements to the delete list. Sets changed to true if anything was moved or
51-
// deleted.
48+
// This routine takes in the ARCMatchingSet \p MatchSet and adds the increments
49+
// and decrements to the delete list.
5250
void ARCPairingContext::optimizeMatchingSet(
5351
ARCMatchingSet &MatchSet, llvm::SmallVectorImpl<SILInstruction *> &NewInsts,
5452
llvm::SmallVectorImpl<SILInstruction *> &DeadInsts) {
@@ -99,9 +97,6 @@ bool ARCPairingContext::performMatching(
9997
for (auto *I : Set.Decrements)
10098
DecToIncStateMap.erase(I);
10199

102-
// Add the Set to the callback. *NOTE* No instruction destruction can
103-
// happen here since we may remove instructions that are insertion points
104-
// for other instructions.
105100
optimizeMatchingSet(Set, NewInsts, DeadInsts);
106101
}
107102
}

lib/SILOptimizer/ARC/RefCountState.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,11 @@ bool BottomUpRefCountState::handleGuaranteedUser(
241241

242242
// Advance the sequence...
243243
switch (LatState) {
244-
// If were decremented, insert the insertion point.
245244
case LatticeState::Decremented: {
246245
LatState = LatticeState::MightBeDecremented;
247246
return true;
248247
}
249248
case LatticeState::MightBeUsed:
250-
// If we have a might be used, we already created an insertion point
251-
// earlier. Just move to MightBeDecremented.
252249
LatState = LatticeState::MightBeDecremented;
253250
return true;
254251
case LatticeState::MightBeDecremented:
@@ -705,14 +702,11 @@ bool TopDownRefCountState::handleGuaranteedUser(
705702
"Must be able to be used at this point of the lattice.");
706703
// Advance the sequence...
707704
switch (LatState) {
708-
// If were decremented, insert the insertion point.
709705
case LatticeState::Incremented: {
710706
LatState = LatticeState::MightBeUsed;
711707
return true;
712708
}
713709
case LatticeState::MightBeDecremented:
714-
// If we have a might be used, we already created an insertion point
715-
// earlier. Just move to MightBeDecremented.
716710
LatState = LatticeState::MightBeUsed;
717711
return true;
718712
case LatticeState::MightBeUsed:

0 commit comments

Comments
 (0)