This change implements four basic optimizations:
- If a relocated value isn't used, it doesn't need to be relocated.
- If the value being relocated is null, relocation doesn't change that. (Technically, this might be collector specific. I don't know of one which it doesn't work for though.)
- If the value being relocated is undef, the relocation is meaningless.
- If the value being relocated was known nonnull, the relocated pointer also isn't null. (Since it points to the same source language object.)
I outlined other planned work in comments.