This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA][PATCH] Fix tree-optimization/59919
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 24 Jan 2014 11:52:50 +0100
- Subject: Re: [RFA][PATCH] Fix tree-optimization/59919
- Authentication-results: sourceware.org; auth=none
- References: <52E1881B dot 7020009 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jan 23, 2014 at 02:22:35PM -0700, Jeff Law wrote:
> --- a/gcc/tree-vrp.c
> +++ b/gcc/tree-vrp.c
> @@ -5891,8 +5891,13 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
> }
> }
>
> - register_new_assert_for (op, op, comp_code, value, bb, NULL, si);
> - need_assert = true;
> + /* Do not register any assertions for a non-returning call. */
> + if (!is_gimple_call (stmt) || !gimple_call_noreturn_p (stmt))
> + {
> + register_new_assert_for (op, op, comp_code,
> + value, bb, NULL, si);
> + need_assert = true;
> + }
> }
> }
I'd say this belongs into infer_value_range instead.
It has:
/* If STMT is the last statement of a basic block with no
successors, there is no point inferring anything about any of its
operands. We would not be able to find a proper insertion point
for the assertion, anyway. */
if (stmt_ends_bb_p (stmt) && EDGE_COUNT (gimple_bb (stmt)->succs) == 0)
return false;
so I'd say it should instead do:
if (stmt_ends_bb_p (stmt))
{
edge_iterator ei;
edge e;
FOR_EACH_EDGE (e, ei, gimple_bb (stmt)->succs)
if (!(e->flags & EDGE_ABNORMAL))
break;
if (e == NULL)
return false;
}
Because, there are e.g. two register_new_assert_for calls with
non-NULL bb and NULL e, so you'd need to handle this for both, etc.
Jakub