re PR middle-end/9967 (Some standard C function calls should not be replaced when optimizing for size)

gcc:
	PR middle-end/9967
	* builtins.c (expand_builtin_fputs): When optimizing for size,
	don't transform fputs into fwrite.
testsuite:
	PR middle-end/9967
	* gcc.c-torture/execute/stdio-opt-1.c: Adjust test for change to
	builtin fputs.

From-SVN: r65033
This commit is contained in:
Arpad Beszedes 2003-03-30 06:42:18 +02:00 committed by Kaveh Ghazi
parent 9964f5045d
commit 5b3e16ece9
4 changed files with 18 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2003-03-29 Arpad Beszedes <beszedes@cc.u-szeged.hu>
PR middle-end/9967
* builtins.c (expand_builtin_fputs): When optimizing for size,
don't transform fputs into fwrite.
2003-03-29 Albert Chin-A-Young <china@thewrittenword.com>
DJ Delorie <dj at redhat dot com>,
Bruce Korb <bkorb at gnu dot org>

View File

@ -3385,8 +3385,12 @@ expand_builtin_fputs (arglist, ignore, unlocked)
/* FALLTHROUGH */
case 1: /* length is greater than 1, call fwrite. */
{
tree string_arg = TREE_VALUE (arglist);
tree string_arg;
/* If optimizing for size keep fputs. */
if (optimize_size)
return 0;
string_arg = TREE_VALUE (arglist);
/* New argument list transforming fputs(string, stream) to
fwrite(string, 1, len, stream). */
arglist = build_tree_list (NULL_TREE, TREE_VALUE (TREE_CHAIN (arglist)));

View File

@ -1,3 +1,9 @@
2003-03-29 Arpad Beszedes <beszedes@cc.u-szeged.hu>
PR middle-end/9967
* gcc.c-torture/execute/stdio-opt-1.c: Adjust test for change to
builtin fputs.
2003-03-29 Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
* gcc.dg/20030323-1.c: New test.

View File

@ -54,7 +54,7 @@ int main()
return 0;
}
#ifdef __OPTIMIZE__
#if defined (__OPTIMIZE__) && ! defined (__OPTIMIZE_SIZE__)
/* When optimizing, all the above cases should be transformed into
something else. So any remaining calls to the original function
should abort. */