public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert
@ 2021-10-22 11:22 tnfchris at gcc dot gnu.org
  2021-10-22 11:29 ` [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2021-10-22 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102897
           Summary: [12 Regression] simplify_permutation ICEs on assert
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
  Target Milestone: ---

The following testcase

typedef __attribute__((vector_size(8))) signed char int8x8_t;
typedef __attribute__((vector_size(8))) unsigned char uint8x8_t;

int8x8_t fn1(int8x8_t val20, char tmp) {
  uint8x8_t __trans_tmp_3;
  __trans_tmp_3 = (uint8x8_t){tmp};
  int8x8_t __a = (int8x8_t)__trans_tmp_3;
  return __builtin_shuffle(__a, val20, (uint8x8_t){});
}

ICEs at -O1 and higher with

during GIMPLE pass: forwprop
<source>: In function 'fn1':
<source>:12:1: internal compiler error: in simplify_permutation, at
tree-ssa-forwprop.c:2271
   12 | }
      | ^
0x1000e00 simplify_permutation
        src/gcc/gcc/tree-ssa-forwprop.c:2271
0x1007ae8 execute
        src/gcc/gcc/tree-ssa-forwprop.c:3397

That line contains an assert with the comment

          tree op2_type = TREE_TYPE (op2);
          /* Should have folded this before.  */
          gcc_assert (op2_type != tgt_type);

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

* [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf
  2021-10-22 11:22 [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert tnfchris at gcc dot gnu.org
@ 2021-10-22 11:29 ` marxin at gcc dot gnu.org
  2021-10-22 18:55 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-10-22 11:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |linkw at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-10-22
            Summary|[12 Regression]             |[12 Regression]
                   |simplify_permutation ICEs   |simplify_permutation ICEs
                   |on assert                   |on assert since
                   |                            |r12-1103-g4a9f2306cb39a3cf
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r12-1103-g4a9f2306cb39a3cf.

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

* [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf
  2021-10-22 11:22 [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert tnfchris at gcc dot gnu.org
  2021-10-22 11:29 ` [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf marxin at gcc dot gnu.org
@ 2021-10-22 18:55 ` pinskia at gcc dot gnu.org
  2021-10-25  2:20 ` linkw at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-22 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |12.0

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

* [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf
  2021-10-22 11:22 [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert tnfchris at gcc dot gnu.org
  2021-10-22 11:29 ` [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf marxin at gcc dot gnu.org
  2021-10-22 18:55 ` pinskia at gcc dot gnu.org
@ 2021-10-25  2:20 ` linkw at gcc dot gnu.org
  2021-10-25  6:43 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: linkw at gcc dot gnu.org @ 2021-10-25  2:20 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
Thanks for reporting and bisection, I'll have a look.

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

* [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf
  2021-10-22 11:22 [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert tnfchris at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-10-25  2:20 ` linkw at gcc dot gnu.org
@ 2021-10-25  6:43 ` rguenth at gcc dot gnu.org
  2021-10-25  9:03 ` linkw at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-10-25  6:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf
  2021-10-22 11:22 [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert tnfchris at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-10-25  6:43 ` rguenth at gcc dot gnu.org
@ 2021-10-25  9:03 ` linkw at gcc dot gnu.org
  2021-10-26 10:04 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: linkw at gcc dot gnu.org @ 2021-10-25  9:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
The culprit assertion is based on one assumption, for one given VEC_PERM_EXPR
expression, if the type of permutation control vector and the type of
permutation operand is the same, and it's foldable, then it's done previously.
But from this case, this is not true.

For example, for the case

int8x8_t fn1(int8x8_t val20, char tmp) {
  int8x8_t __a = (int8x8_t){tmp};
  return __builtin_shuffle(__a, val20, (int8x8_t){0, 1, 2, 3, 4, 5, 6, 7});
}

we can get

int8x8_t fn1 (int8x8_t val20, char tmp)
{
  int8x8_t __a;

  <bb 2> :
  __a_2 = {tmp_1(D)};
  return __a_2;

}

before forwprop, while for the case

int8x8_t fn1(int8x8_t val20, char tmp) {
  int8x8_t __a = (int8x8_t){tmp};
  return __builtin_shuffle(__a, val20, (int8x8_t){0, 1, 2, 3, 0, 1, 2, 3});
}

we only get the below before forwprop,

int8x8_t fn1 (int8x8_t val20, char tmp)
{
  int8x8_t __a;
  int8x8_t _3;

  <bb 2> :
  __a_2 = {tmp_1(D)};
  _3 = VEC_PERM_EXPR <__a_2, __a_2, { 0, 1, 2, 3, 0, 1, 2, 3 }>;
  return _3;

}

After remove the assertion there, we can get below immediately at forwprop.

int8x8_t fn1 (int8x8_t val20, char tmp)
{
  int8x8_t __a;
  int8x8_t _3;

  <bb 2> :
  __a_2 = {tmp_1(D)};
  _3 = {tmp_1(D), 0, 0, 0, tmp_1(D), 0, 0, 0};
  return _3;

}

I think we should remove this assertion.

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

* [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf
  2021-10-22 11:22 [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert tnfchris at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-10-25  9:03 ` linkw at gcc dot gnu.org
@ 2021-10-26 10:04 ` cvs-commit at gcc dot gnu.org
  2021-10-27  7:44 ` cvs-commit at gcc dot gnu.org
  2021-10-27  8:27 ` linkw at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-26 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:54e4e1769e44b925c35c0ffc11723027ff855bd7

commit r12-4705-g54e4e1769e44b925c35c0ffc11723027ff855bd7
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue Oct 26 04:09:38 2021 -0500

    forwprop: Remove incorrect assertion [PR102897]

    As PR102897 shows, there is one incorrect assertion in function
    simplify_permutation, which is based on the wrong assumption that
    all cases with op2_type == tgt_type are handled previously, the
    proposed fix is to remove the assertion.

    gcc/ChangeLog:

            PR tree-optimization/102897
            * tree-ssa-forwprop.c (simplify_permutation): Remove a wrong
assertion.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr102897.c: New test.

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

* [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf
  2021-10-22 11:22 [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert tnfchris at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-10-26 10:04 ` cvs-commit at gcc dot gnu.org
@ 2021-10-27  7:44 ` cvs-commit at gcc dot gnu.org
  2021-10-27  8:27 ` linkw at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-27  7:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS 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:4f1fe0dc25391a1d73c1034a85b3b6bf04c5e26e

commit r12-4735-g4f1fe0dc25391a1d73c1034a85b3b6bf04c5e26e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Oct 27 09:41:38 2021 +0200

    testsuite: Fix up gcc.dg/pr102897.c testcase [PR102897]

    The testcase FAILs on i686-linux due to:
    FAIL: gcc.dg/pr102897.c (test for excess errors)
    Excess errors:
    .../gcc/gcc/testsuite/gcc.dg/pr102897.c:11:1: warning: MMX vector return
without MMX enabled changes the ABI [-Wpsabi]
    .../gcc/gcc/testsuite/gcc.dg/pr102897.c:10:10: warning: MMX vector argument
without MMX enabled changes the ABI [-Wpsabi]
    Fixed by adding -Wno-psabi.

    2021-10-27  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/102897
            * gcc.dg/pr102897.c: Add -Wno-psabi to dg-options.

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

* [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf
  2021-10-22 11:22 [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert tnfchris at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-10-27  7:44 ` cvs-commit at gcc dot gnu.org
@ 2021-10-27  8:27 ` linkw at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: linkw at gcc dot gnu.org @ 2021-10-27  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to CVS Commits from comment #5)
> The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:4f1fe0dc25391a1d73c1034a85b3b6bf04c5e26e
> 
> commit r12-4735-g4f1fe0dc25391a1d73c1034a85b3b6bf04c5e26e
> Author: Jakub Jelinek <jakub@redhat.com>
> Date:   Wed Oct 27 09:41:38 2021 +0200
> 
>     testsuite: Fix up gcc.dg/pr102897.c testcase [PR102897]
>     

Thanks to Jakub for fixing this up!

The original reported issue should be fixed on latest trunk.

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

end of thread, other threads:[~2021-10-27  8:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 11:22 [Bug tree-optimization/102897] New: [12 Regression] simplify_permutation ICEs on assert tnfchris at gcc dot gnu.org
2021-10-22 11:29 ` [Bug tree-optimization/102897] [12 Regression] simplify_permutation ICEs on assert since r12-1103-g4a9f2306cb39a3cf marxin at gcc dot gnu.org
2021-10-22 18:55 ` pinskia at gcc dot gnu.org
2021-10-25  2:20 ` linkw at gcc dot gnu.org
2021-10-25  6:43 ` rguenth at gcc dot gnu.org
2021-10-25  9:03 ` linkw at gcc dot gnu.org
2021-10-26 10:04 ` cvs-commit at gcc dot gnu.org
2021-10-27  7:44 ` cvs-commit at gcc dot gnu.org
2021-10-27  8:27 ` linkw 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).