diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-19 11:42:30 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-19 11:42:30 +0000 |
commit | b307cdec4c2432db7b868d3c5cc86a2ef9a4eaac (patch) | |
tree | b4a6cf8d09ece86719d87f79f3bcfca0c7c4a6da | |
parent | 553c730265fbaace4c46d760297f315c2ca87cf9 (diff) | |
download | gcc-b307cdec4c2432db7b868d3c5cc86a2ef9a4eaac.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194606 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/devirt-9.C | 30 |
4 files changed, 48 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c6c840cf25..694062f7274 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 55bd372e0a8..4f887a0acc4 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6719b296651..0a8580c4d8f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 00000000000..62ea96e5eed --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/devirt-9.C @@ -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" } } */ |