Commit d0d7f887 by Bernd Schmidt Committed by Aaron Sawdey

builtins.c (expand_builtin_memcmp): don't swap args unless result is only being compared with zero.

2016-09-29  Bernd Schmidt  <bschmidt@redhat.com>

	* builtins.c (expand_builtin_memcmp): don't swap args unless
	result is only being compared with zero.

From-SVN: r240625
parent 0b4b9552
2016-09-29 Bernd Schmidt <bschmidt@redhat.com>
* builtins.c (expand_builtin_memcmp): don't swap args unless
result is only being compared with zero.
2016-09-29 Marek Polacek <polacek@redhat.com> 2016-09-29 Marek Polacek <polacek@redhat.com>
* dwarf2out.c (loc_descriptor): Add fall through comment. * dwarf2out.c (loc_descriptor): Add fall through comment.
......
...@@ -3707,11 +3707,13 @@ expand_builtin_memcmp (tree exp, rtx target, bool result_eq) ...@@ -3707,11 +3707,13 @@ expand_builtin_memcmp (tree exp, rtx target, bool result_eq)
by_pieces_constfn constfn = NULL; by_pieces_constfn constfn = NULL;
const char *src_str = c_getstr (arg1); const char *src_str = c_getstr (arg2);
if (src_str == NULL) if (result_eq && src_str == NULL)
src_str = c_getstr (arg2); {
else src_str = c_getstr (arg1);
std::swap (arg1_rtx, arg2_rtx); if (src_str != NULL)
std::swap (arg1_rtx, arg2_rtx);
}
/* If SRC is a string constant and block move would be done /* If SRC is a string constant and block move would be done
by pieces, we can avoid loading the string from memory by pieces, we can avoid loading the string from memory
......
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