[CodeGen] Refactor rematerializer unit tests to reduce boilerplate (NFC) (#197575)
Taking inspiration from other unit tests, this refactors the
rematerializer's unit tests with the aim of reducing the amount of
repetitive boilerplate code in each individual test, making the addition
of new tests easier/faster in the future.
Each unit test defines some input MIR to instantiate a rematerializer
on; a user-provided callback is then invoked with a pre-initialized
rematerializer wrapped in a helper object that factors out as much
common verification logic as possible.