• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -simplifycfg -adce -S | \
2; RUN:   not grep "call void @f1"
3; END.
4
5declare void @f1()
6
7declare void @f2()
8
9declare void @f3()
10
11declare void @f4()
12
13define i32 @test1(i32 %X, i1 %D) {
14E:
15	%C = icmp eq i32 %X, 0		; <i1> [#uses=2]
16	br i1 %C, label %T, label %F
17T:		; preds = %A, %E
18	br i1 %C, label %B, label %A
19A:		; preds = %T
20	call void @f1( )
21	br i1 %D, label %T, label %F
22B:		; preds = %T
23	call void @f2( )
24	ret i32 345
25F:		; preds = %A, %E
26	call void @f3( )
27	ret i32 123
28}
29
30define i32 @test2(i32 %X, i1 %D) {
31E:
32	%C = icmp eq i32 %X, 0		; <i1> [#uses=2]
33	br i1 %C, label %T, label %F
34T:		; preds = %A, %E
35	%P = phi i1 [ true, %E ], [ %C, %A ]		; <i1> [#uses=1]
36	br i1 %P, label %B, label %A
37A:		; preds = %T
38	call void @f1( )
39	br i1 %D, label %T, label %F
40B:		; preds = %T
41	call void @f2( )
42	ret i32 345
43F:		; preds = %A, %E
44	call void @f3( )
45	ret i32 123
46}
47
48define i32 @test3(i32 %X, i1 %D, i32* %AP, i32* %BP) {
49E:
50	%C = icmp eq i32 %X, 0		; <i1> [#uses=2]
51	br i1 %C, label %T, label %F
52T:		; preds = %A, %E
53	call void @f3( )
54	%XX = load i32, i32* %AP		; <i32> [#uses=1]
55	store i32 %XX, i32* %BP
56	br i1 %C, label %B, label %A
57A:		; preds = %T
58	call void @f1( )
59	br i1 %D, label %T, label %F
60B:		; preds = %T
61	call void @f2( )
62	ret i32 345
63F:		; preds = %A, %E
64	call void @f3( )
65	ret i32 123
66}
67