Merge lp:~eres/gcc-linaro/sms_fix_mem_dep into lp:gcc-linaro/4.5

Proposed by Revital Eres
Status: Superseded
Proposed branch: lp:~eres/gcc-linaro/sms_fix_mem_dep
Merge into: lp:gcc-linaro/4.5
Diff against target: 151 lines (+113/-2) (has conflicts)
3 files modified
ChangeLog.linaro (+12/-0)
gcc/ddg.c (+41/-2)
gcc/testsuite/gcc.dg/sms-9.c (+60/-0)
Text conflict in ChangeLog.linaro
To merge this branch: bzr merge lp:~eres/gcc-linaro/sms_fix_mem_dep
Reviewer Review Type Date Requested Status
Linaro Toolchain Builder Needs Fixing
Review via email: mp+66772@code.launchpad.net

This proposal has been superseded by a proposal from 2011-07-05.

To post a comment you must log in.
Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild has taken a snapshot of this branch at r99520 and queued it for build.

The snapshot is available at:
 http://ex.seabright.co.nz/snapshots/gcc-linaro-4.5+bzr99520~eres~sms_fix_mem_dep.tar.xdelta3.xz

and will be built on the following builders:
 a9-builder armv5-builder i686 x86_64

You can track the build queue at:
 http://ex.seabright.co.nz/helpers/scheduler

cbuild-snapshot: gcc-linaro-4.5+bzr99520~eres~sms_fix_mem_dep
cbuild-ancestor: lp:gcc-linaro+bzr99519
cbuild-state: check

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild had trouble building this on i686-natty-cbuild148-oort4-i686r1.
See the following failure logs:
 failed.txt gcc-build-failed.txt

under the build results at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.5+bzr99520~eres~sms_fix_mem_dep/logs/i686-natty-cbuild148-oort4-i686r1

The test suite was not checked as this build has no .sum style test results

cbuild-checked: i686-natty-cbuild148-oort4-i686r1

review: Needs Fixing
Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild had trouble building this on x86_64-natty-cbuild148-oort1-x86_64r1.
See the following failure logs:
 failed.txt gcc-build-failed.txt

under the build results at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.5+bzr99520~eres~sms_fix_mem_dep/logs/x86_64-natty-cbuild148-oort1-x86_64r1

The test suite was not checked as this build has no .sum style test results

cbuild-checked: x86_64-natty-cbuild148-oort1-x86_64r1

review: Needs Fixing

Preview Diff

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

Subscribers

People subscribed via source and target branches