aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine/mul.ll
blob: 793040e87792670746f395244ad7f5848cf588b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; This test makes sure that mul instructions are properly eliminated.
;

; RUN: if as < %s | opt -instcombine | dis | grep mul
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi

implementation

int "test1"(int %A)
begin
	%B = mul int %A, 1
	ret int %B
end

int "test2"(int %A)
begin
	%B = mul int %A, 2   ; Should convert to an add instruction
	ret int %B
end

int "test3"(int %A)
begin
	%B = mul int %A, 0   ; This should disappear entirely
	ret int %B
end