This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR69068] Handle 3-arg phi in copy_bb_and_scalar_dependences
- From: Richard Biener <rguenther at suse dot de>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: Sebastian Pop <sebpop at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 30 May 2016 16:03:46 +0200 (CEST)
- Subject: Re: [PATCH, PR69068] Handle 3-arg phi in copy_bb_and_scalar_dependences
- Authentication-results: sourceware.org; auth=none
- References: <574C09F9 dot 1050201 at mentor dot com> <alpine dot LSU dot 2 dot 11 dot 1605301142440 dot 1493 at t29 dot fhfr dot qr> <574C1766 dot 5090806 at mentor dot com> <alpine dot LSU dot 2 dot 11 dot 1605301255510 dot 1493 at t29 dot fhfr dot qr> <574C475A dot 3040304 at mentor dot com>
On Mon, 30 May 2016, Tom de Vries wrote:
> On 30/05/16 12:56, Richard Biener wrote:
> > On Mon, 30 May 2016, Tom de Vries wrote:
> >
> > > >On 30/05/16 11:46, Richard Biener wrote:
> > > > > > > >This patch fixes the assert conservatively by aborting graphite
> > > > > code
> > > > > > > > > >generation when encountering a phi with more than two
> > > > > > arguments in
> > > > > > > > > >copy_bb_and_scalar_dependences.
> > > > > > > > > >
> > > > > > > > > >Bootstrapped and reg-tested on x86_64.
> > > > > > > > > >
> > > > > > > > > >OK for trunk, 6 branch?
> > > >
> > > > > >Did you check if simply returning false from
> > > > bb_contains_loop_phi_nodes
> > > > > >instead of asserting works? The caller has a 'else' that is supposed
> > > > > >to handle condition PHIs. After all it already handles one
> > > > predecessor
> > > > > >specially ... Thus
> > > > > >
> > > > > > if (EDGE_COUNT (bb->preds) != 2)
> > > > > > return false;
> > > > > >
> > > > > >should work here.
> > > >
> > > >Unfortunately, that doesn't work. We run into another assert in
> > > >copy_cond_phi_nodes:
> > > >...
> > > > /* Cond phi nodes should have exactly two arguments. */
> > > > gcc_assert (2 == EDGE_COUNT (bb->preds));
> > > >...
> > Hah. So can we still do my suggested change and bail out conservatively
> > in Cond PHI node handling instead? Because the PHI node is clearly
> > _not_ a loop header PHI and the cond phi assert is also a latent bug.
> >
>
> Agreed. Updated as attached.
>
> OK for trunk, 6 branch?
Ok with the now redundant 2nd check removed
@@ -1075,7 +1075,8 @@ bb_contains_loop_close_phi_nodes (basic_block bb)
static bool
bb_contains_loop_phi_nodes (basic_block bb)
{
- gcc_assert (EDGE_COUNT (bb->preds) <= 2);
+ if (EDGE_COUNT (bb->preds) != 2)
+ return false;
if (bb->preds->length () == 1)
return false;
^^^^^^^^^^
Thanks,
Richard.
> Thanks,
> - Tom
>
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)