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/113119] ICE: verify_ssa failed: definition in block 18 does not dominate use in block 4 at -O1 with _BitInt
Date: Mon, 08 Jan 2024 13:00:45 +0000	[thread overview]
Message-ID: <bug-113119-4-IcsJUWIiND@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113119-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:7590d975ecfdae4f112b5086c017101c08f07e3e

commit r14-7000-g7590d975ecfdae4f112b5086c017101c08f07e3e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Jan 8 13:57:26 2024 +0100

    lower-bitint: Punt .*_OVERFLOW optimization if cast from IMAGPART_EXPR
appears before REALPART_EXPR [PR113119]

    _BitInt lowering for .{ADD,SUB,MUL}_OVERFLOW calls which have both
    REALPART_EXPR and IMAGPART_EXPR used and have a cast from the IMAGPART_EXPR
    to a boolean or normal integral type lowers them at the point of
    the REALPART_EXPR statement (which is especially needed if the lhs of
    the call is complex with large/huge _BitInt element type); we emit the
    stmt to set the lhs of the cast at the same spot as well.
    Normally, the lowering of __builtin_{add,sub,mul}_overflow arranges
    the REALPART_EXPR to come before IMAGPART_EXPR, followed by cast from that,
    but as the testcase shows, a redundant __builtin_*_overflow call and VN
    can reorder those and we then ICE because the def-stmt of the former cast
    from IMAGPART_EXPR may appear after its uses.
    We already check that all of REALPART_EXPR, IMAGPART_EXPR and the cast
    from the latter appear in the same bb as the .{ADD,SUB,MUL}_OVERFLOW call
    in the optimization, the following patch just extends it to make sure
    cast appears after REALPART_EXPR; if not, we punt on the optimization and
    expand it as a store of a complex _BitInt on the location of the ifn call.
    Only the testcase in the testsuite is changed by the patch, all other
    __builtin_*_overflow* calls in the bitint* tests (and there are quite a
few)
    have REALPART_EXPR first.

    2024-01-08  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/113119
            * gimple-lower-bitint.cc (optimizable_arith_overflow): Punt if
            both REALPART_EXPR and cast from IMAGPART_EXPR appear, but cast
            is before REALPART_EXPR.

            * gcc.dg/bitint-61.c: New test.

  parent reply	other threads:[~2024-01-08 13:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22 18:54 [Bug tree-optimization/113119] New: " zsojka at seznam dot cz
2023-12-22 21:04 ` [Bug tree-optimization/113119] " jakub at gcc dot gnu.org
2023-12-23  7:41 ` zsojka at seznam dot cz
2023-12-23  9:50 ` jakub at gcc dot gnu.org
2024-01-08 13:00 ` cvs-commit at gcc dot gnu.org [this message]
2024-01-08 13:02 ` 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-113119-4-IcsJUWIiND@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).