summaryrefslogtreecommitdiff
path: root/test/Transforms/GCSE/gcsetests.ll
blob: b866bb7eda7235a73c945f8fe092882c0f5ece3d (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
; Various test cases to ensure basic functionality is working for GCSE

; RUN: llvm-upgrade < %s | llvm-as | opt -gcse

implementation

void "testinsts"(int %i, int %j, int* %p)
begin
	%A = cast int %i to uint
	%B = cast int %i to uint
	
	%C = shl int %i, ubyte 1
	%D = shl int %i, ubyte 1

	%E = getelementptr int* %p, long 12
	%F = getelementptr int* %p, long 12
	%G = getelementptr int* %p, long 13
	ret void
end


; Test different combinations of domination properties...
void "sameBBtest"(int %i, int %j)
begin
	%A = add int %i, %j
	%B = add int %i, %j

	%C = xor int %A, -1
	%D = xor int %B, -1
	%E = xor int %j, -1

	ret void
end

int "dominates"(int %i, int %j)
begin
	%A = add int %i, %j
	br label %BB2

BB2:
	%B = add int %i, %j
	ret int %B
end

int "hascommondominator"(int %i, int %j)
begin
	br bool true, label %BB1, label %BB2

BB1:
	%A = add int %i, %j
	ret int %A

BB2:
	%B = add int %i, %j
	ret int %B
end