[PATCH] Enhance urem to bitwise-and optimization

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed May 8 20:54:43 PDT 2013


>>
>> Is the select case really redundant now?
>
> Yes, llvm::isKnownToBeAPowerOfTwo has support for select instructions. The
> function 'test4' in rem.ll provides verification that we still handle select
> instructions.

OK. We will now convert

urem X, (select Cond, 2^C1, 2^C2)

to

X and ((select Cond, 2^C1, 2^C2) - 1)

Instead of creating the two ands. I guess that is fine. Having the
test uses filecehck should make this change explicit to anyone reading
the patch.

Cheers,
Rafael



More information about the llvm-commits mailing list