Fix PR52448 (cselim with calls)

Richard Biener richard.guenther@gmail.com
Wed Feb 6 14:42:00 GMT 2013


On Wed, Feb 6, 2013 at 3:20 PM, Michael Matz <matz@suse.de> 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_flags (call) & ECF_LEAF) != 0,
>> otherwise they might call hooks in the current CU and similar and free
>> in those hooks (likewise setjmp or similar, but again, that is not
>> ECF_LEAF).
>
> Sure.  Consider the patch changed to introduce this function:
>
> static bool
> nonfreeing_call_p (gimple call)
> {
>   if (gimple_call_builtin_p (call, BUILT_IN_NORMAL)
>       && gimple_call_flags (call) & ECF_LEAF)
>     return true;
>
>   return false;
> }
>
> Tested on the testcases and hmmer, okay after regstrapping?

realloc can also effectively free memory.  But the above no longer
considers free () a freeing call as well?!  builtins.def also suggests
built_in_tm_free is to be handled as well.

That said, please enumerate freeing builtins even if they are
not ECF_LEAF at the moment - they might become such I suppose
(realloc is LEAF, free is not) - curiously there is no __builtin_in_tm_realloc.

Richard.

>
> Ciao,
> Michael.



More information about the Gcc-patches mailing list