]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/55683 (ICE in inline_call, at ipa-inline-transform.c:270)
authorJan Hubicka <jh@suse.cz>
Wed, 19 Dec 2012 11:42:30 +0000 (12:42 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 19 Dec 2012 11:42:30 +0000 (11:42 +0000)
PR tree-optimization/55683
* g++.dg/ipa/devirt-9.C: New testcase.

* ipa-prop.c (try_make_edge_direct_virtual_call): Look into constants for binfo.

From-SVN: r194606

gcc/ChangeLog
gcc/ipa-prop.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/devirt-9.C [new file with mode: 0644]

index 5c6c840cf253d5d7ae40c4dbc7de72db8675e23b..694062f727406c86b233cda681bf7b8a6657e196 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-18  Jan Hubicka  <jh@suse.cz>
+
+       PR tree-optimization/55683
+       * ipa-prop.c (try_make_edge_direct_virtual_call): Look into constants for binfo.
+
 2012-12-19  Terry Guo  <terry.guo@arm.com>
 
        * config/arm/arm.c (thumb_find_work_register): Check argument
index 55bd372e0a848b09a1b8f7b603d95cbba96a9a0e..4f887a0acc4974cc73cf65915ff74d36edb1e738 100644 (file)
@@ -2223,9 +2223,16 @@ try_make_edge_direct_virtual_call (struct cgraph_edge *ie,
 
   binfo = ipa_value_from_jfunc (new_root_info, jfunc);
 
-  if (!binfo || TREE_CODE (binfo) != TREE_BINFO)
+  if (!binfo)
     return NULL;
 
+  if (TREE_CODE (binfo) != TREE_BINFO)
+    {
+      binfo = gimple_extract_devirt_binfo_from_cst (binfo);
+      if (!binfo)
+        return NULL;
+    }
+
   binfo = get_binfo_at_offset (binfo, ie->indirect_info->offset,
                               ie->indirect_info->otr_type);
   if (binfo)
index 6719b296651da1642a6aa01385c8b4c06a9f9891..0a8580c4d8ff24fd193dc3c2d16aa542a8482490 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-18  Jan Hubicka  <jh@suse.cz>
+
+       PR tree-optimization/55683
+       * g++.dg/ipa/devirt-9.C: New testcase.
+
 2012-12-19  Terry Guo  <terry.guo@arm.com>
 
        * gcc.target/arm/thumb-find-work-register.c: New.
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-9.C b/gcc/testsuite/g++.dg/ipa/devirt-9.C
new file mode 100644 (file)
index 0000000..62ea96e
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-inline"  } */
+double foo ();
+struct B
+{
+  bool b1 () { return b3 (); }
+  void b2 ();
+  virtual bool b3 ();
+};
+struct C
+{
+  C () {}
+  bool
+  c1 (float x, float y)
+  {
+    if (x != c3 || y != c4)
+      c2.b2 ();
+    return c2.b1 ();
+  }
+  B c2;
+  float c3, c4;
+};
+
+void
+bar ()
+{
+  static C c;
+  c.c1 (60, (int) foo ());
+}
+/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target"  "inline"  } } */