This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement
- From: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 May 2004 08:33:12 -0000
- Subject: [Bug optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement
- References: <20040331112448.14799.kazu@cs.umass.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From kazu at cs dot umass dot edu 2004-05-03 08:33 -------
The following example is not strictly a seuqence of "if"s, but
do note that it is a real-world example extracted from function.c of GCC.
<L21>:;
T.1674_116 = type_1->common.code;
T.1675_117 = T.1674_116 == 18;
T.1676_118 = T.1674_116 == 20;
T.1677_119 = T.1675_117 || T.1676_118;
if (T.1677_119) goto <L25>; else goto <L22>;
<L22>:;
if (T.1674_116 == 21) goto <L25>; else goto <L23>;
<L23>:;
if (T.1674_116 == 22) goto <L25>; else goto <L24>;
<L24>:;
if (T.1674_116 == 19) goto <L25>; else goto <L26>;
<L25>:;
return 1;
Here, we could do a simple range check like "if ((t - 18) <= 4)".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14799