This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix bb-reorder problem with degenerate cond_jump (PR68182)
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Segher Boessenkool <segher at kernel dot crashing dot org>
- Date: Mon, 9 Nov 2015 03:09:17 +0000
- Subject: [PATCH] Fix bb-reorder problem with degenerate cond_jump (PR68182)
- Authentication-results: sourceware.org; auth=none
The code mistakenly thinks any cond_jump has two successors. This is
not true if both destinations are the same, as can happen with weird
patterns as in the PR.
Bootstrapped and tested on powerpc64-linux; also tested the simplified
test in the PR on an x86_64-linux cross.
Sorry for the breakage. Is this okay for trunk?
Segher
2015-11-09 Segher Boessenkool <segher@kernel.crashing.org>
* gcc/bb-reorder.c (reorder_basic_blocks_simple): Treat a conditional
branch with only one successor just like unconditional branches.
---
gcc/bb-reorder.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 5f1c2cc..950b1a1 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2304,7 +2304,9 @@ reorder_basic_blocks_simple (void)
if (JUMP_P (end) && extract_asm_operands (end))
continue;
- if (any_condjump_p (end))
+ if (single_succ_p (bb))
+ edges[n++] = EDGE_SUCC (bb, 0);
+ else if (any_condjump_p (end))
{
edge e0 = EDGE_SUCC (bb, 0);
edge e1 = EDGE_SUCC (bb, 1);
@@ -2315,8 +2317,6 @@ reorder_basic_blocks_simple (void)
edges[n++] = e0;
edges[n++] = e1;
}
- else if (single_succ_p (bb))
- edges[n++] = EDGE_SUCC (bb, 0);
}
/* Sort the edges, the most desirable first. When optimizing for size
--
1.9.3