Bump gcc-7 to 7.3.0 and add testsuites as in solaris-userland
[unleashed-userland.git] / components / developer / gcc-7 / patches / 0006-allow-the-global-disabling-of-function-cloning.patch
blobe98cccea0197221936135b841146ebba17875e5b
1 From 74e4c60103b72f1e4714db11a6d83b60feb85c4f Mon Sep 17 00:00:00 2001
2 From: Richard Lowe <richlowe@richlowe.net>
3 Date: Sun, 30 Sep 2012 16:44:14 -0400
4 Subject: [PATCH 06/11] allow the global disabling of function cloning
6 Optimizations which clone functions to create call-specific implementations
7 which may be better optimized also dissociate these functions from their
8 symbol names in ways harmful to tracing and debugging (since there are now
9 several implementations of a single source symbol, quite possibly none of them
10 having the actual source symbol name).
12 This allows any function cloning to be disabled, and makes any such
13 optimization ineffective, and our source safe for debuggers everywhere.
14 ---
15 gcc/common.opt | 5 +++++
16 gcc/doc/invoke.texi | 11 ++++++++++-
17 gcc/tree-inline.c | 11 ++++++-----
18 3 files changed, 21 insertions(+), 6 deletions(-)
20 diff --git a/gcc/common.opt b/gcc/common.opt
21 index 978fbc83b89..e38dc343afd 100644
22 --- a/gcc/common.opt
23 +++ b/gcc/common.opt
24 @@ -1076,6 +1076,11 @@ fcode-hoisting
25 Common Report Var(flag_code_hoisting) Optimization
26 Enable code hoisting.
28 +fclone-functions
29 +Common Report Var(flag_clone_functions) Init(1)
30 +Allow the compiler to clone functions to facilitate certain optimizations.
31 +Enabled by default.
33 fcombine-stack-adjustments
34 Common Report Var(flag_combine_stack_adjustments) Optimization
35 Looks for opportunities to reduce stack adjustments and stack references.
36 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
37 index 68127bbf6ef..4024dd8af67 100644
38 --- a/gcc/doc/invoke.texi
39 +++ b/gcc/doc/invoke.texi
40 @@ -359,7 +359,7 @@ Objective-C and Objective-C++ Dialects}.
41 -fauto-inc-dec -fbranch-probabilities @gol
42 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
43 -fbtr-bb-exclusive -fcaller-saves @gol
44 --fcombine-stack-adjustments -fconserve-stack @gol
45 +-fclone-functions -fcombine-stack-adjustments -fconserve-stack @gol
46 -fcompare-elim -fcprop-registers -fcrossjumping @gol
47 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
48 -fcx-limited-range @gol
49 @@ -7977,6 +7977,15 @@ and then tries to find ways to combine them.
51 Enabled by default at @option{-O1} and higher.
53 +@item -fno-clone-functions
54 +@opindex fno-clone-functions
55 +Forbid the implicit cloning of functions implicit in certain
56 +optimizations. This also effectively will disable any optimization
57 +which wishes to clone functions, equivalent to each function having
58 +the ``noclone'' attribute. This allows the prevention of the
59 +dissociation of a piece of text from an intelligible and expected
60 +symbol name, which may hamper debugging and tracing.
62 @item -fipa-ra
63 @opindex fipa-ra
64 Use caller save registers for allocation if those registers are not used by
65 diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
66 index f56d09e1bdb..5278ece9c74 100644
67 --- a/gcc/tree-inline.c
68 +++ b/gcc/tree-inline.c
69 @@ -659,7 +659,7 @@ remap_decls (tree decls, vec<tree, va_gc> **nonlocalized_list,
70 gcc_assert (DECL_P (new_var));
71 DECL_CHAIN (new_var) = new_decls;
72 new_decls = new_var;
75 /* Also copy value-expressions. */
76 if (VAR_P (new_var) && DECL_HAS_VALUE_EXPR_P (new_var))
78 @@ -3489,7 +3489,7 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest,
79 done:
80 /* Register the VAR_DECL as the equivalent for the RESULT_DECL; that
81 way, when the RESULT_DECL is encountered, it will be
82 - automatically replaced by the VAR_DECL.
83 + automatically replaced by the VAR_DECL.
85 When returning by reference, ensure that RESULT_DECL remaps to
86 gimple_val. */
87 @@ -4586,7 +4586,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
89 id->block = make_node (BLOCK);
90 BLOCK_ABSTRACT_ORIGIN (id->block) = fn;
91 - BLOCK_SOURCE_LOCATION (id->block)
92 + BLOCK_SOURCE_LOCATION (id->block)
93 = LOCATION_LOCUS (gimple_location (stmt));
94 prepend_lexical_block (gimple_block (stmt), id->block);
96 @@ -5714,7 +5714,8 @@ bool
97 tree_versionable_function_p (tree fndecl)
99 return (!lookup_attribute ("noclone", DECL_ATTRIBUTES (fndecl))
100 - && copy_forbidden (DECL_STRUCT_FUNCTION (fndecl)) == NULL);
101 + && (copy_forbidden (DECL_STRUCT_FUNCTION (fndecl)) == NULL)
102 + && flag_clone_functions);
105 /* Delete all unreachable basic blocks and update callgraph.
106 @@ -5833,7 +5834,7 @@ update_clone_info (copy_body_data * id)
107 tree with another tree while duplicating the function's
108 body, TREE_MAP represents the mapping between these
109 trees. If UPDATE_CLONES is set, the call_stmt fields
110 - of edges of clones of the function will be updated.
111 + of edges of clones of the function will be updated.
113 If non-NULL ARGS_TO_SKIP determine function parameters to remove
114 from new version.
116 2.15.0