From: Martin Jambor Date: Tue, 19 Apr 2011 16:19:13 +0000 (+0200) Subject: ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar non-pointer assignments. X-Git-Tag: releases/gcc-4.7.0~7360 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0004f992f087081cab0f22574347d2d97ea698c1;p=thirdparty%2Fgcc.git ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar non-pointer assignments. 2011-04-19 Martin Jambor * ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar non-pointer assignments. From-SVN: r172717 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7ada452d6ef2..785980d91d10 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-04-19 Martin Jambor + + * ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar + non-pointer assignments. + 2011-04-19 Martin Jambor * ipa-cp.c (ipcp_process_devirtualization_opportunities): Take into diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index c482165a6f38..6620d5791cdd 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -405,13 +405,19 @@ stmt_may_be_vtbl_ptr_store (gimple stmt) { tree lhs = gimple_assign_lhs (stmt); - if (TREE_CODE (lhs) == COMPONENT_REF - && !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1)) - && !AGGREGATE_TYPE_P (TREE_TYPE (lhs))) + if (!AGGREGATE_TYPE_P (TREE_TYPE (lhs))) + { + if (flag_strict_aliasing + && !POINTER_TYPE_P (TREE_TYPE (lhs))) + return false; + + if (TREE_CODE (lhs) == COMPONENT_REF + && !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1))) return false; - /* In the future we might want to use get_base_ref_and_offset to find - if there is a field corresponding to the offset and if so, proceed - almost like if it was a component ref. */ + /* In the future we might want to use get_base_ref_and_offset to find + if there is a field corresponding to the offset and if so, proceed + almost like if it was a component ref. */ + } } return true; }