Re: [RFC, WIP] tree-ssa-strlen optimization pass

2011-09-05 Thread Jakub Jelinek
On Mon, Sep 05, 2011 at 11:50:52AM +0200, Richard Guenther wrote: > Yeah, I suppose update_call_from_tree could use a piecewise variant ... > ok, let's defer this as a cleanup for whoever feels like updating some > more code. Attached are two patches, the first one contains two small changes, one

Re: [RFC, WIP] tree-ssa-strlen optimization pass

2011-09-05 Thread Richard Guenther
On Mon, Sep 5, 2011 at 11:41 AM, Jakub Jelinek wrote: > On Mon, Sep 05, 2011 at 10:54:47AM +0200, Richard Guenther wrote: >> > 2011-09-02  Jakub Jelinek   >> > >> >        * common.opt: Add -ftree-strlen option. >> >> Maybe sth more generic?  -foptimize-string-ops?  Eventually guard >> the existin

Re: [RFC, WIP] tree-ssa-strlen optimization pass

2011-09-05 Thread Jakub Jelinek
On Mon, Sep 05, 2011 at 10:54:47AM +0200, Richard Guenther wrote: > > 2011-09-02  Jakub Jelinek   > > > >        * common.opt: Add -ftree-strlen option. > > Maybe sth more generic? -foptimize-string-ops? Eventually guard > the existing string op foldings with that flag as well. I don't think ot

Re: [RFC, WIP] tree-ssa-strlen optimization pass

2011-09-02 Thread Paolo Carlini
Hi, I'm fairly sure it is much less common than the narrow versions, we don't even handle wprintf and wscanf attributes. I know. Actually, the reason I decided to say something, is that I noticed a few times in the past this "inequality" between char and wchar_t. Frankly, I instinctively think

Re: [RFC, WIP] tree-ssa-strlen optimization pass

2011-09-02 Thread Jakub Jelinek
On Fri, Sep 02, 2011 at 07:14:58PM +0200, Paolo Carlini wrote: > >Any comments related to the implementation, or examples of real-world > >lame C string length code sequences that would be nice to optimize > >will be greatly appreciated. > I'm only wondering how hard would be taking care more consi

Re: [RFC, WIP] tree-ssa-strlen optimization pass

2011-09-02 Thread Paolo Carlini
Hi, Any comments related to the implementation, or examples of real-world lame C string length code sequences that would be nice to optimize will be greatly appreciated. I'm only wondering how hard would be taking care more consistently of the wchar_t counterparts of all these library functions.

[RFC, WIP] tree-ssa-strlen optimization pass

2011-09-02 Thread Jakub Jelinek
Hi! The following patch contains a WIP implementation of a new pass, which attempts to track C string lengths and perform various optimizations using that information. Optimizations it currently performs: 1) optimizing away strlen calls, if the string length is known at that point already (eit