summaryrefslogtreecommitdiffstats
path: root/recipes-devtools
diff options
context:
space:
mode:
authorNathan Rossi <nathan.rossi@xilinx.com>2014-01-17 16:44:52 +1000
committerNathan Rossi <nathan.rossi@xilinx.com>2014-01-21 16:37:06 +1000
commit17972404d1fb54e2d6657a897d7f94a272abdabe (patch)
tree4b503ec32be1d989d5b5208908edbb20a136930a /recipes-devtools
parent62ead9dc37df1848787fa6e82ebce46bf1a6adc8 (diff)
downloadmeta-xilinx-17972404d1fb54e2d6657a897d7f94a272abdabe.tar.gz
gcc: Add patch to resolve MicroBlaze delay slot issues
* Backport of patch which mitigates MicroBlaze delay slot execution issues which primarily effect the Linux kernel when compiled with -Os Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Diffstat (limited to 'recipes-devtools')
-rw-r--r--recipes-devtools/gcc/files/gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch110
-rw-r--r--recipes-devtools/gcc/gcc-microblaze-4.8.inc1
2 files changed, 111 insertions, 0 deletions
diff --git a/recipes-devtools/gcc/files/gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch b/recipes-devtools/gcc/files/gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch
new file mode 100644
index 00000000..1cdc4029
--- /dev/null
+++ b/recipes-devtools/gcc/files/gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch
@@ -0,0 +1,110 @@
1Subject: Cherry-pick mainline patch to resolve MB kernel panic
2
3Cherry-pick backend optimization patch from gcc HEAD which 'resolves' a kernel
4panic for microblaze when compiled with -Os
5
6Upstream HEAD (soon to be gcc 4.9) does not exhibt this error any longer,
7and this patch when applied as a workaround on the 4.8 branch also hides the
8kernel panic resulting from incorrect branch-delay slot filling.
9
10 * tree-ssa-threadedge.c (thread_around_empty_block): Remove
11 checks for the number of predecessors and successors allowed.
12 * tree-ssa-threadupdate.c (mark_threaded_blocks): Ignore requests
13 which require copying a joiner block if there is a request which
14 is a subpath that requires no joiner block copying.
15
16Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
17Upstream-Status: Backport
18---
19 gcc/tree-ssa-threadedge.c | 8 -------
20 gcc/tree-ssa-threadupdate.c | 49 ++++++++++++++++++++++++++++++++++++++-----
21 2 files changed, 44 insertions(+), 13 deletions(-)
22
23diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
24index b31e961..ab58ae8 100644
25--- a/gcc/tree-ssa-threadedge.c
26+++ b/gcc/tree-ssa-threadedge.c
27@@ -761,14 +761,6 @@ thread_around_empty_block (edge taken_edge,
28 gimple stmt;
29 tree cond;
30
31- /* This block must have a single predecessor (E->dest). */
32- if (!single_pred_p (bb))
33- return NULL;
34-
35- /* This block must have more than one successor. */
36- if (single_succ_p (bb))
37- return NULL;
38-
39 /* This block can have no PHI nodes. This is overly conservative. */
40 if (!gsi_end_p (gsi_start_phis (bb)))
41 return NULL;
42diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
43index 0e4cbc9..cf8df8e 100644
44--- a/gcc/tree-ssa-threadupdate.c
45+++ b/gcc/tree-ssa-threadupdate.c
46@@ -1146,17 +1146,56 @@ mark_threaded_blocks (bitmap threaded_blocks)
47 edge e;
48 edge_iterator ei;
49
50+ /* It is possible to have jump threads in which one is a subpath
51+ of the other. ie, (A, B), (B, C), (C, D) where B is a joiner
52+ block and (B, C), (C, D) where no joiner block exists.
53+
54+ When this occurs ignore the jump thread request with the joiner
55+ block. It's totally subsumed by the simpler jump thread request.
56+
57+ This results in less block copying, simpler CFGs. More improtantly,
58+ when we duplicate the joiner block, B, in this case we will create
59+ a new threading opportunity that we wouldn't be able to optimize
60+ until the next jump threading iteration.
61+
62+ So first convert the jump thread requests which do not require a
63+ joiner block. */
64 for (i = 0; i < threaded_edges.length (); i += 3)
65 {
66 edge e = threaded_edges[i];
67- edge *x = XNEWVEC (edge, 2);
68
69- e->aux = x;
70- THREAD_TARGET (e) = threaded_edges[i + 1];
71- THREAD_TARGET2 (e) = threaded_edges[i + 2];
72- bitmap_set_bit (tmp, e->dest->index);
73+ if (threaded_edges[i + 2] == NULL)
74+ {
75+ edge *x = XNEWVEC (edge, 2);
76+
77+ e->aux = x;
78+ THREAD_TARGET (e) = threaded_edges[i + 1];
79+ THREAD_TARGET2 (e) = NULL;
80+ bitmap_set_bit (tmp, e->dest->index);
81+ }
82 }
83
84+
85+ /* Now iterate again, converting cases where we threaded through
86+ a joiner block, but ignoring those where we have already
87+ threaded through the joiner block. */
88+ for (i = 0; i < threaded_edges.length (); i += 3)
89+ {
90+ edge e = threaded_edges[i];
91+
92+ if (threaded_edges[i + 2] != NULL
93+ && threaded_edges[i + 1]->aux == NULL)
94+ {
95+ edge *x = XNEWVEC (edge, 2);
96+
97+ e->aux = x;
98+ THREAD_TARGET (e) = threaded_edges[i + 1];
99+ THREAD_TARGET2 (e) = threaded_edges[i + 2];
100+ bitmap_set_bit (tmp, e->dest->index);
101+ }
102+ }
103+
104+
105 /* If optimizing for size, only thread through block if we don't have
106 to duplicate it or it's an otherwise empty redirection block. */
107 if (optimize_function_for_size_p (cfun))
108--
1091.7.9.5
110
diff --git a/recipes-devtools/gcc/gcc-microblaze-4.8.inc b/recipes-devtools/gcc/gcc-microblaze-4.8.inc
index 8acd32b2..675ecaf0 100644
--- a/recipes-devtools/gcc/gcc-microblaze-4.8.inc
+++ b/recipes-devtools/gcc/gcc-microblaze-4.8.inc
@@ -12,4 +12,5 @@ SRC_URI_append += " \
12 file://0008-Patch-microblaze-Add-branch_compare-instruction.patch \ 12 file://0008-Patch-microblaze-Add-branch_compare-instruction.patch \
13 file://Patch-microblaze-Fix-bswaphi2-implementation.patch \ 13 file://Patch-microblaze-Fix-bswaphi2-implementation.patch \
14 file://Patch-microblaze-cstoresf4-add-mode-and-ordered_comp.patch \ 14 file://Patch-microblaze-cstoresf4-add-mode-and-ordered_comp.patch \
15 file://gcc-Cherry-pick-mainline-patch-to-resolve-MB-k.patch \
15 " 16 "