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.

Reply via email to