This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][PR tree-optimization/64823] Handle threading through blocks with PHIs, but no statements V2
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Jeff Law <law at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 Feb 2015 22:22:49 +0100
- Subject: Re: [PATCH][PR tree-optimization/64823] Handle threading through blocks with PHIs, but no statements V2
- Authentication-results: sourceware.org; auth=none
- References: <54E25A70 dot 6020601 at redhat dot com> <20150216211107 dot GP1746 at tucnak dot redhat dot com> <0B94D44B-D4AA-4CC1-A5C6-4106E431ADCA at gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Feb 16, 2015 at 10:20:23PM +0100, Richard Biener wrote:
> On February 16, 2015 10:11:07 PM CET, Jakub Jelinek <jakub@redhat.com> wrote:
> >On Mon, Feb 16, 2015 at 02:00:32PM -0700, Jeff Law wrote:
> >> --- a/gcc/tree-vrp.c
> >> +++ b/gcc/tree-vrp.c
> >> @@ -10176,13 +10176,20 @@ identify_jump_threads (void)
> >> /* We only care about blocks ending in a COND_EXPR. While
> >there
> >> may be some value in handling SWITCH_EXPR here, I doubt it's
> >> terribly important. */
> >> - last = gsi_stmt (gsi_last_bb (bb));
> >> + last = gsi_stmt (gsi_last_nondebug_bb (bb));
>
> And if the comment is correct then it should not even matter as the condition ends a basic block.
It matters, because the use is:
if (!last
|| gimple_code (last) == GIMPLE_SWITCH
|| (gimple_code (last) == GIMPLE_COND
&& TREE_CODE (gimple_cond_lhs (last)) == SSA_NAME
&& (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (last)))
|| POINTER_TYPE_P (TREE_TYPE (gimple_cond_lhs (last))))
&& (TREE_CODE (gimple_cond_rhs (last)) == SSA_NAME
|| is_gimple_min_invariant (gimple_cond_rhs (last)))))
thus, if a bb contains only debug statements and nothing else,
the condition is false, while if it for corresponding -g0 doesn't contain
anything, it is true (!last).
Jakub