public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108314] New: [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE
@ 2023-01-06 10:38 acoplan at gcc dot gnu.org
  2023-01-06 11:53 ` [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82 marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: acoplan at gcc dot gnu.org @ 2023-01-06 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108314
           Summary: [13 Regression] Segfault in
                    gimple-match-head.cc:do_valueize when vectorizing for
                    SVE
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following appears to be a regression on the trunk:

$ cat t.c
int x, y, z;
void f(void) {
  int t = 4;
  for (; x; x++) {
    if (y)
      continue;
    t = 0;
  }
  z = t;
}
$ aarch64-none-elf-gcc -c t.c -O2 -march=armv9-a
during GIMPLE pass: vect
t.c: In function 'f':
t.c:2:6: internal compiler error: Segmentation fault
    2 | void f(void) {
      |      ^
0xed3a4f crash_signal
        /home/alecop01/toolchain/src/gcc/gcc/toplev.cc:314
0x17255c4 do_valueize
        /home/alecop01/toolchain/src/gcc/gcc/gimple-match-head.cc:845
0x17255c4 operator()
        /home/alecop01/toolchain/src/gcc/gcc/gimple-match-head.cc:1071
0x17255c4 gimple_extract<gimple_simplify(gimple*, gimple_match_op*, gimple**,
tree_node* (*)(tree), tree_node* (*)(tree))::<lambda(tree)>,
gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node* (*)(tree),
tree_node* (*)(tree))::<lambda(tree)> >
        /home/alecop01/toolchain/src/gcc/gcc/gimple-match-head.cc:1028
0x17255c4 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
        /home/alecop01/toolchain/src/gcc/gcc/gimple-match-head.cc:1103
0xb239b6 gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*),
tree_node* (*)(tree_node*))
        /home/alecop01/toolchain/src/gcc/gcc/gimple-fold.cc:7441
0x113d196 visit_stmt
        /home/alecop01/toolchain/src/gcc/gcc/tree-ssa-sccvn.cc:6134
0x113dcee process_bb
        /home/alecop01/toolchain/src/gcc/gcc/tree-ssa-sccvn.cc:7844
0x1140b4d do_rpo_vn_1
        /home/alecop01/toolchain/src/gcc/gcc/tree-ssa-sccvn.cc:8443
0x114127c do_rpo_vn(function*, edge_def*, bitmap_head*, bool, bool,
vn_lookup_kind)
        /home/alecop01/toolchain/src/gcc/gcc/tree-ssa-sccvn.cc:8545
0x123c0ce execute
        /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.cc:1388
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.

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

* [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82
  2023-01-06 10:38 [Bug tree-optimization/108314] New: [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE acoplan at gcc dot gnu.org
@ 2023-01-06 11:53 ` marxin at gcc dot gnu.org
  2023-01-10  7:09 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-06 11:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-01-06
             Status|UNCONFIRMED                 |NEW
            Summary|[13 Regression] Segfault in |[13 Regression] Segfault in
                   |gimple-match-head.cc:do_val |gimple-match-head.cc:do_val
                   |ueize when vectorizing for  |ueize when vectorizing for
                   |SVE                         |SVE since
                   |                            |r13-707-g68e0063397ba82
     Ever confirmed|0                           |1
   Target Milestone|---                         |13.0
            Version|12.0                        |13.0
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

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

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

* [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82
  2023-01-06 10:38 [Bug tree-optimization/108314] New: [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE acoplan at gcc dot gnu.org
  2023-01-06 11:53 ` [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82 marxin at gcc dot gnu.org
@ 2023-01-10  7:09 ` rguenth at gcc dot gnu.org
  2023-01-10  9:40 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-10  7:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.

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

* [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82
  2023-01-06 10:38 [Bug tree-optimization/108314] New: [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE acoplan at gcc dot gnu.org
  2023-01-06 11:53 ` [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82 marxin at gcc dot gnu.org
  2023-01-10  7:09 ` rguenth at gcc dot gnu.org
@ 2023-01-10  9:40 ` rguenth at gcc dot gnu.org
  2023-01-10 10:45 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-10  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(gdb) p debug_gimple_stmt (stmt)
t_5 = .FOLD_EXTRACT_LAST (t_14, _41, );

there's a missing call argument, the call is built here:

#0  vectorizable_condition (vinfo=0x3b67200, stmt_info=0x3c3d160, 
    gsi=0x7fffffffcad0, vec_stmt=0x7fffffffc8a8, slp_node=0x0, cost_vec=0x0)
    at /home/rguenther/src/trunk/gcc/tree-vect-stmts.cc:10763
10763             new_stmt = gimple_build_call_internal
(gdb) l
10758         gimple *new_stmt;
10759         if (reduction_type == EXTRACT_LAST_REDUCTION)
10760           {
10761             gimple *old_stmt = vect_orig_stmt (stmt_info)->stmt;
10762             tree lhs = gimple_get_lhs (old_stmt);
10763             new_stmt = gimple_build_call_internal
10764                 (IFN_FOLD_EXTRACT_LAST, 3, else_clause, vec_compare,
10765                  vec_then_clause);
10766             gimple_call_set_lhs (new_stmt, lhs);
10767             SSA_NAME_DEF_STMT (lhs) = new_stmt;
(gdb) p vec_then_clause
$13 = <tree 0x0>

which is because we run into

              else if (bitop2 == BIT_NOT_EXPR)
                {
                  /* Instead of doing ~x ? y : z do x ? z : y.  */
                  vec_compare = new_temp;
                  std::swap (vec_then_clause, vec_else_clause);

but vec_else_clause isn't initialized for EXTRACT_LAST_REDUCTION.  Instead
we should swap with else_clause here?

It seems to me I've seen this before ...

Note that if we swap we fail to expand the internal function which seems to
want the scalar/vector args in specific places and _not_ support this
inversion.  So instead avoid doing this optimization.

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

* [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82
  2023-01-06 10:38 [Bug tree-optimization/108314] New: [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE acoplan at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-10  9:40 ` rguenth at gcc dot gnu.org
@ 2023-01-10 10:45 ` rguenth at gcc dot gnu.org
  2023-01-10 10:46 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-10 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
patch posted

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

* [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82
  2023-01-06 10:38 [Bug tree-optimization/108314] New: [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE acoplan at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-10 10:45 ` rguenth at gcc dot gnu.org
@ 2023-01-10 10:46 ` rguenth at gcc dot gnu.org
  2023-01-10 12:08 ` cvs-commit at gcc dot gnu.org
  2023-01-10 12:09 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-10 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=106476

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
And PR106476 is the duplicate I was thinking of.

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

* [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82
  2023-01-06 10:38 [Bug tree-optimization/108314] New: [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE acoplan at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-01-10 10:46 ` rguenth at gcc dot gnu.org
@ 2023-01-10 12:08 ` cvs-commit at gcc dot gnu.org
  2023-01-10 12:09 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-10 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:554bb9b61e2b76d4ace16a3f766b98ea887b17f4

commit r13-5089-g554bb9b61e2b76d4ace16a3f766b98ea887b17f4
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Jan 10 10:42:21 2023 +0100

    tree-optimization/108314 - avoid BIT_NOT optimization for extract-last

    The extract-last reduction internal function expects the then and
    else clause as vector and scalar and thus we cannot perform optimization
    of the inversion of the condition by swapping the then/else clauses.

            PR tree-optimization/108314
            * tree-vect-stmts.cc (vectorizable_condition): Do not
            perform BIT_NOT_EXPR optimization for EXTRACT_LAST_REDUCTION.

            * gcc.dg/vect/pr108314.c: New testcase.

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

* [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82
  2023-01-06 10:38 [Bug tree-optimization/108314] New: [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE acoplan at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-01-10 12:08 ` cvs-commit at gcc dot gnu.org
@ 2023-01-10 12:09 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-10 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2023-01-10 12:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 10:38 [Bug tree-optimization/108314] New: [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE acoplan at gcc dot gnu.org
2023-01-06 11:53 ` [Bug tree-optimization/108314] [13 Regression] Segfault in gimple-match-head.cc:do_valueize when vectorizing for SVE since r13-707-g68e0063397ba82 marxin at gcc dot gnu.org
2023-01-10  7:09 ` rguenth at gcc dot gnu.org
2023-01-10  9:40 ` rguenth at gcc dot gnu.org
2023-01-10 10:45 ` rguenth at gcc dot gnu.org
2023-01-10 10:46 ` rguenth at gcc dot gnu.org
2023-01-10 12:08 ` cvs-commit at gcc dot gnu.org
2023-01-10 12:09 ` 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).