https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100366
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- The issue is that FRE sees <bb 2> [local count: 1073741824]: _6 = vec_2(D)->D.33436._M_impl.D.32749._M_start; _7 = vec_2(D)->D.33436._M_impl.D.32749._M_finish; if (_6 != _7) goto <bb 3>; [70.00%] else goto <bb 4>; [30.00%] <bb 3> [local count: 751619281]: vec_2(D)->D.33436._M_impl.D.32749._M_finish = _6; <bb 4> [local count: 1073741824]: _5 = MEM[(char * const &)vec_2(D) + 8]; so clearly _5 is _not_ equal to _7 but on the path 2 -> 3 -> 4 it is equal to _6. Only PRE transforms the load in _5 to a select of both (a PHI node): <bb 2> [local count: 1073741824]: _6 = vec_2(D)->D.33436._M_impl.D.32749._M_start; _7 = vec_2(D)->D.33436._M_impl.D.32749._M_finish; if (_6 != _7) goto <bb 4>; [70.00%] else goto <bb 3>; [30.00%] <bb 3> [local count: 322122544]: _86 = _7 - _6; _125 = (sizetype) _86; goto <bb 5>; [100.00%] <bb 4> [local count: 751619281]: vec_2(D)->D.33436._M_impl.D.32749._M_finish = _6; <bb 5> [local count: 1073741824]: # prephitmp_141 = PHI <_7(3), _6(4)> # prephitmp_83 = PHI <_86(3), 0(4)> # prephitmp_65 = PHI <_125(3), 0(4)> _21 = vec_2(D)->D.33436._M_impl.D.32749._M_end_of_storage; PRE also removes some partial redundancies here (the other two PHIs).