public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161
@ 2021-04-02  2:47 haoxintu at gmail dot com
  2021-04-02 11:13 ` [Bug tree-optimization/99880] [10/11 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54 marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: haoxintu at gmail dot com @ 2021-04-02  2:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99880
           Summary: ICE in maybe_set_vectorized_backedge_value, at
                    tree-vect-loop.c:9161
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi all.

This valid program makes GCC crash at -O3. GCC-10 also incurs an ICE with a
Segmentation fault, while GCC-10 downwards versions handle this case well.

$cat small.c
int a, b, c, d, e;
void f() {
  b = 5;
  for (; b <= 51; b++)
    ;
  int g = -8;
  while (g) {
    g += 5;
    int h = 10;
    do {
      h -= a = 1;
      for (; a; a++)
        ;
      c *= c >= d >= b;
    } while (h);
    c -= e;
  }
}

$gcc -w -O3 small.c
during GIMPLE pass: vect
small.c: In function ‘f’:
small.c:2:6: internal compiler error: in maybe_set_vectorized_backedge_value,
at tree-vect-loop.c:9161
    2 | void f() {
      |      ^
0x66093f maybe_set_vectorized_backedge_value
        ../../gcc/tree-vect-loop.c:9161
0xdc466a vect_transform_loop(_loop_vec_info*, gimple*)
        ../../gcc/tree-vect-loop.c:9650
0xdebbcc try_vectorize_loop_1
        ../../gcc/tree-vectorizer.c:1104
0xdec7b1 vectorize_loops()
        ../../gcc/tree-vectorizer.c:1243
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/tuhaoxin/compilers/gcc/build-20210330/libexec/gcc/x86_64-pc-linux-gnu/11.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
--prefix=/home/tuhaoxin/compilers/gcc/build-20210330/ --enable-bootstrap
--enable-checking=release --enable-languages=c,c++ -disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.1 20210330 (experimental) (GCC)

Reproduced on Godbolt: https://godbolt.org/z/WTje44Wen

Thanks,
Haoxin

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

* [Bug tree-optimization/99880] [10/11 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54
  2021-04-02  2:47 [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 haoxintu at gmail dot com
@ 2021-04-02 11:13 ` marxin at gcc dot gnu.org
  2021-04-06  7:42 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-04-02 11:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |9.3.0
   Last reconfirmed|                            |2021-04-02
            Summary|ICE in                      |[10/11 Regression] ICE in
                   |maybe_set_vectorized_backed |maybe_set_vectorized_backed
                   |ge_value, at                |ge_value, at
                   |tree-vect-loop.c:9161       |tree-vect-loop.c:9161 since
                   |                            |r10-3711-g69f8c1aef5cdcc54
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |10.2.0, 11.0

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Thank you for the bug report, started with r10-3711-g69f8c1aef5cdcc54.

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

* [Bug tree-optimization/99880] [10/11 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54
  2021-04-02  2:47 [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 haoxintu at gmail dot com
  2021-04-02 11:13 ` [Bug tree-optimization/99880] [10/11 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54 marxin at gcc dot gnu.org
@ 2021-04-06  7:42 ` rguenth at gcc dot gnu.org
  2021-04-06 11:11 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-06  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
           Priority|P3                          |P2
   Target Milestone|---                         |10.3
             Status|NEW                         |ASSIGNED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.

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

* [Bug tree-optimization/99880] [10/11 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54
  2021-04-02  2:47 [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 haoxintu at gmail dot com
  2021-04-02 11:13 ` [Bug tree-optimization/99880] [10/11 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54 marxin at gcc dot gnu.org
  2021-04-06  7:42 ` rguenth at gcc dot gnu.org
@ 2021-04-06 11:11 ` rguenth at gcc dot gnu.org
  2021-04-06 12:20 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-06 11:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we're having a PHI latch value vectorized because it's used by the outer
loop (vect_used_in_outer_by_reduction), but the vect_nested_cycle def PHI
in the inner loop isn't relevant since it's vect_unused_in_scope:

  <bb 5> [local count: 11811160]:
  # g_36 = PHI <g_21(11), -8(15)>
  # c_lsm.16_20 = PHI <_12(11), c_lsm.16_29(15)>
  # ivtmp_18 = PHI <ivtmp_1(11), 1717986920(15)>
  g_21 = g_36 + 5;
  vect_cst__28 = { 0, 0, 0, 0 };

  <bb 6> [local count: 118111600]:
  # h_14 = PHI <10(5), h_24(12)>
  # c_lsm.16_22 = PHI <c_lsm.16_20(5), _10(12)>
  # ivtmp_30 = PHI <10(5), ivtmp_31(12)>
  h_24 = h_14 + -1;
  _7 = d.6_6 <= c_lsm.16_22;
  _8 = (int) _7;
  vect__10.19_33 = vect_cst__28;
  _10 = 0;
  ivtmp_31 = ivtmp_30 - 1;
  if (ivtmp_31 != 0)
    goto <bb 12>; [90.00%]
  else
    goto <bb 9>; [10.00%]

  <bb 12> [local count: 106300440]:
  goto <bb 6>; [100.00%]

  <bb 9> [local count: 11811160]:
  # _27 = PHI <_10(6)>
  _12 = _27 - e.10_11;

it's the c_lsm.16_22 PHI and the _10 backedge def (note how we failed to
constant propagate the 10 ...).  The fix is simple and hopefully it doesn't
break other stuff.

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

* [Bug tree-optimization/99880] [10/11 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54
  2021-04-02  2:47 [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 haoxintu at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-06 11:11 ` rguenth at gcc dot gnu.org
@ 2021-04-06 12:20 ` cvs-commit at gcc dot gnu.org
  2021-04-06 12:21 ` [Bug tree-optimization/99880] [10 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-06 12:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:e5c170e080399fb3d24a38bbfcd66bd4675abe53

commit r11-8005-ge5c170e080399fb3d24a38bbfcd66bd4675abe53
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Apr 6 13:20:44 2021 +0200

    tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defs

    This adds a relevancy check before trying to set the vector def of
    a backedge in an unvectorized PHI.

    2021-04-06  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/99880
            * tree-vect-loop.c (maybe_set_vectorized_backedge_value): Only
            set vectorized defs of relevant PHIs.

            * gcc.dg/torture/pr99880.c: New testcase.

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

* [Bug tree-optimization/99880] [10 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54
  2021-04-02  2:47 [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 haoxintu at gmail dot com
                   ` (3 preceding siblings ...)
  2021-04-06 12:20 ` cvs-commit at gcc dot gnu.org
@ 2021-04-06 12:21 ` rguenth at gcc dot gnu.org
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-06 12:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11 Regression] ICE in   |[10 Regression] ICE in
                   |maybe_set_vectorized_backed |maybe_set_vectorized_backed
                   |ge_value, at                |ge_value, at
                   |tree-vect-loop.c:9161 since |tree-vect-loop.c:9161 since
                   |r10-3711-g69f8c1aef5cdcc54  |r10-3711-g69f8c1aef5cdcc54
      Known to fail|11.0                        |
      Known to work|                            |11.0

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug tree-optimization/99880] [10 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54
  2021-04-02  2:47 [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 haoxintu at gmail dot com
                   ` (4 preceding siblings ...)
  2021-04-06 12:21 ` [Bug tree-optimization/99880] [10 " rguenth at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
  2021-04-26 11:46 ` cvs-commit at gcc dot gnu.org
  2021-04-26 11:46 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.3                        |10.4

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.

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

* [Bug tree-optimization/99880] [10 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54
  2021-04-02  2:47 [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 haoxintu at gmail dot com
                   ` (5 preceding siblings ...)
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
@ 2021-04-26 11:46 ` cvs-commit at gcc dot gnu.org
  2021-04-26 11:46 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-26 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:05b35bc2ba6c96ef3d468b246ab141f95694d95a

commit r10-9767-g05b35bc2ba6c96ef3d468b246ab141f95694d95a
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Apr 6 13:20:44 2021 +0200

    tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defs

    This adds a relevancy check before trying to set the vector def of
    a backedge in an unvectorized PHI.

    2021-04-06  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/99880
            * tree-vect-loop.c (maybe_set_vectorized_backedge_value): Only
            set vectorized defs of relevant PHIs.

            * gcc.dg/torture/pr99880.c: New testcase.

    (cherry picked from commit e5c170e080399fb3d24a38bbfcd66bd4675abe53)

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

* [Bug tree-optimization/99880] [10 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54
  2021-04-02  2:47 [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 haoxintu at gmail dot com
                   ` (6 preceding siblings ...)
  2021-04-26 11:46 ` cvs-commit at gcc dot gnu.org
@ 2021-04-26 11:46 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-26 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.3.1
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
      Known to fail|                            |10.3.0

--- 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:[~2021-04-26 11:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02  2:47 [Bug c/99880] New: ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 haoxintu at gmail dot com
2021-04-02 11:13 ` [Bug tree-optimization/99880] [10/11 Regression] ICE in maybe_set_vectorized_backedge_value, at tree-vect-loop.c:9161 since r10-3711-g69f8c1aef5cdcc54 marxin at gcc dot gnu.org
2021-04-06  7:42 ` rguenth at gcc dot gnu.org
2021-04-06 11:11 ` rguenth at gcc dot gnu.org
2021-04-06 12:20 ` cvs-commit at gcc dot gnu.org
2021-04-06 12:21 ` [Bug tree-optimization/99880] [10 " rguenth at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-04-26 11:46 ` cvs-commit at gcc dot gnu.org
2021-04-26 11:46 ` 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).