This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Fix handling of pure/const in tree-ssa-structalias.c


This makes it so we don't add points-to anything constraints for
pure/const calls. Since they can't write anywhere, the can't cause
change what something points-to.

Bootstrapped and regtested on i686-darwin.
I will apply later today

--Dan
2008-06-18  Daniel Berlin  <dberlin@dberlin.org>

        * tree-ssa-structalias.c (handle_rhs_call): Fix handling of pure
        and const functions.
Index: tree-ssa-structalias.c
===================================================================
--- tree-ssa-structalias.c	(revision 136882)
+++ tree-ssa-structalias.c	(working copy)
@@ -3583,6 +3583,11 @@ handle_rhs_call  (tree rhs)
   call_expr_arg_iterator iter;
   struct constraint_expr rhsc;
 
+  /* Pure and const calls don't pointers to point-to anything since they
+     can't write anywhere or call anything not pure or const.  */
+  if (call_expr_flags (rhs) & (ECF_CONST | ECF_PURE))
+    return;
+
   rhsc.var = anything_id;
   rhsc.offset = 0;
   rhsc.type = ADDRESSOF;

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