https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106378
Bug ID: 106378 Summary: Miss to handle ifn .LEN_STORE in DSE Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: linkw at gcc dot gnu.org CC: rguenth at gcc dot gnu.org, rsandifo at gcc dot gnu.org, segher at gcc dot gnu.org Depends on: 106365 Target Milestone: --- Target: powerpc*-linux-gnu +++ This bug was initially created as a clone of Bug #106365 +++ In PR106365, Richi has fixed the miss optimization on {MASK/LEN}_STORE by teaching VN about these IFNs. But it further exposes one miss optimization in DSE for LEN_STORE. With the option -O3 -mcpu=power10 -fno-vect-cost-model, check the optimized dumpings. -------------- for the case gcc/testsuite/gcc.dg/tree-ssa/pr84512.c, we expect to get: int foo () { <bb 2> [local count: 97603129]: return 285; } but it gets now: int foo () { int a[10]; <bb 2> [local count: 97603129]: .LEN_STORE (&MEM <int[10]> [(void *)&a + 32B], 128B, 8, { 64, 0, 0, 0, 81, 0, 0, 0, 100, 0, 0, 0, 121, 0, 0, 0 }, 0); a ={v} {CLOBBER(eol)}; return 285; } -------------- for the case Richi posted: int __attribute__((noinline,noclone)) foo () { int out[10]; int i; for (i = 0; i < 10; ++i) { out[i] = i; } return out[9]; } it gets: __attribute__((noclone, noinline)) int foo () { int out[10]; <bb 2> [local count: 97603129]: .LEN_STORE (&MEM <int[10]> [(void *)&out + 32B], 128B, 8, { 8, 0, 0, 0, 9, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0 }, 0); out ={v} {CLOBBER(eol)}; return 9; } Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106365 [Bug 106365] Miss to handle ifn .LEN_STORE in FRE