Subject: Backport r256009
2018-01-17 Martin Liska <mliska@suse.cz> Backport from mainline 2017-12-27 Martin Liska <mliska@suse.cz> PR tree-optimization/83552 * tree-ssa-strlen.c (fold_strstr_to_strncmp): Assign result of get_string_lenth to a SSA_NAME if not a GIMPLE value. 2018-01-17 Martin Liska <mliska@suse.cz> Backport from mainline 2017-12-27 Martin Liska <mliska@suse.cz> PR tree-optimization/83552 * gcc.dg/pr83552.c: New test. From-SVN: r256786
This commit is contained in:
parent
d64efb4249
commit
c7773e6715
|
@ -1,3 +1,12 @@
|
||||||
|
2018-01-17 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
|
Backport from mainline
|
||||||
|
2017-12-27 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
|
PR tree-optimization/83552
|
||||||
|
* tree-ssa-strlen.c (fold_strstr_to_strncmp): Assign result
|
||||||
|
of get_string_lenth to a SSA_NAME if not a GIMPLE value.
|
||||||
|
|
||||||
2018-01-16 Segher Boessenkool <segher@kernel.crashing.org>
|
2018-01-16 Segher Boessenkool <segher@kernel.crashing.org>
|
||||||
|
|
||||||
Backport from mainline
|
Backport from mainline
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2018-01-17 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
|
Backport from mainline
|
||||||
|
2017-12-27 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
|
PR tree-optimization/83552
|
||||||
|
* gcc.dg/pr83552.c: New test.
|
||||||
|
|
||||||
2018-01-16 Eric Botcazou <ebotcazou@adacore.com>
|
2018-01-16 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
PR testsuite/77734
|
PR testsuite/77734
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
/* PR tree-optimization/83364 */
|
||||||
|
/* { dg-options "-O2" } */
|
||||||
|
|
||||||
|
char *b;
|
||||||
|
char d[100];
|
||||||
|
void a ();
|
||||||
|
void
|
||||||
|
c (void)
|
||||||
|
{
|
||||||
|
__builtin_strcat (d, "12345");
|
||||||
|
if (__builtin_strstr (b, d) == b)
|
||||||
|
a ();
|
||||||
|
}
|
|
@ -2306,6 +2306,16 @@ fold_strstr_to_strncmp (tree rhs1, tree rhs2, gimple *stmt)
|
||||||
{
|
{
|
||||||
gimple_stmt_iterator gsi = gsi_for_stmt (call_stmt);
|
gimple_stmt_iterator gsi = gsi_for_stmt (call_stmt);
|
||||||
tree strncmp_decl = builtin_decl_explicit (BUILT_IN_STRNCMP);
|
tree strncmp_decl = builtin_decl_explicit (BUILT_IN_STRNCMP);
|
||||||
|
|
||||||
|
if (!is_gimple_val (arg1_len))
|
||||||
|
{
|
||||||
|
tree arg1_len_tmp = make_ssa_name (TREE_TYPE (arg1_len));
|
||||||
|
gassign *arg1_stmt = gimple_build_assign (arg1_len_tmp,
|
||||||
|
arg1_len);
|
||||||
|
gsi_insert_before (&gsi, arg1_stmt, GSI_SAME_STMT);
|
||||||
|
arg1_len = arg1_len_tmp;
|
||||||
|
}
|
||||||
|
|
||||||
gcall *strncmp_call = gimple_build_call (strncmp_decl, 3,
|
gcall *strncmp_call = gimple_build_call (strncmp_decl, 3,
|
||||||
arg0, arg1, arg1_len);
|
arg0, arg1, arg1_len);
|
||||||
tree strncmp_lhs = make_ssa_name (integer_type_node);
|
tree strncmp_lhs = make_ssa_name (integer_type_node);
|
||||||
|
|
Loading…
Reference in New Issue