https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128385
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2026-11-03
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm not sure how you'd get this into GVN-PRE, there's similar missed
optimizations for VN itself, _3 and _1 do not get the same value number.
VN does not have a table of requivalences it would use to find a leader
of an expression. Querying the somewhat ad-hoc way we do "predication"
is not going to work and the predicated value infrastructure is special-cased
on NARY hashtable entries, not on the SSA value (vn_ssa_aux), so we cannot
record a set of predicated value-numbers for an SSA name (I'm not sure that
would be a good idea). Instead the "classical" way is doing conditional
copy propagation here, but that comes with its own issues with regard to
pointer provenance.
Value numbering stmt = if (a_6(D) == b_7(D))
Recording on edge 2->3 a_6(D) eq_expr b_7(D) == true
Recording on edge 2->4 a_6(D) eq_expr b_7(D) == false
Recording on edge 2->3 a_6(D) ne_expr b_7(D) == false
Recording on edge 2->4 a_6(D) ne_expr b_7(D) == true
marking outgoing edge 2 -> 3 executable
marking outgoing edge 2 -> 4 executable
Processing block 1: BB4
Value numbering stmt = _3 = *b_7(D);
Setting value number of _3 to _3 (changed)
Making available beyond BB4 _3 for value _3
Value numbering stmt = _4 = *c_9(D);
Setting value number of _4 to _4 (changed)
Making available beyond BB4 _4 for value _4
Value numbering stmt = _10 = _3 + _4;
Setting value number of _10 to _10 (changed)
marking outgoing edge 4 -> 5 executable
Making available beyond BB4 _10 for value _10
Processing block 2: BB3
Value numbering stmt = _1 = *a_6(D);
Setting value number of _1 to _1 (changed)
Making available beyond BB3 _1 for value _1
Value numbering stmt = _2 = *c_9(D);
Setting value number of _2 to _4 (changed)
Making available beyond BB3 _2 for value _4
Value numbering stmt = _11 = _1 + _2;
Setting value number of _11 to _11 (changed)