https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110228
--- Comment #26 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Sergei Trofimovich from comment #24)
> Trying to understand the failure mode here:
>
> In bug.c.033t.early_objsz I still see the explicit stores to LocalFlags:
>
> <bb 4> :
> LookupFlags_15 = 0;
> goto <bb 7>; [INV]
>
> <bb 5> :
> if (v_13 == 1)
> goto <bb 6>; [INV]
> else
> goto <bb 7>; [INV]
>
> <bb 6> :
> LookupFlags_14 = 1;
>
> <bb 7> :
> # LookupFlags_4 = PHI <LookupFlags_15(4), LookupFlags_5(5),
> LookupFlags_14(6)>
> *p_16(D) = LookupFlags_4;
>
> But in bug.c.034t.ccp1 I see no stores at all:
>
> if (v_13 == 0)
> goto <bb 6>; [INV]
> else
> goto <bb 4>; [INV]
>
> <bb 4> :
> if (v_13 == 1)
> goto <bb 5>; [INV]
> else
> goto <bb 6>; [INV]
>
> <bb 5> :
>
> <bb 6> :
> # LookupFlags_4 = PHI <0(3), LookupFlags_5(4), 1(5)>
>
> Specifically '# LookupFlags_4 = PHI <0(3), LookupFlags_5(4), 1(5)>' claims
> that somehow gets values '0' and '1' into a PHI node.
>
> AFAIU PHI is an equivalent of a mutable variable in an otherwise immutable
> SSA form. It has to be a write it needed value is not there yet. Why the
> store of '1' was removed? Is it because variable 'v_13' already happens to
> have 0 or 1 value?
>
> I wonder why PHI does not look like something below:
>
> # LookupFlags_4 = PHI <v_13(3), LookupFlags_5(4), v_13(5)>
LookupFlags is in SSA form thus we are dealing with registers and no "stores".
What happens is just constant propagation, LookupFlags_1{4,5} can be
replaced with their assigned constant.