Basically what the patch does is when we cannot legalize an instruction but there are still legalization artifacts around, push it into a retry list instead of aborting right away. The rationale is that the legalization may have been prevented because the legalization of the instruction couldn't cope with the artifacts in the middle.
This is an RFC/WIP patch, in particular, there are no check whether the element in the retry list got removed, no check for loops (e.g., failed legalization actually inserts a bunch of artifacts and will keep being reapplied over and over) and so on and so forth.
The initial motivation for this patch was to simplify something like opToLegalize (zext(trunc cst)) into opToLegalize cst, i.e., the zext(trunc) chain (which is a legalization artifact) is in the way of the constant whereas opToLegalize may rely on those not being here.
Unfortunately this is not quite enough because legalization artifacts are turned into copies: opToLegalize zext(trunc cst) => opToLegalize (copy cst), so the legalization of opToLegalize still has to look through something.