Skip to content

Commit ce669ca

Browse files
committed
ARCSequenceOpts: Remove unused args in several functions
1 parent fe6d456 commit ce669ca

File tree

4 files changed

+47
-89
lines changed

4 files changed

+47
-89
lines changed

lib/SILOptimizer/ARC/ARCRegionState.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static bool processBlockBottomUpInsts(
208208
if (Op && OtherState->first == Op)
209209
continue;
210210

211-
OtherState->second.updateForSameLoopInst(I, SetFactory, AA);
211+
OtherState->second.updateForSameLoopInst(I, AA);
212212
}
213213
}
214214

@@ -275,7 +275,7 @@ bool ARCRegionState::processLoopBottomUp(
275275
continue;
276276

277277
for (auto *I : State->getSummarizedInterestingInsts())
278-
OtherState->second.updateForDifferentLoopInst(I, SetFactory, AA);
278+
OtherState->second.updateForDifferentLoopInst(I, AA);
279279
}
280280

281281
return false;
@@ -361,7 +361,7 @@ bool ARCRegionState::processBlockTopDown(
361361
if (Op && OtherState->first == Op)
362362
continue;
363363

364-
OtherState->second.updateForSameLoopInst(I, SetFactory, AA);
364+
OtherState->second.updateForSameLoopInst(I, AA);
365365
}
366366
}
367367

@@ -394,7 +394,7 @@ bool ARCRegionState::processLoopTopDown(
394394
continue;
395395

396396
for (auto *I : State->getSummarizedInterestingInsts())
397-
OtherState->second.updateForDifferentLoopInst(I, SetFactory, AA);
397+
OtherState->second.updateForDifferentLoopInst(I, AA);
398398
}
399399

400400
return false;

lib/SILOptimizer/ARC/GlobalARCSequenceDataflow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ bool ARCSequenceDataflowEvaluator::processBBTopDown(ARCBBState &BBState) {
108108
if (Op && OtherState->first == Op)
109109
continue;
110110

111-
OtherState->second.updateForSameLoopInst(&I, SetFactory, AA);
111+
OtherState->second.updateForSameLoopInst(&I, AA);
112112
}
113113
}
114114

@@ -260,7 +260,7 @@ bool ARCSequenceDataflowEvaluator::processBBBottomUp(
260260
if (Op && OtherState->first == Op)
261261
continue;
262262

263-
OtherState->second.updateForSameLoopInst(&I, SetFactory, AA);
263+
OtherState->second.updateForSameLoopInst(&I, AA);
264264
}
265265
}
266266

lib/SILOptimizer/ARC/RefCountState.cpp

Lines changed: 34 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ bool BottomUpRefCountState::valueCanBeUsedGivenLatticeState() const {
195195

196196
/// Given the current lattice state, if we have seen a use, advance the
197197
/// lattice state. Return true if we do so and false otherwise.
198-
bool BottomUpRefCountState::handleUser(
199-
SILValue RCIdentity,
200-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
198+
bool BottomUpRefCountState::handleUser() {
201199
assert(valueCanBeUsedGivenLatticeState() &&
202200
"Must be able to be used at this point of the lattice.");
203201

@@ -233,9 +231,7 @@ valueCanBeGuaranteedUsedGivenLatticeState() const {
233231

234232
/// Given the current lattice state, if we have seen a use, advance the
235233
/// lattice state. Return true if we do so and false otherwise.
236-
bool BottomUpRefCountState::handleGuaranteedUser(
237-
SILValue RCIdentity,
238-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
234+
bool BottomUpRefCountState::handleGuaranteedUser() {
239235
assert(valueCanBeGuaranteedUsedGivenLatticeState() &&
240236
"Must be able to be used at this point of the lattice.");
241237

@@ -270,14 +266,12 @@ bool BottomUpRefCountState::isRefCountInstMatchedToTrackedInstruction(
270266
if (!Transition.matchingInst(RefCountInst))
271267
return false;
272268

273-
return handleRefCountInstMatch(RefCountInst);
269+
return handleRefCountInstMatch();
274270
}
275271

276272
/// We have a matching ref count inst. Return true if we advance the sequence
277273
/// and false otherwise.
278-
bool
279-
BottomUpRefCountState::
280-
handleRefCountInstMatch(SILInstruction *RefCountInst) {
274+
bool BottomUpRefCountState::handleRefCountInstMatch() {
281275
// Otherwise modify the state appropriately in preparation for removing the
282276
// increment, decrement pair.
283277
switch (LatState) {
@@ -340,8 +334,7 @@ bool BottomUpRefCountState::merge(const BottomUpRefCountState &Other) {
340334
// the value we are tracking. If so advance the state's sequence appropriately
341335
// and return true. Otherwise return false.
342336
bool BottomUpRefCountState::handlePotentialGuaranteedUser(
343-
SILInstruction *PotentialGuaranteedUser,
344-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
337+
SILInstruction *PotentialGuaranteedUser, AliasAnalysis *AA) {
345338
// If we are not tracking a ref count, just return false.
346339
if (!isTrackingRefCount())
347340
return false;
@@ -375,7 +368,7 @@ bool BottomUpRefCountState::handlePotentialGuaranteedUser(
375368
FoundNonARCUser = true;
376369

377370
// Otherwise, update the ref count state given the guaranteed user.
378-
return handleGuaranteedUser(getRCRoot(), SetFactory, AA);
371+
return handleGuaranteedUser();
379372
}
380373

381374
/// Check if PotentialDecrement can decrement the reference count associated
@@ -408,9 +401,8 @@ bool BottomUpRefCountState::handlePotentialDecrement(
408401
// Check if PotentialUser could be a use of the reference counted value that
409402
// requires user to be alive. If so advance the state's sequence
410403
// appropriately and return true. Otherwise return false.
411-
bool BottomUpRefCountState::handlePotentialUser(
412-
SILInstruction *PotentialUser,
413-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
404+
bool BottomUpRefCountState::handlePotentialUser(SILInstruction *PotentialUser,
405+
AliasAnalysis *AA) {
414406

415407
// If we are not tracking a ref count, just return false.
416408
if (!isTrackingRefCount())
@@ -434,12 +426,11 @@ bool BottomUpRefCountState::handlePotentialUser(
434426
if (mustUseValue(PotentialUser, getRCRoot(), AA))
435427
FoundNonARCUser = true;
436428

437-
return handleUser(getRCRoot(), SetFactory, AA);
429+
return handleUser();
438430
}
439431

440-
void BottomUpRefCountState::updateForSameLoopInst(
441-
SILInstruction *I,
442-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
432+
void BottomUpRefCountState::updateForSameLoopInst(SILInstruction *I,
433+
AliasAnalysis *AA) {
443434
// If this state is not tracking anything, there is nothing to update.
444435
if (!isTrackingRefCount())
445436
return;
@@ -448,7 +439,7 @@ void BottomUpRefCountState::updateForSameLoopInst(
448439
// instruction in a way that requires us to guarantee the lifetime of the
449440
// pointer up to this point. This has the effect of performing a use and a
450441
// decrement.
451-
if (handlePotentialGuaranteedUser(I, SetFactory, AA)) {
442+
if (handlePotentialGuaranteedUser(I, AA)) {
452443
LLVM_DEBUG(llvm::dbgs() << " Found Potential Guaranteed Use:\n "
453444
<< getRCRoot());
454445
return;
@@ -465,15 +456,14 @@ void BottomUpRefCountState::updateForSameLoopInst(
465456

466457
// Otherwise check if the reference counted value we are tracking
467458
// could be used by the given instruction.
468-
if (!handlePotentialUser(I, SetFactory, AA))
459+
if (!handlePotentialUser(I, AA))
469460
return;
470461
LLVM_DEBUG(llvm::dbgs() << " Found Potential Use:\n "
471462
<< getRCRoot());
472463
}
473464

474-
void BottomUpRefCountState::updateForDifferentLoopInst(
475-
SILInstruction *I,
476-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
465+
void BottomUpRefCountState::updateForDifferentLoopInst(SILInstruction *I,
466+
AliasAnalysis *AA) {
477467
// If we are not tracking anything, bail.
478468
if (!isTrackingRefCount())
479469
return;
@@ -483,15 +473,15 @@ void BottomUpRefCountState::updateForDifferentLoopInst(
483473
mayDecrementRefCount(I, getRCRoot(), AA)) {
484474
LLVM_DEBUG(llvm::dbgs() << " Found potential guaranteed use:\n "
485475
<< getRCRoot());
486-
handleGuaranteedUser(getRCRoot(), SetFactory, AA);
476+
handleGuaranteedUser();
487477
return;
488478
}
489479
}
490480

491481
// We can just handle potential users normally, since if we handle the user we
492482
// already saw a decrement implying that we will treat this like a guaranteed
493483
// use.
494-
if (!handlePotentialUser(I, SetFactory, AA))
484+
if (!handlePotentialUser(I, AA))
495485
return;
496486
LLVM_DEBUG(llvm::dbgs() << " Found Potential Use:\n "
497487
<< getRCRoot());
@@ -585,9 +575,7 @@ bool TopDownRefCountState::valueCanBeDecrementedGivenLatticeState() const {
585575

586576
/// If advance the state's sequence appropriately for a decrement. If we do
587577
/// advance return true. Otherwise return false.
588-
bool TopDownRefCountState::handleDecrement(
589-
SILInstruction *PotentialDecrement,
590-
ImmutablePointerSetFactory<SILInstruction> &SetFactory) {
578+
bool TopDownRefCountState::handleDecrement() {
591579
switch (LatState) {
592580
case LatticeState::Incremented:
593581
LatState = LatticeState::MightBeDecremented;
@@ -618,9 +606,7 @@ bool TopDownRefCountState::valueCanBeUsedGivenLatticeState() const {
618606

619607
/// Given the current lattice state, if we have seen a use, advance the
620608
/// lattice state. Return true if we do so and false otherwise.
621-
bool TopDownRefCountState::handleUser(SILInstruction *PotentialUser,
622-
SILValue RCIdentity,
623-
AliasAnalysis *AA) {
609+
bool TopDownRefCountState::handleUser() {
624610
assert(valueCanBeUsedGivenLatticeState() &&
625611
"Must be able to be used at this point of the lattice.");
626612

@@ -657,10 +643,7 @@ valueCanBeGuaranteedUsedGivenLatticeState() const {
657643

658644
/// Given the current lattice state, if we have seen a use, advance the
659645
/// lattice state. Return true if we do so and false otherwise.
660-
bool TopDownRefCountState::handleGuaranteedUser(
661-
SILInstruction *PotentialGuaranteedUser,
662-
SILValue RCIdentity, ImmutablePointerSetFactory<SILInstruction> &SetFactory,
663-
AliasAnalysis *AA) {
646+
bool TopDownRefCountState::handleGuaranteedUser() {
664647
assert(valueCanBeGuaranteedUsedGivenLatticeState() &&
665648
"Must be able to be used at this point of the lattice.");
666649
// Advance the sequence...
@@ -694,13 +677,12 @@ bool TopDownRefCountState::isRefCountInstMatchedToTrackedInstruction(
694677
if (!Transition.matchingInst(RefCountInst))
695678
return false;
696679

697-
return handleRefCountInstMatch(RefCountInst);
680+
return handleRefCountInstMatch();
698681
}
699682

700683
/// We have a matching ref count inst. Return true if we advance the sequence
701684
/// and false otherwise.
702-
bool TopDownRefCountState::
703-
handleRefCountInstMatch(SILInstruction *RefCountInst) {
685+
bool TopDownRefCountState::handleRefCountInstMatch() {
704686
// Otherwise modify the state appropriately in preparation for removing the
705687
// increment, decrement pair.
706688
switch (LatState) {
@@ -762,8 +744,7 @@ bool TopDownRefCountState::merge(const TopDownRefCountState &Other) {
762744
// the value we are tracking. If so advance the state's sequence appropriately
763745
// and return true. Otherwise return false.
764746
bool TopDownRefCountState::handlePotentialGuaranteedUser(
765-
SILInstruction *PotentialGuaranteedUser,
766-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
747+
SILInstruction *PotentialGuaranteedUser, AliasAnalysis *AA) {
767748
// If we are not tracking a ref count, just return false.
768749
if (!isTrackingRefCount())
769750
return false;
@@ -789,16 +770,14 @@ bool TopDownRefCountState::handlePotentialGuaranteedUser(
789770
}
790771

791772
// Otherwise, update our step given that we have a potential decrement.
792-
return handleGuaranteedUser(PotentialGuaranteedUser, getRCRoot(),
793-
SetFactory, AA);
773+
return handleGuaranteedUser();
794774
}
795775

796776
// Check if PotentialDecrement can decrement the reference count associated with
797777
// the value we are tracking. If so advance the state's sequence appropriately
798778
// and return true. Otherwise return false.
799779
bool TopDownRefCountState::handlePotentialDecrement(
800-
SILInstruction *PotentialDecrement,
801-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
780+
SILInstruction *PotentialDecrement, AliasAnalysis *AA) {
802781
// If we are not tracking a ref count, just return false.
803782
if (!isTrackingRefCount())
804783
return false;
@@ -817,7 +796,7 @@ bool TopDownRefCountState::handlePotentialDecrement(
817796
return false;
818797

819798
// Otherwise, update our state given the potential decrement.
820-
return handleDecrement(PotentialDecrement, SetFactory);
799+
return handleDecrement();
821800
}
822801

823802
// Check if PotentialUser could be a use of the reference counted value that
@@ -840,12 +819,11 @@ bool TopDownRefCountState::handlePotentialUser(SILInstruction *PotentialUser,
840819
if (!mayHaveSymmetricInterference(PotentialUser, getRCRoot(), AA))
841820
return false;
842821

843-
return handleUser(PotentialUser, getRCRoot(), AA);
822+
return handleUser();
844823
}
845824

846-
void TopDownRefCountState::updateForSameLoopInst(
847-
SILInstruction *I,
848-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
825+
void TopDownRefCountState::updateForSameLoopInst(SILInstruction *I,
826+
AliasAnalysis *AA) {
849827
// If we are not tracking anything, bail.
850828
if (!isTrackingRefCount())
851829
return;
@@ -854,7 +832,7 @@ void TopDownRefCountState::updateForSameLoopInst(
854832
// instruction in a way that requires us to guarantee the lifetime of the
855833
// pointer up to this point. This has the effect of performing a use and a
856834
// decrement.
857-
if (handlePotentialGuaranteedUser(I, SetFactory, AA)) {
835+
if (handlePotentialGuaranteedUser(I, AA)) {
858836
LLVM_DEBUG(llvm::dbgs() << " Found Potential Guaranteed Use:\n "
859837
<< getRCRoot());
860838
return;
@@ -863,7 +841,7 @@ void TopDownRefCountState::updateForSameLoopInst(
863841
// Check if the instruction we are visiting could potentially decrement
864842
// the reference counted value we are tracking in a manner that could
865843
// cause us to change states. If we do change states continue...
866-
if (handlePotentialDecrement(I, SetFactory, AA)) {
844+
if (handlePotentialDecrement(I, AA)) {
867845
LLVM_DEBUG(llvm::dbgs() << " Found Potential Decrement:\n "
868846
<< getRCRoot());
869847
return;
@@ -877,9 +855,8 @@ void TopDownRefCountState::updateForSameLoopInst(
877855
<< getRCRoot());
878856
}
879857

880-
void TopDownRefCountState::updateForDifferentLoopInst(
881-
SILInstruction *I,
882-
ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
858+
void TopDownRefCountState::updateForDifferentLoopInst(SILInstruction *I,
859+
AliasAnalysis *AA) {
883860
// If we are not tracking anything, bail.
884861
if (!isTrackingRefCount())
885862
return;
@@ -888,7 +865,7 @@ void TopDownRefCountState::updateForDifferentLoopInst(
888865
if (mayGuaranteedUseValue(I, getRCRoot(), AA) ||
889866
mayDecrementRefCount(I, getRCRoot(), AA)) {
890867
LLVM_DEBUG(llvm::dbgs() << " Found potential guaranteed use!\n");
891-
handleGuaranteedUser(I, getRCRoot(), SetFactory, AA);
868+
handleGuaranteedUser();
892869
return;
893870
}
894871
}

0 commit comments

Comments
 (0)