This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


All,

This is the first patch in a series with the ultimate aim of enabling
-freorder-blocks-and-partition in the ARM backend.

However, whilst working on this I have come across a number of midend issues 
which should be fixed individually.

This patch fixes an ICE during if-conversion.

The problem is that when we encounter a CFG that looks like:

 |            |
 |            |
 |         167 (COLD)
 |          /      \
 |         /        \
 |     168 (COLD)  169 (COLD)
 \         \        /
  \------\  \      /
          \  \    /
          170 (HOT)
              |
              |

The 'ce3' phase merges blocks 167, 168, and 169, and eventually calls
rtl_tidy_fallthru_edge to convert the edge from 167 to 170 into a
fallthru one.

This causes verify_flow_info to fail as you can't have a fallthru edge
between different partitions.

The fix I have implemented is to have rtl_tidy_fallthru not do anything
if the fallthru edge crosses a partition boundary.

OK?

Thanks,

Matt

gcc/ChangeLog:
2012-09-05  Matthew Gretton-Dann  <matthew.gretton-dann@linaro.org>

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

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index c62b5bc..341ea9e 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1572,6 +1572,11 @@ 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 (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.  */

-- 
Matthew Gretton-Dann
Linaro Toolchain Working Group
matthew.gretton-dann@linaro.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]