aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 97800bf..5096522 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -7210,12 +7210,11 @@ fold_builtin_strchr (tree exp, bool actually_strrchr)
r = actually_strrchr ? strrchr (p1, c) : strchr (p1, c);
if (r == NULL)
- return fold_convert (TREE_TYPE (s1), integer_zero_node);
+ return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
- s1, fold_convert (TREE_TYPE (s1),
- ssize_int (r - p1))));
+ s1, build_int_cst (TREE_TYPE (s1), r - p1)));
}
if (actually_strrchr)
@@ -8645,12 +8644,11 @@ simplify_builtin_strstr (tree arglist)
const char *r = strstr (p1, p2);
if (r == NULL)
- return fold_convert (TREE_TYPE (s1), integer_zero_node);
+ return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
- s1, fold_convert (TREE_TYPE (s1),
- ssize_int (r - p1))));
+ s1, build_int_cst (TREE_TYPE (s1), r - p1)));
}
if (p2[0] == '\0')
@@ -8714,12 +8712,11 @@ simplify_builtin_strchr (tree arglist)
r = strchr (p1, c);
if (r == NULL)
- return fold_convert (TREE_TYPE (s1), integer_zero_node);
+ return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
- s1, fold_convert (TREE_TYPE (s1),
- ssize_int (r - p1))));
+ s1, build_int_cst (TREE_TYPE (s1), r - p1)));
}
/* FIXME: Should use here strchrM optab so that ports can optimize
@@ -8771,12 +8768,11 @@ simplify_builtin_strrchr (tree arglist)
r = strrchr (p1, c);
if (r == NULL)
- return fold_convert (TREE_TYPE (s1), integer_zero_node);
+ return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
- s1, fold_convert (TREE_TYPE (s1),
- ssize_int (r - p1))));
+ s1, build_int_cst (TREE_TYPE (s1), r - p1)));
}
if (! integer_zerop (s2))
@@ -8829,12 +8825,11 @@ simplify_builtin_strpbrk (tree arglist)
const char *r = strpbrk (p1, p2);
if (r == NULL)
- return fold_convert (TREE_TYPE (s1), integer_zero_node);
+ return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
- s1, fold_convert (TREE_TYPE (s1),
- ssize_int (r - p1))));
+ s1, build_int_cst (TREE_TYPE (s1), r - p1)));
}
if (p2[0] == '\0')