diff gcc/testsuite/gcc.dg/predict-22.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.dg/predict-22.c	Thu Feb 13 11:34:05 2020 +0900
@@ -0,0 +1,59 @@
+/* { dg-do compile { target freorder } } */
+/* { dg-options "-O2 -fdump-tree-optimized-details-blocks -fdump-rtl-bbpart-details-blocks -freorder-blocks-and-partition" } */
+volatile int v;
+void bar (void) __attribute__((leaf, cold));
+void baz (int *);
+
+void
+foo (int x, int y, int z)
+{
+  static int f __attribute__((section ("mysection")));
+  f = 1;
+  if (__builtin_expect (x, 0))
+  if (__builtin_expect (y, 0))
+  if (__builtin_expect (z, 0))
+    {
+      f = 2;
+      bar ();
+      v += 1;
+      v *= 2;
+      v /= 2;
+      v -= 1;
+      v += 1;
+      v *= 2;
+      v /= 2;
+      v -= 1;
+      v += 1;
+      v *= 2;
+      v /= 2;
+      v -= 1;
+      v += 1;
+      v *= 2;
+      v /= 2;
+      v -= 1;
+      v += 1;
+      v *= 2;
+      v /= 2;
+      v -= 1;
+      v += 1;
+      v *= 2;
+      v /= 2;
+      v -= 1;
+      v += 1;
+      v *= 2;
+      v /= 2;
+      v -= 1;
+      v += 1;
+      v *= 2;
+      v /= 2;
+      v -= 1;
+      f = 3;
+      __builtin_abort ();
+    }
+  f = 4;
+  f = 5;
+  baz (&f);
+}
+/* { dg-final { scan-tree-dump-times "Invalid sum" 0 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "count 0 .precise.," 1 "optimized"} } */
+/* { dg-final { scan-rtl-dump-times "COLD_PARTITION" 1 "bbpart"} } */