Simplify loop exit condition

This commit is contained in:
Dmitry Stogov 2022-09-20 10:42:38 +03:00
parent 23caf1e0d1
commit ba748d5bd4

4
ir.c
View File

@ -920,7 +920,7 @@ void ir_build_def_use_lists(ir_ctx *ctx)
for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) { for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) {
n = ir_input_edges_count(ctx, insn); n = ir_input_edges_count(ctx, insn);
for (j = 1, p = insn->ops + 1; j <= n; j++, p++) { for (j = n, p = insn->ops + 1; j > 0; j--, p++) {
def = *p; def = *p;
if (def > 0) { if (def > 0) {
lists[def].refs = -1; lists[def].refs = -1;
@ -937,7 +937,7 @@ void ir_build_def_use_lists(ir_ctx *ctx)
edges_count = 0; edges_count = 0;
for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) { for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) {
n = ir_input_edges_count(ctx, insn); n = ir_input_edges_count(ctx, insn);
for (j = 1, p = insn->ops + 1; j <= n; j++, p++) { for (j = n, p = insn->ops + 1; j > 0; j--, p++) {
def = *p; def = *p;
if (def > 0) { if (def > 0) {
ir_use_list *use_list = &lists[def]; ir_use_list *use_list = &lists[def];