Closed MattWindsor91 closed 3 years ago
I think this would become a new if
action set, something like:
x
with KV k
k
isn't INT_MIN
if (atomic_fetch_sub(x, k) > k) { /* dead code */ }
, or if (atomic_fetch_sub(x, k) >= k)
{ / surround / }, etc. Maybe have a flag that flicks between sub and add-negative, and maybe have a selection of relational operators that have/don't have equality inside.Probably a set of actions that look like this:
if.surround.kv-sub
if.insert.dead.kv-sub
(we don't have any deadcode if insertions yet, so the naming is speculative)
A variant of #237 concerns rewriting things like (C syntax, but this happens at the x86 level)
into something like
(and similarly for
atomic_fetch_sub(x, -y)
) with the idea that the locked subtract sets up the same flags on x86 that we'd use for the comparison anyway. We don't seem to hit this optimisation yet, so it might be worth having comparison generators that trip it.