https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102513
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- A simple workaround is to add at the begining of the function: if (level == 0) return 0; What I found is since we don't run loop copy header until after IPA-CP, we get some interesting IR where we don't jump thread the level == 0 case correctly.