[Bug rtl-optimization/53417] New: multiple assignments can be optimized
daniel.marjamaki at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat May 19 17:29:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53417
Bug #: 53417
Summary: multiple assignments can be optimized
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.marjamaki@gmail.com
Hello!
It seems to me that assignments can be optimised more.
Example code:
struct X {
char a;
char b;
char c;
char d;
};
void dummy(struct X *x1);
void f() {
struct X x = {0,0,0,0};
dummy(&x);
}
I compile that and look at the assembly code:
gcc -c -O2 test1.c
objdump -d test1.o
In the assembly output the struct is initialized using 4 movb instructions.
I wonder if there can't be an optimizer pass that replace these 4 movb
instructions with a single movl instruction. I assume that would be faster.
More information about the Gcc-bugs
mailing list