public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: hongtao Liu <liuhongt@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2656] Check another epilog variable peeling case in vectorizable_nonlinear_induction. Date: Wed, 14 Sep 2022 07:46:47 +0000 (GMT) [thread overview] Message-ID: <20220914074647.1B2B2383FB8F@sourceware.org> (raw) https://gcc.gnu.org/g:93b09bf3246f413b8e469ebfd8ce43947c0073a6 commit r13-2656-g93b09bf3246f413b8e469ebfd8ce43947c0073a6 Author: liuhongt <hongtao.liu@intel.com> Date: Tue Sep 13 13:25:24 2022 +0800 Check another epilog variable peeling case in vectorizable_nonlinear_induction. in vectorizable_nonlinear_induction, r13-2503-gc13223b790bbc5 prevent variable peeling by only checking LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo). But when "!vect_use_loop_mask_for_alignment_p (loop_vinfo) && LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0", vectorizer will still do variable peeling for epilog, and it hits gcc_assert in vect_peel_nonlinear_iv_init. gcc/ChangeLog: PR tree-optimization/106905 * tree-vect-loop.cc (vectorizable_nonlinear_induction): Return false when !vect_use_loop_mask_for_alignment_p (loop_vinfo) && LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0. gcc/testsuite/ChangeLog: * gcc.target/i386/pr106905.c: New test. * gcc.target/ia64/pr106905.c: New test. Diff: --- gcc/testsuite/gcc.target/i386/pr106905.c | 14 ++++++++++++++ gcc/testsuite/gcc.target/ia64/pr106905.c | 20 ++++++++++++++++++++ gcc/tree-vect-loop.cc | 6 ++++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.target/i386/pr106905.c b/gcc/testsuite/gcc.target/i386/pr106905.c new file mode 100644 index 00000000000..a190a1c84e6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr106905.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-march=silvermont -O2 -fvect-cost-model=dynamic" } */ + +void +foo_mul_peel (int *a, int b) +{ + int i; + + for (i = 0; i < 7; ++i) + { + b *= 2; + a[i] = b; + } +} diff --git a/gcc/testsuite/gcc.target/ia64/pr106905.c b/gcc/testsuite/gcc.target/ia64/pr106905.c new file mode 100644 index 00000000000..1b9656e1203 --- /dev/null +++ b/gcc/testsuite/gcc.target/ia64/pr106905.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -O3 -fPIC" } */ +long ZDICT_fillNoise_p, ZDICT_trainFromBuffer_legacy_result; +unsigned ZDICT_fillNoise_acc; +int ZDICT_totalSampleSize_nbFiles; +static void ZDICT_fillNoise(void *buffer, long length) { + unsigned prime2 = 9; + for (ZDICT_fillNoise_p = 0; ZDICT_fillNoise_p < length; ZDICT_fillNoise_p++) + ZDICT_fillNoise_acc *= ((char *)buffer)[ZDICT_fillNoise_p] = prime2; +} +long ZDICT_trainFromBuffer_legacy() { + void *newBuff; + long total = 0; + for (; ZDICT_totalSampleSize_nbFiles;) + total += 0; + long sBuffSize = total; + newBuff = 0; + ZDICT_fillNoise(newBuff + sBuffSize, 32); + return ZDICT_trainFromBuffer_legacy_result; +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 8f88f1755be..9c434b66c5b 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -8646,8 +8646,10 @@ vectorizable_nonlinear_induction (loop_vec_info loop_vinfo, /* Also doens't support peel for neg when niter is variable. ??? generate something like niter_expr & 1 ? init_expr : -init_expr? */ niters_skip = LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo); - if (niters_skip != NULL_TREE - && TREE_CODE (niters_skip) != INTEGER_CST) + if ((niters_skip != NULL_TREE + && TREE_CODE (niters_skip) != INTEGER_CST) + || (!vect_use_loop_mask_for_alignment_p (loop_vinfo) + && LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
reply other threads:[~2022-09-14 7:46 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220914074647.1B2B2383FB8F@sourceware.org \ --to=liuhongt@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).