aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2012-07-26 14:31:40 -0700
committerRichard Henderson <rth@gcc.gnu.org>2012-07-26 14:31:40 -0700
commite45abe1f20e35a461c2378f4caf8b1455c98385d (patch)
tree20c51469f397cdea4c543dc55b62a9a1b3ce14d1 /gcc/testsuite/gcc.dg
parent27ec0502c807dd79b1e6782806ac2d95bd084a6a (diff)
downloadgcc-e45abe1f20e35a461c2378f4caf8b1455c98385d.zip
gcc-e45abe1f20e35a461c2378f4caf8b1455c98385d.tar.gz
gcc-e45abe1f20e35a461c2378f4caf8b1455c98385d.tar.bz2
Hot/cold attributes for labels.
gcc/ * doc/extend.texi (attribute): Document hot/cold for labels. * predict.c (tree_estimate_probability_bb): Handle hot/cold attributes on user labels. * predict.def (PRED_HOT_LABEL, PRED_COLD_LABEL): New. gcc/c-family/ * c-common.c (handle_hot_attribute): Allow labels. (handle_cold_attribute): Likewise. gcc/testsuite/ * gcc.dg/attr-hotcold-1.c: New. * gcc.dg/tree-ssa/attr-hotcold-2.c: New. From-SVN: r189898
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/attr-hotcold-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c28
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/attr-hotcold-1.c b/gcc/testsuite/gcc.dg/attr-hotcold-1.c
new file mode 100644
index 0000000..f63a95c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-hotcold-1.c
@@ -0,0 +1,8 @@
+void f(void)
+{
+ goto A;
+ A: __attribute__((cold))
+ goto B;
+ B: __attribute__((hot))
+ return;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c b/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c
new file mode 100644
index 0000000..84327fe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-profile_estimate-details" } */
+
+void g(void);
+void h(void);
+void f(int x, int y)
+{
+ if (x) goto A;
+ if (y) goto B;
+ return;
+
+ A: __attribute__((cold))
+ g();
+ return;
+
+ B: __attribute__((hot))
+ h();
+ return;
+}
+
+/* { dg-final { scan-ipa-dump-times "block 4, loop depth 0, count 0, freq 1\[^0-9\]" 1 "profile_estimate" } } */
+
+/* Note: we're attempting to match some number > 6000, i.e. > 60%.
+ The exact number ought to be tweekable without having to juggle
+ the testcase around too much. */
+/* { dg-final { scan-ipa-dump-times "block 5, loop depth 0, count 0, freq \[6-9\]\[0-9\]\[0-9\]\[0-9\]" 1 "profile_estimate" } } */
+
+/* { dg-final { cleanup-tree-dump "profile_estimate" } } */