793040e87792670746f395244ad7f5848cf588b3
[oota-llvm.git] / test / Transforms / InstCombine / mul.ll
1 ; This test makes sure that mul instructions are properly eliminated.
2 ;
3
4 ; RUN: if as < %s | opt -instcombine | dis | grep mul
5 ; RUN: then exit 1
6 ; RUN: else exit 0
7 ; RUN: fi
8
9 implementation
10
11 int "test1"(int %A)
12 begin
13         %B = mul int %A, 1
14         ret int %B
15 end
16
17 int "test2"(int %A)
18 begin
19         %B = mul int %A, 2   ; Should convert to an add instruction
20         ret int %B
21 end
22
23 int "test3"(int %A)
24 begin
25         %B = mul int %A, 0   ; This should disappear entirely
26         ret int %B
27 end
28