https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107047
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2022-09-27 Keywords| |missed-optimization Known to fail| |12.2.1, 13.0 Ever confirmed|0 |1 Component|rtl-optimization |middle-end --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed, we see <bb 2> [local count: 1073741824]: f[1][6] = g_36; _1 = BIT_FIELD_REF <f[1][6], 32, 0>; _8 = _1 & 16777215; if (_8 != 0) VN probably sees the def but it doesn't consider replacing the use with a BIT_FIELD_REF of g_36, it just translates the ref but doesn't find any definition to CSE from. SRA says Candidate (1991): f Too big to totally scalarize: f (UID: 1991) Created a replacement for f offset: 848, size: 8: f$1$6$f1D.1996 Access trees for f (UID: 1991): access { base = (1991)'f', offset = 832, size = 64, expr = f[1][6], type = struct S6, reverse = 0, grp_read = 1, grp_write = 1, grp_assignment_read = 1, grp_assignment_write = 1, grp_scalar_read = 0, grp_scalar_write = 0, grp_total_scalarization = 0, grp_hint = 0, grp_covered = 0, grp_unscalarizable_region = 0, grp_unscalarized_data = 1, grp_same_access_path = 1, grp_partial_lhs = 0, grp_to_be_replaced = 0, grp_to_be_debug_replaced = 0} * access { base = (1991)'f', offset = 848, size = 8, expr = f[1][6].f1, type = char, reverse = 0, grp_read = 1, grp_write = 1, grp_assignment_read = 1, grp_assignment_write = 1, grp_scalar_read = 1, grp_scalar_write = 0, grp_total_scalarization = 0, grp_hint = 0, grp_covered = 1, grp_unscalarizable_region = 0, grp_unscalarized_data = 0, grp_same_access_path = 1, grp_partial_lhs = 0, grp_to_be_replaced = 1, grp_to_be_debug_replaced = 0} but somehow it does not create an access for _1 = BIT_FIELD_REF <f[1][6], 32, 0>; _2 = (unsigned int) _1; note the real offender here is (again) optimize_bit_field_compare ...