public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level
@ 2004-04-02  6:00 kazu at cs dot umass dot edu
  2004-04-02  6:03 ` [Bug optimization/14819] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-02  6:00 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-05-30 21:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-02  6:00 [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level kazu at cs dot umass dot edu
2004-04-02  6:03 ` [Bug optimization/14819] " pinskia at gcc dot gnu dot org
2004-04-02  6:18 ` kazu at cs dot umass dot edu
2004-04-02 14:10 ` steven at gcc dot gnu dot org
2004-05-21 19:44 ` [Bug tree-optimization/14819] " pinskia at gcc dot gnu dot org
2004-05-24 19:18 ` pinskia at gcc dot gnu dot org
2004-05-31 21:01 ` cvs-commit at gcc dot gnu dot org
2004-05-31 21:04 ` kazu at cs dot umass dot edu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).