https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128696
Bug ID: 128696
Summary: ANTIC compute fails to translate and re-value-number
refs in blocks without PHIs
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
gcc.dg/tree-ssa/ssa-hoist-9.c shows that when dropping the last_vuse associated
hashtable entry for VARYING loads from visit_reference_loop_load,
<bb 2> [local count: 1073741824]:
if (flag_6(D) != 0)
goto <bb 3>; [50.00%]
else
goto <bb 4>; [50.00%]
<bb 4> [local count: 536870912]:
res_9 = *a_8(D);
*a_8(D) = 1;
_3 = *b_11(D);
res_12 = _3 + res_9;
the expression for *b_11(D) has .MEM_10 as VUSE and a distinct value from
the same load in BB 3 which has .MEM_7(D) as VUSE. But ANTIC compute
for an edge with no PHI nodes to translate through fails to
translate_vuse_through_block - as that function says
/* We have pruned expressions that are killed in PHIBLOCK via
prune_clobbered_mems but we have not rewritten the VUSE to the one
live at the start of the block. If there is no virtual PHI to translate
through return the VUSE live at entry. Otherwise the VUSE to translate
is the def of the virtual PHI node. */
and the PHI translation would have performed a lookup of the *b_11(D)
expression with the translated use.
A fix might be as simple as not optimizing away the phi-translation,
at least for REFERENCE expressions where this matters or do this part
of the rewrite in the natural place when we also prune_clobbered_mems.