代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gcc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 0263daa1312d0cdcdf9c770bcf5d982a2d4fc16b Mon Sep 17 00:00:00 2001
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
Date: Fri, 29 Mar 2024 17:15:41 +0800
Subject: [PATCH 2/2] Fix fails in IPA prefetch (src-openEuler/gcc: I96ID7)
---
gcc/ipa-prefetch.cc | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/gcc/ipa-prefetch.cc b/gcc/ipa-prefetch.cc
index 9537e4835..1ceb5137f 100644
--- a/gcc/ipa-prefetch.cc
+++ b/gcc/ipa-prefetch.cc
@@ -366,6 +366,7 @@ typedef std::map<memref_t *, memref_t *> memref_map;
typedef std::map<memref_t *, tree> memref_tree_map;
typedef std::set<gimple *> stmt_set;
+typedef std::set<tree> tree_set;
typedef std::map<tree, tree> tree_map;
tree_memref_map *tm_map;
@@ -1124,8 +1125,21 @@ analyse_loops ()
}
}
+/* Compare memrefs by IDs; helper for qsort. */
+
+static int
+memref_id_cmp (const void *p1, const void *p2)
+{
+ const memref_t *mr1 = *(const memref_t **) p1;
+ const memref_t *mr2 = *(const memref_t **) p2;
+
+ if ((unsigned) mr1->mr_id > (unsigned) mr2->mr_id)
+ return 1;
+ return -1;
+}
+
/* Reduce the set filtering out memrefs with the same memory references,
- return the result vector of memrefs. */
+ sort and return the result vector of memrefs. */
static void
reduce_memref_set (memref_set *set, vec<memref_t *> &vec)
@@ -1162,6 +1176,7 @@ reduce_memref_set (memref_set *set, vec<memref_t *> &vec)
vec.safe_push (mr1);
}
}
+ vec.qsort (memref_id_cmp);
if (dump_file)
{
fprintf (dump_file, "MRs (%d) after filtering: ", vec.length ());
@@ -1663,10 +1678,15 @@ optimize_function (cgraph_node *n, function *fn)
}
/* Create other new vars. Insert new stmts. */
+ vec<memref_t *> used_mr_vec = vNULL;
for (memref_set::const_iterator it = used_mrs.begin ();
it != used_mrs.end (); it++)
+ used_mr_vec.safe_push (*it);
+ used_mr_vec.qsort (memref_id_cmp);
+
+ for (unsigned int j = 0; j < used_mr_vec.length (); j++)
{
- memref_t *mr = *it;
+ memref_t *mr = used_mr_vec[j];
if (mr == comp_mr)
continue;
gimple *last_stmt = gimple_copy_and_remap_memref_stmts (mr, stmts, 0,
@@ -1702,6 +1722,7 @@ optimize_function (cgraph_node *n, function *fn)
local = integer_three_node;
break;
}
+ tree_set prefetched_addrs;
for (unsigned int j = 0; j < vmrs.length (); j++)
{
memref_t *mr = vmrs[j];
@@ -1714,10 +1735,13 @@ optimize_function (cgraph_node *n, function *fn)
tree addr = get_mem_ref_address_ssa_name (mr->mem, NULL_TREE);
if (decl_map->count (addr))
addr = (*decl_map)[addr];
+ if (prefetched_addrs.count (addr))
+ continue;
last_stmt = gimple_build_call (builtin_decl_explicit (BUILT_IN_PREFETCH),
3, addr, write_p, local);
pcalls.safe_push (last_stmt);
gimple_seq_add_stmt (&stmts, last_stmt);
+ prefetched_addrs.insert (addr);
if (dump_file)
{
fprintf (dump_file, "Insert %d prefetch stmt:\n", j);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。