@@ -4180,67 +4180,65 @@ const SCEV *DependenceInfo::getSplitIteration(const Dependence &Dep,
41804180 }
41814181 }
41824182
4183- if (Coupled.count ()) {
4184- // test coupled subscript groups
4185- SmallVector<Constraint, 4 > Constraints (MaxLevels + 1 );
4186- for (unsigned II = 0 ; II <= MaxLevels; ++II)
4187- Constraints[II].setAny (SE);
4188- for (unsigned SI : Coupled.set_bits ()) {
4189- SmallBitVector Group (Pair[SI].Group );
4190- SmallBitVector Sivs (Pairs);
4191- SmallBitVector Mivs (Pairs);
4192- SmallBitVector ConstrainedLevels (MaxLevels + 1 );
4193- for (unsigned SJ : Group.set_bits ()) {
4194- if (Pair[SJ].Classification == Subscript::SIV)
4195- Sivs.set (SJ);
4196- else
4197- Mivs.set (SJ);
4183+ assert (!Coupled.empty () && " coupled expected non-empty" );
4184+
4185+ // test coupled subscript groups
4186+ SmallVector<Constraint, 4 > Constraints (MaxLevels + 1 );
4187+ for (unsigned II = 0 ; II <= MaxLevels; ++II)
4188+ Constraints[II].setAny (SE);
4189+ for (unsigned SI : Coupled.set_bits ()) {
4190+ SmallBitVector Group (Pair[SI].Group );
4191+ SmallBitVector Sivs (Pairs);
4192+ SmallBitVector Mivs (Pairs);
4193+ SmallBitVector ConstrainedLevels (MaxLevels + 1 );
4194+ for (unsigned SJ : Group.set_bits ()) {
4195+ if (Pair[SJ].Classification == Subscript::SIV)
4196+ Sivs.set (SJ);
4197+ else
4198+ Mivs.set (SJ);
4199+ }
4200+ while (Sivs.any ()) {
4201+ bool Changed = false ;
4202+ for (unsigned SJ : Sivs.set_bits ()) {
4203+ // SJ is an SIV subscript that's part of the current coupled group
4204+ unsigned Level;
4205+ const SCEV *SplitIter = nullptr ;
4206+ (void )testSIV (Pair[SJ].Src , Pair[SJ].Dst , Level, Result, NewConstraint,
4207+ SplitIter);
4208+ if (Level == SplitLevel && SplitIter)
4209+ return SplitIter;
4210+ ConstrainedLevels.set (Level);
4211+ if (intersectConstraints (&Constraints[Level], &NewConstraint))
4212+ Changed = true ;
4213+ Sivs.reset (SJ);
41984214 }
4199- while (Sivs.any ()) {
4200- bool Changed = false ;
4201- for (unsigned SJ : Sivs.set_bits ()) {
4202- // SJ is an SIV subscript that's part of the current coupled group
4203- unsigned Level;
4204- const SCEV *SplitIter = nullptr ;
4205- (void ) testSIV (Pair[SJ].Src , Pair[SJ].Dst , Level,
4206- Result, NewConstraint, SplitIter);
4207- if (Level == SplitLevel && SplitIter)
4208- return SplitIter;
4209- ConstrainedLevels.set (Level);
4210- if (intersectConstraints (&Constraints[Level], &NewConstraint))
4211- Changed = true ;
4212- Sivs.reset (SJ);
4213- }
4214- if (Changed) {
4215- // propagate, possibly creating new SIVs and ZIVs
4216- for (unsigned SJ : Mivs.set_bits ()) {
4217- // SJ is an MIV subscript that's part of the current coupled group
4218- if (propagate (Pair[SJ].Src , Pair[SJ].Dst ,
4219- Pair[SJ].Loops , Constraints, Result.Consistent )) {
4220- Pair[SJ].Classification =
4221- classifyPair (Pair[SJ].Src , LI->getLoopFor (Src->getParent ()),
4222- Pair[SJ].Dst , LI->getLoopFor (Dst->getParent ()),
4223- Pair[SJ].Loops );
4224- switch (Pair[SJ].Classification ) {
4225- case Subscript::ZIV:
4226- Mivs.reset (SJ);
4227- break ;
4228- case Subscript::SIV:
4229- Sivs.set (SJ);
4230- Mivs.reset (SJ);
4231- break ;
4232- case Subscript::RDIV:
4233- case Subscript::MIV:
4234- break ;
4235- default :
4236- llvm_unreachable (" bad subscript classification" );
4237- }
4238- }
4239- }
4215+ if (!Changed)
4216+ continue ;
4217+ // propagate, possibly creating new SIVs and ZIVs
4218+ for (unsigned SJ : Mivs.set_bits ()) {
4219+ // SJ is an MIV subscript that's part of the current coupled group
4220+ if (!propagate (Pair[SJ].Src , Pair[SJ].Dst , Pair[SJ].Loops , Constraints,
4221+ Result.Consistent ))
4222+ continue ;
4223+ Pair[SJ].Classification = classifyPair (
4224+ Pair[SJ].Src , LI->getLoopFor (Src->getParent ()), Pair[SJ].Dst ,
4225+ LI->getLoopFor (Dst->getParent ()), Pair[SJ].Loops );
4226+ switch (Pair[SJ].Classification ) {
4227+ case Subscript::ZIV:
4228+ Mivs.reset (SJ);
4229+ break ;
4230+ case Subscript::SIV:
4231+ Sivs.set (SJ);
4232+ Mivs.reset (SJ);
4233+ break ;
4234+ case Subscript::RDIV:
4235+ case Subscript::MIV:
4236+ break ;
4237+ default :
4238+ llvm_unreachable (" bad subscript classification" );
42404239 }
42414240 }
42424241 }
42434242 }
42444243 llvm_unreachable (" somehow reached end of routine" );
4245- return nullptr ;
42464244}
0 commit comments