public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
@ 2020-08-04 10:20 zsojka at seznam dot cz
  2020-08-04 12:46 ` [Bug target/96453] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: zsojka at seznam dot cz @ 2020-08-04 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96453
           Summary: [11 Regression] ICE: in gimple_expand_vec_cond_expr,
                    at gimple-isel.cc:167 with -Og -fno-early-inlining
                    -fno-tree-ccp -mavx -mno-sse4.2
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 48991
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48991&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -Og -fno-early-inlining -fno-tree-ccp -mavx
-mno-sse4.2 testcase.c 
during GIMPLE pass: isel
testcase.c: In function 'foo':
testcase.c:12:1: internal compiler error: in gimple_expand_vec_cond_expr, at
gimple-isel.cc:167
   12 | foo (void)
      | ^~~
0x75a09b gimple_expand_vec_cond_expr
        /repo/gcc-trunk/gcc/gimple-isel.cc:167
0x12022fc gimple_expand_vec_cond_exprs
        /repo/gcc-trunk/gcc/gimple-isel.cc:190
0x12022fc execute
        /repo/gcc-trunk/gcc/gimple-isel.cc:240
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r11-2526-20200803220915-g265d817b1eb-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r11-2526-20200803220915-g265d817b1eb-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.0.0 20200804 (experimental) (GCC)

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

* [Bug target/96453] [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
  2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
@ 2020-08-04 12:46 ` rguenth at gcc dot gnu.org
  2020-08-10  3:17 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-04 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
   Target Milestone|---                         |11.0

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

* [Bug target/96453] [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
  2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
  2020-08-04 12:46 ` [Bug target/96453] " rguenth at gcc dot gnu.org
@ 2020-08-10  3:17 ` marxin at gcc dot gnu.org
  2020-08-10 10:39 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-08-10  3:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-08-10
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Mine.

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

* [Bug target/96453] [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
  2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
  2020-08-04 12:46 ` [Bug target/96453] " rguenth at gcc dot gnu.org
  2020-08-10  3:17 ` marxin at gcc dot gnu.org
@ 2020-08-10 10:39 ` marxin at gcc dot gnu.org
  2020-08-10 11:44 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-08-10 10:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with my r11-1445-g502d63b6d6141597.

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

* [Bug target/96453] [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
  2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2020-08-10 10:39 ` marxin at gcc dot gnu.org
@ 2020-08-10 11:44 ` marxin at gcc dot gnu.org
  2020-09-23 12:41 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-08-10 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=96466

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
So the problem here is that we newly meet:

  _5 = { -1, -1 };
  _6 = VEC_COND_EXPR <_5, { -1, -1 }, { 0, 0 }>;

which we before the revision removed in copyprop6.

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

* [Bug target/96453] [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
  2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2020-08-10 11:44 ` marxin at gcc dot gnu.org
@ 2020-09-23 12:41 ` marxin at gcc dot gnu.org
  2020-09-23 12:42 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-09-23 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master with r11-3302-g3696a50beeb73f4d.

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

* [Bug target/96453] [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
  2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2020-09-23 12:41 ` marxin at gcc dot gnu.org
@ 2020-09-23 12:42 ` rguenth at gcc dot gnu.org
  2020-09-23 13:01 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-23 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Needs -fno-tree-dce to ICE (otherwise the loop is completely elided).

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

* [Bug target/96453] [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
  2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2020-09-23 12:42 ` rguenth at gcc dot gnu.org
@ 2020-09-23 13:01 ` rguenth at gcc dot gnu.org
  2020-09-23 13:56 ` cvs-commit at gcc dot gnu.org
  2020-09-23 13:56 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-23 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the issue is that veclower gets to see

-  _3 = { 8, 8 };
-  _4 = _3 != { 0, 0 };
   _5 = VEC_COND_EXPR <_4, { -1, -1 }, { 0, 0 }>;

while ISEL sees

+  _4 = { -1, -1 };
   _5 = VEC_COND_EXPR <_4, { -1, -1 }, { 0, 0 }>;

now, the issue is the target doesn't support the _4 < {0, 0} we fake
but it would support _4 != { 0, 0 }.  The expansion code already handles
this, but only for literal constants:

  icode = get_vcond_icode (mode, cmp_op_mode, unsignedp);
  if (icode == CODE_FOR_nothing)
    {
      if (tcode == LT_EXPR
          && op0a == op0
          && TREE_CODE (op0) == VECTOR_CST)
        {
          /* A VEC_COND_EXPR condition could be folded from EQ_EXPR/NE_EXPR
             into a constant when only get_vcond_eq_icode is supported.
             Verify < 0 and != 0 behave the same and change it to NE_EXPR.  */
...

I'm not sure why the code is restrictive as it is - we always will have
a vector boolean operand for the mask which means the only valid values
are -1 and 0 and thus using NE_EXPR should be always valid.  In fact the
verification code will ICE when we cannot use NE_EXPR so it should also
work for non-constant ops.

diff --git a/gcc/gimple-isel.cc b/gcc/gimple-isel.cc
index b330cf4c20e..97922632afd 100644
--- a/gcc/gimple-isel.cc
+++ b/gcc/gimple-isel.cc
@@ -138,22 +138,11 @@ gimple_expand_vec_cond_expr (gimple_stmt_iterator *gsi,
   if (icode == CODE_FOR_nothing)
     {
       if (tcode == LT_EXPR
-         && op0a == op0
-         && TREE_CODE (op0) == VECTOR_CST)
+         && op0a == op0)
        {
          /* A VEC_COND_EXPR condition could be folded from EQ_EXPR/NE_EXPR
             into a constant when only get_vcond_eq_icode is supported.
-            Verify < 0 and != 0 behave the same and change it to NE_EXPR.  */
-         unsigned HOST_WIDE_INT nelts;
-         if (!VECTOR_CST_NELTS (op0).is_constant (&nelts))
-           {
-             if (VECTOR_CST_STEPPED_P (op0))
-               gcc_unreachable ();
-             nelts = vector_cst_encoded_nelts (op0);
-           }
-         for (unsigned int i = 0; i < nelts; ++i)
-           if (tree_int_cst_sgn (vector_cst_elt (op0, i)) == 1)
-             gcc_unreachable ();
+            Try changing it to NE_EXPR.  */
          tcode = NE_EXPR;
        }
       if (tcode == EQ_EXPR || tcode == NE_EXPR)

fixes the testcase.

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

* [Bug target/96453] [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
  2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2020-09-23 13:01 ` rguenth at gcc dot gnu.org
@ 2020-09-23 13:56 ` cvs-commit at gcc dot gnu.org
  2020-09-23 13:56 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-23 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:3457dae55f72bd4ac0f346bbebb02d1613ac4b5c

commit r11-3396-g3457dae55f72bd4ac0f346bbebb02d1613ac4b5c
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Sep 23 15:03:31 2020 +0200

    middle-end/96453 - relax gimple_expand_vec_cond_expr

    This relaxes the condition under which we also try NE_EXPR
    for a fake generated compare in addition to LT_EXPR given
    the fact the verification ICEd when it failed but obviously
    was only implemented for constants.  Thus the patch removes
    the verification and the restriction to constant operands.

    2020-09-23  Richard Biener  <rguenther@suse.de>

            PR middle-end/96453
            * gimple-isel.cc (gimple_expand_vec_cond_expr): Remove
            LT_EXPR -> NE_EXPR verification and also apply it for
            non-constant masks.

            * gcc.dg/pr96453.c: New testcase.

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

* [Bug target/96453] [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2
  2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
                   ` (7 preceding siblings ...)
  2020-09-23 13:56 ` cvs-commit at gcc dot gnu.org
@ 2020-09-23 13:56 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-23 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
           Assignee|marxin at gcc dot gnu.org          |rguenth at gcc dot gnu.org
         Resolution|---                         |FIXED

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

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

end of thread, other threads:[~2020-09-23 13:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04 10:20 [Bug target/96453] New: [11 Regression] ICE: in gimple_expand_vec_cond_expr, at gimple-isel.cc:167 with -Og -fno-early-inlining -fno-tree-ccp -mavx -mno-sse4.2 zsojka at seznam dot cz
2020-08-04 12:46 ` [Bug target/96453] " rguenth at gcc dot gnu.org
2020-08-10  3:17 ` marxin at gcc dot gnu.org
2020-08-10 10:39 ` marxin at gcc dot gnu.org
2020-08-10 11:44 ` marxin at gcc dot gnu.org
2020-09-23 12:41 ` marxin at gcc dot gnu.org
2020-09-23 12:42 ` rguenth at gcc dot gnu.org
2020-09-23 13:01 ` rguenth at gcc dot gnu.org
2020-09-23 13:56 ` cvs-commit at gcc dot gnu.org
2020-09-23 13:56 ` 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).