https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123385
Bug ID: 123385
Summary: GCC failed loop strength reduction for vectorized IV
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: liuhongt at gcc dot gnu.org
Target Milestone: ---
__attribute__((aligned(64) )) float a[10000];
int foo()
{
for (int i = 0; i < 10000; i++)
{
a[i] = (float)(i * 10);
}
return 0;
}
After vectorization:
<bb 3> [local count: 1063004408]:
# vect_vec_iv_.4_9 = PHI <_8(5), { 0, 1, 2, 3 }(2)>
# ivtmp.12_4 = PHI <ivtmp.12_10(5), ivtmp.12_1(2)>
vect__1.5_13 = vect_vec_iv_.4_9 * { 10, 10, 10, 10 };
vect__2.6_14 = (vector(4) float) vect__1.5_13;
# DEBUG i => NULL
# DEBUG BEGIN_STMT
_2 = (void *) ivtmp.12_4;
MEM <vector(4) float> [(float *)_2] = vect__2.6_14;
# DEBUG BEGIN_STMT
# DEBUG i => NULL
# DEBUG BEGIN_STMT
_8 = vect_vec_iv_.4_9 + { 4, 4, 4, 4 };
ivtmp.12_10 = ivtmp.12_4 + 16;
if (ivtmp.12_10 != _3)
goto <bb 5>; [98.99%]
else
goto <bb 4>; [1.01%]
<bb 5> [local count: 1052266995]:
goto <bb 3>; [100.00%]
This:
# vect_vec_iv_.4_9 = PHI <_8(5), { 0, 1, 2, 3 }(2)>
vect__1.5_13 = vect_vec_iv_.4_9 * { 10, 10, 10, 10 };
...
_8 = vect_vec_iv_.4_9 + { 4, 4, 4, 4 };
Can be folded into
<bb 3> [local count: 1063004408]:
# vect_vec_iv_.4_9 = PHI <_8(5), { 0, 10, 20, 30 }(2)>
vect__1.5_13 = vect_vec_iv_.4_9
...
_8 = vect_vec_iv_.4_9 + { 40, 40, 40, 40 };