https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99089 --- Comment #2 from Jim Wilson <wilson at gcc dot gnu.org> --- I don't know if REE can do this optimization, but it is a good place to start looking.