llvm.org GIT mirror llvm / c49c08f
Test -simplifycfg only. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45389 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 11 years ago
1 changed file(s) with 23 addition(s) and 46 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llvm-as < %s | opt -std-compile-opts -disable-output
1
0 ;RUN: llvm-as < %s | opt -simplifycfg -disable-output
21 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
32
4 define i32 @bork() {
3 define i32 @bork() nounwind {
54 entry:
6 %retval = alloca i32 ; [#uses=2]
7 %opt = alloca i32 ; [#uses=3]
8 %undo = alloca i32 ; [#uses=3]
9 %tmp = alloca i32 ; [#uses=3]
10 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
11 store i32 0, i32* %undo, align 4
5 br label %bb5.outer
6
7 bb5.outer.loopexit: ; preds = %bb5
8 br label %bb5.outer
9
10 bb5.outer: ; preds = %bb5.outer.loopexit, %entry
11 %undo.0.ph = phi i32 [ 0, %entry ], [ 1, %bb5.outer.loopexit ] ; [#uses=1]
1212 br label %bb5
1313
14 bb: ; preds = %bb5
15 %tmp1 = load i32* %opt, align 4 ; [#uses=1]
16 switch i32 %tmp1, label %bb4 [
17 i32 102, label %bb3
18 i32 110, label %bb2
14 bb5: ; preds = %bb5, %bb5.outer
15 %tmp6 = tail call i32 (...)* @foo( ) nounwind ; [#uses=1]
16 switch i32 %tmp6, label %bb13 [
17 i32 -1, label %bb10
18 i32 102, label %bb5
19 i32 110, label %bb5.outer.loopexit
1920 ]
2021
21 bb2: ; preds = %bb
22 store i32 1, i32* %undo, align 4
23 br label %bb3
22 bb10: ; preds = %bb5
23 %tmp12 = tail call i32 (...)* @bar( i32 %undo.0.ph ) nounwind ; [#uses=0]
24 br label %UnifiedReturnBlock
2425
25 bb3: ; preds = %bb2, %bb
26 br label %bb5
26 bb13: ; preds = %bb5
27 br label %UnifiedReturnBlock
2728
28 bb4: ; preds = %bb
29 store i32 258, i32* %tmp, align 4
30 br label %bb13
31
32 bb5: ; preds = %bb3, %entry
33 %tmp6 = call i32 (...)* @foo( ) nounwind ; [#uses=1]
34 store i32 %tmp6, i32* %opt, align 4
35 %tmp7 = load i32* %opt, align 4 ; [#uses=1]
36 %tmp8 = icmp ne i32 %tmp7, -1 ; [#uses=1]
37 %tmp89 = zext i1 %tmp8 to i8 ; [#uses=1]
38 %toBool = icmp ne i8 %tmp89, 0 ; [#uses=1]
39 br i1 %toBool, label %bb, label %bb10
40
41 bb10: ; preds = %bb5
42 %tmp11 = load i32* %undo, align 4 ; [#uses=1]
43 %tmp12 = call i32 (...)* @bar( i32 %tmp11 ) nounwind ; [#uses=0]
44 store i32 1, i32* %tmp, align 4
45 br label %bb13
46
47 bb13: ; preds = %bb10, %bb4
48 %tmp14 = load i32* %tmp, align 4 ; [#uses=1]
49 store i32 %tmp14, i32* %retval, align 4
50 br label %return
51
52 return: ; preds = %bb13
53 %retval15 = load i32* %retval ; [#uses=1]
54 ret i32 %retval15
29 UnifiedReturnBlock: ; preds = %bb13, %bb10
30 %UnifiedRetVal = phi i32 [ 1, %bb10 ], [ 258, %bb13 ] ; [#uses=1]
31 ret i32 %UnifiedRetVal
5532 }
5633
5734 declare i32 @foo(...)