tree-optimization/118405 - ICE with vector(1) T vs T load
Checks
| Context |
Check |
Description |
| rivoscibot/toolchain-ci-rivos-apply-patch |
success
|
Patch applied
|
| rivoscibot/toolchain-ci-rivos-lint |
success
|
Lint passed
|
| rivoscibot/toolchain-ci-rivos-build--newlib-rv64gcv-lp64d-multilib |
success
|
Build passed
|
| rivoscibot/toolchain-ci-rivos-build--linux-rv64gc_zba_zbb_zbc_zbs-lp64d-multilib |
success
|
Build passed
|
| rivoscibot/toolchain-ci-rivos-build--linux-rv64gcv-lp64d-multilib |
success
|
Build passed
|
| rivoscibot/toolchain-ci-rivos-test |
success
|
Testing passed
|
| linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
Commit Message
When vectorizing a load we are now checking alignment before emitting
a vector(1) T load instead of blindly assuming it's OK when we had
a scalar T load. For reasons we're not handling alignment computation
optimally here but we shouldn't ICE when we fall back to loads of T.
The following ensures the IL remains correct by emitting VIEW_CONVERT
from T to vector(1) T when needed. It also removes an earlier fix
done in r9-382-gbb4e47476537f6 for the same issue with VMAT_ELEMENTWISE.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
PR tree-optimization/118405
* tree-vect-stmts.cc (vectorizable_load): When we fall back
to scalar loads make sure we properly convert to vector(1) T
when there was only a single vector element.
---
gcc/tree-vect-stmts.cc | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
@@ -10731,9 +10731,6 @@ vectorizable_load (vec_info *vinfo,
/* Else fall back to the default element-wise access. */
ltype = build_aligned_type (ltype, TYPE_ALIGN (TREE_TYPE (vectype)));
}
- /* Load vector(1) scalar_type if it's 1 element-wise vectype. */
- else if (nloads == 1)
- ltype = vectype;
if (slp)
{
@@ -10782,11 +10779,11 @@ vectorizable_load (vec_info *vinfo,
group_el * elsz + cst_offset);
tree data_ref = build2 (MEM_REF, ltype, running_off, this_off);
vect_copy_ref_info (data_ref, DR_REF (first_dr_info->dr));
- new_stmt = gimple_build_assign (make_ssa_name (ltype), data_ref);
+ new_temp = make_ssa_name (ltype);
+ new_stmt = gimple_build_assign (new_temp, data_ref);
vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi);
if (nloads > 1)
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
- gimple_assign_lhs (new_stmt));
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, new_temp);
group_el += lnel;
if (! slp
@@ -10833,6 +10830,15 @@ vectorizable_load (vec_info *vinfo,
}
}
}
+ else if (!costing_p && ltype != vectype)
+ {
+ new_stmt = gimple_build_assign (make_ssa_name (vectype),
+ VIEW_CONVERT_EXPR,
+ build1 (VIEW_CONVERT_EXPR,
+ vectype, new_temp));
+ vect_finish_stmt_generation (vinfo, stmt_info, new_stmt,
+ gsi);
+ }
if (!costing_p)
{