This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/53417] New: multiple assignments can be optimized
- From: "daniel.marjamaki at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 19 May 2012 17:26:31 +0000
- Subject: [Bug rtl-optimization/53417] New: multiple assignments can be optimized
- Auto-submitted: auto-generated
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.