This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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  <>

	* 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))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]