public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement
       [not found] <bug-14799-4@http.gcc.gnu.org/bugzilla/>
@ 2011-01-14 15:54 ` tom at codesourcery dot com
  2020-12-01 10:47 ` cvs-commit at gcc dot gnu.org
  2020-12-01 10:52 ` marxin at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: tom at codesourcery dot com @ 2011-01-14 15:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14799

Tom de Vries <tom at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tom at codesourcery dot com

--- Comment #3 from Tom de Vries <tom at codesourcery dot com> 2011-01-14 15:45:56 UTC ---
The example from the description field looks like this at tree level (optimized
dump with 4.5.1). It takes until late in the rtl untill the duplicate call
blocks are collapsed.
...
foo (int a)
{
<bb 2>:
  if (a_1(D) == 30)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  bar (); [tail call]
  goto <bb 10>;

<bb 4>:
  if (a_1(D) == 31)
    goto <bb 5>;
  else
    goto <bb 6>;

<bb 5>:
  bar (); [tail call]
  goto <bb 10>;

<bb 6>:
  if (a_1(D) == 53)
    goto <bb 7>;
  else
    goto <bb 8>;

<bb 7>:
  bar (); [tail call]
  goto <bb 10>;

<bb 8>:
  if (a_1(D) == 23)
    goto <bb 9>;
  else
    goto <bb 10>;

<bb 9>:
  bar (); [tail call]

<bb 10>:
  return;
}
...

If the duplicate blocks would have been collapsed, it would look like this:
...
foo (int a)
{
<bb 2>:
  if (a_1(D) == 30)
    goto <bb 9>;
  else
    goto <bb 4>;

<bb 4>:
  if (a_1(D) == 31)
    goto <bb 9>;
  else
    goto <bb 6>;

<bb 6>:
  if (a_1(D) == 53)
    goto <bb 9>;
  else
    goto <bb 8>;

<bb 8>:
  if (a_1(D) == 23)
    goto <bb 9>;
  else
    goto <bb 10>;

<bb 9>:
  bar (); [tail call]

<bb 10>:
  return;
}
...
for this representation, the patch from PR 46935 comment 5 should work.


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

* [Bug tree-optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement
       [not found] <bug-14799-4@http.gcc.gnu.org/bugzilla/>
  2011-01-14 15:54 ` [Bug tree-optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement tom at codesourcery dot com
@ 2020-12-01 10:47 ` cvs-commit at gcc dot gnu.org
  2020-12-01 10:52 ` marxin at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-01 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:03eb09292ef228d1d12b5168cdd748583b1f992a

commit r11-5605-g03eb09292ef228d1d12b5168cdd748583b1f992a
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Aug 28 10:26:13 2020 +0200

    Add if-chain to switch conversion pass.

    gcc/ChangeLog:

            PR tree-optimization/14799
            PR ipa/88702
            * Makefile.in: Add gimple-if-to-switch.o.
            * dbgcnt.def (DEBUG_COUNTER): Add new debug counter.
            * passes.def: Include new pass_if_to_switch pass.
            * timevar.def (TV_TREE_IF_TO_SWITCH): New timevar.
            * tree-pass.h (make_pass_if_to_switch): New.
            * tree-ssa-reassoc.c (struct operand_entry): Move to the header.
            (dump_range_entry): Move to header file.
            (debug_range_entry): Likewise.
            (no_side_effect_bb): Make it global.
            * tree-switch-conversion.h (simple_cluster::simple_cluster):
            Add inline for couple of functions in order to prevent error
            about multiple defined symbols.
            * gimple-if-to-switch.cc: New file.
            * tree-ssa-reassoc.h: New file.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/14799
            PR ipa/88702
            * gcc.dg/tree-ssa/pr96480.c: Disable if-to-switch conversion.
            * gcc.dg/tree-ssa/reassoc-32.c: Likewise.
            * g++.dg/tree-ssa/if-to-switch-1.C: New test.
            * gcc.dg/tree-ssa/if-to-switch-1.c: New test.
            * gcc.dg/tree-ssa/if-to-switch-2.c: New test.
            * gcc.dg/tree-ssa/if-to-switch-3.c: New test.
            * gcc.dg/tree-ssa/if-to-switch-4.c: New test.
            * gcc.dg/tree-ssa/if-to-switch-5.c: New test.
            * gcc.dg/tree-ssa/if-to-switch-6.c: New test.
            * gcc.dg/tree-ssa/if-to-switch-7.c: New test.
            * gcc.dg/tree-ssa/if-to-switch-8.c: New test.

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

* [Bug tree-optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement
       [not found] <bug-14799-4@http.gcc.gnu.org/bugzilla/>
  2011-01-14 15:54 ` [Bug tree-optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement tom at codesourcery dot com
  2020-12-01 10:47 ` cvs-commit at gcc dot gnu.org
@ 2020-12-01 10:52 ` marxin at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-12-01 10:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Implemented in master.

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

* [Bug tree-optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement
  2004-03-31 11:24 [Bug optimization/14799] New: " kazu at cs dot umass dot edu
@ 2004-05-24 19:41 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 19:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.5.0                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14799


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

end of thread, other threads:[~2020-12-01 10:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-14799-4@http.gcc.gnu.org/bugzilla/>
2011-01-14 15:54 ` [Bug tree-optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement tom at codesourcery dot com
2020-12-01 10:47 ` cvs-commit at gcc dot gnu.org
2020-12-01 10:52 ` marxin at gcc dot gnu.org
2004-03-31 11:24 [Bug optimization/14799] New: " kazu at cs dot umass dot edu
2004-05-24 19:41 ` [Bug tree-optimization/14799] " pinskia at gcc dot gnu dot 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).