https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70460
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Perhaps we can try to delegitimize the SET_SRC of def_insn or something similar to handle at least some -fPIC case where we'd want to turn indirect jumps into direct ones. Alan, do you have particular testcases (in the testsuite or in mind) that you wanted to handle with the new mini-pass? Tried int c; void foo (void) { int x = 0; static int b[] = { &&lab1 - &&lab0, &&lab2 - &&lab0 }; void *a = &&lab0 + b[x]; goto *a; lab1: c += 2; lab2: c++; lab0: ; } int main () { foo (); if (c != 3) __builtin_abort (); foo (); if (c != 6) __builtin_abort (); return 0; } (very much surprised nothing at GIMPLE level optimizes this), but that didn't used to be optimized at least with -fpic.