https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126400
Bug ID: 126400
Summary: Improve TARGET_MEM_REF support for load factoring
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Target: aarch64
Created attachment 65128
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65128&action=edit
testcase
Take the attached testcase at -Os on aarch64.
We get in phiopt4:
```
if (_7 != 0)
goto <bb 4>; [50.00%]
else
goto <bb 5>; [50.00%]
<bb 4> [local count: 477815112]:
_23 = ivtmp.6_20 * 16;
_6 = MEM[(ix4 *)c_14(D) + _23 * 1];
goto <bb 6>; [100.00%]
<bb 5> [local count: 477815112]:
_24 = ivtmp.6_20 * 16;
_4 = MEM[(ix4 *)a_13(D) + _24 * 1];
<bb 6> [local count: 955630224]:
```
Right now the patch which adds support for TARGET_MEM_REF will reject this
because the index is different. But this could be supported.
Adding another phi is doable.