Const parameters are always unmodified
authorMartin Jambor <mjambor@suse.cz>
Wed, 18 May 2016 16:41:19 +0000 (18:41 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 18 May 2016 16:41:19 +0000 (18:41 +0200)
2016-05-18  Martin Jambor  <mjambor@suse.cz>

PR ipa/69708
* ipa-prop.c (parm_preserved_before_stmt_p): Return true for loads
from TREE_READONLY parameters.

From-SVN: r236417

gcc/ChangeLog
gcc/ipa-prop.c

index 3a8e9a76373b81bb1fcc9a9616f3e0561cd199a8..7924d1f98c93ee5d6b1aa930dc19130096fe050f 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-18  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/69708
+       * ipa-prop.c (parm_preserved_before_stmt_p): Return true for loads
+       from TREE_READONLY parameters.
+
 2016-05-18  Martin Jambor  <mjambor@suse.cz>
 
        PR ipa/69708
index 785f2f43ab74c8813854a66491d3aa9f3aaef0c1..117a0255b1b9f09ab8adb6152cd9cdd1bcd34e42 100644 (file)
@@ -803,6 +803,11 @@ parm_preserved_before_stmt_p (struct ipa_func_body_info *fbi, int index,
   bool modified = false;
   ao_ref refd;
 
+  tree base = get_base_address (parm_load);
+  gcc_assert (TREE_CODE (base) == PARM_DECL);
+  if (TREE_READONLY (base))
+    return true;
+
   /* FIXME: FBI can be NULL if we are being called from outside
      ipa_node_analysis or ipcp_transform_function, which currently happens
      during inlining analysis.  It would be great to extend fbi's lifetime and