VarAction2: Limit iteration count when substituting variable loads

This commit is contained in:
Jonathan G Rennison
2022-10-05 17:41:49 +01:00
parent abe49c0b83
commit 9e95b3d807

View File

@@ -814,7 +814,9 @@ void OptimiseVarAction2Adjust(VarAction2OptimiseState &state, const GrfSpecFeatu
} }
VarAction2AdjustInferenceFlags non_const_var_inference = VA2AIF_NONE; VarAction2AdjustInferenceFlags non_const_var_inference = VA2AIF_NONE;
while (adjust.variable == 0x7D) { int iteration = 32;
while (adjust.variable == 0x7D && iteration > 0) {
iteration--;
non_const_var_inference = VA2AIF_NONE; non_const_var_inference = VA2AIF_NONE;
auto iter = state.temp_stores.find(adjust.parameter & 0xFF); auto iter = state.temp_stores.find(adjust.parameter & 0xFF);
if (iter == state.temp_stores.end()) { if (iter == state.temp_stores.end()) {