File: branch-phi-thread.ll

package info (click to toggle)
llvm 2.2-12
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 38,648 kB
  • ctags: 28,258
  • sloc: cpp: 215,479; sh: 12,132; ansic: 10,002; yacc: 5,525; perl: 2,352; ml: 1,580; makefile: 956; pascal: 718; lex: 602; exp: 320; ada: 193; lisp: 160; csh: 116; objc: 59; python: 59; tcl: 20
file content (65 lines) | stat: -rw-r--r-- 1,076 bytes parent folder | download
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
; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -adce | llvm-dis | \
; RUN:   not grep {call void %f1}
; END.

declare void %f1()
declare void %f2()
declare void %f3()
declare void %f4()

implementation

int %test1(int %X, bool %D) {
E:
	%C = seteq int %X, 0
	br bool %C, label %T, label %F
T:
	br bool %C, label %B, label %A
A:
	call void %f1()
	br bool %D, label %T, label %F
B:
	call void %f2()
	ret int 345
F:
	call void %f3()
	ret int 123
}

int %test2(int %X, bool %D) {
E:
	%C = seteq int %X, 0
	br bool %C, label %T, label %F
T:
	%P = phi bool [true, %E], [%C, %A]
	br bool %P, label %B, label %A
A:
	call void %f1()
	br bool %D, label %T, label %F
B:
	call void %f2()
	ret int 345
F:
	call void %f3()
	ret int 123
}

int %test3(int %X, bool %D, int* %AP, int* %BP) {
E:
	%C = seteq int %X, 0
	br bool %C, label %T, label %F
T:
	call void %f3()  ;; Inst in block.
	%XX = load int* %AP
	store int %XX, int* %BP
	br bool %C, label %B, label %A
A:
	call void %f1()
	br bool %D, label %T, label %F
B:
	call void %f2()
	ret int 345
F:
	call void %f3()
	ret int 123
}