@@ -2984,7 +2984,7 @@ bool DependenceInfo::propagate(const SCEV *&Src, const SCEV *&Dst,
2984
2984
SmallVectorImpl<Constraint> &Constraints,
2985
2985
bool &Consistent) {
2986
2986
bool Result = false ;
2987
- for (int LI = Loops.find_first (); LI >= 0 ; LI = Loops. find_next (LI )) {
2987
+ for (unsigned LI : Loops.set_bits ( )) {
2988
2988
DEBUG (dbgs () << " \t Constraint[" << LI << " ] is" );
2989
2989
DEBUG (Constraints[LI].dump (dbgs ()));
2990
2990
if (Constraints[LI].isDistance ())
@@ -3266,7 +3266,7 @@ bool DependenceInfo::tryDelinearize(Instruction *Src, Instruction *Dst,
3266
3266
// For debugging purposes, dump a small bit vector to dbgs().
3267
3267
static void dumpSmallBitVector (SmallBitVector &BV) {
3268
3268
dbgs () << " {" ;
3269
- for (int VI = BV.find_first (); VI >= 0 ; VI = BV. find_next (VI )) {
3269
+ for (unsigned VI : BV.set_bits ( )) {
3270
3270
dbgs () << VI;
3271
3271
if (BV.find_next (VI) >= 0 )
3272
3272
dbgs () << ' ' ;
@@ -3506,7 +3506,7 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3506
3506
NewConstraint.setAny (SE);
3507
3507
3508
3508
// test separable subscripts
3509
- for (int SI = Separable.find_first (); SI >= 0 ; SI = Separable. find_next (SI )) {
3509
+ for (unsigned SI : Separable.set_bits ( )) {
3510
3510
DEBUG (dbgs () << " testing subscript " << SI);
3511
3511
switch (Pair[SI].Classification ) {
3512
3512
case Subscript::ZIV:
@@ -3545,14 +3545,14 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3545
3545
SmallVector<Constraint, 4 > Constraints (MaxLevels + 1 );
3546
3546
for (unsigned II = 0 ; II <= MaxLevels; ++II)
3547
3547
Constraints[II].setAny (SE);
3548
- for (int SI = Coupled.find_first (); SI >= 0 ; SI = Coupled. find_next (SI )) {
3548
+ for (unsigned SI : Coupled.set_bits ( )) {
3549
3549
DEBUG (dbgs () << " testing subscript group " << SI << " { " );
3550
3550
SmallBitVector Group (Pair[SI].Group );
3551
3551
SmallBitVector Sivs (Pairs);
3552
3552
SmallBitVector Mivs (Pairs);
3553
3553
SmallBitVector ConstrainedLevels (MaxLevels + 1 );
3554
3554
SmallVector<Subscript *, 4 > PairsInGroup;
3555
- for (int SJ = Group.find_first (); SJ >= 0 ; SJ = Group. find_next (SJ )) {
3555
+ for (unsigned SJ : Group.set_bits ( )) {
3556
3556
DEBUG (dbgs () << SJ << " " );
3557
3557
if (Pair[SJ].Classification == Subscript::SIV)
3558
3558
Sivs.set (SJ);
@@ -3564,7 +3564,7 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3564
3564
DEBUG (dbgs () << " }\n " );
3565
3565
while (Sivs.any ()) {
3566
3566
bool Changed = false ;
3567
- for (int SJ = Sivs.find_first (); SJ >= 0 ; SJ = Sivs. find_next (SJ )) {
3567
+ for (unsigned SJ : Sivs.set_bits ( )) {
3568
3568
DEBUG (dbgs () << " testing subscript " << SJ << " , SIV\n " );
3569
3569
// SJ is an SIV subscript that's part of the current coupled group
3570
3570
unsigned Level;
@@ -3588,7 +3588,7 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3588
3588
DEBUG (dbgs () << " propagating\n " );
3589
3589
DEBUG (dbgs () << " \t Mivs = " );
3590
3590
DEBUG (dumpSmallBitVector (Mivs));
3591
- for (int SJ = Mivs.find_first (); SJ >= 0 ; SJ = Mivs. find_next (SJ )) {
3591
+ for (unsigned SJ : Mivs.set_bits ( )) {
3592
3592
// SJ is an MIV subscript that's part of the current coupled group
3593
3593
DEBUG (dbgs () << " \t SJ = " << SJ << " \n " );
3594
3594
if (propagate (Pair[SJ].Src , Pair[SJ].Dst , Pair[SJ].Loops ,
@@ -3622,7 +3622,7 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3622
3622
}
3623
3623
3624
3624
// test & propagate remaining RDIVs
3625
- for (int SJ = Mivs.find_first (); SJ >= 0 ; SJ = Mivs. find_next (SJ )) {
3625
+ for (unsigned SJ : Mivs.set_bits ( )) {
3626
3626
if (Pair[SJ].Classification == Subscript::RDIV) {
3627
3627
DEBUG (dbgs () << " RDIV test\n " );
3628
3628
if (testRDIV (Pair[SJ].Src , Pair[SJ].Dst , Result))
@@ -3635,7 +3635,7 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3635
3635
// test remaining MIVs
3636
3636
// This code is temporary.
3637
3637
// Better to somehow test all remaining subscripts simultaneously.
3638
- for (int SJ = Mivs.find_first (); SJ >= 0 ; SJ = Mivs. find_next (SJ )) {
3638
+ for (unsigned SJ : Mivs.set_bits ( )) {
3639
3639
if (Pair[SJ].Classification == Subscript::MIV) {
3640
3640
DEBUG (dbgs () << " MIV test\n " );
3641
3641
if (testMIV (Pair[SJ].Src , Pair[SJ].Dst , Pair[SJ].Loops , Result))
@@ -3647,9 +3647,8 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3647
3647
3648
3648
// update Result.DV from constraint vector
3649
3649
DEBUG (dbgs () << " updating\n " );
3650
- for (int SJ = ConstrainedLevels.find_first (); SJ >= 0 ;
3651
- SJ = ConstrainedLevels.find_next (SJ)) {
3652
- if (SJ > (int )CommonLevels)
3650
+ for (unsigned SJ : ConstrainedLevels.set_bits ()) {
3651
+ if (SJ > CommonLevels)
3653
3652
break ;
3654
3653
updateDirection (Result.DV [SJ - 1 ], Constraints[SJ]);
3655
3654
if (Result.DV [SJ - 1 ].Direction == Dependence::DVEntry::NONE)
@@ -3859,7 +3858,7 @@ const SCEV *DependenceInfo::getSplitIteration(const Dependence &Dep,
3859
3858
NewConstraint.setAny (SE);
3860
3859
3861
3860
// test separable subscripts
3862
- for (int SI = Separable.find_first (); SI >= 0 ; SI = Separable. find_next (SI )) {
3861
+ for (unsigned SI : Separable.set_bits ( )) {
3863
3862
switch (Pair[SI].Classification ) {
3864
3863
case Subscript::SIV: {
3865
3864
unsigned Level;
@@ -3886,20 +3885,20 @@ const SCEV *DependenceInfo::getSplitIteration(const Dependence &Dep,
3886
3885
SmallVector<Constraint, 4 > Constraints (MaxLevels + 1 );
3887
3886
for (unsigned II = 0 ; II <= MaxLevels; ++II)
3888
3887
Constraints[II].setAny (SE);
3889
- for (int SI = Coupled.find_first (); SI >= 0 ; SI = Coupled. find_next (SI )) {
3888
+ for (unsigned SI : Coupled.set_bits ( )) {
3890
3889
SmallBitVector Group (Pair[SI].Group );
3891
3890
SmallBitVector Sivs (Pairs);
3892
3891
SmallBitVector Mivs (Pairs);
3893
3892
SmallBitVector ConstrainedLevels (MaxLevels + 1 );
3894
- for (int SJ = Group.find_first (); SJ >= 0 ; SJ = Group. find_next (SJ )) {
3893
+ for (unsigned SJ : Group.set_bits ( )) {
3895
3894
if (Pair[SJ].Classification == Subscript::SIV)
3896
3895
Sivs.set (SJ);
3897
3896
else
3898
3897
Mivs.set (SJ);
3899
3898
}
3900
3899
while (Sivs.any ()) {
3901
3900
bool Changed = false ;
3902
- for (int SJ = Sivs.find_first (); SJ >= 0 ; SJ = Sivs. find_next (SJ )) {
3901
+ for (unsigned SJ : Sivs.set_bits ( )) {
3903
3902
// SJ is an SIV subscript that's part of the current coupled group
3904
3903
unsigned Level;
3905
3904
const SCEV *SplitIter = nullptr ;
@@ -3914,7 +3913,7 @@ const SCEV *DependenceInfo::getSplitIteration(const Dependence &Dep,
3914
3913
}
3915
3914
if (Changed) {
3916
3915
// propagate, possibly creating new SIVs and ZIVs
3917
- for (int SJ = Mivs.find_first (); SJ >= 0 ; SJ = Mivs. find_next (SJ )) {
3916
+ for (unsigned SJ : Mivs.set_bits ( )) {
3918
3917
// SJ is an MIV subscript that's part of the current coupled group
3919
3918
if (propagate (Pair[SJ].Src , Pair[SJ].Dst ,
3920
3919
Pair[SJ].Loops , Constraints, Result.Consistent )) {
0 commit comments