VarAction2: Fix inference handling when pruning ops prior to RST

This commit is contained in:
Jonathan G Rennison 2022-08-21 19:15:01 +01:00
parent c60e3fed99
commit 3676b0912d

View File

@ -640,8 +640,8 @@ void OptimiseVarAction2Adjust(VarAction2OptimiseState &state, const GrfSpecFeatu
} }
}); });
auto try_restore_inference_backup = [&]() { auto try_restore_inference_backup = [&](uint offset) {
if (state.inference_backup.adjust_size != 0 && state.inference_backup.adjust_size == (uint)group->adjusts.size()) { if (state.inference_backup.adjust_size != 0 && state.inference_backup.adjust_size == (uint)group->adjusts.size() - offset) {
state.inference = state.inference_backup.inference; state.inference = state.inference_backup.inference;
state.current_constant = state.inference_backup.current_constant; state.current_constant = state.inference_backup.current_constant;
} }
@ -845,7 +845,7 @@ void OptimiseVarAction2Adjust(VarAction2OptimiseState &state, const GrfSpecFeatu
} }
} }
if (removed) { if (removed) {
state.inference = prev_inference; try_restore_inference_backup(1);
OptimiseVarAction2Adjust(state, feature, varsize, group, group->adjusts.back()); OptimiseVarAction2Adjust(state, feature, varsize, group, group->adjusts.back());
return; return;
} }
@ -882,7 +882,7 @@ void OptimiseVarAction2Adjust(VarAction2OptimiseState &state, const GrfSpecFeatu
break; break;
} }
} }
try_restore_inference_backup(); try_restore_inference_backup(0);
current.operation = DSGA_OP_RST; current.operation = DSGA_OP_RST;
current.adjust_flags = DSGAF_NONE; current.adjust_flags = DSGAF_NONE;
group->adjusts.push_back(current); group->adjusts.push_back(current);