From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29486 invoked by alias); 2 Apr 2004 06:00:40 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 29455 invoked by uid 48); 2 Apr 2004 06:00:37 -0000 Date: Fri, 02 Apr 2004 06:00:00 -0000 From: "kazu at cs dot umass dot edu" To: gcc-bugs@gcc.gnu.org Message-ID: <20040402060018.14819.kazu@cs.umass.edu> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level X-Bugzilla-Reason: CC X-SW-Source: 2004-04/txt/msg00143.txt.bz2 List-Id: 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 () { : 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