https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63459

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-10-04
     Ever confirmed|0                           |1

--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Hmm, indeed:
static bool
gimple_stmt_nonzero_warnv_p (gimple stmt, bool *strict_overflow_p)
{
  switch (gimple_code (stmt))
    {
    case GIMPLE_ASSIGN:
      return gimple_assign_nonzero_warnv_p (stmt, strict_overflow_p);
    case GIMPLE_CALL:
      {
        tree fndecl = gimple_call_fndecl (stmt);
        if (!fndecl) return false;
        if (flag_delete_null_pointer_checks && !flag_check_new
            && DECL_IS_OPERATOR_NEW (fndecl)
            && !TREE_NOTHROW (fndecl))
          return true;
        if (flag_delete_null_pointer_checks &&
            lookup_attribute ("returns_nonnull",
                              TYPE_ATTRIBUTES (gimple_call_fntype (stmt))))
          return true;
        return gimple_alloca_call_p (stmt);
      }
    default:
      gcc_unreachable ();
    }
}
I wonder if we can fold this earlier, for instance FRE1 has all info to do the
job, too.

Reply via email to