re PR tree-optimization/15738 ([tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0)
PR tree-optimization/15738. * builtins.c (fold_builtin_strchr): Transform strrchr (s, '\0') to strchr (s, '\0'). From-SVN: r82572
This commit is contained in:
parent
dff008b446
commit
91fa0e3de6
@ -1,3 +1,9 @@
|
||||
2004-06-02 Kazu Hirata <kazu@cs.umass.edu>
|
||||
|
||||
PR tree-optimization/15738.
|
||||
* builtins.c (fold_builtin_strchr): Transform
|
||||
strrchr (s, '\0') to strchr (s, '\0').
|
||||
|
||||
2004-06-02 Steven Bosscher <stevenb@suse.de>
|
||||
|
||||
* i386.c (ix86_adjust_cost): Don't increase the cost for
|
||||
|
@ -7123,6 +7123,21 @@ fold_builtin_strchr (tree exp, bool actually_strrchr)
|
||||
ssize_int (r - p1))));
|
||||
}
|
||||
|
||||
if (actually_strrchr)
|
||||
{
|
||||
tree fn;
|
||||
|
||||
if (!integer_zerop (s2))
|
||||
return 0;
|
||||
|
||||
fn = implicit_built_in_decls[BUILT_IN_STRCHR];
|
||||
if (!fn)
|
||||
return 0;
|
||||
|
||||
/* Transform strrchr(s1, '\0') to strchr(s1, '\0'). */
|
||||
return build_function_call_expr (fn, arglist);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user