aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-09-02 10:16:28 +0200
committerRichard Biener <rguenther@suse.de>2025-09-02 18:14:13 +0200
commitedeb5b8258382a58e1ce8e1e79e61386250d42b2 (patch)
tree24fa9ee7bfb21b2b687207f764fb3974664804b7
parent9bbf0996bfcd249ef474a3da19831f66a8714319 (diff)
downloadgcc-edeb5b8258382a58e1ce8e1e79e61386250d42b2.zip
gcc-edeb5b8258382a58e1ce8e1e79e61386250d42b2.tar.gz
gcc-edeb5b8258382a58e1ce8e1e79e61386250d42b2.tar.bz2
tree-optimization/121753 - ICE with pattern breaking reduction constraints
The recent change to vect_synth_mult_by_constant missed to handle the synth_shift_p case for alg_shift, so we still changed c * 4 to c + c + c + c. The following also amends alg_add_t2_m, alg_sub_t2_m, alg_add_factor and alg_sub_factor appropriately. PR tree-optimization/121753 * tree-vect-patterns.cc (vect_synth_mult_by_constant): Properly bail when synth_shift_p and an alg_shift use. Handle other problematic cases.
-rw-r--r--gcc/tree-vect-patterns.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index 64a49cc..d0bf2f9 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -4329,7 +4329,14 @@ vect_synth_mult_by_constant (vec_info *vinfo, tree op, tree val,
case alg_add_t2_m:
case alg_sub_t2_m:
op_uses++;
+ /* Fallthru. */
+ case alg_shift:
+ if (synth_shift_p && alg.log[i])
+ return NULL;
break;
+ case alg_add_factor:
+ case alg_sub_factor:
+ return NULL;
default:
break;
}