Commit 21722777 by Martin Sebor Committed by Martin Sebor

tree-ssa-strlen.c (adjust_related_strinfos): Avoid trailing article.


gcc/ChangeLog:

	* tree-ssa-strlen.c (adjust_related_strinfos): Avoid trailing article.
	(handle_builtin_malloc): Remove trailing spaces.
	(handle_builtin_memset): Same.
	(handle_builtin_memcmp): Same.
	(compute_string_length): Same.
	(determine_min_objsize): Same.
	(handle_builtin_string_cmp): Same.
	(handle_char_store): Same.  Break up excessively long line.

From-SVN: r272016
parent c56c8602
2019-06-06 Martin Sebor <msebor@redhat.com>
* tree-ssa-strlen.c (adjust_related_strinfos): Avoid trailing article.
(handle_builtin_malloc): Remove trailing spaces.
(handle_builtin_memset): Same.
(handle_builtin_memcmp): Same.
(compute_string_length): Same.
(determine_min_objsize): Same.
(handle_builtin_string_cmp): Same.
(handle_char_store): Same. Break up excessively long line.
2019-06-06 Martin Jambor <mjambor@suse.cz> 2019-06-06 Martin Jambor <mjambor@suse.cz>
* tree-sra.c (build_reconstructed_reference): Drop the alignment * tree-sra.c (build_reconstructed_reference): Drop the alignment
......
...@@ -891,9 +891,9 @@ adjust_related_strinfos (location_t loc, strinfo *origsi, tree adj) ...@@ -891,9 +891,9 @@ adjust_related_strinfos (location_t loc, strinfo *origsi, tree adj)
tree tem; tree tem;
si = unshare_strinfo (si); si = unshare_strinfo (si);
/* We shouldn't see delayed lengths here; the caller must have /* We shouldn't see delayed lengths here; the caller must
calculated the old length in order to calculate the have calculated the old length in order to calculate
adjustment. */ the adjustment. */
gcc_assert (si->nonzero_chars); gcc_assert (si->nonzero_chars);
tem = fold_convert_loc (loc, TREE_TYPE (si->nonzero_chars), adj); tem = fold_convert_loc (loc, TREE_TYPE (si->nonzero_chars), adj);
si->nonzero_chars = fold_build2_loc (loc, PLUS_EXPR, si->nonzero_chars = fold_build2_loc (loc, PLUS_EXPR,
...@@ -2898,8 +2898,8 @@ handle_builtin_memcmp (gimple_stmt_iterator *gsi) ...@@ -2898,8 +2898,8 @@ handle_builtin_memcmp (gimple_stmt_iterator *gsi)
return true; return true;
} }
/* Given an index to the strinfo vector, compute the string length for the /* Given an index to the strinfo vector, compute the string length
corresponding string. Return -1 when unknown. */ for the corresponding string. Return -1 when unknown. */
static HOST_WIDE_INT static HOST_WIDE_INT
compute_string_length (int idx) compute_string_length (int idx)
...@@ -2924,8 +2924,8 @@ compute_string_length (int idx) ...@@ -2924,8 +2924,8 @@ compute_string_length (int idx)
return string_leni; return string_leni;
} }
/* Determine the minimum size of the object referenced by DEST expression which /* Determine the minimum size of the object referenced by DEST expression
must have a pointer type. which must have a pointer type.
Return the minimum size of the object if successful or NULL when the size Return the minimum size of the object if successful or NULL when the size
cannot be determined. */ cannot be determined. */
static tree static tree
...@@ -2936,8 +2936,8 @@ determine_min_objsize (tree dest) ...@@ -2936,8 +2936,8 @@ determine_min_objsize (tree dest)
if (compute_builtin_object_size (dest, 2, &size)) if (compute_builtin_object_size (dest, 2, &size))
return build_int_cst (sizetype, size); return build_int_cst (sizetype, size);
/* Try to determine the size of the object through the RHS of the /* Try to determine the size of the object through the RHS
assign statement. */ of the assign statement. */
if (TREE_CODE (dest) == SSA_NAME) if (TREE_CODE (dest) == SSA_NAME)
{ {
gimple *stmt = SSA_NAME_DEF_STMT (dest); gimple *stmt = SSA_NAME_DEF_STMT (dest);
...@@ -2984,11 +2984,11 @@ determine_min_objsize (tree dest) ...@@ -2984,11 +2984,11 @@ determine_min_objsize (tree dest)
to a non-zero value. to a non-zero value.
* otherwise, do nothing now. * otherwise, do nothing now.
B. When the length of one argument is constant, try to replace the call with B. When the length of one argument is constant, try to replace the call
a __builtin_str(n)cmp_eq call where possible, i.e: with a __builtin_str(n)cmp_eq call where possible, i.e:
strncmp (s, STR, C) (!)= 0 in which, s is a pointer to a string, STR is a strncmp (s, STR, C) (!)= 0 in which, s is a pointer to a string, STR
string with constant length , C is a constant. is a string with constant length , C is a constant.
if (C <= strlen(STR) && sizeof_array(s) > C) if (C <= strlen(STR) && sizeof_array(s) > C)
{ {
replace this call with replace this call with
...@@ -3000,8 +3000,8 @@ determine_min_objsize (tree dest) ...@@ -3000,8 +3000,8 @@ determine_min_objsize (tree dest)
can handled by the following strcmp. can handled by the following strcmp.
} }
strcmp (s, STR) (!)= 0 in which, s is a pointer to a string, STR is a strcmp (s, STR) (!)= 0 in which, s is a pointer to a string, STR
string with constant length. is a string with constant length.
if (sizeof_array(s) > strlen(STR)) if (sizeof_array(s) > strlen(STR))
{ {
replace this call with replace this call with
...@@ -3083,8 +3083,8 @@ handle_builtin_string_cmp (gimple_stmt_iterator *gsi) ...@@ -3083,8 +3083,8 @@ handle_builtin_string_cmp (gimple_stmt_iterator *gsi)
return false; return false;
} }
/* When the lengths of both arguments are known, and they are unequal, we can /* When the lengths of both arguments are known, and they are unequal,
safely fold the call to a non-zero value for strcmp; we can safely fold the call to a non-zero value for strcmp;
othewise, do nothing now. */ othewise, do nothing now. */
if (idx1 != 0 && idx2 != 0) if (idx1 != 0 && idx2 != 0)
{ {
...@@ -3376,7 +3376,9 @@ handle_char_store (gimple_stmt_iterator *gsi) ...@@ -3376,7 +3376,9 @@ handle_char_store (gimple_stmt_iterator *gsi)
gsi_next (gsi); gsi_next (gsi);
return false; return false;
} }
else if (storing_all_zeros_p || storing_nonzero_p || (offset != 0 && cmp > 0)) else if (storing_all_zeros_p
|| storing_nonzero_p
|| (offset != 0 && cmp > 0))
{ {
/* When STORING_NONZERO_P, we know that the string will start /* When STORING_NONZERO_P, we know that the string will start
with at least OFFSET + 1 nonzero characters. If storing with at least OFFSET + 1 nonzero characters. If storing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment