diff options
Diffstat (limited to 'meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99528.patch')
-rw-r--r-- | meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99528.patch | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99528.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99528.patch new file mode 100644 index 000000000..874358306 --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99528.patch | |||
@@ -0,0 +1,138 @@ | |||
1 | 2011-07-19 Revital Eres <revital.eres@linaro.org> | ||
2 | |||
3 | Backport from mainline -r175090 | ||
4 | gcc/ | ||
5 | * ddg.c (add_intra_loop_mem_dep): New function. | ||
6 | (build_intra_loop_deps): Call it. | ||
7 | |||
8 | gcc/testsuite | ||
9 | * gcc.dg/sms-9.c: New file. | ||
10 | |||
11 | === modified file 'gcc/ddg.c' | ||
12 | --- old/gcc/ddg.c 2011-05-13 16:16:22 +0000 | ||
13 | +++ new/gcc/ddg.c 2011-07-05 09:02:18 +0000 | ||
14 | @@ -352,6 +352,33 @@ | ||
15 | } | ||
16 | |||
17 | |||
18 | +/* Given two nodes, analyze their RTL insns and add intra-loop mem deps | ||
19 | + to ddg G. */ | ||
20 | +static void | ||
21 | +add_intra_loop_mem_dep (ddg_ptr g, ddg_node_ptr from, ddg_node_ptr to) | ||
22 | +{ | ||
23 | + | ||
24 | + if ((from->cuid == to->cuid) | ||
25 | + || !insn_alias_sets_conflict_p (from->insn, to->insn)) | ||
26 | + /* Do not create edge if memory references have disjoint alias sets | ||
27 | + or 'to' and 'from' are the same instruction. */ | ||
28 | + return; | ||
29 | + | ||
30 | + if (mem_write_insn_p (from->insn)) | ||
31 | + { | ||
32 | + if (mem_read_insn_p (to->insn)) | ||
33 | + create_ddg_dep_no_link (g, from, to, | ||
34 | + DEBUG_INSN_P (to->insn) | ||
35 | + ? ANTI_DEP : TRUE_DEP, MEM_DEP, 0); | ||
36 | + else | ||
37 | + create_ddg_dep_no_link (g, from, to, | ||
38 | + DEBUG_INSN_P (to->insn) | ||
39 | + ? ANTI_DEP : OUTPUT_DEP, MEM_DEP, 0); | ||
40 | + } | ||
41 | + else if (!mem_read_insn_p (to->insn)) | ||
42 | + create_ddg_dep_no_link (g, from, to, ANTI_DEP, MEM_DEP, 0); | ||
43 | +} | ||
44 | + | ||
45 | /* Given two nodes, analyze their RTL insns and add inter-loop mem deps | ||
46 | to ddg G. */ | ||
47 | static void | ||
48 | @@ -439,10 +466,22 @@ | ||
49 | if (DEBUG_INSN_P (j_node->insn)) | ||
50 | continue; | ||
51 | if (mem_access_insn_p (j_node->insn)) | ||
52 | - /* Don't bother calculating inter-loop dep if an intra-loop dep | ||
53 | - already exists. */ | ||
54 | + { | ||
55 | + /* Don't bother calculating inter-loop dep if an intra-loop dep | ||
56 | + already exists. */ | ||
57 | if (! TEST_BIT (dest_node->successors, j)) | ||
58 | add_inter_loop_mem_dep (g, dest_node, j_node); | ||
59 | + /* If -fmodulo-sched-allow-regmoves | ||
60 | + is set certain anti-dep edges are not created. | ||
61 | + It might be that these anti-dep edges are on the | ||
62 | + path from one memory instruction to another such that | ||
63 | + removing these edges could cause a violation of the | ||
64 | + memory dependencies. Thus we add intra edges between | ||
65 | + every two memory instructions in this case. */ | ||
66 | + if (flag_modulo_sched_allow_regmoves | ||
67 | + && !TEST_BIT (dest_node->predecessors, j)) | ||
68 | + add_intra_loop_mem_dep (g, j_node, dest_node); | ||
69 | + } | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | === added file 'gcc/testsuite/gcc.dg/sms-9.c' | ||
75 | --- old/gcc/testsuite/gcc.dg/sms-9.c 1970-01-01 00:00:00 +0000 | ||
76 | +++ new/gcc/testsuite/gcc.dg/sms-9.c 2011-07-04 11:13:26 +0000 | ||
77 | @@ -0,0 +1,60 @@ | ||
78 | +/* { dg-do run } */ | ||
79 | +/* { dg-options "-O2 -fmodulo-sched -fno-auto-inc-dec -O2 -fmodulo-sched-allow-regmoves" } */ | ||
80 | + | ||
81 | +#include <stdlib.h> | ||
82 | +#include <stdarg.h> | ||
83 | + | ||
84 | +struct df_ref_info | ||
85 | +{ | ||
86 | + unsigned int *begin; | ||
87 | + unsigned int *count; | ||
88 | +}; | ||
89 | + | ||
90 | +extern void *memset (void *s, int c, __SIZE_TYPE__ n); | ||
91 | + | ||
92 | + | ||
93 | +__attribute__ ((noinline)) | ||
94 | + int | ||
95 | + df_reorganize_refs_by_reg_by_insn (struct df_ref_info *ref_info, | ||
96 | + int num, unsigned int start) | ||
97 | +{ | ||
98 | + unsigned int m = num; | ||
99 | + unsigned int offset = 77; | ||
100 | + unsigned int r; | ||
101 | + | ||
102 | + for (r = start; r < m; r++) | ||
103 | + { | ||
104 | + ref_info->begin[r] = offset; | ||
105 | + offset += ref_info->count[r]; | ||
106 | + ref_info->count[r] = 0; | ||
107 | + } | ||
108 | + | ||
109 | + return offset; | ||
110 | +} | ||
111 | + | ||
112 | +int | ||
113 | +main () | ||
114 | +{ | ||
115 | + struct df_ref_info temp; | ||
116 | + int num = 100; | ||
117 | + unsigned int start = 5; | ||
118 | + int i, offset; | ||
119 | + | ||
120 | + temp.begin = malloc (100 * sizeof (unsigned int)); | ||
121 | + temp.count = malloc (100 * sizeof (unsigned int)); | ||
122 | + | ||
123 | + memset (temp.begin, 0, sizeof (unsigned int) * num); | ||
124 | + memset (temp.count, 0, sizeof (unsigned int) * num); | ||
125 | + | ||
126 | + for (i = 0; i < num; i++) | ||
127 | + temp.count[i] = i + 1; | ||
128 | + | ||
129 | + offset = df_reorganize_refs_by_reg_by_insn (&temp, num, start); | ||
130 | + | ||
131 | + if (offset != 5112) | ||
132 | + abort (); | ||
133 | + | ||
134 | + free (temp.begin); | ||
135 | + free (temp.count); | ||
136 | + return 0; | ||
137 | +} | ||
138 | |||