[Bug tree-optimization/86263] [9 Regression] [nvptx] casesi, tablejump

2018-06-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86263

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #10 from Martin Liška  ---
Should be fixed now.

[Bug tree-optimization/86263] [9 Regression] [nvptx] casesi, tablejump

2018-06-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86263

--- Comment #9 from Martin Liška  ---
Author: marxin
Date: Fri Jun 29 10:57:00 2018
New Revision: 262247

URL: https://gcc.gnu.org/viewcvs?rev=262247=gcc=rev
Log:
Fix bit-test expansion for single cluster (PR tree-optimization/86263).

2018-06-29  Martin Liska  

PR tree-optimization/86263
* tree-switch-conversion.c
(switch_decision_tree::try_switch_expansion):
Make edge redirection.
2018-06-29  Martin Liska  

PR tree-optimization/86263
* gcc.dg/tree-ssa/pr86263.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr86263.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-switch-conversion.c

[Bug tree-optimization/86263] [9 Regression] [nvptx] casesi, tablejump

2018-06-28 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86263

Martin Liška  changed:

   What|Removed |Added

 Status|REOPENED|ASSIGNED

--- Comment #8 from Martin Liška  ---
Confirmed, I've got patch candidate for it.

[Bug tree-optimization/86263] [9 Regression] [nvptx] casesi, tablejump

2018-06-27 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86263

--- Comment #7 from Tom de Vries  ---
The pass_lower_switch has no effect. It generates a switch expansion at
bb12, but the function still uses the switch at bb10:
...
(gdb) call debug_function (cfun.decl, 0)
_dcvt (void * ptr, char type, int opt, int val)
{
  char D.1454;
  int _1;
  char _12;
  unsigned int _13;
  unsigned int _14;
  _Bool _15;
  long unsigned int _16;
  long unsigned int _17;
  _Bool _18;
  long unsigned int _19;
  _Bool _20;
  long unsigned int _21;
  _Bool _22;

   :
  _1 = (int) type_3(D);

   :
  goto ; [100.00%]

   :
  _13 = (unsigned int) _1;
  _14 = _13 + 4294967227;
  _15 = _14 > 34;
  if (_15 != 0)
goto ; [INV]
  else
goto ; [INV]

   :
  _16 = 1 << _14;
  _17 = _16 & 4294967297;
  _18 = _17 != 0;
  if (_18 != 0)
goto ; [INV]
  else
goto ; [INV]

   :
  _19 = _16 & 17179869188;
  _20 = _19 != 0;
  if (_20 != 0)
goto ; [INV]
  else
goto ; [INV]

   :
  _21 = _16 & 8589934594;
  _22 = _21 != 0;
  if (_22 != 0)
goto ; [INV]
  else
goto ; [INV]

   :
  goto ; [INV]

   :
  switch (_1)  [INV], case 69:  [INV], case 70:  [INV],
case 71:  [INV], case 101:  [INV], case 102:  [INV], case 103: 
[INV]>

   :
:
  f1 (ptr_5(D));
  goto ; [INV]

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

   :
  opt_8 = 1;

   :
  f2 (ptr_5(D));
  goto ; [INV]

   :
:
  f3 (ptr_5(D));

   :
:
  _12 = (char) val_11(D);

   :
:
  return _12;

}
...

[Bug tree-optimization/86263] [9 Regression] [nvptx] casesi, tablejump

2018-06-22 Thread cesar at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86263

cesar at gcc dot gnu.org changed:

   What|Removed |Added

 CC||cesar at gcc dot gnu.org

--- Comment #6 from cesar at gcc dot gnu.org ---
Created attachment 44311
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44311=edit
newlib test case

I attached a reduced test case from ecvtbuf.c. At Thomas mentioned, it's
failing with nvptx-gcc.

[Bug tree-optimization/86263] [9 Regression] [nvptx] casesi, tablejump

2018-06-22 Thread tschwinge at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86263

--- Comment #5 from Thomas Schwinge  ---
Looking at newlib's "newlib/libc/stdlib/ecvtbuf.c", the diff of
"ecvtbuf.c.040t.switchconv" between before/after the r261793 "Switch other
switch expansion methods into classes" changes is just:

 beginning to process the following SWITCH statement
([...]/newlib/libc/stdlib/ecvtbuf.c:431) : ---
 switch (type_5(D))  [INV], case 69:  [INV], case 70:
 [INV], case 71:  [INV], case 101:  [INV], case 102:  [INV],
case 103:  [INV]>

-Bailing out - no common successor to all case label target blocks found
+Bailing out - expanding as bit test is preferable
 
 _dcvt (struct _reent * ptr, char * buffer, double invalue, int precision,
int width, char type, int dot)

This doesn't get changed back by your later r261886 -- is that
expected/correct?

[Bug tree-optimization/86263] [9 Regression] [nvptx] casesi, tablejump

2018-06-22 Thread tschwinge at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86263

Thomas Schwinge  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
   Last reconfirmed|2018-06-21 00:00:00 |2018-6-22
 Resolution|FIXED   |---

--- Comment #4 from Thomas Schwinge  ---
Thanks for having a look, but I'm still seeing the same "internal compiler
error: in emit_case_dispatch_table, at stmt.c:851".  :-| Hmm.  How did you test
that it's now fixed?

[Bug tree-optimization/86263] [9 Regression] [nvptx] casesi, tablejump

2018-06-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86263

Martin Liška  changed:

   What|Removed |Added

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

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

[Bug tree-optimization/86263] [9 Regression] [nvptx] casesi, tablejump

2018-06-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86263

--- Comment #2 from Martin Liška  ---
Author: marxin
Date: Fri Jun 22 11:32:20 2018
New Revision: 261886

URL: https://gcc.gnu.org/viewcvs?rev=261886=gcc=rev
Log:
Fix emission of jump tables (PR tree-optimization/86263).

2018-06-22  Martin Liska  

PR tree-optimization/86263
* tree-switch-conversion.c (jump_table_cluster::find_jump_tables):
Bail out if is_enabled is false.
* tree-switch-conversion.h (jump_table_cluster::is_enabled):
New declaration.
(jump_table_cluster::is_enabled): New function.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-switch-conversion.c
trunk/gcc/tree-switch-conversion.h