This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] IPA pure const analysis shortcut
- From: Samuel Tardieu <sam at rfc1149 dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 24 Oct 2007 15:43:30 +0200
- Subject: [PATCH] IPA pure const analysis shortcut
[resubmit in proper format, thanks to David Edelsohn for the note]
When local->pure_const_state in ipa-pure-const.c/check_decl has been set to
IPA_NEITHER, it cannot be modified in the rest of the function, so it is
possible to return immediately. This should bring a tiny performance
improvement while not impairing the code readability.
2007-10-24 Samuel Tardieu <sam@rfc1149.net>
* ipa-pure-const.c: Return immediately when pure_const_state
has been set to IPA_NEITHER.
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 519b402..bfc3d56 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -113,8 +113,11 @@ check_decl (funct_state local,
/* Since we have dealt with the locals and params cases above, if we
are CHECKING_WRITE, this cannot be a pure or constant
function. */
- if (checking_write)
- local->pure_const_state = IPA_NEITHER;
+ if (checking_write)
+ {
+ local->pure_const_state = IPA_NEITHER;
+ return;
+ }
if (DECL_EXTERNAL (t) || TREE_PUBLIC (t))
{