* Extract common optimizer tests (#52169) (cherry picked from commit e5ad72bc) * Hook in the optimizer rules (#52172) (cherry picked from commit 1f90d8cc)