Merge lp:~rsandifo/gcc-linaro/lp-714921-4.6 into lp:gcc-linaro/4.6

Proposed by Richard Sandiford
Status: Merged
Merged at revision: 106740
Proposed branch: lp:~rsandifo/gcc-linaro/lp-714921-4.6
Merge into: lp:gcc-linaro/4.6
Diff against target: 310 lines (+149/-19) (has conflicts)
2 files modified
gcc/ChangeLog (+28/-0)
gcc/dwarf2out.c (+121/-19)
Text conflict in gcc/ChangeLog
To merge this branch: bzr merge lp:~rsandifo/gcc-linaro/lp-714921-4.6
Reviewer Review Type Date Requested Status
Ramana Radhakrishnan (community) Approve
Review via email: mp+58653@code.launchpad.net

Description of the change

Simple backport of 4.7 patch.

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 r106545 and queued it for build.

The snapshot is available at:
 http://ex.seabright.co.nz/snapshots/gcc-linaro-4.6+bzr106545~rsandifo~lp-714921-4.6.tar.xdelta3.xz

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

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

cbuild-snapshot: gcc-linaro-4.6+bzr106545~rsandifo~lp-714921-4.6
cbuild-ancestor: lp:gcc-linaro/4.6+bzr106544
cbuild-state: check

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

cbuild successfully built this on i686-lucid-cbuild112-scorpius-i686r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106545~rsandifo~lp-714921-4.6/logs/i686-lucid-cbuild112-scorpius-i686r1

The test suite results were unchanged compared to the branch point lp:gcc-linaro/4.6+bzr106544.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106545~rsandifo~lp-714921-4.6/logs/i686-lucid-cbuild112-scorpius-i686r1/gcc-testsuite.txt

cbuild-checked: i686-lucid-cbuild112-scorpius-i686r1

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

cbuild successfully built this on x86_64-maverick-cbuild112-crucis-x86_64r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106545~rsandifo~lp-714921-4.6/logs/x86_64-maverick-cbuild112-crucis-x86_64r1

The test suite results were unchanged compared to the branch point lp:gcc-linaro/4.6+bzr106544.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106545~rsandifo~lp-714921-4.6/logs/x86_64-maverick-cbuild112-crucis-x86_64r1/gcc-testsuite.txt

cbuild-checked: x86_64-maverick-cbuild112-crucis-x86_64r1

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

cbuild successfully built this on armv7l-maverick-cbuild112-ursa2-cortexa9r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106545~rsandifo~lp-714921-4.6/logs/armv7l-maverick-cbuild112-ursa2-cortexa9r1

The test suite results changed compared to the branch point lp:gcc-linaro/4.6+bzr106544:
 -FAIL: largefile.c -O0 -I. (internal compiler error)
 -FAIL: largefile.c -O0 -I. (test for excess errors)
 +PASS: largefile.c -O0 -I. (test for excess errors)
 -PASS: ext/mt_allocator/tune-4.cc execution test
 +FAIL: ext/mt_allocator/tune-4.cc execution test
 +WARNING: program timed out.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106545~rsandifo~lp-714921-4.6/logs/armv7l-maverick-cbuild112-ursa2-cortexa9r1/gcc-testsuite.txt

cbuild-checked: armv7l-maverick-cbuild112-ursa2-cortexa9r1

Revision history for this message
Ramana Radhakrishnan (ramana) wrote :

 -PASS: ext/mt_allocator/tune-4.cc execution test
 +FAIL: ext/mt_allocator/tune-4.cc execution test

I'm a bit concerned about the extra failure here with a time-out . Could you have a quick look at this ?

Ramana

Revision history for this message
Richard Sandiford (rsandifo) wrote :

> -PASS: ext/mt_allocator/tune-4.cc execution test
> +FAIL: ext/mt_allocator/tune-4.cc execution test
>
> I'm a bit concerned about the extra failure here with a time-out . Could you
> have a quick look at this ?

Sure, np. I checked that it does pass locally on my Beagleboard. I also
checked that there were no code changes in the testcase: stripping both
the "before" and "after" executables gives output that is byte-for-byte
identical. The only difference between the original (non-stripped)
executables is that the debug info in the "after" executable is smaller.

That's all as hoped, of course. The patch is just supposed to change
the debug information, and is supposed to remove redundant location lists.

Richard

Revision history for this message
Ramana Radhakrishnan (ramana) wrote :

Approved but watch out for potential conflicts in Changelog and add an entry to Changelog.linaro.

cheers
Ramana

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gcc/ChangeLog'
2--- gcc/ChangeLog 2011-04-07 10:52:12 +0000
3+++ gcc/ChangeLog 2011-04-21 11:59:30 +0000
4@@ -1,3 +1,4 @@
5+<<<<<<< TREE
6 2011-04-01 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7
8 * config/spu/t-spu-elf (dp-bit.c): Use > instead of >>.
9@@ -2106,6 +2107,33 @@
10 * config/darwin.c (SECTION_NO_ANCHOR): Define.
11 (darwin_init_sections): Remove assertion.
12
13+=======
14+2011-04-21 Richard Sandiford <richard.sandiford@linaro.org>
15+
16+ Backport from mainline:
17+
18+ 2011-03-29 Richard Sandiford <richard.sandiford@linaro.org>
19+
20+ PR debug/48190
21+ * dwarf2out.c (dw_loc_list_node): Add resolved_addr and replaced.
22+ (cached_dw_loc_list_def): New structure.
23+ (cached_dw_loc_list): New typedef.
24+ (cached_dw_loc_list_table): New variable.
25+ (cached_dw_loc_list_table_hash): New function.
26+ (cached_dw_loc_list_table_eq): Likewise.
27+ (add_location_or_const_value_attribute): Take a bool cache_p.
28+ Cache the list when the parameter is true.
29+ (gen_formal_parameter_die): Update caller.
30+ (gen_variable_die): Likewise.
31+ (dwarf2out_finish): Likewise.
32+ (dwarf2out_abstract_function): Nullify cached_dw_loc_list_table
33+ while generating debug info for the decl.
34+ (dwarf2out_function_decl): Clear cached_dw_loc_list_table.
35+ (dwarf2out_init): Initialize cached_dw_loc_list_table.
36+ (resolve_addr): Cache the result of resolving a chain of
37+ location lists.
38+
39+>>>>>>> MERGE-SOURCE
40 2011-02-03 Nick Clifton <nickc@redhat.com>
41
42 * config/rx/predicates.md (rx_zs_comparison_operator): Remove
43
44=== modified file 'gcc/dwarf2out.c'
45--- gcc/dwarf2out.c 2011-03-29 22:47:59 +0000
46+++ gcc/dwarf2out.c 2011-04-21 11:59:30 +0000
47@@ -4427,6 +4427,11 @@
48 const char *section; /* Section this loclist is relative to */
49 dw_loc_descr_ref expr;
50 hashval_t hash;
51+ /* True if all addresses in this and subsequent lists are known to be
52+ resolved. */
53+ bool resolved_addr;
54+ /* True if this list has been replaced by dw_loc_next. */
55+ bool replaced;
56 bool emitted;
57 } dw_loc_list_node;
58
59@@ -6087,6 +6092,19 @@
60 /* Table of decl location linked lists. */
61 static GTY ((param_is (var_loc_list))) htab_t decl_loc_table;
62
63+/* A cached location list. */
64+struct GTY (()) cached_dw_loc_list_def {
65+ /* The DECL_UID of the decl that this entry describes. */
66+ unsigned int decl_id;
67+
68+ /* The cached location list. */
69+ dw_loc_list_ref loc_list;
70+};
71+typedef struct cached_dw_loc_list_def cached_dw_loc_list;
72+
73+/* Table of cached location lists. */
74+static GTY ((param_is (cached_dw_loc_list))) htab_t cached_dw_loc_list_table;
75+
76 /* A pointer to the base of a list of references to DIE's that
77 are uniquely identified by their tag, presence/absence of
78 children DIE's, and list of attribute/value pairs. */
79@@ -6434,7 +6452,7 @@
80 static void insert_double (double_int, unsigned char *);
81 static void insert_float (const_rtx, unsigned char *);
82 static rtx rtl_for_decl_location (tree);
83-static bool add_location_or_const_value_attribute (dw_die_ref, tree,
84+static bool add_location_or_const_value_attribute (dw_die_ref, tree, bool,
85 enum dwarf_attribute);
86 static bool tree_add_const_value_attribute (dw_die_ref, tree);
87 static bool tree_add_const_value_attribute_for_decl (dw_die_ref, tree);
88@@ -8168,6 +8186,24 @@
89 htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl));
90 }
91
92+/* Returns a hash value for X (which really is a cached_dw_loc_list_list). */
93+
94+static hashval_t
95+cached_dw_loc_list_table_hash (const void *x)
96+{
97+ return (hashval_t) ((const cached_dw_loc_list *) x)->decl_id;
98+}
99+
100+/* Return nonzero if decl_id of cached_dw_loc_list X is the same as
101+ UID of decl *Y. */
102+
103+static int
104+cached_dw_loc_list_table_eq (const void *x, const void *y)
105+{
106+ return (((const cached_dw_loc_list *) x)->decl_id
107+ == DECL_UID ((const_tree) y));
108+}
109+
110 /* Equate a DIE to a particular declaration. */
111
112 static void
113@@ -16965,15 +17001,22 @@
114 these things can crop up in other ways also.) Note that one type of
115 constant value which can be passed into an inlined function is a constant
116 pointer. This can happen for example if an actual argument in an inlined
117- function call evaluates to a compile-time constant address. */
118+ function call evaluates to a compile-time constant address.
119+
120+ CACHE_P is true if it is worth caching the location list for DECL,
121+ so that future calls can reuse it rather than regenerate it from scratch.
122+ This is true for BLOCK_NONLOCALIZED_VARS in inlined subroutines,
123+ since we will need to refer to them each time the function is inlined. */
124
125 static bool
126-add_location_or_const_value_attribute (dw_die_ref die, tree decl,
127+add_location_or_const_value_attribute (dw_die_ref die, tree decl, bool cache_p,
128 enum dwarf_attribute attr)
129 {
130 rtx rtl;
131 dw_loc_list_ref list;
132 var_loc_list *loc_list;
133+ cached_dw_loc_list *cache;
134+ void **slot;
135
136 if (TREE_CODE (decl) == ERROR_MARK)
137 return false;
138@@ -17010,7 +17053,33 @@
139 && add_const_value_attribute (die, rtl))
140 return true;
141 }
142- list = loc_list_from_tree (decl, decl_by_reference_p (decl) ? 0 : 2);
143+ /* If this decl is from BLOCK_NONLOCALIZED_VARS, we might need its
144+ list several times. See if we've already cached the contents. */
145+ list = NULL;
146+ if (loc_list == NULL || cached_dw_loc_list_table == NULL)
147+ cache_p = false;
148+ if (cache_p)
149+ {
150+ cache = (cached_dw_loc_list *)
151+ htab_find_with_hash (cached_dw_loc_list_table, decl, DECL_UID (decl));
152+ if (cache)
153+ list = cache->loc_list;
154+ }
155+ if (list == NULL)
156+ {
157+ list = loc_list_from_tree (decl, decl_by_reference_p (decl) ? 0 : 2);
158+ /* It is usually worth caching this result if the decl is from
159+ BLOCK_NONLOCALIZED_VARS and if the list has at least two elements. */
160+ if (cache_p && list && list->dw_loc_next)
161+ {
162+ slot = htab_find_slot_with_hash (cached_dw_loc_list_table, decl,
163+ DECL_UID (decl), INSERT);
164+ cache = ggc_alloc_cleared_cached_dw_loc_list ();
165+ cache->decl_id = DECL_UID (decl);
166+ cache->loc_list = list;
167+ *slot = cache;
168+ }
169+ }
170 if (list)
171 {
172 add_AT_location_description (die, attr, list);
173@@ -18702,7 +18771,7 @@
174 equate_decl_number_to_die (node, parm_die);
175 if (! DECL_ABSTRACT (node_or_origin))
176 add_location_or_const_value_attribute (parm_die, node_or_origin,
177- DW_AT_location);
178+ node == NULL, DW_AT_location);
179
180 break;
181
182@@ -18887,6 +18956,7 @@
183 tree context;
184 int was_abstract;
185 htab_t old_decl_loc_table;
186+ htab_t old_cached_dw_loc_list_table;
187
188 /* Make sure we have the actual abstract inline, not a clone. */
189 decl = DECL_ORIGIN (decl);
190@@ -18901,6 +18971,8 @@
191 get locations in abstract instantces. */
192 old_decl_loc_table = decl_loc_table;
193 decl_loc_table = NULL;
194+ old_cached_dw_loc_list_table = cached_dw_loc_list_table;
195+ cached_dw_loc_list_table = NULL;
196
197 /* Be sure we've emitted the in-class declaration DIE (if any) first, so
198 we don't get confused by DECL_ABSTRACT. */
199@@ -18925,6 +18997,7 @@
200
201 current_function_decl = save_fn;
202 decl_loc_table = old_decl_loc_table;
203+ cached_dw_loc_list_table = old_cached_dw_loc_list_table;
204 pop_cfun ();
205 }
206
207@@ -19709,9 +19782,8 @@
208 && !TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl_or_origin)))
209 defer_location (decl_or_origin, var_die);
210 else
211- add_location_or_const_value_attribute (var_die,
212- decl_or_origin,
213- DW_AT_location);
214+ add_location_or_const_value_attribute (var_die, decl_or_origin,
215+ decl == NULL, DW_AT_location);
216 add_pubname (decl_or_origin, var_die);
217 }
218 else
219@@ -21498,6 +21570,7 @@
220 dwarf2out_decl (decl);
221
222 htab_empty (decl_loc_table);
223+ htab_empty (cached_dw_loc_list_table);
224 }
225
226 /* Output a marker (i.e. a label) for the beginning of the generated code for
227@@ -22230,6 +22303,11 @@
228 decl_loc_table = htab_create_ggc (10, decl_loc_table_hash,
229 decl_loc_table_eq, NULL);
230
231+ /* Allocate the cached_dw_loc_list_table. */
232+ cached_dw_loc_list_table
233+ = htab_create_ggc (10, cached_dw_loc_list_table_hash,
234+ cached_dw_loc_list_table_eq, NULL);
235+
236 /* Allocate the initial hunk of the decl_scope_table. */
237 decl_scope_table = VEC_alloc (tree, gc, 256);
238
239@@ -22870,30 +22948,53 @@
240 {
241 dw_die_ref c;
242 dw_attr_ref a;
243- dw_loc_list_ref *curr;
244+ dw_loc_list_ref *curr, *start, loc;
245 unsigned ix;
246
247 FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
248 switch (AT_class (a))
249 {
250 case dw_val_class_loc_list:
251- curr = AT_loc_list_ptr (a);
252- while (*curr)
253+ start = curr = AT_loc_list_ptr (a);
254+ loc = *curr;
255+ gcc_assert (loc);
256+ /* The same list can be referenced more than once. See if we have
257+ already recorded the result from a previous pass. */
258+ if (loc->replaced)
259+ *curr = loc->dw_loc_next;
260+ else if (!loc->resolved_addr)
261 {
262- if (!resolve_addr_in_expr ((*curr)->expr))
263+ /* As things stand, we do not expect or allow one die to
264+ reference a suffix of another die's location list chain.
265+ References must be identical or completely separate.
266+ There is therefore no need to cache the result of this
267+ pass on any list other than the first; doing so
268+ would lead to unnecessary writes. */
269+ while (*curr)
270 {
271- dw_loc_list_ref next = (*curr)->dw_loc_next;
272- if (next && (*curr)->ll_symbol)
273+ gcc_assert (!(*curr)->replaced && !(*curr)->resolved_addr);
274+ if (!resolve_addr_in_expr ((*curr)->expr))
275 {
276- gcc_assert (!next->ll_symbol);
277- next->ll_symbol = (*curr)->ll_symbol;
278+ dw_loc_list_ref next = (*curr)->dw_loc_next;
279+ if (next && (*curr)->ll_symbol)
280+ {
281+ gcc_assert (!next->ll_symbol);
282+ next->ll_symbol = (*curr)->ll_symbol;
283+ }
284+ *curr = next;
285 }
286- *curr = next;
287+ else
288+ curr = &(*curr)->dw_loc_next;
289 }
290+ if (loc == *start)
291+ loc->resolved_addr = 1;
292 else
293- curr = &(*curr)->dw_loc_next;
294+ {
295+ loc->replaced = 1;
296+ loc->dw_loc_next = *start;
297+ }
298 }
299- if (!AT_loc_list (a))
300+ if (!*start)
301 {
302 remove_AT (die, a->dw_attr);
303 ix--;
304@@ -23322,6 +23423,7 @@
305 add_location_or_const_value_attribute (
306 VEC_index (deferred_locations, deferred_locations_list, i)->die,
307 VEC_index (deferred_locations, deferred_locations_list, i)->variable,
308+ false,
309 DW_AT_location);
310 }
311

Subscribers

People subscribed via source and target branches