ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar non-pointer assignments.
authorMartin Jambor <mjambor@suse.cz>
Tue, 19 Apr 2011 16:19:13 +0000 (18:19 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Tue, 19 Apr 2011 16:19:13 +0000 (18:19 +0200)
2011-04-19  Martin Jambor  <mjambor@suse.cz>

* ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar
non-pointer assignments.

From-SVN: r172717

gcc/ChangeLog
gcc/ipa-prop.c

index 7ada452d6ef24f0ac7869519acd4b25a7ee706c1..785980d91d1040b442a90abcb9c23ae3cb70d86a 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-19  Martin Jambor  <mjambor@suse.cz>
+
+       * ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar
+       non-pointer assignments.
+
 2011-04-19  Martin Jambor  <mjambor@suse.cz>
 
        * ipa-cp.c (ipcp_process_devirtualization_opportunities): Take into
index c482165a6f38f38cc23103358c67bef6f5ff524a..6620d5791cdd34d1655a6898886788c89ce14a23 100644 (file)
@@ -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;
 }