This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/14495] New: [tree-ssa] Propagate range info into 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: 9 Mar 2004 00:35:14 -0000
- Subject: [Bug optimization/14495] New: [tree-ssa] Propagate range info into a switch statement
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider:
void bar0 (void);
void bar1 (void);
void bar2 (void);
void bar3 (void);
void
foo (int a)
{
if (a < 100)
return;
if (200 < a)
return;
switch (a)
{
case 99: bar0 (); return;
case 100: bar1 (); return;
case 101: bar2 (); return;
case 102: bar3 (); return;
}
}
case 99 won't trigger, but I still get:
foo (a)
{
<bb 0>:
if (a <= 99) goto <L0>; else goto <L1>;
<L0>:;
return;
<L1>:;
if (a > 200) goto <L2>; else goto <L3>;
<L2>:;
return;
<L3>:;
switch (a)
{
case 99: goto <L4>;
case 100: goto <L5>;
case 101: goto <L6>;
case 102: goto <L7>;
default : goto <L8>;
}
<L4>:;
bar0 () [tail call];
return;
<L5>:;
bar1 () [tail call];
return;
<L6>:;
bar2 () [tail call];
return;
<L7>:;
bar3 () [tail call];
return;
<L8>:;
return;
}
--
Summary: [tree-ssa] Propagate range info into a switch statement
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14495