aco: Fix -Wshadow warnings

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7430>
This commit is contained in:
Tony Wasserka
2020-11-03 14:40:05 +01:00
committed by Marge Bot
parent bc7f442d8e
commit 2bb8874320
16 changed files with 194 additions and 196 deletions
+24 -21
View File
@@ -55,7 +55,7 @@ struct wqm_ctx {
std::vector<bool> branch_wqm; /* true if the branch condition in this block should be in wqm */
bool loop;
bool wqm;
wqm_ctx(Program* program) : program(program),
wqm_ctx(Program* program_) : program(program_),
defined_in(program->peekAllocationId(), 0xFFFF),
needs_wqm(program->peekAllocationId()),
branch_wqm(program->blocks.size()),
@@ -74,8 +74,8 @@ struct loop_info {
bool has_divergent_break;
bool has_divergent_continue;
bool has_discard; /* has a discard or demote */
loop_info(Block* b, uint16_t num, uint8_t needs, bool breaks, bool cont, bool discard) :
loop_header(b), num_exec_masks(num), needs(needs), has_divergent_break(breaks),
loop_info(Block* b, uint16_t num, uint8_t needs_, bool breaks, bool cont, bool discard) :
loop_header(b), num_exec_masks(num), needs(needs_), has_divergent_break(breaks),
has_divergent_continue(cont), has_discard(discard) {}
};
@@ -93,7 +93,7 @@ struct exec_ctx {
std::vector<block_info> info;
std::vector<loop_info> loop;
bool handle_wqm = false;
exec_ctx(Program *program) : program(program), info(program->blocks.size()) {}
exec_ctx(Program *program_) : program(program_), info(program->blocks.size()) {}
};
bool pred_by_exec_mask(aco_ptr<Instruction>& instr) {
@@ -475,23 +475,26 @@ unsigned add_coupling_code(exec_ctx& ctx, Block* block,
/* fill the loop header phis */
std::vector<unsigned>& header_preds = header->linear_preds;
int k = 0;
int instr_idx = 0;
if (info.has_discard) {
while (k < info.num_exec_masks - 1) {
aco_ptr<Instruction>& phi = header->instructions[k];
while (instr_idx < info.num_exec_masks - 1) {
aco_ptr<Instruction>& phi = header->instructions[instr_idx];
assert(phi->opcode == aco_opcode::p_linear_phi);
for (unsigned i = 1; i < phi->operands.size(); i++)
phi->operands[i] = Operand(ctx.info[header_preds[i]].exec[k].first);
k++;
phi->operands[i] = Operand(ctx.info[header_preds[i]].exec[instr_idx].first);
instr_idx++;
}
}
aco_ptr<Instruction>& phi = header->instructions[k++];
assert(phi->opcode == aco_opcode::p_linear_phi);
for (unsigned i = 1; i < phi->operands.size(); i++)
phi->operands[i] = Operand(ctx.info[header_preds[i]].exec[info.num_exec_masks - 1].first);
{
aco_ptr<Instruction>& phi = header->instructions[instr_idx++];
assert(phi->opcode == aco_opcode::p_linear_phi);
for (unsigned i = 1; i < phi->operands.size(); i++)
phi->operands[i] = Operand(ctx.info[header_preds[i]].exec[info.num_exec_masks - 1].first);
}
if (info.has_divergent_break) {
aco_ptr<Instruction>& phi = header->instructions[k];
aco_ptr<Instruction>& phi = header->instructions[instr_idx];
assert(phi->opcode == aco_opcode::p_linear_phi);
for (unsigned i = 1; i < phi->operands.size(); i++)
phi->operands[i] = Operand(ctx.info[header_preds[i]].exec[info.num_exec_masks].first);
@@ -501,17 +504,17 @@ unsigned add_coupling_code(exec_ctx& ctx, Block* block,
/* create the loop exit phis if not trivial */
bool need_parallelcopy = false;
for (unsigned k = 0; k < info.num_exec_masks; k++) {
Temp same = ctx.info[preds[0]].exec[k].first;
uint8_t type = ctx.info[header_preds[0]].exec[k].second;
for (unsigned exec_idx = 0; exec_idx < info.num_exec_masks; exec_idx++) {
Temp same = ctx.info[preds[0]].exec[exec_idx].first;
uint8_t type = ctx.info[header_preds[0]].exec[exec_idx].second;
bool trivial = true;
for (unsigned i = 1; i < preds.size() && trivial; i++) {
if (ctx.info[preds[i]].exec[k].first != same)
if (ctx.info[preds[i]].exec[exec_idx].first != same)
trivial = false;
}
if (k == info.num_exec_masks - 1u) {
if (exec_idx == info.num_exec_masks - 1u) {
bool all_liveout_exec = true;
bool all_not_liveout_exec = true;
for (unsigned pred : preds) {
@@ -532,12 +535,12 @@ unsigned add_coupling_code(exec_ctx& ctx, Block* block,
/* create phi for loop footer */
aco_ptr<Pseudo_instruction> phi{create_instruction<Pseudo_instruction>(aco_opcode::p_linear_phi, Format::PSEUDO, preds.size(), 1)};
phi->definitions[0] = bld.def(bld.lm);
if (k == info.num_exec_masks - 1u) {
if (exec_idx == info.num_exec_masks - 1u) {
phi->definitions[0].setFixed(exec);
need_parallelcopy = false;
}
for (unsigned i = 0; i < phi->operands.size(); i++)
phi->operands[i] = Operand(ctx.info[preds[i]].exec[k].first);
phi->operands[i] = Operand(ctx.info[preds[i]].exec[exec_idx].first);
ctx.info[idx].exec.emplace_back(bld.insert(std::move(phi)), type);
}
}