@@ -195,9 +195,7 @@ bool BottomUpRefCountState::valueCanBeUsedGivenLatticeState() const {
195
195
196
196
// / Given the current lattice state, if we have seen a use, advance the
197
197
// / 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 () {
201
199
assert (valueCanBeUsedGivenLatticeState () &&
202
200
" Must be able to be used at this point of the lattice." );
203
201
@@ -233,9 +231,7 @@ valueCanBeGuaranteedUsedGivenLatticeState() const {
233
231
234
232
// / Given the current lattice state, if we have seen a use, advance the
235
233
// / 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 () {
239
235
assert (valueCanBeGuaranteedUsedGivenLatticeState () &&
240
236
" Must be able to be used at this point of the lattice." );
241
237
@@ -270,14 +266,12 @@ bool BottomUpRefCountState::isRefCountInstMatchedToTrackedInstruction(
270
266
if (!Transition.matchingInst (RefCountInst))
271
267
return false ;
272
268
273
- return handleRefCountInstMatch (RefCountInst );
269
+ return handleRefCountInstMatch ();
274
270
}
275
271
276
272
// / We have a matching ref count inst. Return true if we advance the sequence
277
273
// / and false otherwise.
278
- bool
279
- BottomUpRefCountState::
280
- handleRefCountInstMatch (SILInstruction *RefCountInst) {
274
+ bool BottomUpRefCountState::handleRefCountInstMatch () {
281
275
// Otherwise modify the state appropriately in preparation for removing the
282
276
// increment, decrement pair.
283
277
switch (LatState) {
@@ -340,8 +334,7 @@ bool BottomUpRefCountState::merge(const BottomUpRefCountState &Other) {
340
334
// the value we are tracking. If so advance the state's sequence appropriately
341
335
// and return true. Otherwise return false.
342
336
bool BottomUpRefCountState::handlePotentialGuaranteedUser (
343
- SILInstruction *PotentialGuaranteedUser,
344
- ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
337
+ SILInstruction *PotentialGuaranteedUser, AliasAnalysis *AA) {
345
338
// If we are not tracking a ref count, just return false.
346
339
if (!isTrackingRefCount ())
347
340
return false ;
@@ -375,7 +368,7 @@ bool BottomUpRefCountState::handlePotentialGuaranteedUser(
375
368
FoundNonARCUser = true ;
376
369
377
370
// Otherwise, update the ref count state given the guaranteed user.
378
- return handleGuaranteedUser (getRCRoot (), SetFactory, AA );
371
+ return handleGuaranteedUser ();
379
372
}
380
373
381
374
// / Check if PotentialDecrement can decrement the reference count associated
@@ -408,9 +401,8 @@ bool BottomUpRefCountState::handlePotentialDecrement(
408
401
// Check if PotentialUser could be a use of the reference counted value that
409
402
// requires user to be alive. If so advance the state's sequence
410
403
// 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) {
414
406
415
407
// If we are not tracking a ref count, just return false.
416
408
if (!isTrackingRefCount ())
@@ -434,12 +426,11 @@ bool BottomUpRefCountState::handlePotentialUser(
434
426
if (mustUseValue (PotentialUser, getRCRoot (), AA))
435
427
FoundNonARCUser = true ;
436
428
437
- return handleUser (getRCRoot (), SetFactory, AA );
429
+ return handleUser ();
438
430
}
439
431
440
- void BottomUpRefCountState::updateForSameLoopInst (
441
- SILInstruction *I,
442
- ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
432
+ void BottomUpRefCountState::updateForSameLoopInst (SILInstruction *I,
433
+ AliasAnalysis *AA) {
443
434
// If this state is not tracking anything, there is nothing to update.
444
435
if (!isTrackingRefCount ())
445
436
return ;
@@ -448,7 +439,7 @@ void BottomUpRefCountState::updateForSameLoopInst(
448
439
// instruction in a way that requires us to guarantee the lifetime of the
449
440
// pointer up to this point. This has the effect of performing a use and a
450
441
// decrement.
451
- if (handlePotentialGuaranteedUser (I, SetFactory, AA)) {
442
+ if (handlePotentialGuaranteedUser (I, AA)) {
452
443
LLVM_DEBUG (llvm::dbgs () << " Found Potential Guaranteed Use:\n "
453
444
<< getRCRoot ());
454
445
return ;
@@ -465,15 +456,14 @@ void BottomUpRefCountState::updateForSameLoopInst(
465
456
466
457
// Otherwise check if the reference counted value we are tracking
467
458
// could be used by the given instruction.
468
- if (!handlePotentialUser (I, SetFactory, AA))
459
+ if (!handlePotentialUser (I, AA))
469
460
return ;
470
461
LLVM_DEBUG (llvm::dbgs () << " Found Potential Use:\n "
471
462
<< getRCRoot ());
472
463
}
473
464
474
- void BottomUpRefCountState::updateForDifferentLoopInst (
475
- SILInstruction *I,
476
- ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
465
+ void BottomUpRefCountState::updateForDifferentLoopInst (SILInstruction *I,
466
+ AliasAnalysis *AA) {
477
467
// If we are not tracking anything, bail.
478
468
if (!isTrackingRefCount ())
479
469
return ;
@@ -483,15 +473,15 @@ void BottomUpRefCountState::updateForDifferentLoopInst(
483
473
mayDecrementRefCount (I, getRCRoot (), AA)) {
484
474
LLVM_DEBUG (llvm::dbgs () << " Found potential guaranteed use:\n "
485
475
<< getRCRoot ());
486
- handleGuaranteedUser (getRCRoot (), SetFactory, AA );
476
+ handleGuaranteedUser ();
487
477
return ;
488
478
}
489
479
}
490
480
491
481
// We can just handle potential users normally, since if we handle the user we
492
482
// already saw a decrement implying that we will treat this like a guaranteed
493
483
// use.
494
- if (!handlePotentialUser (I, SetFactory, AA))
484
+ if (!handlePotentialUser (I, AA))
495
485
return ;
496
486
LLVM_DEBUG (llvm::dbgs () << " Found Potential Use:\n "
497
487
<< getRCRoot ());
@@ -585,9 +575,7 @@ bool TopDownRefCountState::valueCanBeDecrementedGivenLatticeState() const {
585
575
586
576
// / If advance the state's sequence appropriately for a decrement. If we do
587
577
// / advance return true. Otherwise return false.
588
- bool TopDownRefCountState::handleDecrement (
589
- SILInstruction *PotentialDecrement,
590
- ImmutablePointerSetFactory<SILInstruction> &SetFactory) {
578
+ bool TopDownRefCountState::handleDecrement () {
591
579
switch (LatState) {
592
580
case LatticeState::Incremented:
593
581
LatState = LatticeState::MightBeDecremented;
@@ -618,9 +606,7 @@ bool TopDownRefCountState::valueCanBeUsedGivenLatticeState() const {
618
606
619
607
// / Given the current lattice state, if we have seen a use, advance the
620
608
// / 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 () {
624
610
assert (valueCanBeUsedGivenLatticeState () &&
625
611
" Must be able to be used at this point of the lattice." );
626
612
@@ -657,10 +643,7 @@ valueCanBeGuaranteedUsedGivenLatticeState() const {
657
643
658
644
// / Given the current lattice state, if we have seen a use, advance the
659
645
// / 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 () {
664
647
assert (valueCanBeGuaranteedUsedGivenLatticeState () &&
665
648
" Must be able to be used at this point of the lattice." );
666
649
// Advance the sequence...
@@ -694,13 +677,12 @@ bool TopDownRefCountState::isRefCountInstMatchedToTrackedInstruction(
694
677
if (!Transition.matchingInst (RefCountInst))
695
678
return false ;
696
679
697
- return handleRefCountInstMatch (RefCountInst );
680
+ return handleRefCountInstMatch ();
698
681
}
699
682
700
683
// / We have a matching ref count inst. Return true if we advance the sequence
701
684
// / and false otherwise.
702
- bool TopDownRefCountState::
703
- handleRefCountInstMatch (SILInstruction *RefCountInst) {
685
+ bool TopDownRefCountState::handleRefCountInstMatch () {
704
686
// Otherwise modify the state appropriately in preparation for removing the
705
687
// increment, decrement pair.
706
688
switch (LatState) {
@@ -762,8 +744,7 @@ bool TopDownRefCountState::merge(const TopDownRefCountState &Other) {
762
744
// the value we are tracking. If so advance the state's sequence appropriately
763
745
// and return true. Otherwise return false.
764
746
bool TopDownRefCountState::handlePotentialGuaranteedUser (
765
- SILInstruction *PotentialGuaranteedUser,
766
- ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
747
+ SILInstruction *PotentialGuaranteedUser, AliasAnalysis *AA) {
767
748
// If we are not tracking a ref count, just return false.
768
749
if (!isTrackingRefCount ())
769
750
return false ;
@@ -789,16 +770,14 @@ bool TopDownRefCountState::handlePotentialGuaranteedUser(
789
770
}
790
771
791
772
// Otherwise, update our step given that we have a potential decrement.
792
- return handleGuaranteedUser (PotentialGuaranteedUser, getRCRoot (),
793
- SetFactory, AA);
773
+ return handleGuaranteedUser ();
794
774
}
795
775
796
776
// Check if PotentialDecrement can decrement the reference count associated with
797
777
// the value we are tracking. If so advance the state's sequence appropriately
798
778
// and return true. Otherwise return false.
799
779
bool TopDownRefCountState::handlePotentialDecrement (
800
- SILInstruction *PotentialDecrement,
801
- ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
780
+ SILInstruction *PotentialDecrement, AliasAnalysis *AA) {
802
781
// If we are not tracking a ref count, just return false.
803
782
if (!isTrackingRefCount ())
804
783
return false ;
@@ -817,7 +796,7 @@ bool TopDownRefCountState::handlePotentialDecrement(
817
796
return false ;
818
797
819
798
// Otherwise, update our state given the potential decrement.
820
- return handleDecrement (PotentialDecrement, SetFactory );
799
+ return handleDecrement ();
821
800
}
822
801
823
802
// Check if PotentialUser could be a use of the reference counted value that
@@ -840,12 +819,11 @@ bool TopDownRefCountState::handlePotentialUser(SILInstruction *PotentialUser,
840
819
if (!mayHaveSymmetricInterference (PotentialUser, getRCRoot (), AA))
841
820
return false ;
842
821
843
- return handleUser (PotentialUser, getRCRoot (), AA );
822
+ return handleUser ();
844
823
}
845
824
846
- void TopDownRefCountState::updateForSameLoopInst (
847
- SILInstruction *I,
848
- ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
825
+ void TopDownRefCountState::updateForSameLoopInst (SILInstruction *I,
826
+ AliasAnalysis *AA) {
849
827
// If we are not tracking anything, bail.
850
828
if (!isTrackingRefCount ())
851
829
return ;
@@ -854,7 +832,7 @@ void TopDownRefCountState::updateForSameLoopInst(
854
832
// instruction in a way that requires us to guarantee the lifetime of the
855
833
// pointer up to this point. This has the effect of performing a use and a
856
834
// decrement.
857
- if (handlePotentialGuaranteedUser (I, SetFactory, AA)) {
835
+ if (handlePotentialGuaranteedUser (I, AA)) {
858
836
LLVM_DEBUG (llvm::dbgs () << " Found Potential Guaranteed Use:\n "
859
837
<< getRCRoot ());
860
838
return ;
@@ -863,7 +841,7 @@ void TopDownRefCountState::updateForSameLoopInst(
863
841
// Check if the instruction we are visiting could potentially decrement
864
842
// the reference counted value we are tracking in a manner that could
865
843
// cause us to change states. If we do change states continue...
866
- if (handlePotentialDecrement (I, SetFactory, AA)) {
844
+ if (handlePotentialDecrement (I, AA)) {
867
845
LLVM_DEBUG (llvm::dbgs () << " Found Potential Decrement:\n "
868
846
<< getRCRoot ());
869
847
return ;
@@ -877,9 +855,8 @@ void TopDownRefCountState::updateForSameLoopInst(
877
855
<< getRCRoot ());
878
856
}
879
857
880
- void TopDownRefCountState::updateForDifferentLoopInst (
881
- SILInstruction *I,
882
- ImmutablePointerSetFactory<SILInstruction> &SetFactory, AliasAnalysis *AA) {
858
+ void TopDownRefCountState::updateForDifferentLoopInst (SILInstruction *I,
859
+ AliasAnalysis *AA) {
883
860
// If we are not tracking anything, bail.
884
861
if (!isTrackingRefCount ())
885
862
return ;
@@ -888,7 +865,7 @@ void TopDownRefCountState::updateForDifferentLoopInst(
888
865
if (mayGuaranteedUseValue (I, getRCRoot (), AA) ||
889
866
mayDecrementRefCount (I, getRCRoot (), AA)) {
890
867
LLVM_DEBUG (llvm::dbgs () << " Found potential guaranteed use!\n " );
891
- handleGuaranteedUser (I, getRCRoot (), SetFactory, AA );
868
+ handleGuaranteedUser ();
892
869
return ;
893
870
}
894
871
}
0 commit comments