public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/95582] [11 Regression] LTO lean + PGO bootstrap is broken in Ada
Date: Tue, 09 Jun 2020 08:47:34 +0000	[thread overview]
Message-ID: <bug-95582-4-40irNAxfmJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95582-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
I can reproduce it, yes.

_22 = (boolean) _21;

converts

 <ssa_name 0x7ffff62e3000
    type <boolean_type 0x7ffff6821b28 bool public unsigned QI
        size <integer_cst 0x7ffff680cca8 constant 8>
        unit-size <integer_cst 0x7ffff680ccc0 constant 1>
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6821b28 precision:1 min <integer_cst 0x7ffff680cf00 0> max <integer_cst
0x7ffff680cf30 1>>
    visited
    def_stmt _21 = _11 != _12;
    version:21>

to

 <ssa_name 0x7ffff62e3048
    type <boolean_type 0x7ffff66133f0 boolean public unsigned QI
        size <integer_cst 0x7ffff680cca8 constant 8>
        unit-size <integer_cst 0x7ffff680ccc0 constant 1>
        align:8 warn_if_not_align:0 symtab:0 alias-set 23 canonical-type
0x7ffff66133f0 precision:8 min <integer_cst 0x7ffff6a057b0 0> max <integer_cst
0x7ffff6a05798 255> context <translation_unit_decl 0x7ffff68161e0
ada/b_gnatb.adb>
        pointer_to_this <pointer_type 0x7ffff66b2000>>
    visited
    def_stmt _22 = (boolean) _21;
    version:22
    ptr-info 0x7ffff6303cc0>

so Ada has BOOLEAN_TYPE with 8-bit precision and the middle-end
boolean_type_node is the one with 1-bit precision.

the origs stmt mask_precision is 16 coming from the _11 != _12 compare
with HImode operands.

A C or even GIMPLE testcase is difficult because we have no way to
declare that 8-bit BOOLEAN_TYPE.  But a fix for the ICE is likely
just to enhance VECT_SCALAR_BOOLEAN_TYPE.

We do have other tests like this in forwprop for example:

  /* Canonicalize _Bool == 0 and _Bool != 1 to _Bool != 0 by swapping edges. 
*/
  if ((TREE_CODE (TREE_TYPE (rhs1)) == BOOLEAN_TYPE
       || (INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
           && TYPE_PRECISION (TREE_TYPE (rhs1)) == 1))

so we generally seem to assume BOOLEAN_TYPE has 1 bit precision?  CCing
Eric, eventually the bootstrap issue icks on a corner case of the Ada
FE and is a bug there.

The following would fix it in the vectorizer:

diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 9bb82a546f6..8c8ec6cb111 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1254,11 +1254,11 @@ struct gather_scatter_info {
    VECTOR_BOOLEAN_TYPE_P.  */

 #define VECT_SCALAR_BOOLEAN_TYPE_P(TYPE) \
-  (TREE_CODE (TYPE) == BOOLEAN_TYPE            \
-   || ((TREE_CODE (TYPE) == INTEGER_TYPE       \
-       || TREE_CODE (TYPE) == ENUMERAL_TYPE)   \
-       && TYPE_PRECISION (TYPE) == 1           \
-       && TYPE_UNSIGNED (TYPE)))
+  ((TREE_CODE (TYPE) == BOOLEAN_TYPE    \
+    || TREE_CODE (TYPE) == INTEGER_TYPE         \
+    || TREE_CODE (TYPE) == ENUMERAL_TYPE)\
+    && TYPE_PRECISION (TYPE) == 1       \
+    && TYPE_UNSIGNED (TYPE))

 static inline bool
 nested_in_vect_loop_p (class loop *loop, stmt_vec_info stmt_info)


Maybe Eric can also create something for gnat.dg?  What it needs is
an appearant opportunity in the basic-block thus the two adjacent
stores plus the compare and convert.  Eventually the dump of the
function Martin provided is enough to produce a testcase that ICEs?

  parent reply	other threads:[~2020-06-09  8:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 16:40 [Bug bootstrap/95582] New: " marxin at gcc dot gnu.org
2020-06-09  6:59 ` [Bug bootstrap/95582] " rguenth at gcc dot gnu.org
2020-06-09  7:31 ` marxin at gcc dot gnu.org
2020-06-09  8:10 ` marxin at gcc dot gnu.org
2020-06-09  8:14 ` marxin at gcc dot gnu.org
2020-06-09  8:25 ` marxin at gcc dot gnu.org
2020-06-09  8:47 ` rguenth at gcc dot gnu.org [this message]
2020-06-09  8:52 ` rguenth at gcc dot gnu.org
2020-06-09  9:40 ` ebotcazou at gcc dot gnu.org
2020-06-09 10:38 ` rguenther at suse dot de
2020-06-09 11:23 ` ebotcazou at gcc dot gnu.org
2020-08-27 12:40 ` marxin at gcc dot gnu.org
2020-08-27 12:55 ` rguenth at gcc dot gnu.org
2020-08-27 13:24 ` marxin at gcc dot gnu.org
2020-10-02 13:05 ` marxin at gcc dot gnu.org
2020-10-07 10:02 ` rguenth at gcc dot gnu.org
2020-10-07 11:42 ` rguenth at gcc dot gnu.org
2020-10-07 12:38 ` rguenth at gcc dot gnu.org
2020-12-07 10:05 ` marxin at gcc dot gnu.org
2020-12-10 14:01 ` rguenth at gcc dot gnu.org
2020-12-10 14:21 ` ebotcazou at gcc dot gnu.org
2020-12-11  8:23 ` rguenth at gcc dot gnu.org
2020-12-11  9:10 ` cvs-commit at gcc dot gnu.org
2020-12-11  9:49 ` rguenth at gcc dot gnu.org
2021-01-06  9:21 ` 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-95582-4-40irNAxfmJ@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).