https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113907
--- Comment #54 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Slightly adjusted #c41 testcase, which indeed still fails with my patch at -O2: int d[100], c; static __attribute__((noinline)) int foo (int x, unsigned int y) { if (y > 30) ++c; return x + y; } static int bar (unsigned int x) { if (x > 100) __builtin_unreachable (); if (__builtin_expect (d[x] != 0, 1)) return d[x]; for (int j = 0; j < 100; j++) d[x] += foo (d[j], x & 1 ? x + 17 : x + 16); return d[x]; } static int baz (unsigned int x) { if (x > 10) __builtin_unreachable (); if (__builtin_expect (d[x] != 0, 1)) return d[x]; for (int j = 0; j < 100; j++) d[x] += foo (d[j], x & 1 ? x + 17 : x + 16); return d[x]; } int main () { int r = baz (1) + baz (2) + baz (3) + bar (4) + bar (30); if (c != 100) __builtin_abort (); return r; } I still think we want both my patch and some fix for the jump functions, not just the latter. Anyway, can we in the spot my patch changed just walk all source->node->callees cgraph_edges, for each of them find the corresponding cgraph_edge in the alias and for each walk all the jump_functions recorded and union their m_vr? Or is that something that can't be done in LTO for some reason?