Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
42d57399
Commit
42d57399
authored
Jan 01, 2013
by
Jan Hubicka
Committed by
Jan Hubicka
Jan 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ipa-inline-analysis.c: Fix formatting.
From-SVN: r194769
parent
2a5195d9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
220 additions
and
221 deletions
+220
-221
gcc/ChangeLog
+4
-0
gcc/ipa-inline-analysis.c
+216
-221
No files found.
gcc/ChangeLog
View file @
42d57399
2013
-
01
-
01
Jan
Hubicka
<
jh
@suse
.
cz
>
*
ipa
-
inline
-
analysis
.
c
:
Fix
formatting
.
2013
-
01
-
01
Jakub
Jelinek
<
jakub
@redhat
.
com
>
2013
-
01
-
01
Jakub
Jelinek
<
jakub
@redhat
.
com
>
PR
tree
-
optimization
/
55831
PR
tree
-
optimization
/
55831
gcc/ipa-inline-analysis.c
View file @
42d57399
/* Inlining decision heuristics.
/* Inlining decision heuristics.
Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011
Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011
, 2012, 2013
Free Software Foundation, Inc.
Free Software Foundation, Inc.
Contributed by Jan Hubicka
Contributed by Jan Hubicka
...
@@ -127,8 +127,7 @@ static void inline_node_duplication_hook (struct cgraph_node *,
...
@@ -127,8 +127,7 @@ static void inline_node_duplication_hook (struct cgraph_node *,
struct
cgraph_node
*
,
void
*
);
struct
cgraph_node
*
,
void
*
);
static
void
inline_edge_removal_hook
(
struct
cgraph_edge
*
,
void
*
);
static
void
inline_edge_removal_hook
(
struct
cgraph_edge
*
,
void
*
);
static
void
inline_edge_duplication_hook
(
struct
cgraph_edge
*
,
static
void
inline_edge_duplication_hook
(
struct
cgraph_edge
*
,
struct
cgraph_edge
*
,
struct
cgraph_edge
*
,
void
*
);
void
*
);
/* VECtor holding inline summaries.
/* VECtor holding inline summaries.
In GGC memory because conditions might point to constant trees. */
In GGC memory because conditions might point to constant trees. */
...
@@ -200,6 +199,7 @@ false_predicate_p (struct predicate *p)
...
@@ -200,6 +199,7 @@ false_predicate_p (struct predicate *p)
/* Return predicate that is set true when function is not inlined. */
/* Return predicate that is set true when function is not inlined. */
static
inline
struct
predicate
static
inline
struct
predicate
not_inlined_predicate
(
void
)
not_inlined_predicate
(
void
)
{
{
...
@@ -336,14 +336,15 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause)
...
@@ -336,14 +336,15 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause)
cc1
=
&
(
*
conditions
)[
c1
-
predicate_first_dynamic_condition
];
cc1
=
&
(
*
conditions
)[
c1
-
predicate_first_dynamic_condition
];
/* We have no way to represent !CHANGED and !IS_NOT_CONSTANT
/* We have no way to represent !CHANGED and !IS_NOT_CONSTANT
and thus there is no point for looking for them. */
and thus there is no point for looking for them. */
if
(
cc1
->
code
==
CHANGED
if
(
cc1
->
code
==
CHANGED
||
cc1
->
code
==
IS_NOT_CONSTANT
)
||
cc1
->
code
==
IS_NOT_CONSTANT
)
continue
;
continue
;
for
(
c2
=
c1
+
1
;
c2
<=
NUM_CONDITIONS
;
c2
++
)
for
(
c2
=
c1
+
1
;
c2
<=
NUM_CONDITIONS
;
c2
++
)
if
(
clause
&
(
1
<<
c2
))
if
(
clause
&
(
1
<<
c2
))
{
{
condition
*
cc1
=
&
(
*
conditions
)[
c1
-
predicate_first_dynamic_condition
];
condition
*
cc1
=
condition
*
cc2
=
&
(
*
conditions
)[
c2
-
predicate_first_dynamic_condition
];
&
(
*
conditions
)[
c1
-
predicate_first_dynamic_condition
];
condition
*
cc2
=
&
(
*
conditions
)[
c2
-
predicate_first_dynamic_condition
];
if
(
cc1
->
operand_num
==
cc2
->
operand_num
if
(
cc1
->
operand_num
==
cc2
->
operand_num
&&
cc1
->
val
==
cc2
->
val
&&
cc1
->
val
==
cc2
->
val
&&
cc2
->
code
!=
IS_NOT_CONSTANT
&&
cc2
->
code
!=
IS_NOT_CONSTANT
...
@@ -362,7 +363,7 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause)
...
@@ -362,7 +363,7 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause)
/* Keep clauses in decreasing order. This makes equivalence testing easy. */
/* Keep clauses in decreasing order. This makes equivalence testing easy. */
p
->
clause
[
i2
+
1
]
=
0
;
p
->
clause
[
i2
+
1
]
=
0
;
if
(
insert_here
>=
0
)
if
(
insert_here
>=
0
)
for
(;
i2
>
insert_here
;
i2
--
)
for
(;
i2
>
insert_here
;
i2
--
)
p
->
clause
[
i2
]
=
p
->
clause
[
i2
-
1
];
p
->
clause
[
i2
]
=
p
->
clause
[
i2
-
1
];
else
else
insert_here
=
i2
;
insert_here
=
i2
;
...
@@ -410,9 +411,9 @@ predicates_equal_p (struct predicate *p, struct predicate *p2)
...
@@ -410,9 +411,9 @@ predicates_equal_p (struct predicate *p, struct predicate *p2)
for
(
i
=
0
;
p
->
clause
[
i
];
i
++
)
for
(
i
=
0
;
p
->
clause
[
i
];
i
++
)
{
{
gcc_checking_assert
(
i
<
MAX_CLAUSES
);
gcc_checking_assert
(
i
<
MAX_CLAUSES
);
gcc_checking_assert
(
p
->
clause
[
i
]
>
p
->
clause
[
i
+
1
]);
gcc_checking_assert
(
p
->
clause
[
i
]
>
p
->
clause
[
i
+
1
]);
gcc_checking_assert
(
!
p2
->
clause
[
i
]
gcc_checking_assert
(
!
p2
->
clause
[
i
]
||
p2
->
clause
[
i
]
>
p2
->
clause
[
i
+
1
]);
||
p2
->
clause
[
i
]
>
p2
->
clause
[
i
+
1
]);
if
(
p
->
clause
[
i
]
!=
p2
->
clause
[
i
])
if
(
p
->
clause
[
i
]
!=
p2
->
clause
[
i
])
return
false
;
return
false
;
}
}
...
@@ -423,10 +424,11 @@ predicates_equal_p (struct predicate *p, struct predicate *p2)
...
@@ -423,10 +424,11 @@ predicates_equal_p (struct predicate *p, struct predicate *p2)
/* Return P | P2. */
/* Return P | P2. */
static
struct
predicate
static
struct
predicate
or_predicates
(
conditions
conditions
,
struct
predicate
*
p
,
struct
predicate
*
p2
)
or_predicates
(
conditions
conditions
,
struct
predicate
*
p
,
struct
predicate
*
p2
)
{
{
struct
predicate
out
=
true_predicate
();
struct
predicate
out
=
true_predicate
();
int
i
,
j
;
int
i
,
j
;
/* Avoid busy work. */
/* Avoid busy work. */
if
(
false_predicate_p
(
p2
)
||
true_predicate_p
(
p
))
if
(
false_predicate_p
(
p2
)
||
true_predicate_p
(
p
))
...
@@ -508,12 +510,14 @@ predicate_probability (conditions conds,
...
@@ -508,12 +510,14 @@ predicate_probability (conditions conds,
{
{
if
(
i2
>=
predicate_first_dynamic_condition
)
if
(
i2
>=
predicate_first_dynamic_condition
)
{
{
condition
*
c
=
&
(
*
conds
)[
i2
-
predicate_first_dynamic_condition
];
condition
*
c
=
&
(
*
conds
)[
i2
-
predicate_first_dynamic_condition
];
if
(
c
->
code
==
CHANGED
if
(
c
->
code
==
CHANGED
&&
(
c
->
operand_num
&&
(
c
->
operand_num
<
<
(
int
)
inline_param_summary
.
length
()))
(
int
)
inline_param_summary
.
length
()))
{
{
int
iprob
=
inline_param_summary
[
c
->
operand_num
].
change_prob
;
int
iprob
=
inline_param_summary
[
c
->
operand_num
].
change_prob
;
this_prob
=
MAX
(
this_prob
,
iprob
);
this_prob
=
MAX
(
this_prob
,
iprob
);
}
}
else
else
...
@@ -692,14 +696,16 @@ account_size_time (struct inline_summary *summary, int size, int time,
...
@@ -692,14 +696,16 @@ account_size_time (struct inline_summary *summary, int size, int time,
e
=
&
(
*
summary
->
entry
)[
0
];
e
=
&
(
*
summary
->
entry
)[
0
];
gcc_assert
(
!
e
->
predicate
.
clause
[
0
]);
gcc_assert
(
!
e
->
predicate
.
clause
[
0
]);
if
(
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
if
(
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
fprintf
(
dump_file
,
"
\t\t
Reached limit on number of entries, ignoring the predicate."
);
fprintf
(
dump_file
,
"
\t\t
Reached limit on number of entries, "
"ignoring the predicate."
);
}
}
if
(
dump_file
&&
(
dump_flags
&
TDF_DETAILS
)
&&
(
time
||
size
))
if
(
dump_file
&&
(
dump_flags
&
TDF_DETAILS
)
&&
(
time
||
size
))
{
{
fprintf
(
dump_file
,
"
\t\t
Accounting size:%3.2f, time:%3.2f on %spredicate:"
,
fprintf
(
dump_file
,
((
double
)
size
)
/
INLINE_SIZE_SCALE
,
"
\t\t
Accounting size:%3.2f, time:%3.2f on %spredicate:"
,
((
double
)
time
)
/
INLINE_TIM
E_SCALE
,
((
double
)
size
)
/
INLINE_SIZ
E_SCALE
,
found
?
""
:
"new "
);
((
double
)
time
)
/
INLINE_TIME_SCALE
,
found
?
""
:
"new "
);
dump_predicate
(
dump_file
,
summary
->
conds
,
pred
);
dump_predicate
(
dump_file
,
summary
->
conds
,
pred
);
}
}
if
(
!
found
)
if
(
!
found
)
...
@@ -728,7 +734,7 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate)
...
@@ -728,7 +734,7 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate)
if
(
predicate
&&
!
true_predicate_p
(
predicate
))
if
(
predicate
&&
!
true_predicate_p
(
predicate
))
{
{
if
(
!
es
->
predicate
)
if
(
!
es
->
predicate
)
es
->
predicate
=
(
struct
predicate
*
)
pool_alloc
(
edge_predicate_pool
);
es
->
predicate
=
(
struct
predicate
*
)
pool_alloc
(
edge_predicate_pool
);
*
es
->
predicate
=
*
predicate
;
*
es
->
predicate
=
*
predicate
;
}
}
else
else
...
@@ -744,8 +750,7 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate)
...
@@ -744,8 +750,7 @@ edge_set_predicate (struct cgraph_edge *e, struct predicate *predicate)
static
void
static
void
set_hint_predicate
(
struct
predicate
**
p
,
struct
predicate
new_predicate
)
set_hint_predicate
(
struct
predicate
**
p
,
struct
predicate
new_predicate
)
{
{
if
(
false_predicate_p
(
&
new_predicate
)
if
(
false_predicate_p
(
&
new_predicate
)
||
true_predicate_p
(
&
new_predicate
))
||
true_predicate_p
(
&
new_predicate
))
{
{
if
(
*
p
)
if
(
*
p
)
pool_free
(
edge_predicate_pool
,
*
p
);
pool_free
(
edge_predicate_pool
,
*
p
);
...
@@ -754,7 +759,7 @@ set_hint_predicate (struct predicate **p, struct predicate new_predicate)
...
@@ -754,7 +759,7 @@ set_hint_predicate (struct predicate **p, struct predicate new_predicate)
else
else
{
{
if
(
!*
p
)
if
(
!*
p
)
*
p
=
(
struct
predicate
*
)
pool_alloc
(
edge_predicate_pool
);
*
p
=
(
struct
predicate
*
)
pool_alloc
(
edge_predicate_pool
);
**
p
=
new_predicate
;
**
p
=
new_predicate
;
}
}
}
}
...
@@ -771,7 +776,8 @@ static clause_t
...
@@ -771,7 +776,8 @@ static clause_t
evaluate_conditions_for_known_args
(
struct
cgraph_node
*
node
,
evaluate_conditions_for_known_args
(
struct
cgraph_node
*
node
,
bool
inline_p
,
bool
inline_p
,
vec
<
tree
>
known_vals
,
vec
<
tree
>
known_vals
,
vec
<
ipa_agg_jump_function_p
>
known_aggs
)
vec
<
ipa_agg_jump_function_p
>
known_aggs
)
{
{
clause_t
clause
=
inline_p
?
0
:
1
<<
predicate_not_inlined_condition
;
clause_t
clause
=
inline_p
?
0
:
1
<<
predicate_not_inlined_condition
;
struct
inline_summary
*
info
=
inline_summary
(
node
);
struct
inline_summary
*
info
=
inline_summary
(
node
);
...
@@ -801,8 +807,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
...
@@ -801,8 +807,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
if
(
c
->
code
==
CHANGED
if
(
c
->
code
==
CHANGED
&&
!
c
->
by_ref
&&
!
c
->
by_ref
&&
(
known_vals
[
c
->
operand_num
]
&&
(
known_vals
[
c
->
operand_num
]
==
error_mark_node
))
==
error_mark_node
))
continue
;
continue
;
if
(
known_aggs
.
exists
())
if
(
known_aggs
.
exists
())
...
@@ -828,8 +833,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
...
@@ -828,8 +833,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
if
(
c
->
code
==
IS_NOT_CONSTANT
||
c
->
code
==
CHANGED
)
if
(
c
->
code
==
IS_NOT_CONSTANT
||
c
->
code
==
CHANGED
)
continue
;
continue
;
res
=
fold_binary_to_constant
(
c
->
code
,
boolean_type_node
,
val
,
c
->
val
);
res
=
fold_binary_to_constant
(
c
->
code
,
boolean_type_node
,
val
,
c
->
val
);
if
(
res
if
(
res
&&
integer_zerop
(
res
))
&&
integer_zerop
(
res
))
continue
;
continue
;
clause
|=
1
<<
(
i
+
predicate_first_dynamic_condition
);
clause
|=
1
<<
(
i
+
predicate_first_dynamic_condition
);
}
}
...
@@ -846,7 +850,8 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
...
@@ -846,7 +850,8 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
vec
<
tree
>
*
known_binfos_ptr
,
vec
<
tree
>
*
known_binfos_ptr
,
vec
<
ipa_agg_jump_function_p
>
*
known_aggs_ptr
)
vec
<
ipa_agg_jump_function_p
>
*
known_aggs_ptr
)
{
{
struct
cgraph_node
*
callee
=
cgraph_function_or_thunk_node
(
e
->
callee
,
NULL
);
struct
cgraph_node
*
callee
=
cgraph_function_or_thunk_node
(
e
->
callee
,
NULL
);
struct
inline_summary
*
info
=
inline_summary
(
callee
);
struct
inline_summary
*
info
=
inline_summary
(
callee
);
vec
<
tree
>
known_vals
=
vNULL
;
vec
<
tree
>
known_vals
=
vNULL
;
vec
<
ipa_agg_jump_function_p
>
known_aggs
=
vNULL
;
vec
<
ipa_agg_jump_function_p
>
known_aggs
=
vNULL
;
...
@@ -860,8 +865,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
...
@@ -860,8 +865,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
if
(
ipa_node_params_vector
.
exists
()
if
(
ipa_node_params_vector
.
exists
()
&&
!
e
->
call_stmt_cannot_inline_p
&&
!
e
->
call_stmt_cannot_inline_p
&&
((
clause_ptr
&&
info
->
conds
)
&&
((
clause_ptr
&&
info
->
conds
)
||
known_vals_ptr
||
known_binfos_ptr
))
||
known_vals_ptr
||
known_binfos_ptr
))
{
{
struct
ipa_node_params
*
parms_info
;
struct
ipa_node_params
*
parms_info
;
struct
ipa_edge_args
*
args
=
IPA_EDGE_REF
(
e
);
struct
ipa_edge_args
*
args
=
IPA_EDGE_REF
(
e
);
...
@@ -888,7 +892,8 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
...
@@ -888,7 +892,8 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
{
{
if
(
known_vals
.
exists
()
&&
TREE_CODE
(
cst
)
!=
TREE_BINFO
)
if
(
known_vals
.
exists
()
&&
TREE_CODE
(
cst
)
!=
TREE_BINFO
)
known_vals
[
i
]
=
cst
;
known_vals
[
i
]
=
cst
;
else
if
(
known_binfos_ptr
!=
NULL
&&
TREE_CODE
(
cst
)
==
TREE_BINFO
)
else
if
(
known_binfos_ptr
!=
NULL
&&
TREE_CODE
(
cst
)
==
TREE_BINFO
)
(
*
known_binfos_ptr
)[
i
]
=
cst
;
(
*
known_binfos_ptr
)[
i
]
=
cst
;
}
}
else
if
(
inline_p
&&
!
es
->
param
[
i
].
change_prob
)
else
if
(
inline_p
&&
!
es
->
param
[
i
].
change_prob
)
...
@@ -940,8 +945,7 @@ inline_summary_alloc (void)
...
@@ -940,8 +945,7 @@ inline_summary_alloc (void)
inline_edge_summary_vec
.
safe_grow_cleared
(
cgraph_edge_max_uid
+
1
);
inline_edge_summary_vec
.
safe_grow_cleared
(
cgraph_edge_max_uid
+
1
);
if
(
!
edge_predicate_pool
)
if
(
!
edge_predicate_pool
)
edge_predicate_pool
=
create_alloc_pool
(
"edge predicates"
,
edge_predicate_pool
=
create_alloc_pool
(
"edge predicates"
,
sizeof
(
struct
predicate
),
sizeof
(
struct
predicate
),
10
);
10
);
}
}
/* We are called multiple time for given function; clear
/* We are called multiple time for given function; clear
...
@@ -950,7 +954,7 @@ inline_summary_alloc (void)
...
@@ -950,7 +954,7 @@ inline_summary_alloc (void)
static
void
static
void
reset_inline_edge_summary
(
struct
cgraph_edge
*
e
)
reset_inline_edge_summary
(
struct
cgraph_edge
*
e
)
{
{
if
(
e
->
uid
<
(
int
)
inline_edge_summary_vec
.
length
())
if
(
e
->
uid
<
(
int
)
inline_edge_summary_vec
.
length
())
{
{
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
e
);
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
e
);
...
@@ -1005,10 +1009,11 @@ reset_inline_summary (struct cgraph_node *node)
...
@@ -1005,10 +1009,11 @@ reset_inline_summary (struct cgraph_node *node)
/* Hook that is called by cgraph.c when a node is removed. */
/* Hook that is called by cgraph.c when a node is removed. */
static
void
static
void
inline_node_removal_hook
(
struct
cgraph_node
*
node
,
void
*
data
ATTRIBUTE_UNUSED
)
inline_node_removal_hook
(
struct
cgraph_node
*
node
,
void
*
data
ATTRIBUTE_UNUSED
)
{
{
struct
inline_summary
*
info
;
struct
inline_summary
*
info
;
if
(
vec_safe_length
(
inline_summary_vec
)
<=
(
unsigned
)
node
->
uid
)
if
(
vec_safe_length
(
inline_summary_vec
)
<=
(
unsigned
)
node
->
uid
)
return
;
return
;
info
=
inline_summary
(
node
);
info
=
inline_summary
(
node
);
reset_inline_summary
(
node
);
reset_inline_summary
(
node
);
...
@@ -1054,8 +1059,7 @@ remap_hint_predicate_after_duplication (struct predicate **p,
...
@@ -1054,8 +1059,7 @@ remap_hint_predicate_after_duplication (struct predicate **p,
return
;
return
;
new_predicate
=
remap_predicate_after_duplication
(
*
p
,
new_predicate
=
remap_predicate_after_duplication
(
*
p
,
possible_truths
,
possible_truths
,
info
);
info
);
/* We do not want to free previous predicate; it is used by node origin. */
/* We do not want to free previous predicate; it is used by node origin. */
*
p
=
NULL
;
*
p
=
NULL
;
set_hint_predicate
(
p
,
new_predicate
);
set_hint_predicate
(
p
,
new_predicate
);
...
@@ -1065,29 +1069,28 @@ remap_hint_predicate_after_duplication (struct predicate **p,
...
@@ -1065,29 +1069,28 @@ remap_hint_predicate_after_duplication (struct predicate **p,
/* Hook that is called by cgraph.c when a node is duplicated. */
/* Hook that is called by cgraph.c when a node is duplicated. */
static
void
static
void
inline_node_duplication_hook
(
struct
cgraph_node
*
src
,
struct
cgraph_node
*
dst
,
inline_node_duplication_hook
(
struct
cgraph_node
*
src
,
struct
cgraph_node
*
dst
,
ATTRIBUTE_UNUSED
void
*
data
)
ATTRIBUTE_UNUSED
void
*
data
)
{
{
struct
inline_summary
*
info
;
struct
inline_summary
*
info
;
inline_summary_alloc
();
inline_summary_alloc
();
info
=
inline_summary
(
dst
);
info
=
inline_summary
(
dst
);
memcpy
(
info
,
inline_summary
(
src
),
memcpy
(
info
,
inline_summary
(
src
),
sizeof
(
struct
inline_summary
));
sizeof
(
struct
inline_summary
));
/* TODO: as an optimization, we may avoid copying conditions
/* TODO: as an optimization, we may avoid copying conditions
that are known to be false or true. */
that are known to be false or true. */
info
->
conds
=
vec_safe_copy
(
info
->
conds
);
info
->
conds
=
vec_safe_copy
(
info
->
conds
);
/* When there are any replacements in the function body, see if we can figure
/* When there are any replacements in the function body, see if we can figure
out that something was optimized out. */
out that something was optimized out. */
if
(
ipa_node_params_vector
.
exists
()
if
(
ipa_node_params_vector
.
exists
()
&&
dst
->
clone
.
tree_map
)
&&
dst
->
clone
.
tree_map
)
{
{
vec
<
size_time_entry
,
va_gc
>
*
entry
=
info
->
entry
;
vec
<
size_time_entry
,
va_gc
>
*
entry
=
info
->
entry
;
/* Use SRC parm info since it may not be copied yet. */
/* Use SRC parm info since it may not be copied yet. */
struct
ipa_node_params
*
parms_info
=
IPA_NODE_REF
(
src
);
struct
ipa_node_params
*
parms_info
=
IPA_NODE_REF
(
src
);
vec
<
tree
>
known_vals
=
vNULL
;
vec
<
tree
>
known_vals
=
vNULL
;
int
count
=
ipa_get_param_count
(
parms_info
);
int
count
=
ipa_get_param_count
(
parms_info
);
int
i
,
j
;
int
i
,
j
;
clause_t
possible_truths
;
clause_t
possible_truths
;
struct
predicate
true_pred
=
true_predicate
();
struct
predicate
true_pred
=
true_predicate
();
size_time_entry
*
e
;
size_time_entry
*
e
;
...
@@ -1104,9 +1107,7 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
...
@@ -1104,9 +1107,7 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
for
(
j
=
0
;
vec_safe_iterate
(
dst
->
clone
.
tree_map
,
j
,
&
r
);
j
++
)
for
(
j
=
0
;
vec_safe_iterate
(
dst
->
clone
.
tree_map
,
j
,
&
r
);
j
++
)
{
{
if
(
r
->
old_tree
==
t
if
(
r
->
old_tree
==
t
&&
r
->
replace_p
&&
!
r
->
ref_p
)
&&
r
->
replace_p
&&
!
r
->
ref_p
)
{
{
known_vals
[
i
]
=
r
->
new_tree
;
known_vals
[
i
]
=
r
->
new_tree
;
break
;
break
;
...
@@ -1114,7 +1115,8 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
...
@@ -1114,7 +1115,8 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
}
}
}
}
possible_truths
=
evaluate_conditions_for_known_args
(
dst
,
false
,
possible_truths
=
evaluate_conditions_for_known_args
(
dst
,
false
,
known_vals
,
vNULL
);
known_vals
,
vNULL
);
known_vals
.
release
();
known_vals
.
release
();
account_size_time
(
info
,
0
,
0
,
&
true_pred
);
account_size_time
(
info
,
0
,
0
,
&
true_pred
);
...
@@ -1181,21 +1183,17 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
...
@@ -1181,21 +1183,17 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
edge_set_predicate
(
edge
,
&
new_predicate
);
edge_set_predicate
(
edge
,
&
new_predicate
);
}
}
remap_hint_predicate_after_duplication
(
&
info
->
loop_iterations
,
remap_hint_predicate_after_duplication
(
&
info
->
loop_iterations
,
possible_truths
,
possible_truths
,
info
);
info
);
remap_hint_predicate_after_duplication
(
&
info
->
loop_stride
,
remap_hint_predicate_after_duplication
(
&
info
->
loop_stride
,
possible_truths
,
possible_truths
,
info
);
info
);
remap_hint_predicate_after_duplication
(
&
info
->
array_index
,
remap_hint_predicate_after_duplication
(
&
info
->
array_index
,
possible_truths
,
possible_truths
,
info
);
info
);
/* If inliner or someone after inliner will ever start producing
/* If inliner or someone after inliner will ever start producing
non-trivial clones, we will get trouble with lack of information
non-trivial clones, we will get trouble with lack of information
about updating self sizes, because size vectors already contains
about updating self sizes, because size vectors already contains
sizes of the calees. */
sizes of the calees. */
gcc_assert
(
!
inlined_to_p
gcc_assert
(
!
inlined_to_p
||
!
optimized_out_size
);
||
!
optimized_out_size
);
}
}
else
else
{
{
...
@@ -1226,7 +1224,8 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
...
@@ -1226,7 +1224,8 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
/* Hook that is called by cgraph.c when a node is duplicated. */
/* Hook that is called by cgraph.c when a node is duplicated. */
static
void
static
void
inline_edge_duplication_hook
(
struct
cgraph_edge
*
src
,
struct
cgraph_edge
*
dst
,
inline_edge_duplication_hook
(
struct
cgraph_edge
*
src
,
struct
cgraph_edge
*
dst
,
ATTRIBUTE_UNUSED
void
*
data
)
ATTRIBUTE_UNUSED
void
*
data
)
{
{
struct
inline_edge_summary
*
info
;
struct
inline_edge_summary
*
info
;
...
@@ -1234,8 +1233,7 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
...
@@ -1234,8 +1233,7 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
inline_summary_alloc
();
inline_summary_alloc
();
info
=
inline_edge_summary
(
dst
);
info
=
inline_edge_summary
(
dst
);
srcinfo
=
inline_edge_summary
(
src
);
srcinfo
=
inline_edge_summary
(
src
);
memcpy
(
info
,
srcinfo
,
memcpy
(
info
,
srcinfo
,
sizeof
(
struct
inline_edge_summary
));
sizeof
(
struct
inline_edge_summary
));
info
->
predicate
=
NULL
;
info
->
predicate
=
NULL
;
edge_set_predicate
(
dst
,
srcinfo
->
predicate
);
edge_set_predicate
(
dst
,
srcinfo
->
predicate
);
info
->
param
=
srcinfo
->
param
.
copy
();
info
->
param
=
srcinfo
->
param
.
copy
();
...
@@ -1245,7 +1243,8 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
...
@@ -1245,7 +1243,8 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
/* Keep edge cache consistent across edge removal. */
/* Keep edge cache consistent across edge removal. */
static
void
static
void
inline_edge_removal_hook
(
struct
cgraph_edge
*
edge
,
void
*
data
ATTRIBUTE_UNUSED
)
inline_edge_removal_hook
(
struct
cgraph_edge
*
edge
,
void
*
data
ATTRIBUTE_UNUSED
)
{
{
if
(
edge_growth_cache
.
exists
())
if
(
edge_growth_cache
.
exists
())
reset_edge_growth_cache
(
edge
);
reset_edge_growth_cache
(
edge
);
...
@@ -1279,28 +1278,27 @@ free_growth_caches (void)
...
@@ -1279,28 +1278,27 @@ free_growth_caches (void)
Indent by INDENT. */
Indent by INDENT. */
static
void
static
void
dump_inline_edge_summary
(
FILE
*
f
,
int
indent
,
struct
cgraph_node
*
node
,
dump_inline_edge_summary
(
FILE
*
f
,
int
indent
,
struct
cgraph_node
*
node
,
struct
inline_summary
*
info
)
struct
inline_summary
*
info
)
{
{
struct
cgraph_edge
*
edge
;
struct
cgraph_edge
*
edge
;
for
(
edge
=
node
->
callees
;
edge
;
edge
=
edge
->
next_callee
)
for
(
edge
=
node
->
callees
;
edge
;
edge
=
edge
->
next_callee
)
{
{
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
edge
);
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
edge
);
struct
cgraph_node
*
callee
=
cgraph_function_or_thunk_node
(
edge
->
callee
,
NULL
);
struct
cgraph_node
*
callee
=
cgraph_function_or_thunk_node
(
edge
->
callee
,
NULL
);
int
i
;
int
i
;
fprintf
(
f
,
"%*s%s/%i %s
\n
%*s loop depth:%2i freq:%4i size:%2i time: %2i callee size:%2i stack:%2i"
,
fprintf
(
f
,
indent
,
""
,
cgraph_node_name
(
callee
),
"%*s%s/%i %s
\n
%*s loop depth:%2i freq:%4i size:%2i"
callee
->
uid
,
" time: %2i callee size:%2i stack:%2i"
,
!
edge
->
inline_failed
?
"inlined"
indent
,
""
,
cgraph_node_name
(
callee
),
callee
->
uid
,
:
cgraph_inline_failed_string
(
edge
->
inline_failed
),
!
edge
->
inline_failed
indent
,
""
,
?
"inlined"
:
cgraph_inline_failed_string
(
edge
->
inline_failed
),
es
->
loop_depth
,
indent
,
""
,
es
->
loop_depth
,
edge
->
frequency
,
edge
->
frequency
,
es
->
call_stmt_size
,
es
->
call_stmt_time
,
es
->
call_stmt_size
,
(
int
)
inline_summary
(
callee
)
->
size
/
INLINE_SIZE_SCALE
,
es
->
call_stmt_time
,
(
int
)
inline_summary
(
callee
)
->
estimated_stack_size
);
(
int
)
inline_summary
(
callee
)
->
size
/
INLINE_SIZE_SCALE
,
(
int
)
inline_summary
(
callee
)
->
estimated_stack_size
);
if
(
es
->
predicate
)
if
(
es
->
predicate
)
{
{
...
@@ -1310,7 +1308,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
...
@@ -1310,7 +1308,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
else
else
fprintf
(
f
,
"
\n
"
);
fprintf
(
f
,
"
\n
"
);
if
(
es
->
param
.
exists
())
if
(
es
->
param
.
exists
())
for
(
i
=
0
;
i
<
(
int
)
es
->
param
.
length
();
i
++
)
for
(
i
=
0
;
i
<
(
int
)
es
->
param
.
length
();
i
++
)
{
{
int
prob
=
es
->
param
[
i
].
change_prob
;
int
prob
=
es
->
param
[
i
].
change_prob
;
...
@@ -1325,11 +1323,11 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
...
@@ -1325,11 +1323,11 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
{
{
fprintf
(
f
,
"%*sStack frame offset %i, callee self size %i,"
fprintf
(
f
,
"%*sStack frame offset %i, callee self size %i,"
" callee size %i
\n
"
,
" callee size %i
\n
"
,
indent
+
2
,
""
,
indent
+
2
,
""
,
(
int
)
inline_summary
(
callee
)
->
stack_frame_offset
,
(
int
)
inline_summary
(
callee
)
->
stack_frame_offset
,
(
int
)
inline_summary
(
callee
)
->
estimated_self_stack_size
,
(
int
)
inline_summary
(
callee
)
->
estimated_self_stack_size
,
(
int
)
inline_summary
(
callee
)
->
estimated_stack_size
);
(
int
)
inline_summary
(
callee
)
->
estimated_stack_size
);
dump_inline_edge_summary
(
f
,
indent
+
2
,
callee
,
info
);
dump_inline_edge_summary
(
f
,
indent
+
2
,
callee
,
info
);
}
}
}
}
for
(
edge
=
node
->
indirect_calls
;
edge
;
edge
=
edge
->
next_callee
)
for
(
edge
=
node
->
indirect_calls
;
edge
;
edge
=
edge
->
next_callee
)
...
@@ -1339,9 +1337,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
...
@@ -1339,9 +1337,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
" time: %2i"
,
" time: %2i"
,
indent
,
""
,
indent
,
""
,
es
->
loop_depth
,
es
->
loop_depth
,
edge
->
frequency
,
edge
->
frequency
,
es
->
call_stmt_size
,
es
->
call_stmt_time
);
es
->
call_stmt_size
,
es
->
call_stmt_time
);
if
(
es
->
predicate
)
if
(
es
->
predicate
)
{
{
fprintf
(
f
,
"predicate: "
);
fprintf
(
f
,
"predicate: "
);
...
@@ -1354,7 +1350,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
...
@@ -1354,7 +1350,7 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node,
void
void
dump_inline_summary
(
FILE
*
f
,
struct
cgraph_node
*
node
)
dump_inline_summary
(
FILE
*
f
,
struct
cgraph_node
*
node
)
{
{
if
(
node
->
analyzed
)
if
(
node
->
analyzed
)
{
{
...
@@ -1367,22 +1363,17 @@ dump_inline_summary (FILE * f, struct cgraph_node *node)
...
@@ -1367,22 +1363,17 @@ dump_inline_summary (FILE * f, struct cgraph_node *node)
fprintf
(
f
,
" always_inline"
);
fprintf
(
f
,
" always_inline"
);
if
(
s
->
inlinable
)
if
(
s
->
inlinable
)
fprintf
(
f
,
" inlinable"
);
fprintf
(
f
,
" inlinable"
);
fprintf
(
f
,
"
\n
self time: %i
\n
"
,
fprintf
(
f
,
"
\n
self time: %i
\n
"
,
s
->
self_time
);
s
->
self_time
);
fprintf
(
f
,
" global time: %i
\n
"
,
s
->
time
);
fprintf
(
f
,
" global time: %i
\n
"
,
s
->
time
);
fprintf
(
f
,
" self size: %i
\n
"
,
fprintf
(
f
,
" self size: %i
\n
"
,
s
->
self_size
);
s
->
self_size
);
fprintf
(
f
,
" global size: %i
\n
"
,
s
->
size
);
fprintf
(
f
,
" global size: %i
\n
"
,
s
->
size
);
fprintf
(
f
,
" self stack: %i
\n
"
,
fprintf
(
f
,
" self stack: %i
\n
"
,
(
int
)
s
->
estimated_self_stack_size
);
(
int
)
s
->
estimated_self_stack_size
);
fprintf
(
f
,
" global stack: %i
\n
"
,
fprintf
(
f
,
" global stack: %i
\n
"
,
(
int
)
s
->
estimated_stack_size
);
(
int
)
s
->
estimated_stack_size
);
if
(
s
->
growth
)
if
(
s
->
growth
)
fprintf
(
f
,
" estimated growth:%i
\n
"
,
fprintf
(
f
,
" estimated growth:%i
\n
"
,
(
int
)
s
->
growth
);
(
int
)
s
->
growth
);
if
(
s
->
scc_no
)
if
(
s
->
scc_no
)
fprintf
(
f
,
" In SCC: %i
\n
"
,
fprintf
(
f
,
" In SCC: %i
\n
"
,
(
int
)
s
->
scc_no
);
(
int
)
s
->
scc_no
);
for
(
i
=
0
;
vec_safe_iterate
(
s
->
entry
,
i
,
&
e
);
i
++
)
for
(
i
=
0
;
vec_safe_iterate
(
s
->
entry
,
i
,
&
e
);
i
++
)
{
{
fprintf
(
f
,
" size:%f, time:%f, predicate:"
,
fprintf
(
f
,
" size:%f, time:%f, predicate:"
,
...
@@ -1616,7 +1607,7 @@ eliminated_by_inlining_prob (gimple stmt)
...
@@ -1616,7 +1607,7 @@ eliminated_by_inlining_prob (gimple stmt)
/* Reads of parameters passed by reference
/* Reads of parameters passed by reference
expected to be free (i.e. optimized out after inlining). */
expected to be free (i.e. optimized out after inlining). */
if
(
TREE_CODE
(
inner_rhs
)
==
MEM_REF
if
(
TREE_CODE
(
inner_rhs
)
==
MEM_REF
&&
unmodified_parm
(
stmt
,
TREE_OPERAND
(
inner_rhs
,
0
)))
&&
unmodified_parm
(
stmt
,
TREE_OPERAND
(
inner_rhs
,
0
)))
rhs_free
=
true
;
rhs_free
=
true
;
...
@@ -1657,12 +1648,13 @@ eliminated_by_inlining_prob (gimple stmt)
...
@@ -1657,12 +1648,13 @@ eliminated_by_inlining_prob (gimple stmt)
to return value. */
to return value. */
if
(
TREE_CODE
(
inner_lhs
)
==
PARM_DECL
if
(
TREE_CODE
(
inner_lhs
)
==
PARM_DECL
||
TREE_CODE
(
inner_lhs
)
==
RESULT_DECL
||
TREE_CODE
(
inner_lhs
)
==
RESULT_DECL
||
(
TREE_CODE
(
inner_lhs
)
==
MEM_REF
||
(
TREE_CODE
(
inner_lhs
)
==
MEM_REF
&&
(
unmodified_parm
(
stmt
,
TREE_OPERAND
(
inner_lhs
,
0
))
&&
(
unmodified_parm
(
stmt
,
TREE_OPERAND
(
inner_lhs
,
0
))
||
(
TREE_CODE
(
TREE_OPERAND
(
inner_lhs
,
0
))
==
SSA_NAME
||
(
TREE_CODE
(
TREE_OPERAND
(
inner_lhs
,
0
))
==
SSA_NAME
&&
SSA_NAME_VAR
(
TREE_OPERAND
(
inner_lhs
,
0
))
&&
SSA_NAME_VAR
(
TREE_OPERAND
(
inner_lhs
,
0
))
&&
TREE_CODE
(
SSA_NAME_VAR
(
TREE_OPERAND
&&
TREE_CODE
(
SSA_NAME_VAR
(
TREE_OPERAND
(
inner_lhs
,
0
)))
==
RESULT_DECL
))))
(
inner_lhs
,
0
)))
==
RESULT_DECL
))))
lhs_free
=
true
;
lhs_free
=
true
;
if
(
lhs_free
if
(
lhs_free
&&
(
is_gimple_reg
(
rhs
)
||
is_gimple_min_invariant
(
rhs
)))
&&
(
is_gimple_reg
(
rhs
)
||
is_gimple_min_invariant
(
rhs
)))
...
@@ -1696,8 +1688,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
...
@@ -1696,8 +1688,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
tree
op2
;
tree
op2
;
last
=
last_stmt
(
bb
);
last
=
last_stmt
(
bb
);
if
(
!
last
if
(
!
last
||
gimple_code
(
last
)
!=
GIMPLE_COND
)
||
gimple_code
(
last
)
!=
GIMPLE_COND
)
return
;
return
;
if
(
!
is_gimple_ip_invariant
(
gimple_cond_rhs
(
last
)))
if
(
!
is_gimple_ip_invariant
(
gimple_cond_rhs
(
last
)))
return
;
return
;
...
@@ -1719,7 +1710,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
...
@@ -1719,7 +1710,7 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
?
code
:
inverted_code
,
?
code
:
inverted_code
,
gimple_cond_rhs
(
last
));
gimple_cond_rhs
(
last
));
e
->
aux
=
pool_alloc
(
edge_predicate_pool
);
e
->
aux
=
pool_alloc
(
edge_predicate_pool
);
*
(
struct
predicate
*
)
e
->
aux
=
p
;
*
(
struct
predicate
*
)
e
->
aux
=
p
;
}
}
}
}
...
@@ -1743,15 +1734,15 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
...
@@ -1743,15 +1734,15 @@ set_cond_stmt_execution_predicate (struct ipa_node_params *info,
||
gimple_call_num_args
(
set_stmt
)
!=
1
)
||
gimple_call_num_args
(
set_stmt
)
!=
1
)
return
;
return
;
op2
=
gimple_call_arg
(
set_stmt
,
0
);
op2
=
gimple_call_arg
(
set_stmt
,
0
);
if
(
!
unmodified_parm_or_parm_agg_item
(
info
,
set_stmt
,
op2
,
&
index
,
&
aggpos
))
if
(
!
unmodified_parm_or_parm_agg_item
(
info
,
set_stmt
,
op2
,
&
index
,
&
aggpos
))
return
;
return
;
FOR_EACH_EDGE
(
e
,
ei
,
bb
->
succs
)
FOR_EACH_EDGE
(
e
,
ei
,
bb
->
succs
)
if
(
e
->
flags
&
EDGE_FALSE_VALUE
)
if
(
e
->
flags
&
EDGE_FALSE_VALUE
)
{
{
struct
predicate
p
=
add_condition
(
summary
,
index
,
&
aggpos
,
struct
predicate
p
=
add_condition
(
summary
,
index
,
&
aggpos
,
IS_NOT_CONSTANT
,
NULL_TREE
);
IS_NOT_CONSTANT
,
NULL_TREE
);
e
->
aux
=
pool_alloc
(
edge_predicate_pool
);
e
->
aux
=
pool_alloc
(
edge_predicate_pool
);
*
(
struct
predicate
*
)
e
->
aux
=
p
;
*
(
struct
predicate
*
)
e
->
aux
=
p
;
}
}
}
}
...
@@ -1774,8 +1765,7 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
...
@@ -1774,8 +1765,7 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
size_t
case_idx
;
size_t
case_idx
;
last
=
last_stmt
(
bb
);
last
=
last_stmt
(
bb
);
if
(
!
last
if
(
!
last
||
gimple_code
(
last
)
!=
GIMPLE_SWITCH
)
||
gimple_code
(
last
)
!=
GIMPLE_SWITCH
)
return
;
return
;
op
=
gimple_switch_index
(
last
);
op
=
gimple_switch_index
(
last
);
if
(
!
unmodified_parm_or_parm_agg_item
(
info
,
last
,
op
,
&
index
,
&
aggpos
))
if
(
!
unmodified_parm_or_parm_agg_item
(
info
,
last
,
op
,
&
index
,
&
aggpos
))
...
@@ -1784,9 +1774,9 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
...
@@ -1784,9 +1774,9 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
FOR_EACH_EDGE
(
e
,
ei
,
bb
->
succs
)
FOR_EACH_EDGE
(
e
,
ei
,
bb
->
succs
)
{
{
e
->
aux
=
pool_alloc
(
edge_predicate_pool
);
e
->
aux
=
pool_alloc
(
edge_predicate_pool
);
*
(
struct
predicate
*
)
e
->
aux
=
false_predicate
();
*
(
struct
predicate
*
)
e
->
aux
=
false_predicate
();
}
}
n
=
gimple_switch_num_labels
(
last
);
n
=
gimple_switch_num_labels
(
last
);
for
(
case_idx
=
0
;
case_idx
<
n
;
++
case_idx
)
for
(
case_idx
=
0
;
case_idx
<
n
;
++
case_idx
)
{
{
tree
cl
=
gimple_switch_label
(
last
,
case_idx
);
tree
cl
=
gimple_switch_label
(
last
,
case_idx
);
...
@@ -1811,8 +1801,8 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
...
@@ -1811,8 +1801,8 @@ set_switch_stmt_execution_predicate (struct ipa_node_params *info,
p2
=
add_condition
(
summary
,
index
,
&
aggpos
,
LE_EXPR
,
max
);
p2
=
add_condition
(
summary
,
index
,
&
aggpos
,
LE_EXPR
,
max
);
p
=
and_predicates
(
summary
->
conds
,
&
p1
,
&
p2
);
p
=
and_predicates
(
summary
->
conds
,
&
p1
,
&
p2
);
}
}
*
(
struct
predicate
*
)
e
->
aux
*
(
struct
predicate
*
)
e
->
aux
=
or_predicates
(
summary
->
conds
,
&
p
,
(
struct
predicate
*
)
e
->
aux
);
=
or_predicates
(
summary
->
conds
,
&
p
,
(
struct
predicate
*
)
e
->
aux
);
}
}
}
}
...
@@ -1838,7 +1828,7 @@ compute_bb_predicates (struct cgraph_node *node,
...
@@ -1838,7 +1828,7 @@ compute_bb_predicates (struct cgraph_node *node,
/* Entry block is always executable. */
/* Entry block is always executable. */
ENTRY_BLOCK_PTR_FOR_FUNCTION
(
my_function
)
->
aux
ENTRY_BLOCK_PTR_FOR_FUNCTION
(
my_function
)
->
aux
=
pool_alloc
(
edge_predicate_pool
);
=
pool_alloc
(
edge_predicate_pool
);
*
(
struct
predicate
*
)
ENTRY_BLOCK_PTR_FOR_FUNCTION
(
my_function
)
->
aux
*
(
struct
predicate
*
)
ENTRY_BLOCK_PTR_FOR_FUNCTION
(
my_function
)
->
aux
=
true_predicate
();
=
true_predicate
();
/* A simple dataflow propagation of predicates forward in the CFG.
/* A simple dataflow propagation of predicates forward in the CFG.
...
@@ -1856,11 +1846,11 @@ compute_bb_predicates (struct cgraph_node *node,
...
@@ -1856,11 +1846,11 @@ compute_bb_predicates (struct cgraph_node *node,
if
(
e
->
src
->
aux
)
if
(
e
->
src
->
aux
)
{
{
struct
predicate
this_bb_predicate
struct
predicate
this_bb_predicate
=
*
(
struct
predicate
*
)
e
->
src
->
aux
;
=
*
(
struct
predicate
*
)
e
->
src
->
aux
;
if
(
e
->
aux
)
if
(
e
->
aux
)
this_bb_predicate
this_bb_predicate
=
and_predicates
(
summary
->
conds
,
&
this_bb_predicate
,
=
and_predicates
(
summary
->
conds
,
&
this_bb_predicate
,
(
struct
predicate
*
)
e
->
aux
);
(
struct
predicate
*
)
e
->
aux
);
p
=
or_predicates
(
summary
->
conds
,
&
p
,
&
this_bb_predicate
);
p
=
or_predicates
(
summary
->
conds
,
&
p
,
&
this_bb_predicate
);
if
(
true_predicate_p
(
&
p
))
if
(
true_predicate_p
(
&
p
))
break
;
break
;
...
@@ -1874,12 +1864,12 @@ compute_bb_predicates (struct cgraph_node *node,
...
@@ -1874,12 +1864,12 @@ compute_bb_predicates (struct cgraph_node *node,
{
{
done
=
false
;
done
=
false
;
bb
->
aux
=
pool_alloc
(
edge_predicate_pool
);
bb
->
aux
=
pool_alloc
(
edge_predicate_pool
);
*
((
struct
predicate
*
)
bb
->
aux
)
=
p
;
*
((
struct
predicate
*
)
bb
->
aux
)
=
p
;
}
}
else
if
(
!
predicates_equal_p
(
&
p
,
(
struct
predicate
*
)
bb
->
aux
))
else
if
(
!
predicates_equal_p
(
&
p
,
(
struct
predicate
*
)
bb
->
aux
))
{
{
done
=
false
;
done
=
false
;
*
((
struct
predicate
*
)
bb
->
aux
)
=
p
;
*
((
struct
predicate
*
)
bb
->
aux
)
=
p
;
}
}
}
}
}
}
...
@@ -1906,15 +1896,13 @@ will_be_nonconstant_expr_predicate (struct ipa_node_params *info,
...
@@ -1906,15 +1896,13 @@ will_be_nonconstant_expr_predicate (struct ipa_node_params *info,
expr
=
TREE_OPERAND
(
expr
,
0
);
expr
=
TREE_OPERAND
(
expr
,
0
);
parm
=
unmodified_parm
(
NULL
,
expr
);
parm
=
unmodified_parm
(
NULL
,
expr
);
if
(
parm
if
(
parm
&&
(
index
=
ipa_get_param_decl_index
(
info
,
parm
))
>=
0
)
&&
(
index
=
ipa_get_param_decl_index
(
info
,
parm
))
>=
0
)
return
add_condition
(
summary
,
index
,
NULL
,
CHANGED
,
NULL_TREE
);
return
add_condition
(
summary
,
index
,
NULL
,
CHANGED
,
NULL_TREE
);
if
(
is_gimple_min_invariant
(
expr
))
if
(
is_gimple_min_invariant
(
expr
))
return
false_predicate
();
return
false_predicate
();
if
(
TREE_CODE
(
expr
)
==
SSA_NAME
)
if
(
TREE_CODE
(
expr
)
==
SSA_NAME
)
return
nonconstant_names
[
SSA_NAME_VERSION
(
expr
)];
return
nonconstant_names
[
SSA_NAME_VERSION
(
expr
)];
if
(
BINARY_CLASS_P
(
expr
)
if
(
BINARY_CLASS_P
(
expr
)
||
COMPARISON_CLASS_P
(
expr
))
||
COMPARISON_CLASS_P
(
expr
))
{
{
struct
predicate
p1
=
will_be_nonconstant_expr_predicate
struct
predicate
p1
=
will_be_nonconstant_expr_predicate
(
info
,
summary
,
TREE_OPERAND
(
expr
,
0
),
(
info
,
summary
,
TREE_OPERAND
(
expr
,
0
),
...
@@ -2018,7 +2006,8 @@ will_be_nonconstant_predicate (struct ipa_node_params *info,
...
@@ -2018,7 +2006,8 @@ will_be_nonconstant_predicate (struct ipa_node_params *info,
}
}
if
(
is_load
)
if
(
is_load
)
op_non_const
=
add_condition
(
summary
,
base_index
,
&
aggpos
,
CHANGED
,
NULL
);
op_non_const
=
add_condition
(
summary
,
base_index
,
&
aggpos
,
CHANGED
,
NULL
);
else
else
op_non_const
=
false_predicate
();
op_non_const
=
false_predicate
();
FOR_EACH_SSA_TREE_OPERAND
(
use
,
stmt
,
iter
,
SSA_OP_USE
)
FOR_EACH_SSA_TREE_OPERAND
(
use
,
stmt
,
iter
,
SSA_OP_USE
)
...
@@ -2026,8 +2015,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info,
...
@@ -2026,8 +2015,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info,
tree
parm
=
unmodified_parm
(
stmt
,
use
);
tree
parm
=
unmodified_parm
(
stmt
,
use
);
int
index
;
int
index
;
if
(
parm
if
(
parm
&&
(
index
=
ipa_get_param_decl_index
(
info
,
parm
))
>=
0
)
&&
(
index
=
ipa_get_param_decl_index
(
info
,
parm
))
>=
0
)
{
{
if
(
index
!=
base_index
)
if
(
index
!=
base_index
)
p
=
add_condition
(
summary
,
index
,
NULL
,
CHANGED
,
NULL_TREE
);
p
=
add_condition
(
summary
,
index
,
NULL
,
CHANGED
,
NULL_TREE
);
...
@@ -2055,15 +2043,16 @@ struct record_modified_bb_info
...
@@ -2055,15 +2043,16 @@ struct record_modified_bb_info
set except for info->stmt. */
set except for info->stmt. */
static
bool
static
bool
record_modified
(
ao_ref
*
ao
ATTRIBUTE_UNUSED
,
tree
vdef
,
record_modified
(
ao_ref
*
ao
ATTRIBUTE_UNUSED
,
tree
vdef
,
void
*
data
)
void
*
data
)
{
{
struct
record_modified_bb_info
*
info
=
(
struct
record_modified_bb_info
*
)
data
;
struct
record_modified_bb_info
*
info
=
(
struct
record_modified_bb_info
*
)
data
;
if
(
SSA_NAME_DEF_STMT
(
vdef
)
==
info
->
stmt
)
if
(
SSA_NAME_DEF_STMT
(
vdef
)
==
info
->
stmt
)
return
false
;
return
false
;
bitmap_set_bit
(
info
->
bb_set
,
bitmap_set_bit
(
info
->
bb_set
,
SSA_NAME_IS_DEFAULT_DEF
(
vdef
)
SSA_NAME_IS_DEFAULT_DEF
(
vdef
)
?
ENTRY_BLOCK_PTR
->
index
:
gimple_bb
(
SSA_NAME_DEF_STMT
(
vdef
))
->
index
);
?
ENTRY_BLOCK_PTR
->
index
:
gimple_bb
(
SSA_NAME_DEF_STMT
(
vdef
))
->
index
);
return
false
;
return
false
;
}
}
...
@@ -2081,6 +2070,7 @@ param_change_prob (gimple stmt, int i)
...
@@ -2081,6 +2070,7 @@ param_change_prob (gimple stmt, int i)
basic_block
bb
=
gimple_bb
(
stmt
);
basic_block
bb
=
gimple_bb
(
stmt
);
tree
base
;
tree
base
;
/* Global invariants neve change. */
if
(
is_gimple_min_invariant
(
op
))
if
(
is_gimple_min_invariant
(
op
))
return
0
;
return
0
;
/* We would have to do non-trivial analysis to really work out what
/* We would have to do non-trivial analysis to really work out what
...
@@ -2251,18 +2241,17 @@ predicate_for_phi_result (struct inline_summary *summary, gimple phi,
...
@@ -2251,18 +2241,17 @@ predicate_for_phi_result (struct inline_summary *summary, gimple phi,
static
struct
predicate
static
struct
predicate
array_index_predicate
(
struct
inline_summary
*
info
,
array_index_predicate
(
struct
inline_summary
*
info
,
vec
<
predicate_t
>
nonconstant_names
,
tree
op
)
vec
<
predicate_t
>
nonconstant_names
,
tree
op
)
{
{
struct
predicate
p
=
false_predicate
();
struct
predicate
p
=
false_predicate
();
while
(
handled_component_p
(
op
))
while
(
handled_component_p
(
op
))
{
{
if
(
TREE_CODE
(
op
)
==
ARRAY_REF
if
(
TREE_CODE
(
op
)
==
ARRAY_REF
||
TREE_CODE
(
op
)
==
ARRAY_RANGE_REF
)
||
TREE_CODE
(
op
)
==
ARRAY_RANGE_REF
)
{
{
if
(
TREE_CODE
(
TREE_OPERAND
(
op
,
1
))
==
SSA_NAME
)
if
(
TREE_CODE
(
TREE_OPERAND
(
op
,
1
))
==
SSA_NAME
)
p
=
or_predicates
(
info
->
conds
,
&
p
,
p
=
or_predicates
(
info
->
conds
,
&
p
,
&
nonconstant_names
[
&
nonconstant_names
[
SSA_NAME_VERSION
SSA_NAME_VERSION
(
TREE_OPERAND
(
op
,
1
))]);
(
TREE_OPERAND
(
op
,
1
))]);
}
}
op
=
TREE_OPERAND
(
op
,
0
);
op
=
TREE_OPERAND
(
op
,
0
);
}
}
...
@@ -2304,7 +2293,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
...
@@ -2304,7 +2293,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
if
(
ipa_node_params_vector
.
exists
())
if
(
ipa_node_params_vector
.
exists
())
{
{
parms_info
=
IPA_NODE_REF
(
node
);
parms_info
=
IPA_NODE_REF
(
node
);
nonconstant_names
.
safe_grow_cleared
(
SSANAMES
(
my_function
)
->
length
());
nonconstant_names
.
safe_grow_cleared
(
SSANAMES
(
my_function
)
->
length
());
}
}
}
}
...
@@ -2335,7 +2325,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
...
@@ -2335,7 +2325,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
if
(
parms_info
)
if
(
parms_info
)
{
{
if
(
bb
->
aux
)
if
(
bb
->
aux
)
bb_predicate
=
*
(
struct
predicate
*
)
bb
->
aux
;
bb_predicate
=
*
(
struct
predicate
*
)
bb
->
aux
;
else
else
bb_predicate
=
false_predicate
();
bb_predicate
=
false_predicate
();
}
}
...
@@ -2384,24 +2374,31 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
...
@@ -2384,24 +2374,31 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
fprintf
(
dump_file
,
" "
);
fprintf
(
dump_file
,
" "
);
print_gimple_stmt
(
dump_file
,
stmt
,
0
,
0
);
print_gimple_stmt
(
dump_file
,
stmt
,
0
,
0
);
fprintf
(
dump_file
,
"
\t\t
freq:%3.2f size:%3i time:%3i
\n
"
,
fprintf
(
dump_file
,
"
\t\t
freq:%3.2f size:%3i time:%3i
\n
"
,
((
double
)
freq
)
/
CGRAPH_FREQ_BASE
,
this_size
,
this_time
);
((
double
)
freq
)
/
CGRAPH_FREQ_BASE
,
this_size
,
this_time
);
}
}
if
(
gimple_assign_load_p
(
stmt
)
&&
nonconstant_names
.
exists
())
if
(
gimple_assign_load_p
(
stmt
)
&&
nonconstant_names
.
exists
())
{
{
struct
predicate
this_array_index
;
struct
predicate
this_array_index
;
this_array_index
=
array_index_predicate
(
info
,
nonconstant_names
,
this_array_index
=
array_index_predicate
(
info
,
nonconstant_names
,
gimple_assign_rhs1
(
stmt
));
gimple_assign_rhs1
(
stmt
));
if
(
!
false_predicate_p
(
&
this_array_index
))
if
(
!
false_predicate_p
(
&
this_array_index
))
array_index
=
and_predicates
(
info
->
conds
,
&
array_index
,
&
this_array_index
);
array_index
=
and_predicates
(
info
->
conds
,
&
array_index
,
&
this_array_index
);
}
}
if
(
gimple_store_p
(
stmt
)
&&
nonconstant_names
.
exists
())
if
(
gimple_store_p
(
stmt
)
&&
nonconstant_names
.
exists
())
{
{
struct
predicate
this_array_index
;
struct
predicate
this_array_index
;
this_array_index
=
array_index_predicate
(
info
,
nonconstant_names
,
this_array_index
=
array_index_predicate
(
info
,
nonconstant_names
,
gimple_get_lhs
(
stmt
));
gimple_get_lhs
(
stmt
));
if
(
!
false_predicate_p
(
&
this_array_index
))
if
(
!
false_predicate_p
(
&
this_array_index
))
array_index
=
and_predicates
(
info
->
conds
,
&
array_index
,
&
this_array_index
);
array_index
=
and_predicates
(
info
->
conds
,
&
array_index
,
&
this_array_index
);
}
}
...
@@ -2458,7 +2455,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
...
@@ -2458,7 +2455,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
prob
=
eliminated_by_inlining_prob
(
stmt
);
prob
=
eliminated_by_inlining_prob
(
stmt
);
if
(
prob
==
1
&&
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
if
(
prob
==
1
&&
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
fprintf
(
dump_file
,
"
\t\t
50%% will be eliminated by inlining
\n
"
);
fprintf
(
dump_file
,
"
\t\t
50%% will be eliminated by inlining
\n
"
);
if
(
prob
==
2
&&
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
if
(
prob
==
2
&&
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
fprintf
(
dump_file
,
"
\t\t
Will be eliminated by inlining
\n
"
);
fprintf
(
dump_file
,
"
\t\t
Will be eliminated by inlining
\n
"
);
...
@@ -2521,7 +2519,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
...
@@ -2521,7 +2519,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
unsigned
int
j
,
i
;
unsigned
int
j
,
i
;
struct
tree_niter_desc
niter_desc
;
struct
tree_niter_desc
niter_desc
;
basic_block
*
body
=
get_loop_body
(
loop
);
basic_block
*
body
=
get_loop_body
(
loop
);
bb_predicate
=
*
(
struct
predicate
*
)
loop
->
header
->
aux
;
bb_predicate
=
*
(
struct
predicate
*
)
loop
->
header
->
aux
;
exits
=
get_loop_exit_edges
(
loop
);
exits
=
get_loop_exit_edges
(
loop
);
FOR_EACH_VEC_ELT
(
exits
,
j
,
ex
)
FOR_EACH_VEC_ELT
(
exits
,
j
,
ex
)
...
@@ -2530,24 +2528,28 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
...
@@ -2530,24 +2528,28 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
{
{
predicate
will_be_nonconstant
predicate
will_be_nonconstant
=
will_be_nonconstant_expr_predicate
(
parms_info
,
info
,
=
will_be_nonconstant_expr_predicate
(
parms_info
,
info
,
niter_desc
.
niter
,
nonconstant_names
);
niter_desc
.
niter
,
nonconstant_names
);
if
(
!
true_predicate_p
(
&
will_be_nonconstant
))
if
(
!
true_predicate_p
(
&
will_be_nonconstant
))
will_be_nonconstant
=
and_predicates
(
info
->
conds
,
will_be_nonconstant
=
and_predicates
(
info
->
conds
,
&
bb_predicate
,
&
bb_predicate
,
&
will_be_nonconstant
);
&
will_be_nonconstant
);
if
(
!
true_predicate_p
(
&
will_be_nonconstant
)
if
(
!
true_predicate_p
(
&
will_be_nonconstant
)
&&
!
false_predicate_p
(
&
will_be_nonconstant
))
&&
!
false_predicate_p
(
&
will_be_nonconstant
))
/* This is slightly inprecise. We may want to represent each loop with
/* This is slightly inprecise. We may want to represent each
independent predicate. */
loop with independent predicate. */
loop_iterations
=
and_predicates
(
info
->
conds
,
&
loop_iterations
,
&
will_be_nonconstant
);
loop_iterations
=
and_predicates
(
info
->
conds
,
&
loop_iterations
,
&
will_be_nonconstant
);
}
}
exits
.
release
();
exits
.
release
();
for
(
i
=
0
;
i
<
loop
->
num_nodes
;
i
++
)
for
(
i
=
0
;
i
<
loop
->
num_nodes
;
i
++
)
{
{
gimple_stmt_iterator
gsi
;
gimple_stmt_iterator
gsi
;
bb_predicate
=
*
(
struct
predicate
*
)
body
[
i
]
->
aux
;
bb_predicate
=
*
(
struct
predicate
*
)
body
[
i
]
->
aux
;
for
(
gsi
=
gsi_start_bb
(
body
[
i
]);
!
gsi_end_p
(
gsi
);
gsi_next
(
&
gsi
))
for
(
gsi
=
gsi_start_bb
(
body
[
i
]);
!
gsi_end_p
(
gsi
);
gsi_next
(
&
gsi
))
{
{
gimple
stmt
=
gsi_stmt
(
gsi
);
gimple
stmt
=
gsi_stmt
(
gsi
);
affine_iv
iv
;
affine_iv
iv
;
...
@@ -2558,27 +2560,33 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
...
@@ -2558,27 +2560,33 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
{
{
predicate
will_be_nonconstant
;
predicate
will_be_nonconstant
;
if
(
!
simple_iv
(
loop
,
loop_containing_stmt
(
stmt
),
use
,
&
iv
,
true
)
if
(
!
simple_iv
(
loop
,
loop_containing_stmt
(
stmt
),
use
,
&
iv
,
true
)
||
is_gimple_min_invariant
(
iv
.
step
))
||
is_gimple_min_invariant
(
iv
.
step
))
continue
;
continue
;
will_be_nonconstant
will_be_nonconstant
=
will_be_nonconstant_expr_predicate
(
parms_info
,
info
,
=
will_be_nonconstant_expr_predicate
(
parms_info
,
info
,
iv
.
step
,
nonconstant_names
);
iv
.
step
,
nonconstant_names
);
if
(
!
true_predicate_p
(
&
will_be_nonconstant
))
if
(
!
true_predicate_p
(
&
will_be_nonconstant
))
will_be_nonconstant
=
and_predicates
(
info
->
conds
,
will_be_nonconstant
=
and_predicates
(
info
->
conds
,
&
bb_predicate
,
&
bb_predicate
,
&
will_be_nonconstant
);
&
will_be_nonconstant
);
if
(
!
true_predicate_p
(
&
will_be_nonconstant
)
if
(
!
true_predicate_p
(
&
will_be_nonconstant
)
&&
!
false_predicate_p
(
&
will_be_nonconstant
))
&&
!
false_predicate_p
(
&
will_be_nonconstant
))
/* This is slightly inprecise. We may want to represent each loop with
/* This is slightly inprecise. We may want to represent
independent predicate. */
each loop with independent predicate. */
loop_stride
=
and_predicates
(
info
->
conds
,
&
loop_stride
,
&
will_be_nonconstant
);
loop_stride
=
and_predicates
(
info
->
conds
,
&
loop_stride
,
&
will_be_nonconstant
);
}
}
}
}
}
}
free
(
body
);
free
(
body
);
}
}
set_hint_predicate
(
&
inline_summary
(
node
)
->
loop_iterations
,
loop_iterations
);
set_hint_predicate
(
&
inline_summary
(
node
)
->
loop_iterations
,
loop_iterations
);
set_hint_predicate
(
&
inline_summary
(
node
)
->
loop_stride
,
loop_stride
);
set_hint_predicate
(
&
inline_summary
(
node
)
->
loop_stride
,
loop_stride
);
scev_finalize
();
scev_finalize
();
}
}
...
@@ -2691,8 +2699,7 @@ compute_inline_parameters (struct cgraph_node *node, bool early)
...
@@ -2691,8 +2699,7 @@ compute_inline_parameters (struct cgraph_node *node, bool early)
info
->
estimated_stack_size
=
info
->
estimated_self_stack_size
;
info
->
estimated_stack_size
=
info
->
estimated_self_stack_size
;
#ifdef ENABLE_CHECKING
#ifdef ENABLE_CHECKING
inline_update_overall_summary
(
node
);
inline_update_overall_summary
(
node
);
gcc_assert
(
info
->
time
==
info
->
self_time
gcc_assert
(
info
->
time
==
info
->
self_time
&&
info
->
size
==
info
->
self_size
);
&&
info
->
size
==
info
->
self_size
);
#endif
#endif
pop_cfun
();
pop_cfun
();
...
@@ -2716,7 +2723,7 @@ struct gimple_opt_pass pass_inline_parameters =
...
@@ -2716,7 +2723,7 @@ struct gimple_opt_pass pass_inline_parameters =
"inline_param"
,
/* name */
"inline_param"
,
/* name */
OPTGROUP_INLINE
,
/* optinfo_flags */
OPTGROUP_INLINE
,
/* optinfo_flags */
NULL
,
/* gate */
NULL
,
/* gate */
compute_inline_parameters_for_current
,
/* execute */
compute_inline_parameters_for_current
,
/* execute */
NULL
,
/* sub */
NULL
,
/* sub */
NULL
,
/* next */
NULL
,
/* next */
0
,
/* static_pass_number */
0
,
/* static_pass_number */
...
@@ -2776,7 +2783,6 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time,
...
@@ -2776,7 +2783,6 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time,
vec
<
tree
>
known_binfos
,
vec
<
tree
>
known_binfos
,
vec
<
ipa_agg_jump_function_p
>
known_aggs
,
vec
<
ipa_agg_jump_function_p
>
known_aggs
,
inline_hints
*
hints
)
inline_hints
*
hints
)
{
{
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
e
);
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
e
);
int
call_size
=
es
->
call_stmt_size
;
int
call_size
=
es
->
call_stmt_size
;
...
@@ -2784,8 +2790,7 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time,
...
@@ -2784,8 +2790,7 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time,
if
(
!
e
->
callee
if
(
!
e
->
callee
&&
estimate_edge_devirt_benefit
(
e
,
&
call_size
,
&
call_time
,
&&
estimate_edge_devirt_benefit
(
e
,
&
call_size
,
&
call_time
,
known_vals
,
known_binfos
,
known_aggs
)
known_vals
,
known_binfos
,
known_aggs
)
&&
hints
&&
hints
&&
cgraph_maybe_hot_edge_p
(
e
))
&&
cgraph_maybe_hot_edge_p
(
e
))
*
hints
|=
INLINE_HINT_indirect_call
;
*
hints
|=
INLINE_HINT_indirect_call
;
*
size
+=
call_size
*
INLINE_SIZE_SCALE
;
*
size
+=
call_size
*
INLINE_SIZE_SCALE
;
*
time
+=
call_time
*
prob
/
REG_BR_PROB_BASE
*
time
+=
call_time
*
prob
/
REG_BR_PROB_BASE
...
@@ -2812,26 +2817,29 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, int *time,
...
@@ -2812,26 +2817,29 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, int *time,
for
(
e
=
node
->
callees
;
e
;
e
=
e
->
next_callee
)
for
(
e
=
node
->
callees
;
e
;
e
=
e
->
next_callee
)
{
{
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
e
);
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
e
);
if
(
!
es
->
predicate
||
evaluate_predicate
(
es
->
predicate
,
possible_truths
))
if
(
!
es
->
predicate
||
evaluate_predicate
(
es
->
predicate
,
possible_truths
))
{
{
if
(
e
->
inline_failed
)
if
(
e
->
inline_failed
)
{
{
/* Predicates of calls shall not use NOT_CHANGED codes,
/* Predicates of calls shall not use NOT_CHANGED codes,
sowe do not need to compute probabilities. */
sowe do not need to compute probabilities. */
estimate_edge_size_and_time
(
e
,
size
,
time
,
REG_BR_PROB_BASE
,
estimate_edge_size_and_time
(
e
,
size
,
time
,
REG_BR_PROB_BASE
,
known_vals
,
known_binfos
,
known_aggs
,
known_vals
,
known_binfos
,
hints
);
known_aggs
,
hints
);
}
}
else
else
estimate_calls_size_and_time
(
e
->
callee
,
size
,
time
,
hints
,
estimate_calls_size_and_time
(
e
->
callee
,
size
,
time
,
hints
,
possible_truths
,
possible_truths
,
known_vals
,
known_binfos
,
known_aggs
);
known_vals
,
known_binfos
,
known_aggs
);
}
}
}
}
for
(
e
=
node
->
indirect_calls
;
e
;
e
=
e
->
next_callee
)
for
(
e
=
node
->
indirect_calls
;
e
;
e
=
e
->
next_callee
)
{
{
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
e
);
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
e
);
if
(
!
es
->
predicate
||
evaluate_predicate
(
es
->
predicate
,
possible_truths
))
if
(
!
es
->
predicate
||
evaluate_predicate
(
es
->
predicate
,
possible_truths
))
estimate_edge_size_and_time
(
e
,
size
,
time
,
REG_BR_PROB_BASE
,
estimate_edge_size_and_time
(
e
,
size
,
time
,
REG_BR_PROB_BASE
,
known_vals
,
known_binfos
,
known_aggs
,
known_vals
,
known_binfos
,
known_aggs
,
hints
);
hints
);
...
@@ -2861,18 +2869,15 @@ estimate_node_size_and_time (struct cgraph_node *node,
...
@@ -2861,18 +2869,15 @@ estimate_node_size_and_time (struct cgraph_node *node,
inline_hints
hints
=
0
;
inline_hints
hints
=
0
;
int
i
;
int
i
;
if
(
dump_file
if
(
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
&&
(
dump_flags
&
TDF_DETAILS
))
{
{
bool
found
=
false
;
bool
found
=
false
;
fprintf
(
dump_file
,
" Estimating body: %s/%i
\n
"
fprintf
(
dump_file
,
" Estimating body: %s/%i
\n
"
" Known to be false: "
,
" Known to be false: "
,
cgraph_node_name
(
node
),
node
->
uid
);
cgraph_node_name
(
node
),
node
->
uid
);
for
(
i
=
predicate_not_inlined_condition
;
for
(
i
=
predicate_not_inlined_condition
;
i
<
(
predicate_first_dynamic_condition
i
<
(
predicate_first_dynamic_condition
+
(
int
)
vec_safe_length
(
info
->
conds
));
i
++
)
+
(
int
)
vec_safe_length
(
info
->
conds
));
i
++
)
if
(
!
(
possible_truths
&
(
1
<<
i
)))
if
(
!
(
possible_truths
&
(
1
<<
i
)))
{
{
if
(
found
)
if
(
found
)
...
@@ -2898,7 +2903,7 @@ estimate_node_size_and_time (struct cgraph_node *node,
...
@@ -2898,7 +2903,7 @@ estimate_node_size_and_time (struct cgraph_node *node,
inline_param_summary
);
inline_param_summary
);
gcc_checking_assert
(
prob
>=
0
);
gcc_checking_assert
(
prob
>=
0
);
gcc_checking_assert
(
prob
<=
REG_BR_PROB_BASE
);
gcc_checking_assert
(
prob
<=
REG_BR_PROB_BASE
);
time
+=
((
gcov_type
)
e
->
time
*
prob
)
/
REG_BR_PROB_BASE
;
time
+=
((
gcov_type
)
e
->
time
*
prob
)
/
REG_BR_PROB_BASE
;
}
}
if
(
time
>
MAX_TIME
*
INLINE_TIME_SCALE
)
if
(
time
>
MAX_TIME
*
INLINE_TIME_SCALE
)
time
=
MAX_TIME
*
INLINE_TIME_SCALE
;
time
=
MAX_TIME
*
INLINE_TIME_SCALE
;
...
@@ -2910,13 +2915,13 @@ estimate_node_size_and_time (struct cgraph_node *node,
...
@@ -2910,13 +2915,13 @@ estimate_node_size_and_time (struct cgraph_node *node,
if
(
info
->
loop_iterations
if
(
info
->
loop_iterations
&&
!
evaluate_predicate
(
info
->
loop_iterations
,
possible_truths
))
&&
!
evaluate_predicate
(
info
->
loop_iterations
,
possible_truths
))
hints
|=
INLINE_HINT_loop_iterations
;
hints
|=
INLINE_HINT_loop_iterations
;
if
(
info
->
loop_stride
if
(
info
->
loop_stride
&&
!
evaluate_predicate
(
info
->
loop_stride
,
possible_truths
))
&&
!
evaluate_predicate
(
info
->
loop_stride
,
possible_truths
))
hints
|=
INLINE_HINT_loop_stride
;
hints
|=
INLINE_HINT_loop_stride
;
if
(
info
->
array_index
if
(
info
->
array_index
&&
!
evaluate_predicate
(
info
->
array_index
,
possible_truths
))
&&
!
evaluate_predicate
(
info
->
array_index
,
possible_truths
))
hints
|=
INLINE_HINT_array_index
;
hints
|=
INLINE_HINT_array_index
;
if
(
info
->
scc_no
)
if
(
info
->
scc_no
)
hints
|=
INLINE_HINT_in_scc
;
hints
|=
INLINE_HINT_in_scc
;
if
(
DECL_DECLARED_INLINE_P
(
node
->
symbol
.
decl
))
if
(
DECL_DECLARED_INLINE_P
(
node
->
symbol
.
decl
))
...
@@ -2929,9 +2934,8 @@ estimate_node_size_and_time (struct cgraph_node *node,
...
@@ -2929,9 +2934,8 @@ estimate_node_size_and_time (struct cgraph_node *node,
time
=
RDIV
(
time
,
INLINE_TIME_SCALE
);
time
=
RDIV
(
time
,
INLINE_TIME_SCALE
);
size
=
RDIV
(
size
,
INLINE_SIZE_SCALE
);
size
=
RDIV
(
size
,
INLINE_SIZE_SCALE
);
if
(
dump_file
if
(
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
&&
(
dump_flags
&
TDF_DETAILS
))
fprintf
(
dump_file
,
"
\n
size:%i time:%i
\n
"
,
(
int
)
size
,
(
int
)
time
);
fprintf
(
dump_file
,
"
\n
size:%i time:%i
\n
"
,
(
int
)
size
,
(
int
)
time
);
if
(
ret_time
)
if
(
ret_time
)
*
ret_time
=
time
;
*
ret_time
=
time
;
if
(
ret_size
)
if
(
ret_size
)
...
@@ -2982,8 +2986,7 @@ remap_predicate (struct inline_summary *info,
...
@@ -2982,8 +2986,7 @@ remap_predicate (struct inline_summary *info,
struct
predicate
*
p
,
struct
predicate
*
p
,
vec
<
int
>
operand_map
,
vec
<
int
>
operand_map
,
vec
<
int
>
offset_map
,
vec
<
int
>
offset_map
,
clause_t
possible_truths
,
clause_t
possible_truths
,
struct
predicate
*
toplev_predicate
)
struct
predicate
*
toplev_predicate
)
{
{
int
i
;
int
i
;
struct
predicate
out
=
true_predicate
();
struct
predicate
out
=
true_predicate
();
...
@@ -2999,7 +3002,7 @@ remap_predicate (struct inline_summary *info,
...
@@ -2999,7 +3002,7 @@ remap_predicate (struct inline_summary *info,
gcc_assert
(
i
<
MAX_CLAUSES
);
gcc_assert
(
i
<
MAX_CLAUSES
);
for
(
cond
=
0
;
cond
<
NUM_CONDITIONS
;
cond
++
)
for
(
cond
=
0
;
cond
<
NUM_CONDITIONS
;
cond
++
)
/* Do we have condition we can't disprove? */
/* Do we have condition we can't disprove? */
if
(
clause
&
possible_truths
&
(
1
<<
cond
))
if
(
clause
&
possible_truths
&
(
1
<<
cond
))
{
{
...
@@ -3011,11 +3014,12 @@ remap_predicate (struct inline_summary *info,
...
@@ -3011,11 +3014,12 @@ remap_predicate (struct inline_summary *info,
struct
condition
*
c
;
struct
condition
*
c
;
c
=
&
(
*
callee_info
->
conds
)[
cond
c
=
&
(
*
callee_info
->
conds
)[
cond
-
predicate_first_dynamic_condition
];
-
predicate_first_dynamic_condition
];
/* See if we can remap condition operand to caller's operand.
/* See if we can remap condition operand to caller's operand.
Otherwise give up. */
Otherwise give up. */
if
(
!
operand_map
.
exists
()
if
(
!
operand_map
.
exists
()
||
(
int
)
operand_map
.
length
()
<=
c
->
operand_num
||
(
int
)
operand_map
.
length
()
<=
c
->
operand_num
||
operand_map
[
c
->
operand_num
]
==
-
1
||
operand_map
[
c
->
operand_num
]
==
-
1
/* TODO: For non-aggregate conditions, adding an offset is
/* TODO: For non-aggregate conditions, adding an offset is
basically an arithmetic jump function processing which
basically an arithmetic jump function processing which
...
@@ -3035,8 +3039,7 @@ remap_predicate (struct inline_summary *info,
...
@@ -3035,8 +3039,7 @@ remap_predicate (struct inline_summary *info,
offset_delta
=
0
;
offset_delta
=
0
;
}
}
gcc_assert
(
!
c
->
agg_contents
gcc_assert
(
!
c
->
agg_contents
||
c
->
by_ref
||
c
->
by_ref
||
offset_delta
==
0
);
||
offset_delta
==
0
);
ap
.
offset
=
c
->
offset
+
offset_delta
;
ap
.
offset
=
c
->
offset
+
offset_delta
;
ap
.
agg_contents
=
c
->
agg_contents
;
ap
.
agg_contents
=
c
->
agg_contents
;
ap
.
by_ref
=
c
->
by_ref
;
ap
.
by_ref
=
c
->
by_ref
;
...
@@ -3065,8 +3068,7 @@ remap_predicate (struct inline_summary *info,
...
@@ -3065,8 +3068,7 @@ remap_predicate (struct inline_summary *info,
Compute peak stack usage. */
Compute peak stack usage. */
static
void
static
void
inline_update_callee_summaries
(
struct
cgraph_node
*
node
,
inline_update_callee_summaries
(
struct
cgraph_node
*
node
,
int
depth
)
int
depth
)
{
{
struct
cgraph_edge
*
e
;
struct
cgraph_edge
*
e
;
struct
inline_summary
*
callee_info
=
inline_summary
(
node
);
struct
inline_summary
*
callee_info
=
inline_summary
(
node
);
...
@@ -3078,8 +3080,7 @@ inline_update_callee_summaries (struct cgraph_node *node,
...
@@ -3078,8 +3080,7 @@ inline_update_callee_summaries (struct cgraph_node *node,
+
caller_info
->
estimated_self_stack_size
;
+
caller_info
->
estimated_self_stack_size
;
peak
=
callee_info
->
stack_frame_offset
peak
=
callee_info
->
stack_frame_offset
+
callee_info
->
estimated_self_stack_size
;
+
callee_info
->
estimated_self_stack_size
;
if
(
inline_summary
(
node
->
global
.
inlined_to
)
->
estimated_stack_size
if
(
inline_summary
(
node
->
global
.
inlined_to
)
->
estimated_stack_size
<
peak
)
<
peak
)
inline_summary
(
node
->
global
.
inlined_to
)
->
estimated_stack_size
=
peak
;
inline_summary
(
node
->
global
.
inlined_to
)
->
estimated_stack_size
=
peak
;
cgraph_propagate_frequency
(
node
);
cgraph_propagate_frequency
(
node
);
for
(
e
=
node
->
callees
;
e
;
e
=
e
->
next_callee
)
for
(
e
=
node
->
callees
;
e
;
e
=
e
->
next_callee
)
...
@@ -3163,8 +3164,7 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge,
...
@@ -3163,8 +3164,7 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge,
{
{
p
=
remap_predicate
(
info
,
callee_info
,
p
=
remap_predicate
(
info
,
callee_info
,
es
->
predicate
,
operand_map
,
offset_map
,
es
->
predicate
,
operand_map
,
offset_map
,
possible_truths
,
possible_truths
,
toplev_predicate
);
toplev_predicate
);
edge_set_predicate
(
e
,
&
p
);
edge_set_predicate
(
e
,
&
p
);
/* TODO: We should remove the edge for code that will be
/* TODO: We should remove the edge for code that will be
optimized out, but we need to keep verifiers and tree-inline
optimized out, but we need to keep verifiers and tree-inline
...
@@ -3227,17 +3227,13 @@ remap_hint_predicate (struct inline_summary *info,
...
@@ -3227,17 +3227,13 @@ remap_hint_predicate (struct inline_summary *info,
p
=
remap_predicate
(
info
,
callee_info
,
p
=
remap_predicate
(
info
,
callee_info
,
*
hint
,
*
hint
,
operand_map
,
offset_map
,
operand_map
,
offset_map
,
possible_truths
,
possible_truths
,
toplev_predicate
);
toplev_predicate
);
if
(
!
false_predicate_p
(
&
p
)
&&
!
true_predicate_p
(
&
p
))
if
(
!
false_predicate_p
(
&
p
)
&&
!
true_predicate_p
(
&
p
))
{
{
if
(
!*
hint
)
if
(
!*
hint
)
set_hint_predicate
(
hint
,
p
);
set_hint_predicate
(
hint
,
p
);
else
else
**
hint
=
and_predicates
(
info
->
conds
,
**
hint
=
and_predicates
(
info
->
conds
,
*
hint
,
&
p
);
*
hint
,
&
p
);
}
}
}
}
...
@@ -3312,19 +3308,19 @@ inline_merge_summary (struct cgraph_edge *edge)
...
@@ -3312,19 +3308,19 @@ inline_merge_summary (struct cgraph_edge *edge)
&
toplev_predicate
);
&
toplev_predicate
);
if
(
!
false_predicate_p
(
&
p
))
if
(
!
false_predicate_p
(
&
p
))
{
{
gcov_type
add_time
=
((
gcov_type
)
e
->
time
*
edge
->
frequency
gcov_type
add_time
=
((
gcov_type
)
e
->
time
*
edge
->
frequency
+
CGRAPH_FREQ_BASE
/
2
)
/
CGRAPH_FREQ_BASE
;
+
CGRAPH_FREQ_BASE
/
2
)
/
CGRAPH_FREQ_BASE
;
int
prob
=
predicate_probability
(
callee_info
->
conds
,
int
prob
=
predicate_probability
(
callee_info
->
conds
,
&
e
->
predicate
,
&
e
->
predicate
,
clause
,
es
->
param
);
clause
,
es
->
param
);
add_time
=
((
gcov_type
)
add_time
*
prob
)
/
REG_BR_PROB_BASE
;
add_time
=
((
gcov_type
)
add_time
*
prob
)
/
REG_BR_PROB_BASE
;
if
(
add_time
>
MAX_TIME
*
INLINE_TIME_SCALE
)
if
(
add_time
>
MAX_TIME
*
INLINE_TIME_SCALE
)
add_time
=
MAX_TIME
*
INLINE_TIME_SCALE
;
add_time
=
MAX_TIME
*
INLINE_TIME_SCALE
;
if
(
prob
!=
REG_BR_PROB_BASE
if
(
prob
!=
REG_BR_PROB_BASE
&&
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
&&
dump_file
&&
(
dump_flags
&
TDF_DETAILS
))
{
{
fprintf
(
dump_file
,
"
\t\t
Scaling time by probability:%f
\n
"
,
fprintf
(
dump_file
,
"
\t\t
Scaling time by probability:%f
\n
"
,
(
double
)
prob
/
REG_BR_PROB_BASE
);
(
double
)
prob
/
REG_BR_PROB_BASE
);
}
}
account_size_time
(
info
,
e
->
size
,
add_time
,
&
p
);
account_size_time
(
info
,
e
->
size
,
add_time
,
&
p
);
}
}
...
@@ -3333,16 +3329,13 @@ inline_merge_summary (struct cgraph_edge *edge)
...
@@ -3333,16 +3329,13 @@ inline_merge_summary (struct cgraph_edge *edge)
offset_map
,
clause
,
&
toplev_predicate
);
offset_map
,
clause
,
&
toplev_predicate
);
remap_hint_predicate
(
info
,
callee_info
,
remap_hint_predicate
(
info
,
callee_info
,
&
callee_info
->
loop_iterations
,
&
callee_info
->
loop_iterations
,
operand_map
,
offset_map
,
operand_map
,
offset_map
,
clause
,
&
toplev_predicate
);
clause
,
&
toplev_predicate
);
remap_hint_predicate
(
info
,
callee_info
,
remap_hint_predicate
(
info
,
callee_info
,
&
callee_info
->
loop_stride
,
&
callee_info
->
loop_stride
,
operand_map
,
offset_map
,
operand_map
,
offset_map
,
clause
,
&
toplev_predicate
);
clause
,
&
toplev_predicate
);
remap_hint_predicate
(
info
,
callee_info
,
remap_hint_predicate
(
info
,
callee_info
,
&
callee_info
->
array_index
,
&
callee_info
->
array_index
,
operand_map
,
offset_map
,
operand_map
,
offset_map
,
clause
,
&
toplev_predicate
);
clause
,
&
toplev_predicate
);
inline_update_callee_summaries
(
edge
->
callee
,
inline_update_callee_summaries
(
edge
->
callee
,
inline_edge_summary
(
edge
)
->
loop_depth
);
inline_edge_summary
(
edge
)
->
loop_depth
);
...
@@ -3374,7 +3367,7 @@ inline_update_overall_summary (struct cgraph_node *node)
...
@@ -3374,7 +3367,7 @@ inline_update_overall_summary (struct cgraph_node *node)
info
->
time
=
MAX_TIME
*
INLINE_TIME_SCALE
;
info
->
time
=
MAX_TIME
*
INLINE_TIME_SCALE
;
}
}
estimate_calls_size_and_time
(
node
,
&
info
->
size
,
&
info
->
time
,
NULL
,
estimate_calls_size_and_time
(
node
,
&
info
->
size
,
&
info
->
time
,
NULL
,
~
(
clause_t
)(
1
<<
predicate_false_condition
),
~
(
clause_t
)
(
1
<<
predicate_false_condition
),
vNULL
,
vNULL
,
vNULL
);
vNULL
,
vNULL
,
vNULL
);
info
->
time
=
(
info
->
time
+
INLINE_TIME_SCALE
/
2
)
/
INLINE_TIME_SCALE
;
info
->
time
=
(
info
->
time
+
INLINE_TIME_SCALE
/
2
)
/
INLINE_TIME_SCALE
;
info
->
size
=
(
info
->
size
+
INLINE_SIZE_SCALE
/
2
)
/
INLINE_SIZE_SCALE
;
info
->
size
=
(
info
->
size
+
INLINE_SIZE_SCALE
/
2
)
/
INLINE_SIZE_SCALE
;
...
@@ -3386,8 +3379,7 @@ simple_edge_hints (struct cgraph_edge *edge)
...
@@ -3386,8 +3379,7 @@ simple_edge_hints (struct cgraph_edge *edge)
{
{
int
hints
=
0
;
int
hints
=
0
;
struct
cgraph_node
*
to
=
(
edge
->
caller
->
global
.
inlined_to
struct
cgraph_node
*
to
=
(
edge
->
caller
->
global
.
inlined_to
?
edge
->
caller
->
global
.
inlined_to
?
edge
->
caller
->
global
.
inlined_to
:
edge
->
caller
);
:
edge
->
caller
);
if
(
inline_summary
(
to
)
->
scc_no
if
(
inline_summary
(
to
)
->
scc_no
&&
inline_summary
(
to
)
->
scc_no
==
inline_summary
(
edge
->
callee
)
->
scc_no
&&
inline_summary
(
to
)
->
scc_no
==
inline_summary
(
edge
->
callee
)
->
scc_no
&&
!
cgraph_edge_recursive_p
(
edge
))
&&
!
cgraph_edge_recursive_p
(
edge
))
...
@@ -3437,7 +3429,7 @@ do_estimate_edge_time (struct cgraph_edge *edge)
...
@@ -3437,7 +3429,7 @@ do_estimate_edge_time (struct cgraph_edge *edge)
/* When caching, update the cache entry. */
/* When caching, update the cache entry. */
if
(
edge_growth_cache
.
exists
())
if
(
edge_growth_cache
.
exists
())
{
{
if
((
int
)
edge_growth_cache
.
length
()
<=
edge
->
uid
)
if
((
int
)
edge_growth_cache
.
length
()
<=
edge
->
uid
)
edge_growth_cache
.
safe_grow_cleared
(
cgraph_edge_max_uid
);
edge_growth_cache
.
safe_grow_cleared
(
cgraph_edge_max_uid
);
edge_growth_cache
[
edge
->
uid
].
time
=
time
+
(
time
>=
0
);
edge_growth_cache
[
edge
->
uid
].
time
=
time
+
(
time
>=
0
);
...
@@ -3537,7 +3529,8 @@ estimate_time_after_inlining (struct cgraph_node *node,
...
@@ -3537,7 +3529,8 @@ estimate_time_after_inlining (struct cgraph_node *node,
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
edge
);
struct
inline_edge_summary
*
es
=
inline_edge_summary
(
edge
);
if
(
!
es
->
predicate
||
!
false_predicate_p
(
es
->
predicate
))
if
(
!
es
->
predicate
||
!
false_predicate_p
(
es
->
predicate
))
{
{
gcov_type
time
=
inline_summary
(
node
)
->
time
+
estimate_edge_time
(
edge
);
gcov_type
time
=
inline_summary
(
node
)
->
time
+
estimate_edge_time
(
edge
);
if
(
time
<
0
)
if
(
time
<
0
)
time
=
0
;
time
=
0
;
if
(
time
>
MAX_TIME
)
if
(
time
>
MAX_TIME
)
...
@@ -3600,7 +3593,7 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data)
...
@@ -3600,7 +3593,7 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data)
int
int
do_estimate_growth
(
struct
cgraph_node
*
node
)
do_estimate_growth
(
struct
cgraph_node
*
node
)
{
{
struct
growth_data
d
=
{
0
,
false
};
struct
growth_data
d
=
{
0
,
false
};
struct
inline_summary
*
info
=
inline_summary
(
node
);
struct
inline_summary
*
info
=
inline_summary
(
node
);
cgraph_for_node_and_aliases
(
node
,
do_estimate_growth_1
,
&
d
,
true
);
cgraph_for_node_and_aliases
(
node
,
do_estimate_growth_1
,
&
d
,
true
);
...
@@ -3629,7 +3622,7 @@ do_estimate_growth (struct cgraph_node *node)
...
@@ -3629,7 +3622,7 @@ do_estimate_growth (struct cgraph_node *node)
if
(
node_growth_cache
.
exists
())
if
(
node_growth_cache
.
exists
())
{
{
if
((
int
)
node_growth_cache
.
length
()
<=
node
->
uid
)
if
((
int
)
node_growth_cache
.
length
()
<=
node
->
uid
)
node_growth_cache
.
safe_grow_cleared
(
cgraph_max_uid
);
node_growth_cache
.
safe_grow_cleared
(
cgraph_max_uid
);
node_growth_cache
[
node
->
uid
]
=
d
.
growth
+
(
d
.
growth
>=
0
);
node_growth_cache
[
node
->
uid
]
=
d
.
growth
+
(
d
.
growth
>=
0
);
}
}
...
@@ -3741,8 +3734,7 @@ read_inline_edge_summary (struct lto_input_block *ib, struct cgraph_edge *e)
...
@@ -3741,8 +3734,7 @@ read_inline_edge_summary (struct lto_input_block *ib, struct cgraph_edge *e)
{
{
es
->
param
.
safe_grow_cleared
(
length
);
es
->
param
.
safe_grow_cleared
(
length
);
for
(
i
=
0
;
i
<
length
;
i
++
)
for
(
i
=
0
;
i
<
length
;
i
++
)
es
->
param
[
i
].
change_prob
es
->
param
[
i
].
change_prob
=
streamer_read_uhwi
(
ib
);
=
streamer_read_uhwi
(
ib
);
}
}
}
}
...
@@ -3906,7 +3898,7 @@ write_inline_edge_summary (struct output_block *ob, struct cgraph_edge *e)
...
@@ -3906,7 +3898,7 @@ write_inline_edge_summary (struct output_block *ob, struct cgraph_edge *e)
streamer_write_uhwi
(
ob
,
es
->
loop_depth
);
streamer_write_uhwi
(
ob
,
es
->
loop_depth
);
write_predicate
(
ob
,
es
->
predicate
);
write_predicate
(
ob
,
es
->
predicate
);
streamer_write_uhwi
(
ob
,
es
->
param
.
length
());
streamer_write_uhwi
(
ob
,
es
->
param
.
length
());
for
(
i
=
0
;
i
<
(
int
)
es
->
param
.
length
();
i
++
)
for
(
i
=
0
;
i
<
(
int
)
es
->
param
.
length
();
i
++
)
streamer_write_uhwi
(
ob
,
es
->
param
[
i
].
change_prob
);
streamer_write_uhwi
(
ob
,
es
->
param
[
i
].
change_prob
);
}
}
...
@@ -3946,7 +3938,10 @@ inline_write_summary (void)
...
@@ -3946,7 +3938,10 @@ inline_write_summary (void)
size_time_entry
*
e
;
size_time_entry
*
e
;
struct
condition
*
c
;
struct
condition
*
c
;
streamer_write_uhwi
(
ob
,
lto_symtab_encoder_encode
(
encoder
,
(
symtab_node
)
node
));
streamer_write_uhwi
(
ob
,
lto_symtab_encoder_encode
(
encoder
,
(
symtab_node
)
node
));
streamer_write_hwi
(
ob
,
info
->
estimated_self_stack_size
);
streamer_write_hwi
(
ob
,
info
->
estimated_self_stack_size
);
streamer_write_hwi
(
ob
,
info
->
self_size
);
streamer_write_hwi
(
ob
,
info
->
self_size
);
streamer_write_hwi
(
ob
,
info
->
self_time
);
streamer_write_hwi
(
ob
,
info
->
self_time
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment