[Sync] Sync patches from openeuler/gcc.
This commit is contained in:
parent
12fa32c59d
commit
15fb725e40
2387
0156-add-icp-optimization.patch
Normal file
2387
0156-add-icp-optimization.patch
Normal file
File diff suppressed because it is too large
Load Diff
2072
0158-Implement-IPA-prefetch-optimization.patch
Normal file
2072
0158-Implement-IPA-prefetch-optimization.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -46,7 +46,7 @@ index 56ad9a378..a8a2264ee 100644
|
||||
+Common Report Var(flag_llc_allocate) Optimization
|
||||
Generate LLC hint instructions.
|
||||
|
||||
fprofile
|
||||
fipa-prefetch
|
||||
diff --git a/gcc/params.opt b/gcc/params.opt
|
||||
index 792ca5c35..ef7bea311 100644
|
||||
--- a/gcc/params.opt
|
||||
|
||||
24
0173-IPA-Fix-test-completion-1.c.patch
Normal file
24
0173-IPA-Fix-test-completion-1.c.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From d6ef1c0c182267d3ab68e3ae1d7f1a576a7bbb2a Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Wed, 20 Dec 2023 18:44:29 +0800
|
||||
Subject: [PATCH 2/5] [IPA] Fix test completion-1.c
|
||||
|
||||
---
|
||||
gcc/testsuite/gcc.dg/completion-1.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/gcc/testsuite/gcc.dg/completion-1.c b/gcc/testsuite/gcc.dg/completion-1.c
|
||||
index 64da64f1c..df2319c76 100644
|
||||
--- a/gcc/testsuite/gcc.dg/completion-1.c
|
||||
+++ b/gcc/testsuite/gcc.dg/completion-1.c
|
||||
@@ -2,6 +2,7 @@
|
||||
/* { dg-options "--completion=-fipa-ic" } */
|
||||
|
||||
/* { dg-begin-multiline-output "" }
|
||||
+-fipa-ic
|
||||
-fipa-icf
|
||||
-fipa-icf-functions
|
||||
-fipa-icf-variables
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
From ed548cec9d8efe8ef742225c39f5d84aba4be81b Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia WX1215920 <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Wed, 20 Dec 2023 13:53:47 +0300
|
||||
Subject: [PATCH 3/5] [IPA] Fix fails on checked build and comments from review
|
||||
|
||||
---
|
||||
gcc/ipa-prefetch.c | 24 ++++++++++++++++++++++--
|
||||
gcc/params.opt | 4 ++--
|
||||
2 files changed, 24 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gcc/ipa-prefetch.c b/gcc/ipa-prefetch.c
|
||||
index 93483a6e8..d8bb9a251 100644
|
||||
--- a/gcc/ipa-prefetch.c
|
||||
+++ b/gcc/ipa-prefetch.c
|
||||
@@ -167,6 +167,7 @@ analyse_cgraph ()
|
||||
}
|
||||
|
||||
/* TODO: maybe remove loop info here. */
|
||||
+ n->get_body ();
|
||||
push_cfun (DECL_STRUCT_FUNCTION (n->decl));
|
||||
calculate_dominance_info (CDI_DOMINATORS);
|
||||
loop_optimizer_init (LOOPS_NORMAL);
|
||||
@@ -1540,9 +1541,28 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
return 0;
|
||||
}
|
||||
else if (dump_file)
|
||||
- fprintf (dump_file, "Dominator bb %d for MRs\n", dom_bb->index);
|
||||
+ {
|
||||
+ fprintf (dump_file, "Dominator bb %d for MRs:\n", dom_bb->index);
|
||||
+ gimple_dump_bb (dump_file, dom_bb, 0, dump_flags);
|
||||
+ fprintf (dump_file, "\n");
|
||||
+ }
|
||||
+
|
||||
+ /* Try to find comp_mr's stmt in the dominator bb. */
|
||||
+ gimple *last_used = NULL;
|
||||
+ for (gimple_stmt_iterator si = gsi_last_bb (dom_bb); !gsi_end_p (si);
|
||||
+ gsi_prev (&si))
|
||||
+ if (comp_mr->stmts[0] == gsi_stmt (si))
|
||||
+ {
|
||||
+ last_used = gsi_stmt (si);
|
||||
+ if (dump_file)
|
||||
+ {
|
||||
+ fprintf (dump_file, "Last used stmt in dominator bb:\n");
|
||||
+ print_gimple_stmt (dump_file, last_used, 0);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
- split_block (dom_bb, (gimple *) NULL);
|
||||
+ split_block (dom_bb, last_used);
|
||||
gimple_stmt_iterator gsi = gsi_last_bb (dom_bb);
|
||||
|
||||
/* Create new inc var. Insert new_var = old_var + step * factor. */
|
||||
diff --git a/gcc/params.opt b/gcc/params.opt
|
||||
index ef7bea311..76ae925fd 100644
|
||||
--- a/gcc/params.opt
|
||||
+++ b/gcc/params.opt
|
||||
@@ -251,8 +251,8 @@ Common Joined UInteger Var(param_ipa_prefetch_distance_factor) Init(4) Param Opt
|
||||
The factor represents the number of inductive variable incrementations to evaluate an indirect memory address for IPA prefetch.
|
||||
|
||||
-param=ipa-prefetch-locality=
|
||||
-Common Joined UInteger Var(param_ipa_prefetch_locality) Init(3) Param Optimization
|
||||
-The flag represents temporal locality values in the following way: 0:pstl1strm, 1:pstl3keep, 2:pstl2keep, 3:pstl1keep.
|
||||
+Common Joined UInteger Var(param_ipa_prefetch_locality) Init(3) IntegerRange(0, 3) Param Optimization
|
||||
+The flag represents temporal locality value between 0 and 3, the higher value means the higher temporal locality in the data.
|
||||
|
||||
-param=ira-loop-reserved-regs=
|
||||
Common Joined UInteger Var(param_ira_loop_reserved_regs) Init(2) Param Optimization
|
||||
--
|
||||
2.33.0
|
||||
|
||||
61
0176-Fix-bugs-in-ICP-src-openEuler-gcc-I8PYBF-I8PYLL.patch
Normal file
61
0176-Fix-bugs-in-ICP-src-openEuler-gcc-I8PYBF-I8PYLL.patch
Normal file
@ -0,0 +1,61 @@
|
||||
From d2742041454dbd4c4c3c3e0a27b5fb26d1e05832 Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia WX1215920 <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Thu, 21 Dec 2023 11:14:06 +0300
|
||||
Subject: [PATCH 5/5] Fix bugs in ICP (src-openEuler/gcc: I8PYBF, I8PYLL)
|
||||
|
||||
---
|
||||
gcc/ipa-devirt.c | 17 +++++++++++++++--
|
||||
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
|
||||
index fbde7eb94..a18cbe36a 100644
|
||||
--- a/gcc/ipa-devirt.c
|
||||
+++ b/gcc/ipa-devirt.c
|
||||
@@ -4399,6 +4399,11 @@ print_type_set(unsigned ftype_uid, type_alias_map *map)
|
||||
if (!map->count (ftype_uid))
|
||||
return;
|
||||
type_set* s = (*map)[ftype_uid];
|
||||
+ if (!s)
|
||||
+ {
|
||||
+ fprintf (dump_file, "%d (no set)", ftype_uid);
|
||||
+ return;
|
||||
+ }
|
||||
for (type_set::const_iterator it = s->begin (); it != s->end (); it++)
|
||||
fprintf (dump_file, it == s->begin () ? "%d" : ", %d", *it);
|
||||
}
|
||||
@@ -4966,7 +4971,8 @@ analyze_assign_stmt (gimple *stmt)
|
||||
{
|
||||
rhs = TREE_OPERAND (rhs, 0);
|
||||
if (VAR_OR_FUNCTION_DECL_P (rhs) || TREE_CODE (rhs) == STRING_CST
|
||||
- || TREE_CODE (rhs) == ARRAY_REF || TREE_CODE (rhs) == PARM_DECL)
|
||||
+ || TREE_CODE (rhs) == ARRAY_REF || TREE_CODE (rhs) == PARM_DECL
|
||||
+ || TREE_CODE (rhs) == LABEL_DECL)
|
||||
rhs_type = build_pointer_type (TREE_TYPE (rhs));
|
||||
else if (TREE_CODE (rhs) == COMPONENT_REF)
|
||||
{
|
||||
@@ -4980,7 +4986,12 @@ analyze_assign_stmt (gimple *stmt)
|
||||
gcc_assert (POINTER_TYPE_P (rhs_type));
|
||||
}
|
||||
else
|
||||
- gcc_unreachable();
|
||||
+ {
|
||||
+ fprintf (dump_file, "\nUnsupported rhs type %s in assign stmt: ",
|
||||
+ get_tree_code_name (TREE_CODE (rhs)));
|
||||
+ print_gimple_stmt (dump_file, stmt, 0);
|
||||
+ gcc_unreachable ();
|
||||
+ }
|
||||
}
|
||||
else
|
||||
rhs_type = TREE_TYPE (rhs);
|
||||
@@ -5678,6 +5689,8 @@ merge_fs_map_for_ftype_aliases ()
|
||||
decl_set *d_set = it1->second;
|
||||
tree type = (*type_uid_map)[it1->first];
|
||||
type_set *set = (*fta_map)[it1->first];
|
||||
+ if (!set)
|
||||
+ continue;
|
||||
for (type_set::const_iterator it2 = set->begin ();
|
||||
it2 != set->end (); it2++)
|
||||
{
|
||||
--
|
||||
2.33.0
|
||||
|
||||
168
0177-Fix-sqlite-build.patch
Normal file
168
0177-Fix-sqlite-build.patch
Normal file
@ -0,0 +1,168 @@
|
||||
From 71a992aca88f63ec1afb1608619b82a857d8e297 Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Fri, 22 Dec 2023 10:11:24 +0800
|
||||
Subject: [PATCH 1/4] Fix sqlite build
|
||||
|
||||
---
|
||||
gcc/ipa-prefetch.c | 71 ++++++++++++++++++++++++++--------------------
|
||||
gcc/ipa-sra.c | 7 +++++
|
||||
2 files changed, 47 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/gcc/ipa-prefetch.c b/gcc/ipa-prefetch.c
|
||||
index d8bb9a251..371702ad8 100644
|
||||
--- a/gcc/ipa-prefetch.c
|
||||
+++ b/gcc/ipa-prefetch.c
|
||||
@@ -1092,6 +1092,15 @@ analyse_loops ()
|
||||
memref_t *mr = it->first, *mr2 = it->second;
|
||||
if (mr2 == NULL || !(*fmrs_map)[fn]->count (mr))
|
||||
continue;
|
||||
+ /* For now optimize only MRs that mem is MEM_REF.
|
||||
+ TODO: support other MR types. */
|
||||
+ if (TREE_CODE (mr->mem) != MEM_REF)
|
||||
+ {
|
||||
+ if (dump_file)
|
||||
+ fprintf (dump_file, "Skip MR %d: unsupported tree code = %s\n",
|
||||
+ mr->mr_id, get_tree_code_name (TREE_CODE (mr->mem)));
|
||||
+ continue;
|
||||
+ }
|
||||
if (!optimize_mrs_map->count (fn))
|
||||
(*optimize_mrs_map)[fn] = new memref_set;
|
||||
(*optimize_mrs_map)[fn]->insert (mr);
|
||||
@@ -1104,7 +1113,7 @@ analyse_loops ()
|
||||
it != (*optimize_mrs_map)[fn]->end (); it++)
|
||||
{
|
||||
memref_t *mr = *it, *mr2 = (*mr_candidate_map)[mr];
|
||||
- fprintf (dump_file, "MRs %d,%d with incremental offset ",
|
||||
+ fprintf (dump_file, "MRs %d, %d with incremental offset ",
|
||||
mr->mr_id, mr2->mr_id);
|
||||
print_generic_expr (dump_file, mr2->offset);
|
||||
fprintf (dump_file, "\n");
|
||||
@@ -1437,6 +1446,27 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
+/* Copy stmt and remap its operands. */
|
||||
+
|
||||
+static gimple *
|
||||
+gimple_copy_and_remap (gimple *stmt)
|
||||
+{
|
||||
+ gimple *copy = gimple_copy (stmt);
|
||||
+ gcc_checking_assert (!is_gimple_debug (copy));
|
||||
+
|
||||
+ /* Remap all the operands in COPY. */
|
||||
+ struct walk_stmt_info wi;
|
||||
+ memset (&wi, 0, sizeof (wi));
|
||||
+ wi.info = copy;
|
||||
+ walk_gimple_op (copy, remap_gimple_op_r, &wi);
|
||||
+ if (dump_file)
|
||||
+ {
|
||||
+ fprintf (dump_file, "Stmt copy after remap:\n");
|
||||
+ print_gimple_stmt (dump_file, copy, 0);
|
||||
+ }
|
||||
+ return copy;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
create_cgraph_edge (cgraph_node *n, gimple *stmt)
|
||||
{
|
||||
@@ -1585,7 +1615,6 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
/* Create other new vars. Insert new stmts. */
|
||||
struct walk_stmt_info wi;
|
||||
stmt_set processed_stmts;
|
||||
- memref_tree_map mr_new_trees;
|
||||
for (memref_set::const_iterator it = used_mrs.begin ();
|
||||
it != used_mrs.end (); it++)
|
||||
{
|
||||
@@ -1606,23 +1635,10 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
}
|
||||
/* Create a new copy of STMT and duplicate STMT's virtual
|
||||
operands. */
|
||||
- gimple *copy = gimple_copy (mr->stmts[i]);
|
||||
- gcc_checking_assert (!is_gimple_debug (copy));
|
||||
-
|
||||
- /* Remap all the operands in COPY. */
|
||||
- memset (&wi, 0, sizeof (wi));
|
||||
- last_stmt = copy;
|
||||
- wi.info = copy;
|
||||
- walk_gimple_op (copy, remap_gimple_op_r, &wi);
|
||||
- if (dump_file)
|
||||
- {
|
||||
- fprintf (dump_file, "Stmt %d after remap:\n",i);
|
||||
- print_gimple_stmt (dump_file, copy, 0);
|
||||
- }
|
||||
- gimple_seq_add_stmt (&stmts, copy);
|
||||
+ last_stmt = gimple_copy_and_remap (mr->stmts[i]);
|
||||
+ gimple_seq_add_stmt (&stmts, last_stmt);
|
||||
}
|
||||
gcc_assert (last_stmt);
|
||||
- mr_new_trees[mr] = gimple_assign_lhs (last_stmt);
|
||||
if (dump_file)
|
||||
{
|
||||
fprintf (dump_file, "MR (%d) new mem: ", mr->mr_id);
|
||||
@@ -1664,23 +1680,11 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
continue;
|
||||
processed_stmts.insert (mr->stmts[i]);
|
||||
|
||||
- gimple *copy = gimple_copy (mr->stmts[i]);
|
||||
- gcc_checking_assert (!is_gimple_debug (copy));
|
||||
-
|
||||
- /* Remap all the operands in COPY. */
|
||||
- memset (&wi, 0, sizeof (wi));
|
||||
- wi.info = copy;
|
||||
- walk_gimple_op (copy, remap_gimple_op_r, &wi);
|
||||
- if (dump_file)
|
||||
- {
|
||||
- fprintf (dump_file, "Stmt %d after remap:\n",i);
|
||||
- print_gimple_stmt (dump_file, copy, 0);
|
||||
- }
|
||||
+ gimple *copy = gimple_copy_and_remap (mr->stmts[i]);
|
||||
gimple_seq_add_stmt (&stmts, copy);
|
||||
}
|
||||
gimple *last_stmt = mr->stmts[0];
|
||||
gcc_assert (last_stmt);
|
||||
- mr_new_trees[mr] = gimple_assign_lhs (last_stmt);
|
||||
tree write_p = mr->is_store ? integer_one_node : integer_zero_node;
|
||||
tree addr = get_mem_ref_address_ssa_name (mr->mem, NULL_TREE);
|
||||
if (decl_map->count (addr))
|
||||
@@ -1689,6 +1693,11 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
3, addr, write_p, local);
|
||||
pcalls.safe_push (last_stmt);
|
||||
gimple_seq_add_stmt (&stmts, last_stmt);
|
||||
+ if (dump_file)
|
||||
+ {
|
||||
+ fprintf (dump_file, "Insert %d prefetch stmt:\n", j);
|
||||
+ print_gimple_stmt (dump_file, last_stmt, 0);
|
||||
+ }
|
||||
}
|
||||
|
||||
gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT);
|
||||
@@ -1827,7 +1836,7 @@ pass_ipa_prefetch::gate (function *)
|
||||
/* Don't bother doing anything if the program has errors. */
|
||||
&& !seen_error ()
|
||||
&& flag_lto_partition == LTO_PARTITION_ONE
|
||||
- /* Only enable struct optimizations in lto or whole_program. */
|
||||
+ /* Only enable prefetch optimizations in lto or whole_program. */
|
||||
&& (in_lto_p || flag_whole_program));
|
||||
}
|
||||
|
||||
diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c
|
||||
index d7019ec42..ee927bf6a 100644
|
||||
--- a/gcc/ipa-sra.c
|
||||
+++ b/gcc/ipa-sra.c
|
||||
@@ -3448,6 +3448,13 @@ param_splitting_across_edge (cgraph_edge *cs)
|
||||
gcc_checking_assert (from_ifs && from_ifs->m_parameters);
|
||||
|
||||
isra_call_summary *csum = call_sums->get (cs);
|
||||
+ /* TODO: implement better support for call edges inserted after summary
|
||||
+ collection but before sra wpa invocation. */
|
||||
+ if (!csum)
|
||||
+ {
|
||||
+ csum = call_sums->get_create (cs);
|
||||
+ csum->m_return_ignored = true;
|
||||
+ }
|
||||
gcc_checking_assert (csum);
|
||||
unsigned args_count = csum->m_arg_flow.length ();
|
||||
isra_func_summary *to_ifs = func_sums->get (callee);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
52
0178-Fix-freetype-build.patch
Normal file
52
0178-Fix-freetype-build.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From b187b3043c5a7aa96e6d1106e4b0f37d14c914a6 Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Fri, 22 Dec 2023 11:39:09 +0800
|
||||
Subject: [PATCH 2/4] Fix freetype build
|
||||
|
||||
---
|
||||
gcc/ipa-prefetch.c | 17 +++++++++++++++--
|
||||
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gcc/ipa-prefetch.c b/gcc/ipa-prefetch.c
|
||||
index 371702ad8..f91ac3edc 100644
|
||||
--- a/gcc/ipa-prefetch.c
|
||||
+++ b/gcc/ipa-prefetch.c
|
||||
@@ -1522,6 +1522,13 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
"Skip the case.\n");
|
||||
return 0;
|
||||
}
|
||||
+ if (!tree_fits_shwi_p (inc_mr->step))
|
||||
+ {
|
||||
+ if (dump_file)
|
||||
+ fprintf (dump_file, "Cannot represent incremental MR's step as "
|
||||
+ "integer. Skip the case.\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
if (dump_file && !used_mrs.empty ())
|
||||
print_mrs_ids (used_mrs, "Common list of used mrs:\n");
|
||||
|
||||
@@ -1607,13 +1614,19 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
else
|
||||
inc_code = PLUS_EXPR;
|
||||
tree step = inc_mr->step;
|
||||
- unsigned dist_val = tree_to_uhwi (step) * param_ipa_prefetch_distance_factor;
|
||||
+ HOST_WIDE_INT dist_val = tree_to_shwi (step)
|
||||
+ * param_ipa_prefetch_distance_factor;
|
||||
tree dist = build_int_cst (TREE_TYPE (step), dist_val);
|
||||
tree new_inc_var = gimple_build (&stmts, inc_code, var_type, inc_var, dist);
|
||||
(*decl_map)[inc_var] = new_inc_var;
|
||||
+ if (dump_file)
|
||||
+ {
|
||||
+ fprintf (dump_file, "New distance value: %ld, new inc var: ", dist_val);
|
||||
+ print_generic_expr (dump_file, new_inc_var);
|
||||
+ fprintf (dump_file, "\n");
|
||||
+ }
|
||||
|
||||
/* Create other new vars. Insert new stmts. */
|
||||
- struct walk_stmt_info wi;
|
||||
stmt_set processed_stmts;
|
||||
for (memref_set::const_iterator it = used_mrs.begin ();
|
||||
it != used_mrs.end (); it++)
|
||||
--
|
||||
2.33.0
|
||||
|
||||
115
0181-Fix-issue-I8QD9H.patch
Normal file
115
0181-Fix-issue-I8QD9H.patch
Normal file
@ -0,0 +1,115 @@
|
||||
From 25f1ebeb88a4eae247f58488cac9da878f188d9f Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Sat, 23 Dec 2023 10:05:10 +0800
|
||||
Subject: [PATCH 4/4] Fix issue I8QD9H
|
||||
|
||||
---
|
||||
gcc/ipa-prefetch.c | 64 +++++++++++++++++++++++++++-------------------
|
||||
1 file changed, 37 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/gcc/ipa-prefetch.c b/gcc/ipa-prefetch.c
|
||||
index f91ac3edc..a471b118e 100644
|
||||
--- a/gcc/ipa-prefetch.c
|
||||
+++ b/gcc/ipa-prefetch.c
|
||||
@@ -1467,6 +1467,31 @@ gimple_copy_and_remap (gimple *stmt)
|
||||
return copy;
|
||||
}
|
||||
|
||||
+/* Copy and remap stmts listed in MR in reverse order to last_idx, skipping
|
||||
+ processed ones. Insert new stmts to the sequence. */
|
||||
+
|
||||
+static gimple *
|
||||
+gimple_copy_and_remap_memref_stmts (memref_t *mr, gimple_seq &stmts,
|
||||
+ int last_idx, stmt_set &processed)
|
||||
+{
|
||||
+ gimple *last_stmt = NULL;
|
||||
+ for (int i = mr->stmts.length () - 1; i >= last_idx ; i--)
|
||||
+ {
|
||||
+ if (processed.count (mr->stmts[i]))
|
||||
+ continue;
|
||||
+ processed.insert (mr->stmts[i]);
|
||||
+ if (dump_file)
|
||||
+ {
|
||||
+ fprintf (dump_file, "Copy stmt %d from used MR (%d):\n",
|
||||
+ i, mr->mr_id);
|
||||
+ print_gimple_stmt (dump_file, mr->stmts[i], 0);
|
||||
+ }
|
||||
+ last_stmt = gimple_copy_and_remap (mr->stmts[i]);
|
||||
+ gimple_seq_add_stmt (&stmts, last_stmt);
|
||||
+ }
|
||||
+ return last_stmt;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
create_cgraph_edge (cgraph_node *n, gimple *stmt)
|
||||
{
|
||||
@@ -1606,7 +1631,16 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
decl_map = new tree_map;
|
||||
gcc_assert (comp_mr->stmts[0] && gimple_assign_single_p (comp_mr->stmts[0]));
|
||||
tree inc_var = gimple_assign_lhs (comp_mr->stmts[0]);
|
||||
+ /* If old_var definition dominates the current use, just use it, otherwise
|
||||
+ evaluate it just before new inc var evaluation. */
|
||||
gimple_seq stmts = NULL;
|
||||
+ stmt_set processed_stmts;
|
||||
+ if (!dominated_by_p (CDI_DOMINATORS, dom_bb, gimple_bb (comp_mr->stmts[0])))
|
||||
+ {
|
||||
+ gimple *tmp = gimple_copy_and_remap_memref_stmts (comp_mr, stmts, 0,
|
||||
+ processed_stmts);
|
||||
+ inc_var = gimple_assign_lhs (tmp);
|
||||
+ }
|
||||
tree var_type = TREE_TYPE (inc_var);
|
||||
enum tree_code inc_code;
|
||||
if (TREE_CODE (var_type) == POINTER_TYPE)
|
||||
@@ -1627,30 +1661,14 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
}
|
||||
|
||||
/* Create other new vars. Insert new stmts. */
|
||||
- stmt_set processed_stmts;
|
||||
for (memref_set::const_iterator it = used_mrs.begin ();
|
||||
it != used_mrs.end (); it++)
|
||||
{
|
||||
memref_t *mr = *it;
|
||||
- gimple *last_stmt = NULL;
|
||||
if (mr == comp_mr)
|
||||
continue;
|
||||
- for (int i = mr->stmts.length () - 1; i >= 0 ; i--)
|
||||
- {
|
||||
- if (processed_stmts.count (mr->stmts[i]))
|
||||
- continue;
|
||||
- processed_stmts.insert (mr->stmts[i]);
|
||||
- if (dump_file)
|
||||
- {
|
||||
- fprintf (dump_file, "Copy stmt %d from used MR (%d):\n",
|
||||
- i, mr->mr_id);
|
||||
- print_gimple_stmt (dump_file, mr->stmts[i], 0);
|
||||
- }
|
||||
- /* Create a new copy of STMT and duplicate STMT's virtual
|
||||
- operands. */
|
||||
- last_stmt = gimple_copy_and_remap (mr->stmts[i]);
|
||||
- gimple_seq_add_stmt (&stmts, last_stmt);
|
||||
- }
|
||||
+ gimple *last_stmt = gimple_copy_and_remap_memref_stmts (mr, stmts, 0,
|
||||
+ processed_stmts);
|
||||
gcc_assert (last_stmt);
|
||||
if (dump_file)
|
||||
{
|
||||
@@ -1687,15 +1705,7 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
memref_t *mr = vmrs[j];
|
||||
/* Don't need to copy the last stmt, since we insert prefetch insn
|
||||
instead of it. */
|
||||
- for (int i = mr->stmts.length () - 1; i >= 1 ; i--)
|
||||
- {
|
||||
- if (processed_stmts.count (mr->stmts[i]))
|
||||
- continue;
|
||||
- processed_stmts.insert (mr->stmts[i]);
|
||||
-
|
||||
- gimple *copy = gimple_copy_and_remap (mr->stmts[i]);
|
||||
- gimple_seq_add_stmt (&stmts, copy);
|
||||
- }
|
||||
+ gimple_copy_and_remap_memref_stmts (mr, stmts, 1, processed_stmts);
|
||||
gimple *last_stmt = mr->stmts[0];
|
||||
gcc_assert (last_stmt);
|
||||
tree write_p = mr->is_store ? integer_one_node : integer_zero_node;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
47
0182-Fix-bugs-in-ICP-src-openEuler-gcc-I8RKFJ.patch
Normal file
47
0182-Fix-bugs-in-ICP-src-openEuler-gcc-I8RKFJ.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From 1724319692f3c5443802e0cef44a81667cfcc0ae Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Wed, 27 Dec 2023 07:29:26 +0800
|
||||
Subject: [PATCH 1/4] Fix bugs in ICP (src-openEuler/gcc: I8RKFJ)
|
||||
|
||||
---
|
||||
gcc/ipa-devirt.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
|
||||
index a18cbe36a..987f15a15 100644
|
||||
--- a/gcc/ipa-devirt.c
|
||||
+++ b/gcc/ipa-devirt.c
|
||||
@@ -4669,12 +4669,19 @@ maybe_register_aliases (tree type1, tree type2)
|
||||
if (register_ailas_type (type1, type2, ta_map))
|
||||
analyze_pointees (type1, type2);
|
||||
}
|
||||
+ unsigned type1_uid = TYPE_UID (type1);
|
||||
+ unsigned type2_uid = TYPE_UID (type2);
|
||||
+ if (type_uid_map->count (type1_uid) == 0)
|
||||
+ (*type_uid_map)[type1_uid] = type1;
|
||||
+ if (type_uid_map->count (type2_uid) == 0)
|
||||
+ (*type_uid_map)[type2_uid] = type2;
|
||||
+
|
||||
/* If function and non-function type pointers alias,
|
||||
the function type is unsafe. */
|
||||
if (FUNCTION_POINTER_TYPE_P (type1) && !FUNCTION_POINTER_TYPE_P (type2))
|
||||
- unsafe_types->insert (TYPE_UID (type1));
|
||||
+ unsafe_types->insert (type1_uid);
|
||||
if (FUNCTION_POINTER_TYPE_P (type2) && !FUNCTION_POINTER_TYPE_P (type1))
|
||||
- unsafe_types->insert (TYPE_UID (type2));
|
||||
+ unsafe_types->insert (type2_uid);
|
||||
|
||||
/* Try to figure out with pointers to incomplete types. */
|
||||
if (POINTER_TYPE_P (type1) && POINTER_TYPE_P (type2))
|
||||
@@ -4972,7 +4979,7 @@ analyze_assign_stmt (gimple *stmt)
|
||||
rhs = TREE_OPERAND (rhs, 0);
|
||||
if (VAR_OR_FUNCTION_DECL_P (rhs) || TREE_CODE (rhs) == STRING_CST
|
||||
|| TREE_CODE (rhs) == ARRAY_REF || TREE_CODE (rhs) == PARM_DECL
|
||||
- || TREE_CODE (rhs) == LABEL_DECL)
|
||||
+ || TREE_CODE (rhs) == LABEL_DECL || TREE_CODE (rhs) == CONST_DECL)
|
||||
rhs_type = build_pointer_type (TREE_TYPE (rhs));
|
||||
else if (TREE_CODE (rhs) == COMPONENT_REF)
|
||||
{
|
||||
--
|
||||
2.33.0
|
||||
|
||||
26
0183-Fix-fail-in-ICP-src-openEuler-gcc-I8RP4H.patch
Normal file
26
0183-Fix-fail-in-ICP-src-openEuler-gcc-I8RP4H.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 351d049f09b1e96e48c3038ab3a6a9c1d6a13f8d Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Thu, 28 Dec 2023 09:51:34 +0800
|
||||
Subject: [PATCH 2/4] Fix fail in ICP (src-openEuler/gcc: I8RP4H)
|
||||
|
||||
---
|
||||
gcc/ipa-devirt.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
|
||||
index 987f15a15..ed19a57a4 100644
|
||||
--- a/gcc/ipa-devirt.c
|
||||
+++ b/gcc/ipa-devirt.c
|
||||
@@ -4979,7 +4979,8 @@ analyze_assign_stmt (gimple *stmt)
|
||||
rhs = TREE_OPERAND (rhs, 0);
|
||||
if (VAR_OR_FUNCTION_DECL_P (rhs) || TREE_CODE (rhs) == STRING_CST
|
||||
|| TREE_CODE (rhs) == ARRAY_REF || TREE_CODE (rhs) == PARM_DECL
|
||||
- || TREE_CODE (rhs) == LABEL_DECL || TREE_CODE (rhs) == CONST_DECL)
|
||||
+ || TREE_CODE (rhs) == LABEL_DECL || TREE_CODE (rhs) == CONST_DECL
|
||||
+ || TREE_CODE (rhs) == RESULT_DECL)
|
||||
rhs_type = build_pointer_type (TREE_TYPE (rhs));
|
||||
else if (TREE_CODE (rhs) == COMPONENT_REF)
|
||||
{
|
||||
--
|
||||
2.33.0
|
||||
|
||||
45
0184-Fix-fail-in-IPA-prefetch-src-openEuler-gcc-I8RURA.patch
Normal file
45
0184-Fix-fail-in-IPA-prefetch-src-openEuler-gcc-I8RURA.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 2a5c250262ec0497a5efbbd1d0d67e7147696074 Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Thu, 28 Dec 2023 20:20:16 +0800
|
||||
Subject: [PATCH 1/2] Fix fail in IPA prefetch (src-openEuler/gcc: I8RURA)
|
||||
|
||||
---
|
||||
gcc/ipa-devirt.c | 9 ++++++---
|
||||
gcc/ipa-prefetch.c | 1 +
|
||||
2 files changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
|
||||
index ed19a57a4..9863084e4 100644
|
||||
--- a/gcc/ipa-devirt.c
|
||||
+++ b/gcc/ipa-devirt.c
|
||||
@@ -4995,9 +4995,12 @@ analyze_assign_stmt (gimple *stmt)
|
||||
}
|
||||
else
|
||||
{
|
||||
- fprintf (dump_file, "\nUnsupported rhs type %s in assign stmt: ",
|
||||
- get_tree_code_name (TREE_CODE (rhs)));
|
||||
- print_gimple_stmt (dump_file, stmt, 0);
|
||||
+ if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
+ {
|
||||
+ fprintf (dump_file, "\nUnsupported rhs type %s in assign stmt: ",
|
||||
+ get_tree_code_name (TREE_CODE (rhs)));
|
||||
+ print_gimple_stmt (dump_file, stmt, 0);
|
||||
+ }
|
||||
gcc_unreachable ();
|
||||
}
|
||||
}
|
||||
diff --git a/gcc/ipa-prefetch.c b/gcc/ipa-prefetch.c
|
||||
index a471b118e..24cb4424a 100644
|
||||
--- a/gcc/ipa-prefetch.c
|
||||
+++ b/gcc/ipa-prefetch.c
|
||||
@@ -1730,6 +1730,7 @@ optimize_function (cgraph_node *n, function *fn)
|
||||
for (unsigned i = 0; i < pcalls.length (); i++)
|
||||
create_cgraph_edge (n, pcalls[i]);
|
||||
ipa_update_overall_fn_summary (n);
|
||||
+ renumber_gimple_stmt_uids (DECL_STRUCT_FUNCTION (n->decl));
|
||||
|
||||
return 1;
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
26
0185-Fix-fail-in-IPA-prefetch-src-openEuler-gcc-I8RV7T.patch
Normal file
26
0185-Fix-fail-in-IPA-prefetch-src-openEuler-gcc-I8RV7T.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 4014d651825c3e03e0ad2eabeddcfb94f5f00e68 Mon Sep 17 00:00:00 2001
|
||||
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
||||
Date: Fri, 29 Dec 2023 05:59:00 +0800
|
||||
Subject: [PATCH 2/2] Fix fail in IPA prefetch (src-openEuler/gcc: I8RV7T)
|
||||
|
||||
---
|
||||
gcc/ipa-prefetch.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/gcc/ipa-prefetch.c b/gcc/ipa-prefetch.c
|
||||
index 24cb4424a..d9456519c 100644
|
||||
--- a/gcc/ipa-prefetch.c
|
||||
+++ b/gcc/ipa-prefetch.c
|
||||
@@ -943,6 +943,9 @@ compare_memrefs (memref_t* mr, memref_t* mr2)
|
||||
(*mr_candidate_map)[mr] = mr2;
|
||||
return;
|
||||
}
|
||||
+ /* Probably we shouldn't leave nulls in the map. */
|
||||
+ if ((*mr_candidate_map)[mr] == NULL)
|
||||
+ return;
|
||||
/* TODO: support analysis with incrementation of different fields. */
|
||||
if ((*mr_candidate_map)[mr]->offset != mr2->offset)
|
||||
{
|
||||
--
|
||||
2.33.0
|
||||
|
||||
32
gcc.spec
32
gcc.spec
@ -61,7 +61,7 @@
|
||||
Summary: Various compilers (C, C++, Objective-C, ...)
|
||||
Name: gcc
|
||||
Version: %{gcc_version}
|
||||
Release: 49
|
||||
Release: 50
|
||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
|
||||
URL: https://gcc.gnu.org
|
||||
|
||||
@ -263,7 +263,9 @@ Patch152: 0152-Add-LLC-Allocation-Pass.patch
|
||||
Patch153: 0153-LLC-add-extending-outer-loop.patch
|
||||
Patch154: 0154-Loop-CRC32-Judge-null-on-pointers-and-solving-coding.patch
|
||||
Patch155: 0155-Add-maxmin-and-uzp1-uzp2-combining.patch
|
||||
Patch156: 0156-add-icp-optimization.patch
|
||||
Patch157: 0157-Add-split-complex-instructions-pass.patch
|
||||
Patch158: 0158-Implement-IPA-prefetch-optimization.patch
|
||||
Patch159: 0159-Implement-AES-pattern-matching.patch
|
||||
Patch160: 0160-AES-Add-lost-files.patch
|
||||
Patch161: 0161-Fix-lost-ftree-fold-phiopt-option-in-tests.patch
|
||||
@ -278,9 +280,19 @@ Patch169: 0169-Struct-Reorg-Fix-several-bugs.patch
|
||||
Patch170: 0170-DFE-Add-escape-check.patch
|
||||
Patch171: 0171-phiopt-testsuite-Add-ftree-fold-phiopt-option-to-5-t.patch
|
||||
Patch172: 0172-minmax-Move-minmax-pattern-to-gimple.patch
|
||||
Patch173: 0173-IPA-Fix-test-completion-1.c.patch
|
||||
Patch174: 0174-IPA-Fix-fails-on-checked-build-and-comments-from-rev.patch
|
||||
Patch175: 0175-split-ldp-stp-Extending-and-refactoring-of-pass_spli.patch
|
||||
Patch176: 0176-Fix-bugs-in-ICP-src-openEuler-gcc-I8PYBF-I8PYLL.patch
|
||||
Patch177: 0177-Fix-sqlite-build.patch
|
||||
Patch178: 0178-Fix-freetype-build.patch
|
||||
Patch179: 0179-rtl-ifcvt-refuse-to-rename-def-in-the-last-instructi.patch
|
||||
Patch180: 0180-add-optimization-level-requirement-to-the-gate.patch
|
||||
Patch181: 0181-Fix-issue-I8QD9H.patch
|
||||
Patch182: 0182-Fix-bugs-in-ICP-src-openEuler-gcc-I8RKFJ.patch
|
||||
Patch183: 0183-Fix-fail-in-ICP-src-openEuler-gcc-I8RP4H.patch
|
||||
Patch184: 0184-Fix-fail-in-IPA-prefetch-src-openEuler-gcc-I8RURA.patch
|
||||
Patch185: 0185-Fix-fail-in-IPA-prefetch-src-openEuler-gcc-I8RV7T.patch
|
||||
|
||||
%global gcc_target_platform %{_arch}-linux-gnu
|
||||
|
||||
@ -889,7 +901,9 @@ not stable, so plugins must be rebuilt any time GCC is updated.
|
||||
%patch153 -p1
|
||||
%patch154 -p1
|
||||
%patch155 -p1
|
||||
%patch156 -p1
|
||||
%patch157 -p1
|
||||
%patch158 -p1
|
||||
%patch159 -p1
|
||||
%patch160 -p1
|
||||
%patch161 -p1
|
||||
@ -904,9 +918,19 @@ not stable, so plugins must be rebuilt any time GCC is updated.
|
||||
%patch170 -p1
|
||||
%patch171 -p1
|
||||
%patch172 -p1
|
||||
%patch173 -p1
|
||||
%patch174 -p1
|
||||
%patch175 -p1
|
||||
%patch176 -p1
|
||||
%patch177 -p1
|
||||
%patch178 -p1
|
||||
%patch179 -p1
|
||||
%patch180 -p1
|
||||
%patch181 -p1
|
||||
%patch182 -p1
|
||||
%patch183 -p1
|
||||
%patch184 -p1
|
||||
%patch185 -p1
|
||||
|
||||
%build
|
||||
|
||||
@ -2931,6 +2955,12 @@ end
|
||||
%doc rpm.doc/changelogs/libcc1/ChangeLog*
|
||||
|
||||
%changelog
|
||||
* Thu Jan 4 2024 Chenhui Zheng <zhengchenhui1@huawei.com> - 10.3.1-50
|
||||
- Type:Sync
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: Sync patch from openeuler/gcc
|
||||
|
||||
* Thu Dec 28 2023 Xiong Zhou <xiongzhou4@huawei.com> - 10.3.1-49
|
||||
- Type:Revert & sync
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user