Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit fd3ce69

Browse files
committed
Compilation fix for -Werror=shadow-compatible-local
I am hitting these errors internally. But this option doesn't seem to be available in default gcc. Or I might be doing something stupid. What I tried - I added -Werror=shadow-compatible-local to the cmake argument link along with -Werror. Also google shows not a lot of references of this option, first one is from Jim, which makes me thing it is not common. So I figured out I am going to just fix the code for now.
1 parent 09ce450 commit fd3ce69

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

tc/autotuner/genetic_search.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ TuningConfiguration GeneticSearch::crossover(
230230
}
231231
};
232232

233-
for (size_t i = 0; i < kMutateIterations; ++i) {
233+
for (size_t iter = 0; iter < kMutateIterations; ++iter) {
234234
TuningConfiguration child{a};
235235
auto params = child.collectParameters();
236236
for (size_t i = 0; i < params.size(); ++i) {

tc/core/halide2isl.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,12 @@ isl::schedule makeScheduleTreeHelper(
402402
// this loop var at the same index.
403403
isl::multi_union_pw_aff mupa;
404404
body.get_domain().foreach_set([&](isl::set s) {
405-
isl::aff loopVar(
405+
isl::aff newLoopVar(
406406
isl::local_space(s.get_space()), isl::dim_type::set, thisLoopIdx);
407407
if (mupa) {
408-
mupa = mupa.union_add(isl::union_pw_aff(isl::pw_aff(loopVar)));
408+
mupa = mupa.union_add(isl::union_pw_aff(isl::pw_aff(newLoopVar)));
409409
} else {
410-
mupa = isl::union_pw_aff(isl::pw_aff(loopVar));
410+
mupa = isl::union_pw_aff(isl::pw_aff(newLoopVar));
411411
}
412412
});
413413

@@ -420,9 +420,9 @@ isl::schedule makeScheduleTreeHelper(
420420
// Build a schedule tree for both members of the block and
421421
// combine them in a sequence.
422422
std::vector<isl::schedule> schedules;
423-
for (Stmt s : stmts) {
423+
for (Stmt stmt : stmts) {
424424
schedules.push_back(makeScheduleTreeHelper(
425-
s, set, outer, reads, writes, accesses, statements, iterators));
425+
stmt, set, outer, reads, writes, accesses, statements, iterators));
426426
}
427427
schedule = schedules[0].sequence(schedules[1]);
428428

tc/core/polyhedral/schedule_transforms.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,9 @@ isl::multi_union_pw_aff infixScheduleMupa(
463463
prefix = prefix.intersect_domain(domain);
464464
prefix = foldl(
465465
filterType<ScheduleTreeElemBand>(tree->ancestors(relativeRoot)),
466-
[](const ScheduleTree* st, isl::multi_union_pw_aff prefix) {
466+
[](const ScheduleTree* st, isl::multi_union_pw_aff pref) {
467467
auto mupa = st->elemAs<ScheduleTreeElemBand>()->mupa_;
468-
return prefix.flat_range_product(mupa);
468+
return pref.flat_range_product(mupa);
469469
},
470470
prefix);
471471
return prefix;

tc/core/polyhedral/schedule_tree.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,7 @@ vector<const ScheduleTree*> ScheduleTree::collectDFSPostorder(
326326
vector<const ScheduleTree*> ScheduleTree::collectDFSPostorder(
327327
const ScheduleTree* tree,
328328
detail::ScheduleTreeType type) {
329-
auto filterType = [type](const ScheduleTree* tree) {
330-
return tree->type_ == type;
331-
};
329+
auto filterType = [type](const ScheduleTree* t) { return t->type_ == type; };
332330
return functional::Filter(filterType, collectDFSPostorder(tree));
333331
}
334332

@@ -345,9 +343,7 @@ vector<const ScheduleTree*> ScheduleTree::collectDFSPreorder(
345343
vector<const ScheduleTree*> ScheduleTree::collectDFSPreorder(
346344
const ScheduleTree* tree,
347345
detail::ScheduleTreeType type) {
348-
auto filterType = [type](const ScheduleTree* tree) {
349-
return tree->type_ == type;
350-
};
346+
auto filterType = [type](const ScheduleTree* t) { return t->type_ == type; };
351347
return functional::Filter(filterType, collectDFSPreorder(tree));
352348
}
353349

tc/core/tc2halide.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,11 +724,11 @@ void translateComprehension(
724724

725725
if (added_implicit_initialization) {
726726
// Also reorder reduction initializations to the TC convention
727-
vector<Var> lhs = func.args();
727+
vector<Var> funcArgs = func.args();
728728
loop_nest.clear();
729-
while (!lhs.empty()) {
730-
loop_nest.push_back(lhs.back());
731-
lhs.pop_back();
729+
while (!funcArgs.empty()) {
730+
loop_nest.push_back(funcArgs.back());
731+
funcArgs.pop_back();
732732
}
733733
func.reorder(loop_nest);
734734
}

0 commit comments

Comments
 (0)