Patchwork [RFA,1/n] Fix if conversion interactions with block partitioning

login
register
mail settings
Submitter Matthew Gretton-Dann
Date Sept. 24, 2012, 10:34 a.m.
Message ID <1586422.8dgmbajGbX@e103209-lin>
Download mbox | patch
Permalink /patch/186359/
State New
Headers show

Comments

Matthew Gretton-Dann - Sept. 24, 2012, 10:34 a.m.
On Wednesday 05 September 2012 13:47:19 Steven Bosscher wrote:
> On Wed, Sep 5, 2012 at 1:25 PM, Matthew Gretton-Dann wrote:
> > +  /* If the two blocks are in different partitions we do not want to mark
> > +     this as a fallthru edge.  */
> > +  if (BB_PARTITION (b) != BB_PARTITION (c))
> > +    return;
> > +
> 
> I think you should look for a REG_CROSSING_JUMP note on BB_END instead
> of comparing BB_PARTITION.

Sorry for the delay in getting  back to this.

Anyway, I had a look at how other parts of cfgrtl.c handled this and it seems 
as if they do both your suggestion and the check against different partitions.

So this is what I have implemented in the attached patch.

Cross tested arm-none-linux-gnueabi with QEmu.

OK for trunk?

Thanks,

Matt

gcc/ChangeLog:

2012-09-24  Matthew Gretton-Dann  <matthew.gretton-dann@linaro.org>

        * cfgrtl.c (rtl_tidy_fallthru_edge): Don't tidy edges which
          cross partitions.

Patch

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index c62b5bc..8fcf7e4 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1572,6 +1572,12 @@  rtl_tidy_fallthru_edge (edge e)
     if (INSN_P (q))
       return;
 
+  /* If the two blocks are in different partitions we do not want to mark
+     this as a fallthru edge.  */
+  if (find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX)
+      || BB_PARTITION (b) != BB_PARTITION (c))
+    return;
+
   /* Remove what will soon cease being the jump insn from the source block.
      If block B consisted only of this single jump, turn it into a deleted
      note.  */