https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99309
--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> --- 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 was worried about this idea since this will still lead to some inconsistency since uses guarded by the __builtin_constnat_p may or may not be constant propagated and it seems logical to assume that in the block guarded by builtin_constnat_p the expression will indeed evaluate to compile time constant. However we can get similar inconsistencies with alias oracle walking limits as well, so these constructions are generally fragile (but seems increasingly common in C++ codebases). It would be still nice to have fre5 to constant propagate this. IPA analysis are very simplistics. Richi, any idea on this?