re PR ipa/63416 (Three calls to empty functions via pointers get folded, but not...
authorJan Hubicka <hubicka@ucw.cz>
Sun, 11 Sep 2016 12:08:28 +0000 (14:08 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 11 Sep 2016 12:08:28 +0000 (12:08 +0000)
PR ipa/64316
* gcc.dg/ipa/pr63416.c: New testcase.

From-SVN: r240081

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ipa/pr63416.c [new file with mode: 0644]

index 337593b..8766abb 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-09  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/64316
+       * gcc.dg/ipa/pr63416.c: New testcase.
+
 2016-09-10  Paul Thomas  <pault@gcc.gnu.org>
            Steven G. Kargl  <kargl@gcc.gnu.org>
 
diff --git a/gcc/testsuite/gcc.dg/ipa/pr63416.c b/gcc/testsuite/gcc.dg/ipa/pr63416.c
new file mode 100644 (file)
index 0000000..b5374c5
--- /dev/null
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized"  } */
+#define _UNUSED_ __attribute__((__unused__))
+
+typedef int TEST_F30 (int *v);
+typedef void TEST_F31 (int *v);
+typedef void TEST_F32 (int *v, int r);
+
+typedef struct TEST_T30_ {
+   TEST_F30 * pf30;
+   TEST_F31 * pf31;
+   TEST_F32 * pf32;
+} TEST_T30;
+
+static inline
+int test_f30 (int *v)
+{
+   *v = 1;
+   return 0;
+}//test_f30()
+
+static inline
+void test_f31 (int *v _UNUSED_)
+{
+}//test_f31()
+
+static inline
+void test_f32 (int *v, int r _UNUSED_)
+{
+   *v = 0;
+}//test_f32()
+
+static const
+TEST_T30 test_t30 = {
+   .pf30 = test_f30,
+   .pf31 = test_f31,
+   .pf32 = test_f32,
+};
+
+static inline
+int test_f10 (const TEST_T30 *pt30, int *v)
+{
+   int r = pt30->pf30(v);
+   pt30->pf31(v);
+   pt30->pf32(v, r);
+   return 0;
+}//test_f10()
+
+int test_f00 (int *v)
+{
+   return test_f10(&test_t30, v);
+}//test_f00()
+
+/* Everything should be inlined and only test_f00 body should appear.  */
+/* { dg-final { scan-tree-dump-not "test_f10" "optimized"  } } */
+/* { dg-final { scan-tree-dump-not "test_f3" "optimized"  } } */