public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/65412] New: missing control flow optimisation
@ 2015-03-12 21:33 skvadrik at gmail dot com
  2015-03-13  9:22 ` [Bug tree-optimization/65412] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: skvadrik at gmail dot com @ 2015-03-12 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65412
           Summary: missing control flow optimisation
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: skvadrik at gmail dot com

Created attachment 35023
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35023&action=edit
files 1.c (source), 1.s (gcc assembly), 2.s (clang assembly)

Consider the following code:

void f(int x)
{
   if (x == 0) f0();
   else if (x == 1) f1();
   else if (x == 2) f2();
   else if (x == 3) f3();
   else if (x == 4) f4();
   else if (x == 5) f5();
}

gcc-4.9.2 doesn't optimize ifs to decision tree, jump table or something (see
1.s in attach). clang does (2.s in attach, jump table).

Maybe you could improve that?


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

end of thread, other threads:[~2021-06-04 21:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 21:33 [Bug tree-optimization/65412] New: missing control flow optimisation skvadrik at gmail dot com
2015-03-13  9:22 ` [Bug tree-optimization/65412] " rguenth at gcc dot gnu.org
2021-06-04 21:38 ` [Bug tree-optimization/65412] sequence of ifs not turned into a switch statement pinskia at gcc dot gnu.org
2021-06-04 21:41 ` 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).