Re: Tr : [redundency elimination, code motion, commun expression elimination] GCC optimizations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff Law <law@xxxxxxxxxx> writes:
> The tail merging code in the RTL optimizers might pick this stuff up
> and Tom's work on block merging might as well.  It'd be worth
> looking into why they aren't triggering.

Hmm, actually testing with a recent gcc snapshot, it _is_ merging the
two if-blocks:

   int a, b, c, d, e, f;
   extern void foo ();
   void t (int x)
   {
     if (x==1) { a=b; c=d; e=f; foo(); }
     if (x==2) { a=b; c=d; e=f; foo(); }
   }

=>

   t:
           cmpl	$1, %edi
           je	.L4
           cmpl	$2, %edi
           je	.L4
           rep
           ret
   .L4:
           movl	b(%rip), %eax
           movl	%eax, a(%rip)
           movl	d(%rip), %eax
           movl	%eax, c(%rip)
           movl	f(%rip), %eax
           movl	%eax, e(%rip)
           xorl	%eax, %eax
           jmp	foo
           ...
           .ident	"GCC: (Debian 20110924-1) 4.7.0 20110924 (experimental) [trunk revision 179143]"

-Miles

-- 
Quotation, n. The act of repeating erroneously the words of another. The words
erroneously repeated.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux