https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116824
Bug ID: 116824 Summary: phiprop gets confused with vop phi Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: pinskia at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` int g(int i, int *tt) { const int t = 10; const int *a; { if (t < i) { *tt = 1; a = &t; } else { *tt = 1; a = &i; } } return *a; } ``` phiprop does not move the loads of PHI<&t,&i> into the branch but PRE is able to. This is because the check: if (!SSA_NAME_IS_DEFAULT_DEF (vuse) && (gimple_bb (def_stmt) == bb || (gimple_bb (def_stmt) && !dominated_by_p (CDI_DOMINATORS, bb, gimple_bb (def_stmt))))) goto next; is true as `gimple_bb (def_stmt) == bb` but def_stmt here is a phi. Note the code that was added to update the vuse manually in r14-1981-g85107abeb71bbf actually added support for phis.