1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
From 66e1c68b47a1fd889e206be5572a2ba5d62afb4d Mon Sep 17 00:00:00 2001
From: Zinin Ivan WX1305386 <zinin.ivan@huawei-partners.com>
Date: Tue, 17 Dec 2024 22:07:36 +0800
Subject: [PATCH] [if-split][BugFix]Fixed work with loops in
process_complex_cond()
Signed-off-by: zhenyu--zhao_admin <zhaozhenyu17@huawei.com>
---
gcc/gimple-if-split.cc | 17 +++++++++++++++--
gcc/tree-loop-distribution.cc | 6 ++++++
gcc/tree-vect-loop.cc | 4 ----
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/gcc/gimple-if-split.cc b/gcc/gimple-if-split.cc
index 914b65d4782..b535ffab1c3 100644
--- a/gcc/gimple-if-split.cc
+++ b/gcc/gimple-if-split.cc
@@ -262,9 +262,11 @@ process_complex_cond (basic_block cond_bb, basic_block then_bb,
/* Setting cond. */
if (a_var_n_cst.n != NULL_TREE && a_var_n_cst.cst != NULL_TREE)
- /* Setting cond as: if (n == const). */
- gimple_cond_set_condition (as_a<gcond *> (cond), EQ_EXPR, a_var_n_cst.n,
+ {
+ /* Setting cond as: if (n == const). */
+ gimple_cond_set_condition (as_a<gcond *> (cond), EQ_EXPR, a_var_n_cst.n,
a_var_n_cst.cst);
+ }
else
{
/* Setting cond as: if (a != 0). */
@@ -276,8 +278,19 @@ process_complex_cond (basic_block cond_bb, basic_block then_bb,
/* Creating inner_cond_bb. */
edge then_e = find_edge (cond_bb, then_bb);
edge else_e = find_edge (cond_bb, else_bb);
+
+ bool inner_cond_bb_need_set_loop = false;
+ if (else_e->dest->loop_father != else_e->src->loop_father)
+ inner_cond_bb_need_set_loop = true;
+
basic_block inner_cond_bb = split_edge (else_e);
+ if (inner_cond_bb_need_set_loop)
+ {
+ remove_bb_from_loops (inner_cond_bb);
+ add_bb_to_loop (inner_cond_bb, cond_bb->loop_father);
+ }
+
/* Setting inner_cond. */
gcond *inner_cond = NULL;
if (b_var_n_cst.n != NULL_TREE && b_var_n_cst.cst != NULL_TREE)
diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc
index 8d118e98739..f7a4690246c 100644
--- a/gcc/tree-loop-distribution.cc
+++ b/gcc/tree-loop-distribution.cc
@@ -5265,10 +5265,16 @@ loop_distribution::execute (function *fun)
bool destroy_p;
int nb_generated_loops, nb_generated_calls;
+
+ vect_slp_init ();
+
nb_generated_loops
= distribute_loop (loop, work_list, cd, &nb_generated_calls,
&destroy_p, (!optimize_loop_for_speed_p (loop)
|| !flag_tree_loop_distribution));
+
+ vect_slp_fini ();
+
if (destroy_p)
loops_to_be_destroyed.safe_push (loop);
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index f296e9415c4..7f75779519a 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -3016,10 +3016,6 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared,
opt_loop_vec_info first_loop_vinfo = opt_loop_vec_info::success (NULL);
/* Loop_vinfo for loop-distribution pass. */
opt_loop_vec_info fail_loop_vinfo = opt_loop_vec_info::success (NULL);
- if (result_only_p)
- {
- vect_slp_init ();
- }
unsigned int mode_i = 0;
unsigned HOST_WIDE_INT simdlen = loop->simdlen;
--
Gitee
|