helping the compiler with asserts-hints to optimize
Jeff Law
law@redhat.com
Thu Apr 24 15:32:00 GMT 2014
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
More information about the Gcc-help
mailing list