Skip to content

[x86 / Refactor] Minor logic fix in aoc_ForceNewIteration check

Summary

This merge request fixes a minor logic error in the aoc_ForceNewIteration check where UpdateUsedRegs was called when p was not a member of SkipInstr, when instead it should be called when the opposite is true. The intent was to avoid calling UpdateUsedRegs unnecessarily and thus save some CPU cycles, but the condition is back-to-front.

System

  • Processor architecture: i386, x86_64

What is the current bug behavior?

Currently, UpdateUsedRegs is called when p is not a member of SkipInstr, which is when it's something like a label or an instruction, and this will cause UpdateUsedRegs to immediately exit. On the other hand, if p is a member of SkipInstr, then UpdateUsedRegs is not called and p is changed to p.Next, which may cause a register tracking inconsistency if p was originally of type tai_regalloc.

What is the behavior after applying this patch?

Such a possible register tracking fault should no longer occur.

Relevant logs and/or screenshots

Currently the bug is not known to manifest and cause bad code, but it is better to be safe than sorry.

Edited by J. Gareth "Kit" Moreton

Merge request reports