This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]