[Bug tree-optimization/98455] [11 Regression] ICE: verify_gimple failed (error: invalid 'PHI' argument; error: incompatible types in 'PHI' argument 2) since r11-5642-gc961e94901eb793b

2021-01-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98455

Martin Liška  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Martin Liška  ---
Fixed.

[Bug tree-optimization/98455] [11 Regression] ICE: verify_gimple failed (error: invalid 'PHI' argument; error: incompatible types in 'PHI' argument 2) since r11-5642-gc961e94901eb793b

2021-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98455

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Martin Liska :

https://gcc.gnu.org/g:7875e8dc831f30eec7203e090a209efe4c01a27d

commit r11-6635-g7875e8dc831f30eec7203e090a209efe4c01a27d
Author: Martin Liska 
Date:   Tue Jan 12 13:40:44 2021 +0100

if-to-switch: fix also virtual phis

gcc/ChangeLog:

PR tree-optimization/98455
* gimple-if-to-switch.cc (condition_info::record_phi_mapping):
Record also virtual PHIs.
(pass_if_to_switch::execute): Return TODO_cleanup_cfg only
conditionally.

gcc/testsuite/ChangeLog:

PR tree-optimization/98455
* gcc.dg/tree-ssa/pr98455.c: New test.

[Bug tree-optimization/98455] [11 Regression] ICE: verify_gimple failed (error: invalid 'PHI' argument; error: incompatible types in 'PHI' argument 2) since r11-5642-gc961e94901eb793b

2021-01-11 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98455

--- Comment #3 from Richard Biener  ---
The issue is you are leaving the virtual PHI arguments NULL and thus
ssa_redirect_edge runs into

if (def == NULL_TREE)
  continue;

but then later flush_pending_stmts expects a 1:1 correspondence of PHI
and argument per edge.  The fix is to either put in bare gimple_vop (cfun)
symbols (you'll rename later anyway) in the PHI argument place or try
to make the CFG workers deal with missing arguments.

Note missing args are not really valid.  After if-to-switch:

   :
  # .MEM_2 = PHI <.MEM_3(D)(3), .MEM_2(7), .MEM_3(D)(2), .MEM_2(9), .MEM_2(5),
(6)>
  # uc$1_12 = PHI <2.0e+0(3), uc$1_12(7), 2.0e+0(2), 0.0(9), uc$1_12(5),
uc$1_12(6)>
:
  if (io_6(D) == 0)

note the missing MEM argument in the edge from 6 to 5

[Bug tree-optimization/98455] [11 Regression] ICE: verify_gimple failed (error: invalid 'PHI' argument; error: incompatible types in 'PHI' argument 2) since r11-5642-gc961e94901eb793b

2021-01-11 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98455

Martin Liška  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #2 from Martin Liška  ---
What happens here:

if-to-switch conversion happens:

(gdb) pcfun
void n4 (int io, int vb)
{
  double uc$1;
  double uc[2];

   :
  if (io_6(D) == 0)
goto ; [INV]
  else
goto ; [INV]

   :

   :
  # uc$1_12 = PHI <2.0e+0(3), uc$1_12(7), 2.0e+0(2), 0.0(9), uc$1_12(5),
uc$1_12(6)>
:
  if (io_6(D) == 0)
goto ; [INV]
  else
goto ; [INV]

   :
  switch (vb_8(D))  [INV], case 0:  [INV], case 1: 
[INV]>

   :
:
  goto ; [INV]

   :
:
  goto ; [INV]

}

as seen, uc$1_12 = PHI <..., uc$1_12(6), ...> is properly fixed.

The pass uses TODO_cleanup_cfg that corrupts the CFG in
gimple_make_forwarder_block

EMERGENCY DUMP:

void n4 (int io, int vb)
{
  double uc$1;
  double uc[2];

   :

   :
  # uc$1_12 = PHI <2.0e+0(2), uc$1_12(5), (4), uc$1_12(3), 0.0(6)> <- HERE
:
  if (io_6(D) == 0)
goto ; [INV]
  else
goto ; [INV]

   :
  switch (vb_8(D))  [INV], case 0:  [INV], case 1: 
[INV]>

   :
:
  goto ; [INV]

   :
:
  goto ; [INV]

}

@Richi: What am I doing wrong?

[Bug tree-optimization/98455] [11 Regression] ICE: verify_gimple failed (error: invalid 'PHI' argument; error: incompatible types in 'PHI' argument 2) since r11-5642-gc961e94901eb793b

2021-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98455

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
  Known to work||10.2.0
   Last reconfirmed||2021-01-04
  Known to fail||11.0
   Priority|P3  |P1
Summary|[11 Regression] ICE:|[11 Regression] ICE:
   |verify_gimple failed|verify_gimple failed
   |(error: invalid 'PHI'   |(error: invalid 'PHI'
   |argument; error:|argument; error:
   |incompatible types in 'PHI' |incompatible types in 'PHI'
   |argument 2) |argument 2) since
   ||r11-5642-gc961e94901eb793b
   Target Milestone|--- |11.0

--- Comment #1 from Martin Liška  ---
Mine, started with r11-5642-gc961e94901eb793b.