On Tue, Aug 22, 2017 at 4:11 PM Jeff Law <l...@redhat.com> wrote:
>
> On 08/22/2017 03:03 AM, Richard Biener wrote:
> >
> > The following patch makes sure to not grow the number of incoming
> > edges in the destination when doing split_edge on GIMPLE.  That's
> > easy by first redirecting the existing edge to the destination
> > to the new block rather than creating the new fallthru from the
> > new block to the destination.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
> >
> > Richard.
> >
> > 2017-08-22  Richard Biener  <rguent...@suse.de>
> >
> >       * tree-cfg.c (gimple_split_edge): Avoid reallocating target
> >       PHI nodes.
> Definitely a good thing.  Having PHIs get reallocated has led to some
> subtle bugs.  I realize this isn't a complete solution to that problem,
> but every bit helps.

So this causes PHI args to be swapped which I need to avoid now.

Thus the following followup, bootstrapped on x86_64-unknown-linux-gnu,
testing in progress.

Richard.

>From b17d1ec8ef94f1ab87fcfedf7c947815e60e42e7 Mon Sep 17 00:00:00 2001
From: Richard Biener <rguent...@suse.de>
Date: Tue, 20 Oct 2020 12:52:31 +0200
Subject: [PATCH] Avoid changing PHIs in GIMPLE split_edge
To: gcc-patches@gcc.gnu.org

Previously I've changed gimple_split_edge to avoid PHI node
re-allocation, but this introduced swapping of PHI arguments
due to the way edge redirection works.  This is now a problem
for me and which can be solved with the following approach
reducing the overhead of split_edge even more.  We can simply
pretend there are no PHI nodes if we can make sure the
new fallthru will have the same dest_idx as the old edge
into the destination.

2020-10-20  Richard Biener  <rguent...@suse.de>

        * tree-cfg.c (reinstall_phi_args): Remove.
        (gimple_split_edge): Remove PHIs around the edge redirection
        to avoid touching them at all.

Attachment: p
Description: Binary data

Reply via email to