https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87055
Bug ID: 87055 Summary: Unoptimal address calculation Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: ubizjak at gmail dot com Target Milestone: --- Following testcase: --cut here-- int a[256]; int foo (int i) { return a[i+1]; } --cut here-- compiles on x86_64 (-O2) to: addl $1, %edi movslq %edi, %rdi movl a(,%rdi,4), %eax ret clang merges the addition with the address: movslq %edi, %rax movl a+4(,%rax,4), %eax retq Related: PR54589