ipa-prop.c (detect_type_change): Shor circuit testing of type changes on THIS pointer.
* ipa-prop.c (detect_type_change): Shor circuit testing of type changes on THIS pointer. * g++.dg/ipa/devirrt-22.C: Fix template. From-SVN: r207495
This commit is contained in:
parent
d92f4df01a
commit
4bf2a588d4
|
@ -1,3 +1,8 @@
|
|||
2014-02-04 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
* ipa-prop.c (detect_type_change): Shor circuit testing of
|
||||
type changes on THIS pointer.
|
||||
|
||||
2014-02-04 John David Anglin <danglin@gcc.gnu.org>
|
||||
|
||||
PR target/59777
|
||||
|
|
|
@ -688,6 +688,19 @@ detect_type_change (tree arg, tree base, tree comp_type, gimple call,
|
|||
|| !BINFO_VTABLE (TYPE_BINFO (comp_type)))
|
||||
return false;
|
||||
|
||||
/* C++ methods are not allowed to change THIS pointer unless they
|
||||
are constructors or destructors. */
|
||||
if (TREE_CODE (base) == MEM_REF
|
||||
&& TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME
|
||||
&& SSA_NAME_IS_DEFAULT_DEF (TREE_OPERAND (base, 0))
|
||||
&& TREE_CODE (SSA_NAME_VAR (TREE_OPERAND (base, 0))) == PARM_DECL
|
||||
&& TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE
|
||||
&& !DECL_CXX_CONSTRUCTOR_P (current_function_decl)
|
||||
&& !DECL_CXX_DESTRUCTOR_P (current_function_decl)
|
||||
&& (SSA_NAME_VAR (TREE_OPERAND (base, 0))
|
||||
== DECL_ARGUMENTS (current_function_decl)))
|
||||
return false;
|
||||
|
||||
ao_ref_init (&ao, arg);
|
||||
ao.base = base;
|
||||
ao.offset = offset;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2014-02-04 Jan Hubicka <hubicka@ucw.cz>
|
||||
|
||||
* g++.dg/ipa/devirrt-22.C: Fix template.
|
||||
|
||||
2014-02-04 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/60036
|
||||
|
|
|
@ -37,5 +37,5 @@ void update_sources() {
|
|||
/* Note that we miss one devirtualization because we are not able to track the
|
||||
vtbl store in destructor.
|
||||
Previously we devirtualized to C::m_fn1 instead of B::m_fn1. */
|
||||
/* { dg-final { scan-tree-dump-times "Discovered a virtual call to a known target" 1 "cp" } } */
|
||||
/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "cp" } } */
|
||||
/* { dg-final { cleanup-ipa-dump "cp" } } */
|
||||
|
|
Loading…
Reference in New Issue