This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/34737] Scheduling of post-modified function arguments is not good
- From: "abnikant dot singh at atmel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Sep 2010 11:38:16 -0000
- Subject: [Bug tree-optimization/34737] Scheduling of post-modified function arguments is not good
- References: <bug-34737-14966@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from abnikant dot singh at atmel dot com 2010-09-13 11:38 -------
we get better code in the head. Both the cases [test1 and test2] produce the
same piece of code:
i.e for the following test case:
void foo(char *p);
void test1(char * p)
{
foo(p++);
foo(p++);
foo(p++);
foo(p++);
}
void test2(char * p)
{
foo(p); p++;
foo(p); p++;
foo(p); p++;
foo(p); p++;
}
we get:
test1:
push r28
push r29
/* prologue: function */
/* frame size = 0 */
/* stack size = 2 */
.L__stack_usage = 2
mov r28,r24
mov r29,r25
rcall foo
mov r24,r28
mov r25,r29
adiw r24,1
rcall foo
mov r24,r28
mov r25,r29
adiw r24,2
rcall foo
mov r24,r28
mov r25,r29
adiw r24,3
rcall foo
/* epilogue start */
pop r29
pop r28
ret
.size test1, .-test1
.global test2
.type test2, @function
test2:
push r28
push r29
/* prologue: function */
/* frame size = 0 */
/* stack size = 2 */
.L__stack_usage = 2
mov r28,r24
mov r29,r25
rcall foo
mov r24,r28
mov r25,r29
adiw r24,1
rcall foo
mov r24,r28
mov r25,r29
adiw r24,2
rcall foo
mov r24,r28
mov r25,r29
adiw r24,3
rcall foo
/* epilogue start */
pop r29
pop r28
ret
.size test2, .-test2
--
abnikant dot singh at atmel dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |abnikant dot singh at atmel
| |dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34737