Test that we can reassociate (x<<1)+(y<<1) -> (X+Y)<<1.
[oota-llvm.git] / test / Transforms / Reassociate / shift-factor.ll
1 ; There should be exactly one shift and one add left.
2 ; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | grep shl | wc -l | grep 1 &&
3 ; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | grep add | wc -l | grep 1
4
5 int %test(int %X, int %Y) {
6         %tmp.2 = shl int %X, ubyte 1            ; <int> [#uses=1]
7         %tmp.6 = shl int %Y, ubyte 1            ; <int> [#uses=1]
8         %tmp.4 = add int %tmp.6, %tmp.2         ; <int> [#uses=1]
9         ret int %tmp.4
10 }
11