https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101256
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I have a fix but I don't have a testcase really. What is happening is value_replacement is happening but since the ssa_name that is being used for replace_phi_edge_with_variable is not newly defined, we are adding the range info from something which was conditionally defined. To be able to make sure we are doing the range for a newly defined name, we need to pass the sequence of statements that get moved/added before conditional.