public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2
@ 2022-09-12  8:53 slyfox at gcc dot gnu.org
  2022-09-12  9:47 ` [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5 marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-09-12  8:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106905

            Bug ID: 106905
           Summary: [13 Regression] ia64: ICE in in
                    vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412
                    on zstd-1.5.2
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

The error apepared in this week's gcc-weekly snapshot. Original failure happens
to ICE on zstd-1.5.2 when compiling for ia64-unknown-linux-gnu target.
Extracted example:

// $ cat zdict.c.c
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;
  for (; ZDICT_totalSampleSize_nbFiles;)
    total += 0;
  long sBuffSize = total;
  newBuff = 0;
  ZDICT_fillNoise(newBuff + sBuffSize, 32);
  return ZDICT_trainFromBuffer_legacy_result;
}

Crashing:

$ ia64-unknown-linux-gnu-gcc-13.0.0 -std=c99 -Wall -Wextra -O3 -fPIC -c
zdict.c.c
during GIMPLE pass: vect
zdict.c.c: In function 'ZDICT_trainFromBuffer_legacy':
zdict.c.c:10:6: internal compiler error: in vect_peel_nonlinear_iv_init, at
tree-vect-loop.cc:8412
   10 | long ZDICT_trainFromBuffer_legacy() {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x142e907 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, __va_list_tag (*) [1], diagnostic_t)
        ???:0
0x142f757 internal_error(char const*, ...)
        ???:0
0x5db0de fancy_abort(char const*, int, char const*)
        ???:0
0x5c8a88 vect_peel_nonlinear_iv_init(gimple**, tree_node*, tree_node*,
tree_node*, vect_induction_op_type) [clone .cold]
        ???:0
0xd9b1f1 vect_do_peeling(_loop_vec_info*, tree_node*, tree_node*, tree_node**,
tree_node**, tree_node**, int, bool, bool, tree_node**)
        ???:0
0xd90776 vect_transform_loop(_loop_vec_info*, gimple*)
        ???:0
0xdc8a0b vect_transform_loops(hash_table<simduid_to_vf, false, xcallocator>*&,
loop*, gimple*, function*)
        ???:0
0xdc90a3 try_vectorize_loop(hash_table<simduid_to_vf, false, xcallocator>*&,
unsigned int*, loop*, function*)
        ???:0
0xdc960c (anonymous namespace)::pass_vectorize::execute(function*)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ ia64-unknown-linux-gnu-gcc-13.0.0 -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/ia64-unknown-linux-gnu-stage-final-gcc-13.0.0/bin/ia64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/<<NIX>>/ia64-unknown-linux-gnu-stage-final-gcc-13.0.0/libexec/gcc/ia64-unknown-linux-gnu/13.0.0/lto-wrapper
Target: ia64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220911 (experimental) (GCC)

x86_64 target does not seem to crash when executed as is.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5
  2022-09-12  8:53 [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 slyfox at gcc dot gnu.org
@ 2022-09-12  9:47 ` marxin at gcc dot gnu.org
  2022-09-13  2:48 ` asolokha at gmx dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-09-12  9:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106905

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
            Summary|[13 Regression] ia64: ICE   |[13 Regression] ia64: ICE
                   |in in                       |in in
                   |vect_peel_nonlinear_iv_init |vect_peel_nonlinear_iv_init
                   |, at tree-vect-loop.cc:8412 |, at tree-vect-loop.cc:8412
                   |on zstd-1.5.2               |on zstd-1.5.2 since
                   |                            |r13-2503-gc13223b790bbc5
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |13.0
                 CC|                            |crazylht at gmail dot com
   Last reconfirmed|                            |2022-09-12

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-2503-gc13223b790bbc5.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5
  2022-09-12  8:53 [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 slyfox at gcc dot gnu.org
  2022-09-12  9:47 ` [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5 marxin at gcc dot gnu.org
@ 2022-09-13  2:48 ` asolokha at gmx dot com
  2022-09-13  5:16 ` crazylht at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: asolokha at gmx dot com @ 2022-09-13  2:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106905

Arseny Solokha <asolokha at gmx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |asolokha at gmx dot com

--- Comment #2 from Arseny Solokha <asolokha at gmx dot com> ---
It also can be reproduced for x86_64 when compiling the following testcase,
reduced from gcc/testsuite/gcc.target/i386/pr103144-mul-2.c, w/
-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;
    }
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5
  2022-09-12  8:53 [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 slyfox at gcc dot gnu.org
  2022-09-12  9:47 ` [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5 marxin at gcc dot gnu.org
  2022-09-13  2:48 ` asolokha at gmx dot com
@ 2022-09-13  5:16 ` crazylht at gmail dot com
  2022-09-13  5:18 ` crazylht at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-09-13  5:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106905

--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
in vectorizable_nonlinear_induction, we 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 also do
variable peeling for epilog, and it hits gcc_assert in
vect_peel_nonlinear_iv_init.


I'm testing

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,

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5
  2022-09-12  8:53 [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 slyfox at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-09-13  5:16 ` crazylht at gmail dot com
@ 2022-09-13  5:18 ` crazylht at gmail dot com
  2022-09-14  7:46 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-09-13  5:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106905

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Arseny Solokha from comment #2)
> It also can be reproduced for x86_64 when compiling the following testcase,
> reduced from gcc/testsuite/gcc.target/i386/pr103144-mul-2.c, w/
> -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;
>     }
> }

Thanks for the testcase.
I can confirm it's the same issue in #c3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5
  2022-09-12  8:53 [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 slyfox at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-09-13  5:18 ` crazylht at gmail dot com
@ 2022-09-14  7:46 ` cvs-commit at gcc dot gnu.org
  2022-09-14  7:51 ` crazylht at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-14  7:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106905

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5
  2022-09-12  8:53 [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 slyfox at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-09-14  7:46 ` cvs-commit at gcc dot gnu.org
@ 2022-09-14  7:51 ` crazylht at gmail dot com
  2022-09-14 20:34 ` slyfox at gcc dot gnu.org
  2022-10-18  8:47 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-09-14  7:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106905

--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed in GCC13.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5
  2022-09-12  8:53 [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 slyfox at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-09-14  7:51 ` crazylht at gmail dot com
@ 2022-09-14 20:34 ` slyfox at gcc dot gnu.org
  2022-10-18  8:47 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-09-14 20:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106905

--- Comment #7 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
The change fixed real zstd-1.5.2 build on ia64 as well. Thank you!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5
  2022-09-12  8:53 [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 slyfox at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-09-14 20:34 ` slyfox at gcc dot gnu.org
@ 2022-10-18  8:47 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-18  8:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106905

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-10-18  8:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12  8:53 [Bug tree-optimization/106905] New: [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 slyfox at gcc dot gnu.org
2022-09-12  9:47 ` [Bug tree-optimization/106905] [13 Regression] ia64: ICE in in vect_peel_nonlinear_iv_init, at tree-vect-loop.cc:8412 on zstd-1.5.2 since r13-2503-gc13223b790bbc5 marxin at gcc dot gnu.org
2022-09-13  2:48 ` asolokha at gmx dot com
2022-09-13  5:16 ` crazylht at gmail dot com
2022-09-13  5:18 ` crazylht at gmail dot com
2022-09-14  7:46 ` cvs-commit at gcc dot gnu.org
2022-09-14  7:51 ` crazylht at gmail dot com
2022-09-14 20:34 ` slyfox at gcc dot gnu.org
2022-10-18  8:47 ` rguenth at gcc dot gnu.org

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).