Re: Fix PR52448 (cselim with calls)

2013-02-06 Thread Richard Biener
On Wed, Feb 6, 2013 at 4:07 PM, Michael Matz wrote: > Hi, > > On Wed, 6 Feb 2013, Richard Biener wrote: > >> realloc can also effectively free memory. But the above no longer >> considers free () a freeing call as well?! > > free is not ECF_LEAF, so is handled correctly, like tm_free. I didn't >

Re: Fix PR52448 (cselim with calls)

2013-02-06 Thread Michael Matz
Hi, On Wed, 6 Feb 2013, Richard Biener wrote: > realloc can also effectively free memory. But the above no longer > considers free () a freeing call as well?! free is not ECF_LEAF, so is handled correctly, like tm_free. I didn't consider realloc, it's indeed not handled. > That said, please

Re: Fix PR52448 (cselim with calls)

2013-02-06 Thread Richard Biener
On Wed, Feb 6, 2013 at 3:20 PM, Michael Matz wrote: > Hi, > > On Wed, 6 Feb 2013, Jakub Jelinek wrote: > >> First of all, I'd use gimple_call_builtin_p (call, BUILT_IN_NORMAL) >> test. And, the function should certainly conservatively return false >> for all builtins that aren't (gimple_call_flag

Re: Fix PR52448 (cselim with calls)

2013-02-06 Thread Michael Matz
Hi, On Wed, 6 Feb 2013, Jakub Jelinek wrote: > First of all, I'd use gimple_call_builtin_p (call, BUILT_IN_NORMAL) > test. And, the function should certainly conservatively return false > for all builtins that aren't (gimple_call_flags (call) & ECF_LEAF) != 0, > otherwise they might call hook

Re: Fix PR52448 (cselim with calls)

2013-02-06 Thread Jakub Jelinek
On Wed, Feb 06, 2013 at 02:45:10PM +0100, Michael Matz wrote: > @@ -1329,20 +1337,53 @@ add_or_mark_expr (basic_block bb, tree e > } > } > > +/* Return true when CALL is a call stmt that definitely doesn't > + free any memory or makes it unavailable otherwise. */ > +static bool > +nonfre

Fix PR52448 (cselim with calls)

2013-02-06 Thread Michael Matz
Hi, marking of non-trapping accesses currently has an issue when there's a call between the dominated and the dominating access (that makes the former non-trapping), namely when that call frees the accessed memory (or makes it unavailable via other means). Instead of a full-blown algorithm ite