https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99309
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |hubicka at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> --- Have WIP patch to attach predicates to buildtin_constant_p and redirect to true if inliner works out that it is a constat (still relying on late passes to optimize the if branch well). >From all the options I can think of this seems best even though it may end up in relatively rare cases that we do the (very simple) propagation at IPA time and late optimizations won't. Without explicitly disabling passes (where I think this is fine to happen) all testcases we seen so far was of the form that constant was eventually propagated but only after we folded builtin_constant_p to false. Overall it is not possible to assure that builtin_constant_p on memory will fold to true only if all uses of the memory later in the if branch will ford to constant since AO has walking limits.