https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94573
Bug ID: 94573 Summary: Optimizer produces suboptimal code related to -fstore-merging Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: zhongyunde at tom dot com Target Milestone: --- For the following code, we can known init the array C000016DD is always consecutive, so we can use the more bigger mode size. test base on the x86-64 gcc 9.2 on https://gcc.godbolt.org/, now it is still handled DWORD by DWORD, and we except optimize it with QWORD or more bigger size. extern signed int C000016DD[43][12]; void C00001F93(int index) { C000016DD[index][0] = 0; C000016DD[index][1] = 0; C000016DD[index][2] = 0; C000016DD[index][3] = 0; C000016DD[index][4] = 0; C000016DD[index][5] = 0; C000016DD[index][6] = 0; C000016DD[index][7] = 0; return; } ============= related assemble ============= C00001F93(int): movsx rdi, edi lea rax, [rdi+rdi*2] sal rax, 4 mov DWORD PTR C000016DD[rax], 0 mov DWORD PTR C000016DD[rax+4], 0 mov DWORD PTR C000016DD[rax+8], 0 mov DWORD PTR C000016DD[rax+12], 0 mov DWORD PTR C000016DD[rax+16], 0 mov DWORD PTR C000016DD[rax+20], 0 mov DWORD PTR C000016DD[rax+24], 0 mov DWORD PTR C000016DD[rax+28], 0 ret