This patch changes the legalization order from top down to bottom up.
Also, this deletes trivially dead instructions while legalizing.
Additionally, the LegalizationCombiner tries to clean up artifacts before legalizeInstrStep. This lets the combiner clean up redundant extends/truncs before letting the target deal with them. This simplifies the legalization loop a little - where we don't need to have a separate list to track new legalization artifacts for combines - as we can try to clean up every artifact (vs just new ones).
I have updated AArch backend with this patch.
I thought the same with my original patch. I think this is fine to live here for now though especially if logging needs to be different.