This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
- 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: 1 Jun 2004 06:45:02 -0000
- Subject: [Bug tree-optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
- References: <20040509192540.15347.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-06-01 06:45 -------
Now that Steven's strchr patch is in, let me reiterate the problem.
void bar (void);
void
foo (void)
{
int c = '1';
if (strchr ("<12ers", c) == 0)
bar ();
}
void
baz (void)
{
int c = '1';
if ("<12ers" + 1 == 0)
bar ();
}
The last tree-ssa form looks like:
;; Function foo (foo)
foo ()
{
int c;
char * T.0;
<bb 0>:
T.0_2 = "<12ers" + 1B;
if (T.0_2 == 0B) goto <L0>; else goto <L1>;
<L0>:;
bar () [tail call];
<L1>:;
return;
}
;; Function baz (baz)
baz ()
{
int c;
<bb 0>:
if ("<12ers" == -1B) goto <L0>; else goto <L1>;
<L0>:;
bar () [tail call];
<L1>:;
return;
}
In either case, we miss the folding opportunity.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15347