52 lines
1.7 KiB
Diff
52 lines
1.7 KiB
Diff
From bfb77997f423ffe3bdcbd8bb8d7f739fe51ce4f5 Mon Sep 17 00:00:00 2001
|
|
From: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
|
Date: Fri, 6 Sep 2024 11:36:11 +0800
|
|
Subject: [PATCH 3/3] Fix error with stmts insertion in ipa-prefetch (for
|
|
IAO6R3)
|
|
|
|
Signed-off-by: Diachkov Ilia <diachkov.ilia1@huawei-partners.com>
|
|
---
|
|
gcc/ipa-prefetch.cc | 19 +++++++++++++++++--
|
|
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/gcc/ipa-prefetch.cc b/gcc/ipa-prefetch.cc
|
|
index b000d4d75..6190c2ebb 100644
|
|
--- a/gcc/ipa-prefetch.cc
|
|
+++ b/gcc/ipa-prefetch.cc
|
|
@@ -2096,7 +2096,7 @@ optimize_function (cgraph_node *n, function *fn)
|
|
fprintf (dump_file, "\n");
|
|
}
|
|
|
|
- /* Try to find comp_mr's stmt in the dominator bb. */
|
|
+ /* Try to find comp_mr's stmt in the post dominator bb. */
|
|
gimple *last_used = NULL;
|
|
for (gimple_stmt_iterator si = gsi_last_bb (dom_bb); !gsi_end_p (si);
|
|
gsi_prev (&si))
|
|
@@ -2168,7 +2168,22 @@ optimize_function (cgraph_node *n, function *fn)
|
|
vec<gimple *> pcalls = vNULL;
|
|
gimple *last_pref = NULL;
|
|
insert_prefetch_stmts (pcalls, stmts, last_pref, vmrs, processed_stmts);
|
|
- gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT);
|
|
+
|
|
+ gimple *gstmt = gsi_stmt (gsi);
|
|
+ bool insert_after = last_used || gstmt == NULL || !is_ctrl_stmt (gstmt);
|
|
+ if (dump_file && (dump_flags & TDF_DETAILS))
|
|
+ {
|
|
+ fprintf (dump_file, "Insert prefetch sequence %s stmt:\n",
|
|
+ insert_after ? "after": "before");
|
|
+ if (gstmt)
|
|
+ print_gimple_stmt (dump_file, gstmt, 0);
|
|
+ else
|
|
+ fprintf (dump_file, "(no stmts)\n");
|
|
+ }
|
|
+ if (insert_after)
|
|
+ gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT);
|
|
+ else
|
|
+ gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT);
|
|
|
|
correct_cfg (bbends, last_pref, dom_bb);
|
|
|
|
--
|
|
2.33.0
|
|
|