summaryrefslogtreecommitdiff
path: root/test/Transforms/Inline/inline_cleanup.ll
blob: f0c153b4ca074b6c0951f2bc4b60820d99928314 (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
58
59
60
61
62
63
64
65
; Test that the inliner doesn't leave around dead allocas, and that it folds
; uncond branches away after it is done specializing.

; RUN: llvm-upgrade < %s | llvm-as | opt -inline -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -inline | llvm-dis | not grep 'alloca.*uses=0' &&
; RUN: llvm-upgrade < %s | llvm-as | opt -inline | llvm-dis | not grep 'br label'

%A = weak global int 0		; <int*> [#uses=1]
%B = weak global int 0		; <int*> [#uses=1]
%C = weak global int 0		; <int*> [#uses=1]

implementation   ; Functions:

internal fastcc void %foo(int %X) {
entry:
	%ALL = alloca int, align 4		; <int*> [#uses=1]
	%tmp1 = and int %X, 1		; <int> [#uses=1]
	%tmp1 = seteq int %tmp1, 0		; <bool> [#uses=1]
	br bool %tmp1, label %cond_next, label %cond_true

cond_true:		; preds = %entry
	store int 1, int* %A
	br label %cond_next

cond_next:		; preds = %entry, %cond_true
	%tmp4 = and int %X, 2		; <int> [#uses=1]
	%tmp4 = seteq int %tmp4, 0		; <bool> [#uses=1]
	br bool %tmp4, label %cond_next7, label %cond_true5

cond_true5:		; preds = %cond_next
	store int 1, int* %B
	br label %cond_next7

cond_next7:		; preds = %cond_next, %cond_true5
	%tmp10 = and int %X, 4		; <int> [#uses=1]
	%tmp10 = seteq int %tmp10, 0		; <bool> [#uses=1]
	br bool %tmp10, label %cond_next13, label %cond_true11

cond_true11:		; preds = %cond_next7
	store int 1, int* %C
	br label %cond_next13

cond_next13:		; preds = %cond_next7, %cond_true11
	%tmp16 = and int %X, 8		; <int> [#uses=1]
	%tmp16 = seteq int %tmp16, 0		; <bool> [#uses=1]
	br bool %tmp16, label %UnifiedReturnBlock, label %cond_true17

cond_true17:		; preds = %cond_next13
	call void %ext( int* %ALL )
	ret void

UnifiedReturnBlock:		; preds = %cond_next13
	ret void
}

declare void %ext(int*)

void %test() {
entry:
	tail call fastcc void %foo( int 1 )
	tail call fastcc void %foo( int 2 )
	tail call fastcc void %foo( int 3 )
	tail call fastcc void %foo( int 8 )
	ret void
}