AArch64: Avoid the ICE on empty reduction definition in info_for_reduction [PR110625]
Fix the assertion failure on empty reduction define in info_for_reduction. Even a stmt is live, it may still have empty reduction define. Check the reduction definition instead of live info before calling info_for_reduction. gcc/ChangeLog: PR target/110625 * config/aarch64/aarch64.cc (aarch64_force_single_cycle): check STMT_VINFO_REDUC_DEF to avoid failures in info_for_reduction. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pr110625_3.c: New testcase.
This commit is contained in:
parent
51e5a5cefb
commit
4d8b556317
2 changed files with 36 additions and 1 deletions
|
@ -16776,7 +16776,7 @@ aarch64_adjust_stmt_cost (vect_cost_for_stmt kind, stmt_vec_info stmt_info,
|
|||
static bool
|
||||
aarch64_force_single_cycle (vec_info *vinfo, stmt_vec_info stmt_info)
|
||||
{
|
||||
if (!STMT_VINFO_LIVE_P (stmt_info))
|
||||
if (!STMT_VINFO_REDUC_DEF (stmt_info))
|
||||
return false;
|
||||
|
||||
auto reduc_info = info_for_reduction (vinfo, stmt_info);
|
||||
|
|
35
gcc/testsuite/gcc.target/aarch64/pr110625_3.c
Normal file
35
gcc/testsuite/gcc.target/aarch64/pr110625_3.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O3 -mcpu=neoverse-n2" } */
|
||||
|
||||
/* Avoid ICE on empty reduction def in info_for_reduction called by
|
||||
aarch64_force_single_cycle.
|
||||
|
||||
E.g.
|
||||
<bb 3> [local count: 858993456]:
|
||||
# sum_18 = PHI <sum_15(5), 0(2)>
|
||||
sum.0_5 = (unsigned int) sum_18;
|
||||
_6 = _4 + sum.0_5; <-- it is "live" but doesn't have reduction def
|
||||
sum_15 = (int) _6;
|
||||
...
|
||||
if (ivtmp_29 != 0)
|
||||
goto <bb 5>; [75.00%]
|
||||
else
|
||||
goto <bb 4>; [25.00%]
|
||||
|
||||
<bb 5> [local count: 644245086]:
|
||||
goto <bb 3>; [100.00%]
|
||||
|
||||
<bb 4> [local count: 214748368]:
|
||||
# _31 = PHI <_6(3)>
|
||||
_8 = _31 >> 1;
|
||||
*/
|
||||
|
||||
int
|
||||
f (unsigned int *tmp)
|
||||
{
|
||||
int sum = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
sum += tmp[i];
|
||||
|
||||
return (unsigned int) sum >> 1;
|
||||
}
|
Loading…
Add table
Reference in a new issue