]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-structalias.c (find_func_aliases): For memset use a constraint from NULL...
authorRichard Guenther <rguenther@suse.de>
Sat, 20 Jun 2009 12:03:16 +0000 (12:03 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sat, 20 Jun 2009 12:03:16 +0000 (12:03 +0000)
2009-06-20  Richard Guenther  <rguenther@suse.de>

* tree-ssa-structalias.c (find_func_aliases): For memset use
a constraint from NULL if we memset to zero.
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Add builtins
we explicitly handle that do not read from memory.
(call_may_clobber_ref_p_1): Properly handle builtins that may
set errno.

From-SVN: r148747

gcc/ChangeLog
gcc/tree-ssa-alias.c
gcc/tree-ssa-structalias.c

index 11db843e050ea8880f46fd34a299bb5d75517267..d25a5d060335e6bc75ffbc7e81573806d61544d5 100644 (file)
@@ -1,3 +1,12 @@
+2009-06-20  Richard Guenther  <rguenther@suse.de>
+
+       * tree-ssa-structalias.c (find_func_aliases): For memset use
+       a constraint from NULL if we memset to zero.
+       * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Add builtins
+       we explicitly handle that do not read from memory.
+       (call_may_clobber_ref_p_1): Properly handle builtins that may
+       set errno.
+
 2009-06-20  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/40495
index c83488b178806d5c14f38ce1f0aef541dc175080..98955246aea1cc523762e47616b3ba54e18b5d2c 100644 (file)
@@ -899,6 +899,29 @@ ref_maybe_used_by_call_p_1 (gimple call, tree ref)
            tree src = gimple_call_arg (call, 1);
            return ptr_deref_may_alias_ref_p (src, ref);
          }
+       /* The following builtins do not read from memory.  */
+       case BUILT_IN_FREE:
+       case BUILT_IN_MEMSET:
+       case BUILT_IN_FREXP:
+       case BUILT_IN_FREXPF:
+       case BUILT_IN_FREXPL:
+       case BUILT_IN_GAMMA_R:
+       case BUILT_IN_GAMMAF_R:
+       case BUILT_IN_GAMMAL_R:
+       case BUILT_IN_LGAMMA_R:
+       case BUILT_IN_LGAMMAF_R:
+       case BUILT_IN_LGAMMAL_R:
+       case BUILT_IN_MODF:
+       case BUILT_IN_MODFF:
+       case BUILT_IN_MODFL:
+       case BUILT_IN_REMQUO:
+       case BUILT_IN_REMQUOF:
+       case BUILT_IN_REMQUOL:
+       case BUILT_IN_SINCOS:
+       case BUILT_IN_SINCOSF:
+       case BUILT_IN_SINCOSL:
+         return false;
+
        default:
          /* Fallthru to general call handling.  */;
       }
@@ -1060,15 +1083,23 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
            tree ptr = gimple_call_arg (call, 0);
            return ptr_deref_may_alias_ref_p_1 (ptr, ref);
          }
-       case BUILT_IN_FREXP:
-       case BUILT_IN_FREXPF:
-       case BUILT_IN_FREXPL:
        case BUILT_IN_GAMMA_R:
        case BUILT_IN_GAMMAF_R:
        case BUILT_IN_GAMMAL_R:
        case BUILT_IN_LGAMMA_R:
        case BUILT_IN_LGAMMAF_R:
        case BUILT_IN_LGAMMAL_R:
+         {
+           tree out = gimple_call_arg (call, 1);
+           if (ptr_deref_may_alias_ref_p_1 (out, ref))
+             return true;
+           if (flag_errno_math)
+             break;
+           return false;
+         }
+       case BUILT_IN_FREXP:
+       case BUILT_IN_FREXPF:
+       case BUILT_IN_FREXPL:
        case BUILT_IN_MODF:
        case BUILT_IN_MODFF:
        case BUILT_IN_MODFL:
@@ -1081,7 +1112,11 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
        case BUILT_IN_REMQUOL:
          {
            tree out = gimple_call_arg (call, 2);
-           return ptr_deref_may_alias_ref_p_1 (out, ref);
+           if (ptr_deref_may_alias_ref_p_1 (out, ref))
+             return true;
+           if (flag_errno_math)
+             break;
+           return false;
          }
        case BUILT_IN_SINCOS:
        case BUILT_IN_SINCOSF:
index 09b87622836d78e2f1f4a621e4919604da779799..ac2c7dc04a83414aca92cba4facf44c4b974c9a5 100644 (file)
@@ -3674,8 +3674,17 @@ find_func_aliases (gimple origt)
                }
              get_constraint_for_ptr_offset (dest, NULL_TREE, &lhsc);
              do_deref (&lhsc);
-             ac.type = SCALAR;
-             ac.var = integer_id;
+             if (flag_delete_null_pointer_checks
+                 && integer_zerop (gimple_call_arg (t, 1)))
+               {
+                 ac.type = ADDRESSOF;
+                 ac.var = nothing_id;
+               }
+             else
+               {
+                 ac.type = SCALAR;
+                 ac.var = integer_id;
+               }
              ac.offset = 0;
              for (i = 0; VEC_iterate (ce_s, lhsc, i, lhsp); ++i)
                process_constraint (new_constraint (*lhsp, ac));