@@ -299,30 +299,25 @@ void PresburgerSpace::mergeAndAlignSymbols(PresburgerSpace &other) {
299
299
" Both spaces need to have identifers to merge & align" );
300
300
301
301
// First merge & align identifiers into `other` from `this`.
302
- unsigned kindBeginOffset = other.getVarKindOffset (VarKind::Symbol);
303
302
unsigned i = 0 ;
304
- for (const Identifier *identifier =
305
- identifiers.begin () + getVarKindOffset (VarKind::Symbol);
306
- identifier != identifiers.begin () + getVarKindEnd (VarKind::Symbol);
307
- identifier++) {
303
+ for (const Identifier identifier : getIds (VarKind::Symbol)) {
308
304
// If the identifier exists in `other`, then align it; otherwise insert it
309
305
// assuming it is a new identifier. Search in `other` starting at position
310
306
// `i` since the left of `i` is aligned.
311
- auto *findEnd =
312
- other.identifiers .begin () + other.getVarKindEnd (VarKind::Symbol);
313
- auto *itr = std::find (other.identifiers .begin () + kindBeginOffset + i,
314
- findEnd, *identifier);
307
+ auto *findBegin = other.getIds (VarKind::Symbol).begin () + i;
308
+ auto *findEnd = other.getIds (VarKind::Symbol).end ();
309
+ auto *itr = std::find (findBegin, findEnd, identifier);
315
310
if (itr != findEnd) {
316
- std::iter_swap (other. identifiers . begin () + kindBeginOffset + i , itr);
311
+ std::swap (findBegin , itr);
317
312
} else {
318
313
other.insertVar (VarKind::Symbol, i);
319
- other.getId (VarKind::Symbol, i) = * identifier;
314
+ other.getId (VarKind::Symbol, i) = identifier;
320
315
}
321
- i++ ;
316
+ ++i ;
322
317
}
323
318
324
319
// Finally add identifiers that are in `other`, but not in `this` to `this`.
325
- for (unsigned e = other.getNumVarKind (VarKind::Symbol); i < e; i++ ) {
320
+ for (unsigned e = other.getNumVarKind (VarKind::Symbol); i < e; ++i ) {
326
321
insertVar (VarKind::Symbol, i);
327
322
getId (VarKind::Symbol, i) = other.getId (VarKind::Symbol, i);
328
323
}
0 commit comments