https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99309
--- Comment #7 from Jan Hubicka <hubicka at ucw dot cz> --- > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99309 > > --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > (In reply to Jan Hubicka from comment #5) > > As discussed, I can prepare patch to make inliner to redirect > > __builtin_constant_p to __builtin_true whenever inliner detect that the > > expression is compile time ocnstant. This will avoid us eventually hitting > > unreachable when late optimizations forget to make the transformation. > > I'm quite worried about that, the point of guarding something with > __builtin_constant_p is about the hope that the argument of that builtin will > evaluate to constant in the conditional block guarded by it. > By folding __builtin_constant_p to true if it sees it as constant but not > actually propagating that constant to all uses of that expression we could > have > the condition folded to true, but if SRA or FRE etc. is disabled or isn't able > to optimize it, we wouldn't have it constant. Yes, it is not good (this is why I did not implement it earlier). However you can trigger same problem without inline. Just put enough statements between the conditional and use so AO walk oracles gives up... Honza