diff options
author | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-07-08 18:00:54 -0300 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-07-08 18:00:54 -0300 |
commit | 75c8f3173d0ebb63b7130fa692358f2c2a2a06f4 (patch) | |
tree | c9be6d4f8470eb5fe63f9563b43ba9f101f66767 /gcc | |
parent | 79e10e02f1f0dfe39061660c945d48995df3f3f3 (diff) | |
download | gcc-75c8f3173d0ebb63b7130fa692358f2c2a2a06f4.zip gcc-75c8f3173d0ebb63b7130fa692358f2c2a2a06f4.tar.gz gcc-75c8f3173d0ebb63b7130fa692358f2c2a2a06f4.tar.bz2 |
Bootstrap with promote_statics = false.
In this commit, we make bootstrap with promote_statics = false pass by
carefully handling SYMBOL_DUPLICATE non-public symbols at partition
time.
We also implement params which control partition balancing and statics
promotion.
gcc/ChangeLog
2020-07-08 Giuliano Belinassi <giuliano.belinassi@usp.br>
* cgraphunit.c (ipa_passes): Use params instead of literals.
* lto-partition.c (merge_static_calls): Be careful with
SYMBOL_DUPLICATE.
* params.def: New params promote-statics and balance-partitions.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cgraphunit.c | 11 | ||||
-rw-r--r-- | gcc/lto-partition.c | 26 | ||||
-rw-r--r-- | gcc/params.opt | 8 |
3 files changed, 29 insertions, 16 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 1cb13d1..d61bded 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2656,16 +2656,17 @@ ipa_passes (void) if (split_outputs) { - bool promote_statics = true; - bool balance = true; + bool promote_statics = param_promote_statics; + bool balance = param_balance_partitions; /* Trick the compiler to think that we are in WPA. */ flag_wpa = ""; symtab_node::checking_verify_symtab_nodes (); - /* Map with a restriction of varpool nodes be in the same partition - if functions that have references to them. */ - //lto_max_no_alonevap_map (); + /* Partition the program so that COMDATs get mapped to the same + partition. If promote_statics is true, it also maps statics + to the same partition. If balance is true, try to balance the + partitions for compilation performance. */ lto_merge_comdat_map (balance, promote_statics); /* AUX pointers are used by partitioning code to bookkeep number of diff --git a/gcc/lto-partition.c b/gcc/lto-partition.c index bc27a09..1431abb 100644 --- a/gcc/lto-partition.c +++ b/gcc/lto-partition.c @@ -978,14 +978,19 @@ static bool merge_static_calls (symtab_node *node, int set) { bool ret = false; + enum symbol_partitioning_class c = node->get_partitioning_class (); if (node->aux) return false; node->aux = (void *) 1; - if (!TREE_PUBLIC (node->decl)) + + if (!TREE_PUBLIC (node->decl) || c == SYMBOL_DUPLICATE) { + int i; + struct ipa_ref *ref = NULL; + if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node)) { for (cgraph_edge *e = cnode->callers; e; e = e->next_caller) @@ -999,17 +1004,13 @@ merge_static_calls (symtab_node *node, int set) } } - else if (varpool_node *vnode = dyn_cast <varpool_node *> (node)) - { - int i; - struct ipa_ref *ref = NULL; - for (i = 0; vnode->iterate_referring (i, ref); ++i) - { - symtab_node *node1 = ref->referring; - ds->unite (node1->aux2, set); - ret = true; - } + for (i = 0; node->iterate_referring (i, ref); ++i) + { + symtab_node *node1 = ref->referring; + ds->unite (node1->aux2, set); + merge_static_calls (node1, set); + ret = true; } } @@ -1059,6 +1060,9 @@ lto_merge_comdat_map (bool balance, bool promote_statics) merge_contained_symbols (node, node->aux2); } + FOR_EACH_SYMBOL (node) + node->aux = NULL; + /* Then look at STATICs, if needed. */ if (!promote_statics) FOR_EACH_SYMBOL (node) diff --git a/gcc/params.opt b/gcc/params.opt index 4aec480..5431bea 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -370,6 +370,14 @@ Minimal size of a partition for LTO (in estimated instructions). Common Joined UInteger Var(param_lto_partitions) Init(128) IntegerRange(1, 65536) Param Number of partitions the program should be split to. +-param=promote-statics= +Common Joined UInteger Var(param_promote_statics) Init(0) IntegerRange(0, 1) Param +Allow statics and non-public functions to be promoted as public when compiling in parallel. + +-param=balance-partitions= +Common Joined UInteger Var(param_balance_partitions) Init(1) IntegerRange(0, 1) Param +When compiling in parallel, try to balance the partitions for compilation performance. + -param=max-average-unrolled-insns= Common Joined UInteger Var(param_max_average_unrolled_insns) Init(80) Param Optimization The maximum number of instructions to consider to unroll in a loop on average. |