Revert ICP and IPA prefetch related patches and sync patch
This commit is contained in:
parent
941557967f
commit
37c1aa0a69
File diff suppressed because it is too large
Load Diff
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
|
+Common Report Var(flag_llc_allocate) Optimization
|
||||||
Generate LLC hint instructions.
|
Generate LLC hint instructions.
|
||||||
|
|
||||||
fipa-prefetch
|
fprofile
|
||||||
diff --git a/gcc/params.opt b/gcc/params.opt
|
diff --git a/gcc/params.opt b/gcc/params.opt
|
||||||
index 792ca5c35..ef7bea311 100644
|
index 792ca5c35..ef7bea311 100644
|
||||||
--- a/gcc/params.opt
|
--- a/gcc/params.opt
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
@ -1,168 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
@ -1,115 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
25
0180-add-optimization-level-requirement-to-the-gate.patch
Normal file
25
0180-add-optimization-level-requirement-to-the-gate.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From aa66bcf2b684655d0fbcc6b4543ffef1b2e37288 Mon Sep 17 00:00:00 2001
|
||||||
|
From: vchernon <chernonog.vyacheslav@huawei.com>
|
||||||
|
Date: Thu, 28 Dec 2023 10:44:35 +0800
|
||||||
|
Subject: [PATCH] add optimization level requirement to the gate.
|
||||||
|
|
||||||
|
---
|
||||||
|
gcc/crypto-accel.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/gcc/crypto-accel.c b/gcc/crypto-accel.c
|
||||||
|
index f4e810a6b..e7766a585 100644
|
||||||
|
--- a/gcc/crypto-accel.c
|
||||||
|
+++ b/gcc/crypto-accel.c
|
||||||
|
@@ -2391,7 +2391,7 @@ public:
|
||||||
|
/* opt_pass methods: */
|
||||||
|
virtual bool gate (function *)
|
||||||
|
{
|
||||||
|
- if (flag_crypto_accel_aes <= 0)
|
||||||
|
+ if (flag_crypto_accel_aes <= 0 || optimize < 1)
|
||||||
|
return false;
|
||||||
|
return targetm.get_v16qi_mode
|
||||||
|
&& targetm.gen_rev32v16qi
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
25
gcc.spec
25
gcc.spec
@ -61,7 +61,7 @@
|
|||||||
Summary: Various compilers (C, C++, Objective-C, ...)
|
Summary: Various compilers (C, C++, Objective-C, ...)
|
||||||
Name: gcc
|
Name: gcc
|
||||||
Version: %{gcc_version}
|
Version: %{gcc_version}
|
||||||
Release: 48
|
Release: 49
|
||||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
|
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
|
||||||
URL: https://gcc.gnu.org
|
URL: https://gcc.gnu.org
|
||||||
|
|
||||||
@ -263,9 +263,7 @@ Patch152: 0152-Add-LLC-Allocation-Pass.patch
|
|||||||
Patch153: 0153-LLC-add-extending-outer-loop.patch
|
Patch153: 0153-LLC-add-extending-outer-loop.patch
|
||||||
Patch154: 0154-Loop-CRC32-Judge-null-on-pointers-and-solving-coding.patch
|
Patch154: 0154-Loop-CRC32-Judge-null-on-pointers-and-solving-coding.patch
|
||||||
Patch155: 0155-Add-maxmin-and-uzp1-uzp2-combining.patch
|
Patch155: 0155-Add-maxmin-and-uzp1-uzp2-combining.patch
|
||||||
Patch156: 0156-add-icp-optimization.patch
|
|
||||||
Patch157: 0157-Add-split-complex-instructions-pass.patch
|
Patch157: 0157-Add-split-complex-instructions-pass.patch
|
||||||
Patch158: 0158-Implement-IPA-prefetch-optimization.patch
|
|
||||||
Patch159: 0159-Implement-AES-pattern-matching.patch
|
Patch159: 0159-Implement-AES-pattern-matching.patch
|
||||||
Patch160: 0160-AES-Add-lost-files.patch
|
Patch160: 0160-AES-Add-lost-files.patch
|
||||||
Patch161: 0161-Fix-lost-ftree-fold-phiopt-option-in-tests.patch
|
Patch161: 0161-Fix-lost-ftree-fold-phiopt-option-in-tests.patch
|
||||||
@ -280,14 +278,9 @@ Patch169: 0169-Struct-Reorg-Fix-several-bugs.patch
|
|||||||
Patch170: 0170-DFE-Add-escape-check.patch
|
Patch170: 0170-DFE-Add-escape-check.patch
|
||||||
Patch171: 0171-phiopt-testsuite-Add-ftree-fold-phiopt-option-to-5-t.patch
|
Patch171: 0171-phiopt-testsuite-Add-ftree-fold-phiopt-option-to-5-t.patch
|
||||||
Patch172: 0172-minmax-Move-minmax-pattern-to-gimple.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
|
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
|
Patch179: 0179-rtl-ifcvt-refuse-to-rename-def-in-the-last-instructi.patch
|
||||||
Patch180: 0180-Fix-issue-I8QD9H.patch
|
Patch180: 0180-add-optimization-level-requirement-to-the-gate.patch
|
||||||
|
|
||||||
%global gcc_target_platform %{_arch}-linux-gnu
|
%global gcc_target_platform %{_arch}-linux-gnu
|
||||||
|
|
||||||
@ -896,9 +889,7 @@ not stable, so plugins must be rebuilt any time GCC is updated.
|
|||||||
%patch153 -p1
|
%patch153 -p1
|
||||||
%patch154 -p1
|
%patch154 -p1
|
||||||
%patch155 -p1
|
%patch155 -p1
|
||||||
%patch156 -p1
|
|
||||||
%patch157 -p1
|
%patch157 -p1
|
||||||
%patch158 -p1
|
|
||||||
%patch159 -p1
|
%patch159 -p1
|
||||||
%patch160 -p1
|
%patch160 -p1
|
||||||
%patch161 -p1
|
%patch161 -p1
|
||||||
@ -913,12 +904,7 @@ not stable, so plugins must be rebuilt any time GCC is updated.
|
|||||||
%patch170 -p1
|
%patch170 -p1
|
||||||
%patch171 -p1
|
%patch171 -p1
|
||||||
%patch172 -p1
|
%patch172 -p1
|
||||||
%patch173 -p1
|
|
||||||
%patch174 -p1
|
|
||||||
%patch175 -p1
|
%patch175 -p1
|
||||||
%patch176 -p1
|
|
||||||
%patch177 -p1
|
|
||||||
%patch178 -p1
|
|
||||||
%patch179 -p1
|
%patch179 -p1
|
||||||
%patch180 -p1
|
%patch180 -p1
|
||||||
|
|
||||||
@ -2945,6 +2931,13 @@ end
|
|||||||
%doc rpm.doc/changelogs/libcc1/ChangeLog*
|
%doc rpm.doc/changelogs/libcc1/ChangeLog*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Dec 28 2023 Xiong Zhou <xiongzhou4@huawei.com> - 10.3.1-49
|
||||||
|
- Type:Revert & sync
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: Revert ICP and IPA prefetch related patches.
|
||||||
|
Sync patch from openeuler/gcc.
|
||||||
|
|
||||||
* Sat Dec 23 2023 Chenhui Zheng <zhengchenhui1@huawei.com> - 10.3.1-48
|
* Sat Dec 23 2023 Chenhui Zheng <zhengchenhui1@huawei.com> - 10.3.1-48
|
||||||
- Type:Sync
|
- Type:Sync
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user