https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112970
Bug ID: 112970 Summary: LoongArch: Suboptimal code when the address and the value of an array element are both used Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: xry111 at gcc dot gnu.org Target Milestone: --- int d[2]; struct r { int *p, v; }; struct r test() { return (struct r){&d[1], d[1]}; } is compiled to: la.local $r12,.LANCHOR0 ld.wu $r5,$r12,4 la.local $r4,.LANCHOR0+4 But it's better to be: la.local $r4,.LANCHOR0+4 ld.wu $r5,$r4,0