Skip to content

Commit f7ab2dd

Browse files
committed
clang-tidy fixes
1 parent d1a6c88 commit f7ab2dd

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

src/Profiling.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ class InjectCounters : public IRMutator {
369369
}
370370

371371
void mul(const Expr &e) {
372-
for (int i = 0; i < num_counters; i++) {
373-
if (counters[i].defined()) {
374-
counters[i] *= e;
372+
for (auto &counter : counters) {
373+
if (counter.defined()) {
374+
counter *= e;
375375
}
376376
}
377377
add_free_vars(e);
@@ -467,7 +467,7 @@ class InjectCounters : public IRMutator {
467467

468468
Stmt flush_all(const Stmt &stmt) {
469469
Stmt s = stmt;
470-
for (auto p : counters) {
470+
for (const auto &p : counters) {
471471
s = flush(s, p.first, p.second);
472472
}
473473
counters.clear();
@@ -498,9 +498,9 @@ class InjectCounters : public IRMutator {
498498
// Used after any hoisting operation that mutates the Exprs in place.
499499
static void recompute_free_vars(Counters &c) {
500500
c.free_vars.clear();
501-
for (int i = 0; i < num_counters; i++) {
502-
if (c.counters[i].defined()) {
503-
c.add_free_vars(c.counters[i]);
501+
for (const auto &counter : c.counters) {
502+
if (counter.defined()) {
503+
c.add_free_vars(counter);
504504
}
505505
}
506506
}
@@ -517,13 +517,13 @@ class InjectCounters : public IRMutator {
517517
if (!c.free_vars.count(op->name)) {
518518
continue;
519519
}
520-
for (int i = 0; i < num_counters; i++) {
521-
if (c.counters[i].defined() && expr_uses_var(c.counters[i], op->name)) {
522-
Interval iv = bounds_of_expr_in_scope(c.counters[i], scope);
520+
for (auto &counter : c.counters) {
521+
if (counter.defined() && expr_uses_var(counter, op->name)) {
522+
Interval iv = bounds_of_expr_in_scope(counter, scope);
523523
if (iv.has_upper_bound()) {
524-
c.counters[i] = simplify(iv.max);
524+
counter = simplify(iv.max);
525525
} else {
526-
c.counters[i] = Expr();
526+
counter = Expr();
527527
}
528528
}
529529
}
@@ -544,12 +544,12 @@ class InjectCounters : public IRMutator {
544544
if (!c.free_vars.count(name)) {
545545
continue;
546546
}
547-
for (int i = 0; i < num_counters; i++) {
548-
if (c.counters[i].defined() && expr_uses_var(c.counters[i], name)) {
547+
for (auto &counter : c.counters) {
548+
if (counter.defined() && expr_uses_var(counter, name)) {
549549
if (value_pure) {
550-
c.counters[i] = Let::make(name, value, c.counters[i]);
550+
counter = Let::make(name, value, counter);
551551
} else {
552-
c.counters[i] = Expr();
552+
counter = Expr();
553553
}
554554
}
555555
}

0 commit comments

Comments
 (0)