This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR tree-optimization/71170
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Kugan Vivekanandarajah <kugan dot vivekanandarajah at linaro dot org>
- Cc: Christophe Lyon <christophe dot lyon at linaro dot org>, Richard Biener <richard dot guenther at gmail dot com>, Martin LiÅka <mliska at suse dot cz>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 24 May 2016 11:10:51 +0200
- Subject: Re: [PATCH] Fix PR tree-optimization/71170
- Authentication-results: sourceware.org; auth=none
- References: <CAFiYyc0Wz+PzJTLyTOu=r7vrb3j3Jvui5P7osmOiL3iCre4oNg at mail dot gmail dot com> <CAELXzTMpv+nksazet0XQHtOtVqvG+4wieP1aziWtoLvzhbar1g at mail dot gmail dot com> <CAFiYyc21j9-wMFC8Zk547H2A+An5UVow6wiT7KYtBFnDdqm9ig at mail dot gmail dot com> <CAELXzTOxTWx3Ti20H23x0k4_f7ys_KMbPMF=uBMiqutjJcMS9Q at mail dot gmail dot com> <CAFiYyc3JqihqwswtUCGNtqJNwjYLKBx0khXOn4c9rvntTL-vcA at mail dot gmail dot com> <CAELXzTPgcUrck1o5oGGHU6W_nUtGBrRRuKmV6YhsiGyTftEkrQ at mail dot gmail dot com> <CAFiYyc0+s-YKspxEZWH_kAHsSNYASnTg1zR1DuhoGjyZUYDF9g at mail dot gmail dot com> <CAELXzTOd0JmSuGLKHohgehvQHsSRNupWG5aA83qrpvrP14P0gQ at mail dot gmail dot com> <CAKdteOYBBkdtZ8eNQP5BcSKHO9ta1Bk12y26tEic7-Ntj_-J3w at mail dot gmail dot com> <CAELXzTPsEH67qeYf77dLfQYpEFQ=pFA2n+eXQkcB5qCVRfSmnw at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, May 24, 2016 at 06:46:49PM +1000, Kugan Vivekanandarajah wrote:
> 2016-05-24 Kugan Vivekanandarajah <kuganv@linaro.org>
>
> * tree-ssa-reassoc.c (sort_by_operand_rank): Check fgimple_bb for NULL.
s/fgimple/gimple/ ?
> --- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-44.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-44.c
> @@ -0,0 +1,10 @@
> +
> +/* { dg-do compile } */
Why the empty line above? Either stick there a PR number if one is filed,
or leave it out.
> +/* { dg-options "-O2" } */
> +
> +unsigned int a;
> +int b, c;
> +void fn1 ()
> +{
> + b = a + c + c;
> +}
> diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
> index fb683ad..06f4d1b 100644
> --- a/gcc/tree-ssa-reassoc.c
> +++ b/gcc/tree-ssa-reassoc.c
> @@ -525,7 +525,7 @@ sort_by_operand_rank (const void *pa, const void *pb)
> gimple *stmtb = SSA_NAME_DEF_STMT (oeb->op);
> basic_block bba = gimple_bb (stmta);
> basic_block bbb = gimple_bb (stmtb);
> - if (bbb != bba)
> + if (bba && bbb && bbb != bba)
> {
> if (bb_rank[bbb->index] != bb_rank[bba->index])
> return bb_rank[bbb->index] - bb_rank[bba->index];
Can bb_rank be ever the same for bbb != bba? If yes, perhaps it would be
better to fallthrough into the reassoc_stmt_dominates_stmt_p testing
code, if not, perhaps just assert that it is different and just
return the difference unconditionally?
Jakub