diff options
author | Joel Hutton <joel.hutton@arm.com> | 2021-12-10 10:26:42 +0000 |
---|---|---|
committer | Joel Hutton <joel.hutton@arm.com> | 2021-12-10 10:28:01 +0000 |
commit | a5f65cf7ad640ae398eba7a45c712322ce841809 (patch) | |
tree | ab066b3b66409b732938c03d21ac6c918132246e /gcc/tree-vect-loop.c | |
parent | db184a3453b6fe810e2d9765ef8ed9028f96e968 (diff) | |
download | gcc-a5f65cf7ad640ae398eba7a45c712322ce841809.zip gcc-a5f65cf7ad640ae398eba7a45c712322ce841809.tar.gz gcc-a5f65cf7ad640ae398eba7a45c712322ce841809.tar.bz2 |
pr103523: Check for PLUS/MINUS support
Check for PLUS_EXPR/MINUS_EXPR support in vectorizable_induction.
PR103523 is an ICE on valid code:
void d(float *a, float b, int c) {
float e;
for (; c; c--, e += b)
a[c] = e;
}
This is due to not checking for PLUS_EXPR support, which is missing in
VNx2sf mode. This causes an ICE at expand time. This patch adds a check
for support in vectorizable_induction.
gcc/ChangeLog:
PR tree-optimization/103523
* tree-vect-loop.c (vectorizable_induction): Check for
PLUS_EXPR/MINUS_EXPR support.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/pr103523.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 7f544ba..f700d5e 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -8065,6 +8065,15 @@ vectorizable_induction (loop_vec_info loop_vinfo, return false; } + step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_info); + gcc_assert (step_expr != NULL_TREE); + tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype); + + /* Check for backend support of PLUS/MINUS_EXPR. */ + if (!directly_supported_p (PLUS_EXPR, step_vectype) + || !directly_supported_p (MINUS_EXPR, step_vectype)) + return false; + if (!vec_stmt) /* transformation not required. */ { unsigned inside_cost = 0, prologue_cost = 0; @@ -8124,10 +8133,6 @@ vectorizable_induction (loop_vec_info loop_vinfo, if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "transform induction phi.\n"); - step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_info); - gcc_assert (step_expr != NULL_TREE); - tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype); - pe = loop_preheader_edge (iv_loop); /* Find the first insertion point in the BB. */ basic_block bb = gimple_bb (phi); |