@@ -362,13 +362,13 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
362
362
// Check to see if all of the leading entries are now opcode checks. If so,
363
363
// we can convert this Scope to be a OpcodeSwitch instead.
364
364
bool AllOpcodeChecks = true , AllTypeChecks = true ;
365
- for (unsigned i = 0 , e = OptionsToMatch. size (); i != e; ++i ) {
365
+ for (Matcher *Optn : OptionsToMatch) {
366
366
// Check to see if this breaks a series of CheckOpcodeMatchers.
367
- if (AllOpcodeChecks && !isa<CheckOpcodeMatcher>(OptionsToMatch[i] )) {
367
+ if (AllOpcodeChecks && !isa<CheckOpcodeMatcher>(Optn )) {
368
368
#if 0
369
369
if (i > 3) {
370
370
errs() << "FAILING OPC #" << i << "\n";
371
- OptionsToMatch[i] ->dump();
371
+ Optn ->dump();
372
372
}
373
373
#endif
374
374
AllOpcodeChecks = false ;
@@ -377,7 +377,7 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
377
377
// Check to see if this breaks a series of CheckTypeMatcher's.
378
378
if (AllTypeChecks) {
379
379
CheckTypeMatcher *CTM = cast_or_null<CheckTypeMatcher>(
380
- FindNodeWithKind (OptionsToMatch[i] , Matcher::CheckType));
380
+ FindNodeWithKind (Optn , Matcher::CheckType));
381
381
if (!CTM ||
382
382
// iPTR checks could alias any other case without us knowing, don't
383
383
// bother with them.
@@ -386,12 +386,11 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
386
386
CTM->getResNo () != 0 ||
387
387
// If the CheckType isn't at the start of the list, see if we can move
388
388
// it there.
389
- !CTM->canMoveBefore (OptionsToMatch[i] )) {
389
+ !CTM->canMoveBefore (Optn )) {
390
390
#if 0
391
391
if (i > 3 && AllTypeChecks) {
392
392
errs() << "FAILING TYPE #" << i << "\n";
393
- OptionsToMatch[i]->dump();
394
- }
393
+ Optn->dump(); }
395
394
#endif
396
395
AllTypeChecks = false ;
397
396
}
@@ -402,8 +401,8 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
402
401
if (AllOpcodeChecks) {
403
402
StringSet<> Opcodes;
404
403
SmallVector<std::pair<const SDNodeInfo *, Matcher *>, 8 > Cases;
405
- for (unsigned i = 0 , e = OptionsToMatch. size (); i != e; ++i ) {
406
- CheckOpcodeMatcher *COM = cast<CheckOpcodeMatcher>(OptionsToMatch[i] );
404
+ for (Matcher *Optn : OptionsToMatch) {
405
+ CheckOpcodeMatcher *COM = cast<CheckOpcodeMatcher>(Optn );
407
406
assert (Opcodes.insert (COM->getOpcode ().getEnumName ()).second &&
408
407
" Duplicate opcodes not factored?" );
409
408
Cases.emplace_back (&COM->getOpcode (), COM->takeNext ());
@@ -418,12 +417,12 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
418
417
if (AllTypeChecks) {
419
418
DenseMap<unsigned , unsigned > TypeEntry;
420
419
SmallVector<std::pair<MVT::SimpleValueType, Matcher *>, 8 > Cases;
421
- for (unsigned i = 0 , e = OptionsToMatch. size (); i != e; ++i ) {
422
- Matcher *M = FindNodeWithKind (OptionsToMatch[i] , Matcher::CheckType);
420
+ for (Matcher *Optn : OptionsToMatch) {
421
+ Matcher *M = FindNodeWithKind (Optn , Matcher::CheckType);
423
422
assert (M && isa<CheckTypeMatcher>(M) && " Unknown Matcher type" );
424
423
425
424
auto *CTM = cast<CheckTypeMatcher>(M);
426
- Matcher *MatcherWithoutCTM = OptionsToMatch[i] ->unlinkNode (CTM);
425
+ Matcher *MatcherWithoutCTM = Optn ->unlinkNode (CTM);
427
426
MVT::SimpleValueType CTMTy = CTM->getType ();
428
427
delete CTM;
429
428
0 commit comments