https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117684
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Maybe some earlier commit on GCC 9 was needed for that one to fix the slowness, and that earlier commit was not backported to GCC 8.