From 776e4fe2cacf85c639bbf98ffc49da0ea4d996b2 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Wed, 18 May 2016 18:41:19 +0200 Subject: [PATCH] Const parameters are always unmodified 2016-05-18 Martin Jambor PR ipa/69708 * ipa-prop.c (parm_preserved_before_stmt_p): Return true for loads from TREE_READONLY parameters. From-SVN: r236417 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-prop.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3a8e9a76373..7924d1f98c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-18 Martin Jambor + + PR ipa/69708 + * ipa-prop.c (parm_preserved_before_stmt_p): Return true for loads + from TREE_READONLY parameters. + 2016-05-18 Martin Jambor PR ipa/69708 diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 785f2f43ab7..117a0255b1b 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -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 -- 2.30.2