https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100063
Bug ID: 100063 Summary: VN predication is weak Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- We are currently handling the following in FRE1, if you drop the *other = 1 store we run into the limitation that we record predicated values "on BBs" (the single_pred_p condition in vn_nary_op_insert_pieces_predicated) which results in this artificial limitation when considering optimistic VN and not executable edges. Predicates should be recorded on edges instead. void bar (); void foo (int pred, int *other) { *other = 0; if (*other) goto cnt; if (pred) { *other = 1; // necessary cnt: if (!pred) bar (); } }