Re: helping the compiler with asserts-hints to optimize

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

 



On 04/24/14 06:40, Agustin Perez Paladini wrote:

int
fun_module(int a)
{
     ASSUME(a % 4 == 0);

     if (a == 3) {
         return 123;
     }
     return 789;
}

giving this asm

fun_module:
     .LFB3:
     .cfi_startproc
     cmpl $3, 4(%esp)
     movl $789, %edx
     movl $123, %eax
     cmovne %edx, %eax
     ret
     .cfi_endproc


Anyway, I think its pretty much what I was looking for.
Feel free to file a bug report for this one. VRP doesn't have a nonzero/zero bits tracking lattice, but it's something I can see being added at some point and having examples like this in the BZ database is often helpful when doing that kind of optimization work.

Thanks,

Jeff




[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