diff options
-rw-r--r-- | gcc/config/aarch64/aarch64.cc | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/pr110625_3.c | 35 |
2 files changed, 36 insertions, 1 deletions
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index d4d7602..5b8d8fa 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -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); diff --git a/gcc/testsuite/gcc.target/aarch64/pr110625_3.c b/gcc/testsuite/gcc.target/aarch64/pr110625_3.c new file mode 100644 index 0000000..cdc2465 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr110625_3.c @@ -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; +} |