diff options
author | Pengfei Li <Pengfei.Li2@arm.com> | 2025-07-30 10:54:14 +0100 |
---|---|---|
committer | Tamar Christina <tamar.christina@arm.com> | 2025-07-30 10:54:14 +0100 |
commit | 28310b3ff84616cea242cb4cef8f16b4538dbd22 (patch) | |
tree | 31d94b066fb13a87cde4626f56812a0a11e9f08d /gcc/gimple-loop-interchange.cc | |
parent | 46a862ef08f3c44780c8d9043ce16382d8a70ada (diff) | |
download | gcc-master.zip gcc-master.tar.gz gcc-master.tar.bz2 |
This fixes a miscompilation issue introduced by the enablement of
combined loop peeling and versioning. A test case that reproduces the
issue is included in the patch.
When performing loop peeling, GCC usually inserts a skip-vector check.
This ensures that after peeling, there are enough remaining iterations
to enter the main vectorized loop. Previously, the check was omitted if
loop versioning for alignment was applied. It was safe before because
versioning and peeling for alignment were mutually exclusive.
However, with combined peeling and versioning enabled, this is not safe
any more. A loop may be peeled and versioned at the same time. Without
the skip-vector check, the main vectorized loop can be entered even if
its iteration count is zero. This can cause the loop running many more
iterations than needed, resulting in incorrect results.
To fix this, the patch updates the condition of omitting the skip-vector
check to when versioning is performed alone without peeling.
gcc/ChangeLog:
PR tree-optimization/121020
* tree-vect-loop-manip.cc (vect_do_peeling): Update the
condition of omitting the skip-vector check.
* tree-vectorizer.h (LOOP_VINFO_USE_VERSIONING_WITHOUT_PEELING):
Add a helper macro.
gcc/testsuite/ChangeLog:
PR tree-optimization/121020
* gcc.dg/vect/vect-early-break_138-pr121020.c: New test.
Diffstat (limited to 'gcc/gimple-loop-interchange.cc')
0 files changed, 0 insertions, 0 deletions