[Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level

kazu at cs dot umass dot edu gcc-bugzilla@gcc.gnu.org
Fri Apr 2 06:00:00 GMT 2004


Consider:

extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));

int
foo (void)
{
  int c = '1';
  return (strchr ("<12ers", c) == 0);
}

Here is the last tree form.

foo ()
{
<bb 0>:
  return strchr ("<12ers", 49) == 0B;

}

This strchr seems to be optimized at expand time.

As you might guess from the above testcase, GCC has a lot of redundant
IS_EXPR_CODE_CLASS(CLASS), where CLASS is a compile-time constant.
Optimizing these strchr away in turn allows us to remove a lot of dead code.

It seems to be a simple extension to call simplify_builtin_strchr() from
tree-ssa-ccp.c.

-- 
           Summary: [tree-ssa] strchr is not folded at tree-level
           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=14819



More information about the Gcc-bugs mailing list