public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
@ 2024-05-17 21:29 patrick at rivosinc dot com
  2024-05-18  2:00 ` [Bug tree-optimization/115143] " pinskia at gcc dot gnu.org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: patrick at rivosinc dot com @ 2024-05-17 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115143
           Summary: [14/15 Regression] tree check: expected class 'type',
                    have 'exceptional' (error_mark) in
                    useless_type_conversion_p, at gimple-expr.cc:85
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
short a, d;
char b;
long c;
unsigned long e, f;
void g(unsigned long h) {
  if (c ? e : b)
    if (e)
      if (d) {
        a = f ? ({
          unsigned long i = d ? f : 0, j = e ? h : 0;
          i < j ? i : j;
        }) : 0;
      }
}

Backtrace:
> /scratch/tc-testing/tc-may-17/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -O3 red.c -o red.out
during GIMPLE pass: phiopt
./red.c: In function 'g':
./red.c:14:1: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
   14 | }
      | ^
0xb17187 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../../gcc/gcc/tree.cc:9045
0xa40033 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../../gcc/gcc/tree.h:3779
0xa40033 useless_type_conversion_p(tree_node*, tree_node*)
        ../../../gcc/gcc/gimple-expr.cc:85
0x1378e92 verify_gimple_assign_binary
        ../../../gcc/gcc/tree-cfg.cc:4309
0x13841de verify_gimple_in_cfg(function*, bool, bool)
        ../../../gcc/gcc/tree-cfg.cc:5614
0x11fff20 execute_function_todo
        ../../../gcc/gcc/passes.cc:2089
0x120046b execute_todo
        ../../../gcc/gcc/passes.cc:2143
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Godbolt:
https://godbolt.org/z/o187xKdP1

Affects x86, arm, risc-v.

Found via fuzzer.

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

* [Bug tree-optimization/115143] [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
@ 2024-05-18  2:00 ` pinskia at gcc dot gnu.org
  2024-05-18  2:22 ` pinskia at gcc dot gnu.org
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18  2:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org
   Target Milestone|---                         |14.2

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

* [Bug tree-optimization/115143] [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
  2024-05-18  2:00 ` [Bug tree-optimization/115143] " pinskia at gcc dot gnu.org
@ 2024-05-18  2:22 ` pinskia at gcc dot gnu.org
  2024-05-18 13:11 ` pinskia at gcc dot gnu.org
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18  2:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-05-18
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks to be maybe mine.

Before phiopt we start out with:
  if (f.7_6 != 0)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 9> :
  # iftmp.10_12 = PHI <h_22(D)(8)>
  _25 = MIN_EXPR <f.7_6, iftmp.10_12>;
  iftmp.6_26 = (short int) _25;

  <bb 10> :
  # iftmp.6_10 = PHI <iftmp.6_26(9), 0(8)>


And then we move the cast outside of the if condition:
```
PHI iftmp.6_10 changed to factor operation out from COND_EXPR.
New stmt with OPERATION that defines iftmp.6_10.
Applying pattern match.pd:7193, generic-match-6.cc:1904
Applying pattern match.pd:4062, gimple-match-7.cc:15093
Removing basic block 9
;; basic block 9, loop depth 0
;;  pred:       8
# iftmp.10_12 = PHI <h_22(D)(8)>
;;  succ:       10

```

the bug is in minmax part of phiopt and I think it was caused by my
r14-4279-g68fa82e2d8f868 .

Anyways removing minmax is on my plan but I have not gotten to the patches yet.

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

* [Bug tree-optimization/115143] [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
  2024-05-18  2:00 ` [Bug tree-optimization/115143] " pinskia at gcc dot gnu.org
  2024-05-18  2:22 ` pinskia at gcc dot gnu.org
@ 2024-05-18 13:11 ` pinskia at gcc dot gnu.org
  2024-05-18 13:12 ` [Bug tree-optimization/115143] [13/14/15 " pinskia at gcc dot gnu.org
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 13:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> the bug is in minmax part of phiopt and I think it was caused by my
> r14-4279-g68fa82e2d8f868 .
> 

It was not caused by that. Rather it was caused by r14-3827-g30e6ee074588ba .

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

* [Bug tree-optimization/115143] [13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (2 preceding siblings ...)
  2024-05-18 13:11 ` pinskia at gcc dot gnu.org
@ 2024-05-18 13:12 ` pinskia at gcc dot gnu.org
  2024-05-18 13:15 ` [Bug tree-optimization/115143] [11/12/13/14/15 " pinskia at gcc dot gnu.org
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |13.2.0
            Summary|[14/15 Regression] tree     |[13/14/15 Regression] tree
                   |check: expected class       |check: expected class
                   |'type', have 'exceptional'  |'type', have 'exceptional'
                   |(error_mark) in             |(error_mark) in
                   |useless_type_conversion_p,  |useless_type_conversion_p,
                   |at gimple-expr.cc:85        |at gimple-expr.cc:85
           Severity|normal                      |blocker
   Target Milestone|14.2                        |13.3
      Known to fail|                            |13.2.1

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Which means it is now a regression in GCC 13.

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (3 preceding siblings ...)
  2024-05-18 13:12 ` [Bug tree-optimization/115143] [13/14/15 " pinskia at gcc dot gnu.org
@ 2024-05-18 13:15 ` pinskia at gcc dot gnu.org
  2024-05-18 13:27 ` pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[13/14/15 Regression] tree  |[11/12/13/14/15 Regression]
                   |check: expected class       |tree check: expected class
                   |'type', have 'exceptional'  |'type', have 'exceptional'
                   |(error_mark) in             |(error_mark) in
                   |useless_type_conversion_p,  |useless_type_conversion_p,
                   |at gimple-expr.cc:85        |at gimple-expr.cc:85

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
And GCC 11, and 12 too.

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (4 preceding siblings ...)
  2024-05-18 13:15 ` [Bug tree-optimization/115143] [11/12/13/14/15 " pinskia at gcc dot gnu.org
@ 2024-05-18 13:27 ` pinskia at gcc dot gnu.org
  2024-05-18 13:27 ` pinskia at gcc dot gnu.org
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note this is a latent bug that dates back to r0-66475-g8eaa0f34a3387d (GCC
4.1.0)

Note also r13-1950-g9bb19e143cfe88 introduced the similar bug too.

Basically there needs a check for no phi nodes in the middle bb's.

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (5 preceding siblings ...)
  2024-05-18 13:27 ` pinskia at gcc dot gnu.org
@ 2024-05-18 13:27 ` pinskia at gcc dot gnu.org
  2024-05-18 14:04 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 58232
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58232&action=edit
Patch which I am testing

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (6 preceding siblings ...)
  2024-05-18 13:27 ` pinskia at gcc dot gnu.org
@ 2024-05-18 14:04 ` pinskia at gcc dot gnu.org
  2024-05-18 14:06 ` pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
here is the simplified gimple testcase so it does not depend on optimizations
before hand:
```
unsigned __GIMPLE (ssa,startwith("phiopt"))
foo (unsigned a, unsigned b)
{
  unsigned j;
  unsigned _23;
  unsigned _12;

  __BB(2):
  if (a_6(D) != 0u)
    goto __BB3;
  else
    goto __BB4;

  __BB(3):
  j_10 = __PHI (__BB2: b_11(D));
  _23 = __MIN (a_6(D), j_10);
  goto __BB4;

  __BB(4):
  _12 = __PHI (__BB3: _23, __BB2: 0u);
  return _12;

}
```


Here is one which failed since GCC 10 (when __MIN support was added for gimple
FE):
```
signed __GIMPLE (ssa,startwith("phiopt"))
foo (signed a, unsigned b)
{
  signed j;
  signed _23;
  signed _12;

  __BB(2):
  if (a_6(D) > 0)
    goto __BB3;
  else
    goto __BB4;

  __BB(3):
  j_10 = __PHI (__BB2: b_11(D));
  _23 = __MIN (a_6(D), j_10);
  goto __BB4;

  __BB(4):
  _12 = __PHI (__BB3: _23, __BB2: 0);
  return _12;

}
```

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (7 preceding siblings ...)
  2024-05-18 14:04 ` pinskia at gcc dot gnu.org
@ 2024-05-18 14:06 ` pinskia at gcc dot gnu.org
  2024-05-18 14:10 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 14:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|13.2.0                      |
           Severity|blocker                     |normal
      Known to fail|                            |10.1.0

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (8 preceding siblings ...)
  2024-05-18 14:06 ` pinskia at gcc dot gnu.org
@ 2024-05-18 14:10 ` pinskia at gcc dot gnu.org
  2024-05-18 14:36 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 14:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #7) 
> Here is one which failed since GCC 10 (when __MIN support was added for
> gimple FE):
> ```
> signed __GIMPLE (ssa,startwith("phiopt"))
> foo (signed a, unsigned b)
> {
>   signed j;
>   signed _23;
>   signed _12;
> 
>   __BB(2):
>   if (a_6(D) > 0)
>     goto __BB3;
>   else
>     goto __BB4;
> 
>   __BB(3):
>   j_10 = __PHI (__BB2: b_11(D));
>   _23 = __MIN (a_6(D), j_10);
>   goto __BB4;
> 
>   __BB(4):
>   _12 = __PHI (__BB3: _23, __BB2: 0);
>   return _12;
> 
> }
> ```

This testcase is buggy.

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (9 preceding siblings ...)
  2024-05-18 14:10 ` pinskia at gcc dot gnu.org
@ 2024-05-18 14:36 ` pinskia at gcc dot gnu.org
  2024-05-18 23:12 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
here is one that is more correct to show the failure:
```
unsigned __GIMPLE (ssa,startwith("phiopt"))
foo (unsigned a, unsigned b)
{
  unsigned j;
  unsigned _23;
  unsigned _12;

  __BB(2):
  if (a_6(D) > 0u)
    goto __BB3;
  else
    goto __BB4;

  __BB(3):
  j_10 = __PHI (__BB2: b_7(D));
  _23 = __MIN (a_6(D), j_10);
  goto __BB4;

  __BB(4):
  _12 = __PHI (__BB3: _23, __BB2: 0u);
  return _12;
}
```

But note this does use the canonical form for the comparison; `a > 0u` is the
non-canonical form of `a != 0u` (for unsigned types). That is why it didn't
show up before. My patch (r14-3827-g30e6ee074588ba ) fixed the issue with the
way comparison was doing and exposed this latent bug. It was trying `j_10 >=
1u` before when it should have been doing `j_10 >= 0u` and that is the issue.

THIS only shows up with unsigned types because  `j_10 >= 0u` is always true and
it needed that to match the constant really.

Anyways my patch fixes the issue

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (10 preceding siblings ...)
  2024-05-18 14:36 ` pinskia at gcc dot gnu.org
@ 2024-05-18 23:12 ` pinskia at gcc dot gnu.org
  2024-05-20 21:45 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 23:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2024-May/652
                   |                            |095.html

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652095.html

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (11 preceding siblings ...)
  2024-05-18 23:12 ` pinskia at gcc dot gnu.org
@ 2024-05-20 21:45 ` cvs-commit at gcc dot gnu.org
  2024-05-20 21:57 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-20 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:9ff8f041331ef8b56007fb3c4d41d76f9850010d

commit r15-699-g9ff8f041331ef8b56007fb3c4d41d76f9850010d
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Sat May 18 11:55:58 2024 -0700

    PHIOPT: Don't transform minmax if middle bb contains a phi [PR115143]

    The problem here is even if last_and_only_stmt returns a statement,
    the bb might still contain a phi node which defines a ssa name
    which is used in that statement so we need to add a check to make sure
    that the phi nodes are empty for the middle bbs in both the
    `CMP?MINMAX:MINMAX` case and the `CMP?MINMAX:B` cases.

    Bootstrapped and tested on x86_64_linux-gnu with no regressions.

            PR tree-optimization/115143

    gcc/ChangeLog:

            * tree-ssa-phiopt.cc (minmax_replacement): Check for empty
            phi nodes for middle bbs for the case where middle bb is not empty.

    gcc/testsuite/ChangeLog:

            * gcc.c-torture/compile/pr115143-1.c: New test.
            * gcc.c-torture/compile/pr115143-2.c: New test.
            * gcc.c-torture/compile/pr115143-3.c: New test.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>

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

* [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (12 preceding siblings ...)
  2024-05-20 21:45 ` cvs-commit at gcc dot gnu.org
@ 2024-05-20 21:57 ` cvs-commit at gcc dot gnu.org
  2024-05-20 21:58 ` [Bug tree-optimization/115143] [11/12/13 " pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-20 21:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Andrew Pinski
<pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:89ab128656b9da1359705bd770ae7d2367b33ec2

commit r14-10222-g89ab128656b9da1359705bd770ae7d2367b33ec2
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Sat May 18 11:55:58 2024 -0700

    PHIOPT: Don't transform minmax if middle bb contains a phi [PR115143]

    The problem here is even if last_and_only_stmt returns a statement,
    the bb might still contain a phi node which defines a ssa name
    which is used in that statement so we need to add a check to make sure
    that the phi nodes are empty for the middle bbs in both the
    `CMP?MINMAX:MINMAX` case and the `CMP?MINMAX:B` cases.

    Bootstrapped and tested on x86_64_linux-gnu with no regressions.

            PR tree-optimization/115143

    gcc/ChangeLog:

            * tree-ssa-phiopt.cc (minmax_replacement): Check for empty
            phi nodes for middle bbs for the case where middle bb is not empty.

    gcc/testsuite/ChangeLog:

            * gcc.c-torture/compile/pr115143-1.c: New test.
            * gcc.c-torture/compile/pr115143-2.c: New test.
            * gcc.c-torture/compile/pr115143-3.c: New test.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
    (cherry picked from commit 9ff8f041331ef8b56007fb3c4d41d76f9850010d)

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

* [Bug tree-optimization/115143] [11/12/13 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (13 preceding siblings ...)
  2024-05-20 21:57 ` cvs-commit at gcc dot gnu.org
@ 2024-05-20 21:58 ` pinskia at gcc dot gnu.org
  2024-05-21  9:20 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-20 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13/14/15 Regression] |[11/12/13 Regression] tree
                   |tree check: expected class  |check: expected class
                   |'type', have 'exceptional'  |'type', have 'exceptional'
                   |(error_mark) in             |(error_mark) in
                   |useless_type_conversion_p,  |useless_type_conversion_p,
                   |at gimple-expr.cc:85        |at gimple-expr.cc:85
      Known to work|                            |14.1.1, 15.0

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed so far on the trunk and gcc-14 branches. Waiting for GCC 13.3.0 release
to backport (unless approved tomorrow for the branch).

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

* [Bug tree-optimization/115143] [11/12/13 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (14 preceding siblings ...)
  2024-05-20 21:58 ` [Bug tree-optimization/115143] [11/12/13 " pinskia at gcc dot gnu.org
@ 2024-05-21  9:20 ` jakub at gcc dot gnu.org
  2024-05-21 14:32 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-05-21  9:20 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.3                        |13.4

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 13.3 is being released, retargeting bugs to GCC 13.4.

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

* [Bug tree-optimization/115143] [11/12/13 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (15 preceding siblings ...)
  2024-05-21  9:20 ` jakub at gcc dot gnu.org
@ 2024-05-21 14:32 ` cvs-commit at gcc dot gnu.org
  2024-05-21 14:36 ` [Bug tree-optimization/115143] [11/12 " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-21 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Andrew Pinski
<pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:3f6a42510a1bd4b004ed70ac44cdad2770b732a8

commit r13-8784-g3f6a42510a1bd4b004ed70ac44cdad2770b732a8
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Sat May 18 11:55:58 2024 -0700

    PHIOPT: Don't transform minmax if middle bb contains a phi [PR115143]

    The problem here is even if last_and_only_stmt returns a statement,
    the bb might still contain a phi node which defines a ssa name
    which is used in that statement so we need to add a check to make sure
    that the phi nodes are empty for the middle bbs in both the
    `CMP?MINMAX:MINMAX` case and the `CMP?MINMAX:B` cases.

    Bootstrapped and tested on x86_64_linux-gnu with no regressions.

            PR tree-optimization/115143

    gcc/ChangeLog:

            * tree-ssa-phiopt.cc (minmax_replacement): Check for empty
            phi nodes for middle bbs for the case where middle bb is not empty.

    gcc/testsuite/ChangeLog:

            * gcc.c-torture/compile/pr115143-1.c: New test.
            * gcc.c-torture/compile/pr115143-2.c: New test.
            * gcc.c-torture/compile/pr115143-3.c: New test.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
    (cherry picked from commit 9ff8f041331ef8b56007fb3c4d41d76f9850010d)

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

* [Bug tree-optimization/115143] [11/12 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (16 preceding siblings ...)
  2024-05-21 14:32 ` cvs-commit at gcc dot gnu.org
@ 2024-05-21 14:36 ` pinskia at gcc dot gnu.org
  2024-06-11 17:19 ` cvs-commit at gcc dot gnu.org
  2024-06-11 17:20 ` [Bug tree-optimization/115143] [11 " pinskia at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-21 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |13.3.0
            Summary|[11/12/13 Regression] tree  |[11/12 Regression] tree
                   |check: expected class       |check: expected class
                   |'type', have 'exceptional'  |'type', have 'exceptional'
                   |(error_mark) in             |(error_mark) in
                   |useless_type_conversion_p,  |useless_type_conversion_p,
                   |at gimple-expr.cc:85        |at gimple-expr.cc:85
   Target Milestone|13.4                        |11.5
      Known to work|                            |13.3.1

--- Comment #16 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed on the GCC 13 branch too. Backporting further requires removing the hunk
that handles diamond bbs as that was not in 12 or 11. I will handle that
tomorrow.

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

* [Bug tree-optimization/115143] [11/12 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (17 preceding siblings ...)
  2024-05-21 14:36 ` [Bug tree-optimization/115143] [11/12 " pinskia at gcc dot gnu.org
@ 2024-06-11 17:19 ` cvs-commit at gcc dot gnu.org
  2024-06-11 17:20 ` [Bug tree-optimization/115143] [11 " pinskia at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-11 17:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Andrew Pinski
<pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:d30afaae6764379a63c22459b40aaecfa82b0fc4

commit r12-10546-gd30afaae6764379a63c22459b40aaecfa82b0fc4
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Sat May 18 11:55:58 2024 -0700

    PHIOPT: Don't transform minmax if middle bb contains a phi [PR115143]

    The problem here is even if last_and_only_stmt returns a statement,
    the bb might still contain a phi node which defines a ssa name
    which is used in that statement so we need to add a check to make sure
    that the phi nodes are empty for the middle bbs in both the
    `CMP?MINMAX:MINMAX` case and the `CMP?MINMAX:B` cases.

    Bootstrapped and tested on x86_64_linux-gnu with no regressions.

            PR tree-optimization/115143

    gcc/ChangeLog:

            * tree-ssa-phiopt.cc (minmax_replacement): Check for empty
            phi nodes for middle bbs for the case where middle bb is not empty.

    gcc/testsuite/ChangeLog:

            * gcc.c-torture/compile/pr115143-1.c: New test.
            * gcc.c-torture/compile/pr115143-2.c: New test.
            * gcc.c-torture/compile/pr115143-3.c: New test.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
    (cherry picked from commit 9ff8f041331ef8b56007fb3c4d41d76f9850010d)

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

* [Bug tree-optimization/115143] [11 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
  2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
                   ` (18 preceding siblings ...)
  2024-06-11 17:19 ` cvs-commit at gcc dot gnu.org
@ 2024-06-11 17:20 ` pinskia at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-11 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression] tree     |[11 Regression] tree check:
                   |check: expected class       |expected class 'type', have
                   |'type', have 'exceptional'  |'exceptional' (error_mark)
                   |(error_mark) in             |in
                   |useless_type_conversion_p,  |useless_type_conversion_p,
                   |at gimple-expr.cc:85        |at gimple-expr.cc:85
      Known to work|                            |12.3.1

--- Comment #18 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #16)
> Fixed on the GCC 13 branch too. Backporting further requires removing the
> hunk that handles diamond bbs as that was not in 12 or 11. I will handle
> that tomorrow.

Fixed on the GCC 12 branch too now. Will handle 11 tomorrow.

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

end of thread, other threads:[~2024-06-11 17:20 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 patrick at rivosinc dot com
2024-05-18  2:00 ` [Bug tree-optimization/115143] " pinskia at gcc dot gnu.org
2024-05-18  2:22 ` pinskia at gcc dot gnu.org
2024-05-18 13:11 ` pinskia at gcc dot gnu.org
2024-05-18 13:12 ` [Bug tree-optimization/115143] [13/14/15 " pinskia at gcc dot gnu.org
2024-05-18 13:15 ` [Bug tree-optimization/115143] [11/12/13/14/15 " pinskia at gcc dot gnu.org
2024-05-18 13:27 ` pinskia at gcc dot gnu.org
2024-05-18 13:27 ` pinskia at gcc dot gnu.org
2024-05-18 14:04 ` pinskia at gcc dot gnu.org
2024-05-18 14:06 ` pinskia at gcc dot gnu.org
2024-05-18 14:10 ` pinskia at gcc dot gnu.org
2024-05-18 14:36 ` pinskia at gcc dot gnu.org
2024-05-18 23:12 ` pinskia at gcc dot gnu.org
2024-05-20 21:45 ` cvs-commit at gcc dot gnu.org
2024-05-20 21:57 ` cvs-commit at gcc dot gnu.org
2024-05-20 21:58 ` [Bug tree-optimization/115143] [11/12/13 " pinskia at gcc dot gnu.org
2024-05-21  9:20 ` jakub at gcc dot gnu.org
2024-05-21 14:32 ` cvs-commit at gcc dot gnu.org
2024-05-21 14:36 ` [Bug tree-optimization/115143] [11/12 " pinskia at gcc dot gnu.org
2024-06-11 17:19 ` cvs-commit at gcc dot gnu.org
2024-06-11 17:20 ` [Bug tree-optimization/115143] [11 " pinskia 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).