This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix PR52448 (cselim with calls)


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?


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]