aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-06-21 14:52:14 +0200
committerMartin Liska <marxin@gcc.gnu.org>2017-06-21 12:52:14 +0000
commit93c18375823fdd0e384f673f75e39136719135dd (patch)
treed25acabcbf72c143c997ccd8e7b212c5930584ad /gcc/gimplify.c
parente59a1c22fb249388e82b4fd004f33615abe36d2e (diff)
downloadgcc-93c18375823fdd0e384f673f75e39136719135dd.zip
gcc-93c18375823fdd0e384f673f75e39136719135dd.tar.gz
gcc-93c18375823fdd0e384f673f75e39136719135dd.tar.bz2
Rework cold and hot label attributes in predict.c.
2017-06-21 Martin Liska <mliska@suse.cz> * gimplify.c (gimplify_label_expr): Insert GIMPLE_PREDICT statements on cold and hot labels. * predict.c (tree_estimate_probability_bb): Remove the prediction from this place. 2017-06-21 Martin Liska <mliska@suse.cz> * gcc.dg/tree-ssa/attr-hotcold-2.c: Update scanned patterns. From-SVN: r249451
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index c645bce..641a821 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2357,10 +2357,18 @@ gimplify_label_expr (tree *expr_p, gimple_seq *pre_p)
gcc_assert (decl_function_context (LABEL_EXPR_LABEL (*expr_p))
== current_function_decl);
- glabel *label_stmt = gimple_build_label (LABEL_EXPR_LABEL (*expr_p));
+ tree label = LABEL_EXPR_LABEL (*expr_p);
+ glabel *label_stmt = gimple_build_label (label);
gimple_set_location (label_stmt, EXPR_LOCATION (*expr_p));
gimplify_seq_add_stmt (pre_p, label_stmt);
+ if (lookup_attribute ("cold", DECL_ATTRIBUTES (label)))
+ gimple_seq_add_stmt (pre_p, gimple_build_predict (PRED_COLD_LABEL,
+ NOT_TAKEN));
+ else if (lookup_attribute ("hot", DECL_ATTRIBUTES (label)))
+ gimple_seq_add_stmt (pre_p, gimple_build_predict (PRED_HOT_LABEL,
+ TAKEN));
+
return GS_ALL_DONE;
}