return false;
};
}
+
+static inline void
+set_best_compile(struct v3d_compile **best, struct v3d_compile *c)
+{
+ if (*best)
+ vir_compile_destroy(*best);
+ *best = c;
+}
+
uint64_t *v3d_compile(const struct v3d_compiler *compiler,
struct v3d_key *key,
struct v3d_prog_data **out_prog_data,
if (c->spills == 0 ||
strategies[strat].min_threads == 4 ||
V3D_DBG(OPT_COMPILE_TIME)) {
- best_c = c;
+ set_best_compile(&best_c, c);
break;
} else if (c->spills + c->fills <
best_spill_fill_count) {
- best_c = c;
+ set_best_compile(&best_c, c);
best_spill_fill_count = c->spills + c->fills;
}
}
/* If the best strategy was not the last, choose that */
- if (best_c && c != best_c) {
- vir_compile_destroy(c);
- c = best_c;
- }
+ if (best_c && c != best_c)
+ set_best_compile(&c, best_c);
if (V3D_DBG(PERF) &&
c->compilation_result !=