}
if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
return builtin_fnspec (gimple_call_fndecl (stmt));
+ tree fndecl = gimple_call_fndecl (stmt);
+ /* If the call is to a replaceable operator delete and results
+ from a delete expression as opposed to a direct call to
+ such operator, then we can treat it as free. */
+ if (fndecl
+ && DECL_IS_OPERATOR_DELETE_P (fndecl)
+ && gimple_call_from_new_or_delete (stmt))
+ return ".co ";
+ /* Similarly operator new can be treated as malloc. */
+ if (fndecl
+ && DECL_IS_OPERATOR_NEW_P (fndecl)
+ && gimple_call_from_new_or_delete (stmt))
+ return "mC";
return "";
}
from a new or delete expression. */
static inline bool
-gimple_call_from_new_or_delete (gcall *s)
+gimple_call_from_new_or_delete (const gcall *s)
{
return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0;
}
}
}
/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" { xfail *-*-* } } } */
-/* { dg-final { scan-ipa-dump-times "Aggregate passed by reference" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Aggregate passed by reference" 2 "cp" } } */