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 middle-end/108237] [13 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:281 at -O since r13-1085-g90467f0ad649d081
Date: Fri, 10 Feb 2023 17:45:18 +0000	[thread overview]
Message-ID: <bug-108237-4-1IhVHkZZwY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108237-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 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:4c8e17a6a578b9eb15cd210651b6ea273022db39

commit r12-9136-g4c8e17a6a578b9eb15cd210651b6ea273022db39
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jan 4 10:54:38 2023 +0100

    generic-match-head: Don't assume GENERIC folding is done only early
[PR108237]

    We ICE on the following testcase, because a valid V2DImode
    != comparison is folded into an unsupported V2DImode > comparison.
    The match.pd pattern which does this looks like:
    /* Transform comparisons of the form (X & Y) CMP 0 to X CMP2 Z
       where ~Y + 1 == pow2 and Z = ~Y.  */
    (for cst (VECTOR_CST INTEGER_CST)
     (for cmp (eq ne)
          icmp (le gt)
      (simplify
       (cmp (bit_and:c@2 @0 cst@1) integer_zerop)
        (with { tree csts = bitmask_inv_cst_vector_p (@1); }
         (if (csts && (VECTOR_TYPE_P (TREE_TYPE (@1)) || single_use (@2)))
          (with { auto optab = VECTOR_TYPE_P (TREE_TYPE (@1))
                             ? optab_vector : optab_default;
                  tree utype = unsigned_type_for (TREE_TYPE (@1)); }
           (if (target_supports_op_p (utype, icmp, optab)
                || (optimize_vectors_before_lowering_p ()
                    && (!target_supports_op_p (type, cmp, optab)
                        || !target_supports_op_p (type, BIT_AND_EXPR, optab))))
            (if (TYPE_UNSIGNED (TREE_TYPE (@1)))
             (icmp @0 { csts; })
             (icmp (view_convert:utype @0) { csts; })))))))))
    and that optimize_vectors_before_lowering_p () guarded stuff there
    already deals with this problem, not trying to fold a supported comparison
    into a non-supported one.  The reason it doesn't work in this case is that
    it isn't GIMPLE folding which does this, but GENERIC folding done during
    forwprop4 - forward_propagate_into_comparison ->
forward_propagate_into_comparison_1
    -> combine_cond_expr_cond -> fold_binary_loc -> generic_simplify
    and we simply assumed that GENERIC folding happens only before
    gimplification.

    The following patch fixes that by checking cfun properties instead of
    always returning true in those cases.

    2023-01-04  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/108237
            * generic-match-head.cc: Include tree-pass.h.
            (canonicalize_math_p, optimize_vectors_before_lowering_p): Define
            to false if cfun and cfun->curr_properties has PROP_gimple_opt_math
            resp. PROP_gimple_lvec property set.

            * gcc.c-torture/compile/pr108237.c: New test.

    (cherry picked from commit 345dffd0d4ebff7e705dfff1a8a72017a167120a)

  parent reply	other threads:[~2023-02-10 17:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 22:52 [Bug middle-end/108237] New: [13 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:281 at -O zsojka at seznam dot cz
2022-12-28  8:52 ` [Bug middle-end/108237] [13 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:281 at -O since r13-1085-g90467f0ad649d081 marxin at gcc dot gnu.org
2023-01-03 15:57 ` jakub at gcc dot gnu.org
2023-01-03 16:16 ` jakub at gcc dot gnu.org
2023-01-03 16:35 ` jakub at gcc dot gnu.org
2023-01-03 16:40 ` jakub at gcc dot gnu.org
2023-01-04  9:55 ` cvs-commit at gcc dot gnu.org
2023-01-04  9:56 ` jakub at gcc dot gnu.org
2023-01-09 10:08 ` rguenth at gcc dot gnu.org
2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-02 20:13 ` cvs-commit at gcc dot gnu.org
2023-05-03 15:20 ` cvs-commit 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-108237-4-1IhVHkZZwY@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).