Using x - 0 = x or x*(-1)=-x should not be done during constant folding (separation of concerns...).
We should only incorporate those arithmetic identities which produce a constant value like x * 0 = 0 or x % 1 = 0. Explicit simplification should be unnecessary because those are used implicitly on tarval computation and the tarval then signals constness, which leads to replacement during the normal constant folder cleanup.
Using
x - 0 = x
orx*(-1)=-x
should not be done during constant folding (separation of concerns...).We should only incorporate those arithmetic identities which produce a constant value like
x * 0 = 0
orx % 1 = 0
. Explicit simplification should be unnecessary because those are used implicitly on tarval computation and the tarval then signals constness, which leads to replacement during the normal constant folder cleanup.