public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/109176] [11/12 Regression] internal compiler error: in to_constant, at poly-int.h:504
Date: Tue, 18 Apr 2023 07:15:48 +0000	[thread overview]
Message-ID: <bug-109176-4-duxknbQBmG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109176-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:0a4cf0e92cbd5f18de3195fa2deb058f2f88e77e

commit r12-9421-g0a4cf0e92cbd5f18de3195fa2deb058f2f88e77e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Mar 23 10:02:25 2023 +0100

    tree-vect-generic: Fix up expand_vector_condition [PR109176]

    The following testcase ICEs on aarch64-linux, because
    expand_vector_condition attempts to piecewise lower SVE
      d_3 = a_1(D) < b_2(D);
      _5 = VEC_COND_EXPR <d_3, c_4(D), d_3>;
    which isn't possible - nunits_for_known_piecewise_op ICEs but
    the rest of the code assumes constant number of elements too.

    expand_vector_condition attempts to find if a (rhs1) is a SSA_NAME
    for comparison and calls expand_vec_cond_expr_p (type, TREE_TYPE (a1),
code)
    where a1 is one of the operands of the comparison and code is the
comparison
    code.  That one indeed isn't supported here, but what aarch64 SVE supports
    are the individual statements, comparison (expand_vec_cmp_expr_p) and
    expand_vec_cond_expr_p (type, TREE_TYPE (a), SSA_NAME), the latter because
    that function starts with
      if (VECTOR_BOOLEAN_TYPE_P (cmp_op_type)
          && get_vcond_mask_icode (TYPE_MODE (value_type),
                                   TYPE_MODE (cmp_op_type)) !=
CODE_FOR_nothing)
        return true;

    In an earlier version of the patch (in the PR), we did this
      if (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (a))
          && expand_vec_cond_expr_p (type, TREE_TYPE (a), ERROR_MARK))
        return true;
    before the code == SSA_NAME handling plus some further tweaks later.
    While that fixed the ICE, it broke quite a few tests on x86 and some on
    aarch64 too.  The problem is that expand_vector_comparison doesn't lower
    comparisons which aren't supported and only feed VEC_COND_EXPR first
operand
    and expand_vector_condition succeeds for those, so with the above mentioned
    change we'd verify the VEC_COND_EXPR is implementable using optab alone,
    but nothing would verify the tcc_comparison which relied on
    expand_vector_condition to verify.

    So, the following patch instead queries whether optabs can handle the
    comparison and VEC_COND_EXPR together (if a (rhs1) is a comparison;
    otherwise as before it checks only the VEC_COND_EXPR) and if that fails,
    also checks whether the two operations could be supported individually
    and only if even that fails does the piecewise lowering.

    2023-03-23  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/109176
            * tree-vect-generic.cc (expand_vector_condition): If a has
            vector boolean type and is a comparison, also check if both
            the comparison and VEC_COND_EXPR could be successfully expanded
            individually.

            * gcc.target/aarch64/sve/pr109176.c: New test.

    (cherry picked from commit 484c41c747d95f9cee15a33b75b32ae2e7eb45f3)

  parent reply	other threads:[~2023-04-18  7:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 16:19 [Bug c++/109176] New: " malat at debian dot org
2023-03-17 16:43 ` [Bug c++/109176] " malat at debian dot org
2023-03-17 17:54 ` [Bug tree-optimization/109176] " ktkachov at gcc dot gnu.org
2023-03-20  9:17 ` [Bug tree-optimization/109176] [13 Regression] " rguenth at gcc dot gnu.org
2023-03-20  9:37 ` ktkachov at gcc dot gnu.org
2023-03-20 13:59 ` jakub at gcc dot gnu.org
2023-03-20 15:35 ` jakub at gcc dot gnu.org
2023-03-21  9:25 ` jakub at gcc dot gnu.org
2023-03-21  9:53 ` rguenth at gcc dot gnu.org
2023-03-21 10:28 ` jakub at gcc dot gnu.org
2023-03-21 10:41 ` jakub at gcc dot gnu.org
2023-03-21 10:57 ` ktkachov at gcc dot gnu.org
2023-03-21 12:03 ` jakub at gcc dot gnu.org
2023-03-21 12:12 ` rguenth at gcc dot gnu.org
2023-03-22  8:47 ` jakub at gcc dot gnu.org
2023-03-22 12:03 ` jakub at gcc dot gnu.org
2023-03-22 12:08 ` jakub at gcc dot gnu.org
2023-03-23  9:04 ` cvs-commit at gcc dot gnu.org
2023-03-23  9:08 ` [Bug tree-optimization/109176] [11/12 " jakub at gcc dot gnu.org
2023-04-18  7:15 ` cvs-commit at gcc dot gnu.org [this message]
2023-04-18  7:21 ` [Bug tree-optimization/109176] [11 " jakub at gcc dot gnu.org
2023-04-26  6:58 ` rguenth at gcc dot gnu.org
2023-05-02 20:16 ` cvs-commit at gcc dot gnu.org
2023-05-03 10:45 ` jakub at gcc dot gnu.org

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=bug-109176-4-duxknbQBmG@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).