Fix PR52448 (cselim with calls)

Richard Biener richard.guenther@gmail.com
Wed Feb 6 15:13:00 GMT 2013


On Wed, Feb 6, 2013 at 4:07 PM, Michael Matz <matz@suse.de> 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
> consider realloc, it's indeed not handled.
>
>> 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.
>
> The function now reads:
>
> --------------
> static bool
> nonfreeing_call_p (gimple call)
> {
>   if (gimple_call_builtin_p (call, BUILT_IN_NORMAL)
>       && gimple_call_flags (call) & ECF_LEAF)
>     switch (DECL_FUNCTION_CODE (gimple_call_fndecl (call)))
>       {
>         /* Just in case these become ECF_LEAF in the future.  */
>         case BUILT_IN_FREE:
>         case BUILT_IN_TM_FREE:
>         case BUILT_IN_REALLOC:
>         case BUILT_IN_STACK_RESTORE:
>           return false;
>         default:
>           return true;
>       }
>
>   return false;
> }
> --------------
>
> Testcase and hmmer work, okay after regstrapping?

Ok.

Thanks,
Richard.

>
> Ciao,
> Michael.



More information about the Gcc-patches mailing list