2010-11-10 Jan Hubicka <jh@suse.cz>
+ PR tree-optimize/33172
+ PR tree-optimize/43411
+ * gcc.dg/tree-ssa/pr33172.c: New testcase.
+ * g++.dg/tree-ssa/pr43411.C: New testcase.
+
+2010-11-10 Jan Hubicka <jh@suse.cz>
+
PR tree-optimize/46228
* g++.dg/tree-ssa/pr46228.C: New testcase.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+class P { public: virtual int val() { return 123; } };
+class Psub : public P { };
+
+extern int sink1, sink2;
+
+void test() {
+ Psub p;
+ P &pRef = p;
+ sink1 = p.val();
+ sink2 = pRef.val();
+}
+
+
+inline int v(P &p) { return p.val(); }
+
+void testInlineP() {
+ P p;
+ sink1 = v(p);
+}
+
+void testInlinePsub() {
+ Psub p;
+ sink1 = v(p);
+}
+
+// { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "optimized" } }
+// { dg-final { cleanup-tree-dump "optimized" } }
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+struct abc {
+ void (*abc_call)(void);
+};
+
+/*
+ * Use only any one of the three definitions below at a time:
+ *
+ * 1. nothing optimized away. Good.
+ * 2. call_func() _not_ optimized away, but struct xyz is. gcc disappoints.
+ * 3. both call_func() and struct xyz optimized away. Nice.
+ */
+
+/* 1 */
+/*extern int do_register(struct abc *xyz);*/
+
+/* 2 */
+static inline int do_register(struct abc *xyz)
+{
+ return 0;
+}
+
+/* 3 */
+/*#define do_register(xyz) do { (void)(xyz); } while (0)*/
+
+static void call_func(void)
+{
+}
+
+static struct abc xyz = {
+ .abc_call = call_func,
+};
+
+void func(void)
+{
+ do_register(&xyz);
+}
+
+/* { dg-final { scan-tree-dump-not "call_func" "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */