[LLVMdev] Integer factorizations in clang

Duncan Sands baldrick at free.fr
Thu Jan 5 07:27:59 PST 2012


Hi Ivan,

> I have a small test case :
>
> a = b * c + b * d
>
> and clang is fatorizing b to get only one multiplication (-O3) which is
> normally good for most architectures. But in my case, that pattern takes
> just one instruction and I would like to recover it as is.
> Where can I find this particular optimization in clang ?
> Is there a way of setting multiplications as being cheaper than
> additions/subtracions in clang ?

if you see the b*(c+d) pattern can't you just generate your b*c+b*d instruction
for it?

Ciao, Duncan.



More information about the llvm-dev mailing list