===================================================================
@@ -4474,6 +4474,22 @@ find_func_aliases_for_builtin_call (stru
process_all_all_constraints (lhsc, rhsc);
}
return true;
+ /* Pure functions that return something not based on any object. */
+ case BUILT_IN_STRLEN:
+ case BUILT_IN_STRCMP:
+ case BUILT_IN_STRNCMP:
+ case BUILT_IN_STRCASECMP:
+ case BUILT_IN_STRNCASECMP:
+ case BUILT_IN_MEMCMP:
+ case BUILT_IN_BCMP:
+ case BUILT_IN_STRSPN:
+ case BUILT_IN_STRCSPN:
+ case BUILT_IN_OBJECT_SIZE:
+ case BUILT_IN_CONSTANT_P:
+ /* We don't need to do anything here. No constraints are necessary
+ for the return value and call handling for pure functions is
+ special-cased in the alias oracle. */
+ return true;
/* Trampolines are special - they set up passing the static
frame. */
case BUILT_IN_INIT_TRAMPOLINE:
===================================================================
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-strlen" } */
+
+void f (unsigned);
+
+void f3 (void)
+{
+ char s[] = "1234";
+
+ f (__builtin_strlen (s));
+ f (__builtin_strlen (s));
+ f (__builtin_strlen (s));
+}
+
+/* { dg-final { scan-tree-dump-times "strlen" 1 "strlen" } } */