aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/Mem2Reg/PromoteMemToRegister.ll
blob: b540a291cea7718355cc02c25be2d1ecb044871a (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
; Simple sanity check testcase.  Both alloca's should be eliminated.
; RUN: llvm-as < %s | opt -mem2reg | llvm-dis | not grep 'alloca'

implementation

double "testfunc"(int %i, double %j)
begin
	%I = alloca int
	%J = alloca double

	store int %i, int* %I
	store double %j, double* %J

	%t1 = load int* %I
	%t2 = add int %t1, 1
	store int %t2, int* %I

	%t3 = load int* %I
	%t4 = cast int %t3 to double
	%t5 = load double* %J
	%t6 = mul double %t4, %t5

	ret double %t6
end