This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/53417] New: multiple assignments can be optimized


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]