This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/15353] New: [tree-ssa] Merge two "if"s if one subsumes the other.
- 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 May 2004 20:07:19 -0000
- Subject: [Bug optimization/15353] New: [tree-ssa] Merge two "if"s if one subsumes the other.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
void bar (void);
void
foo (int a, int b)
{
do
{
if (a < b)
break;
if (a != b)
break;
bar ();
}
while (0);
}
I get:
foo (a, b)
{
<bb 0>:
if (a_1 < b_2) goto <L2>; else goto <L0>;
<L0>:;
if (a_1 != b_2) goto <L2>; else goto <L1>;
<L1>:;
bar () [tail call];
<L2>:;
return;
}
Note that the second "if" completely subsumes the first.
We would like:
foo (a, b)
{
<bb 0>:
if (a_1 == b_2) goto <L0>; else goto <L1>;
<L0>:;
bar () [tail call];
<L1>:;
return;
}
This comes from shorten_compare from c-common.c.
--
Summary: [tree-ssa] Merge two "if"s if one subsumes the other.
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: enhancement
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=15353