@@ -362,13 +362,13 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
362362 // Check to see if all of the leading entries are now opcode checks. If so,
363363 // we can convert this Scope to be a OpcodeSwitch instead.
364364 bool AllOpcodeChecks = true , AllTypeChecks = true ;
365- for (unsigned i = 0 , e = OptionsToMatch. size (); i != e; ++i ) {
365+ for (Matcher *Optn : OptionsToMatch) {
366366 // Check to see if this breaks a series of CheckOpcodeMatchers.
367- if (AllOpcodeChecks && !isa<CheckOpcodeMatcher>(OptionsToMatch[i] )) {
367+ if (AllOpcodeChecks && !isa<CheckOpcodeMatcher>(Optn )) {
368368#if 0
369369 if (i > 3) {
370370 errs() << "FAILING OPC #" << i << "\n";
371- OptionsToMatch[i] ->dump();
371+ Optn ->dump();
372372 }
373373#endif
374374 AllOpcodeChecks = false ;
@@ -377,7 +377,7 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
377377 // Check to see if this breaks a series of CheckTypeMatcher's.
378378 if (AllTypeChecks) {
379379 CheckTypeMatcher *CTM = cast_or_null<CheckTypeMatcher>(
380- FindNodeWithKind (OptionsToMatch[i] , Matcher::CheckType));
380+ FindNodeWithKind (Optn , Matcher::CheckType));
381381 if (!CTM ||
382382 // iPTR checks could alias any other case without us knowing, don't
383383 // bother with them.
@@ -386,12 +386,11 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
386386 CTM->getResNo () != 0 ||
387387 // If the CheckType isn't at the start of the list, see if we can move
388388 // it there.
389- !CTM->canMoveBefore (OptionsToMatch[i] )) {
389+ !CTM->canMoveBefore (Optn )) {
390390#if 0
391391 if (i > 3 && AllTypeChecks) {
392392 errs() << "FAILING TYPE #" << i << "\n";
393- OptionsToMatch[i]->dump();
394- }
393+ Optn->dump(); }
395394#endif
396395 AllTypeChecks = false ;
397396 }
@@ -402,8 +401,8 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
402401 if (AllOpcodeChecks) {
403402 StringSet<> Opcodes;
404403 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 );
407406 assert (Opcodes.insert (COM->getOpcode ().getEnumName ()).second &&
408407 " Duplicate opcodes not factored?" );
409408 Cases.emplace_back (&COM->getOpcode (), COM->takeNext ());
@@ -418,12 +417,12 @@ static void FactorScope(std::unique_ptr<Matcher> &MatcherPtr) {
418417 if (AllTypeChecks) {
419418 DenseMap<unsigned , unsigned > TypeEntry;
420419 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);
423422 assert (M && isa<CheckTypeMatcher>(M) && " Unknown Matcher type" );
424423
425424 auto *CTM = cast<CheckTypeMatcher>(M);
426- Matcher *MatcherWithoutCTM = OptionsToMatch[i] ->unlinkNode (CTM);
425+ Matcher *MatcherWithoutCTM = Optn ->unlinkNode (CTM);
427426 MVT::SimpleValueType CTMTy = CTM->getType ();
428427 delete CTM;
429428
0 commit comments