2 ; RUN: opt -S -passes=dfa-jump-threading %s -debug-only=dfa-jump-threading 2>&1 | FileCheck %s
4 ; CHECK-COUNT-3: Exiting early due to unpredictability heuristic.
6 @.str.1 = private unnamed_addr constant [3 x i8] c"10\00", align 1
7 @.str.2 = private unnamed_addr constant [3 x i8] c"30\00", align 1
8 @.str.3 = private unnamed_addr constant [3 x i8] c"20\00", align 1
9 @.str.4 = private unnamed_addr constant [3 x i8] c"40\00", align 1
11 define void @test1(i32 noundef %num, i32 noundef %num2) {
15 while.body: ; preds = %entry, %sw.epilog
16 %num.addr.0 = phi i32 [ %num, %entry ], [ %num.addr.1, %sw.epilog ]
17 switch i32 %num.addr.0, label %sw.default [
24 sw.bb: ; preds = %while.body
25 %call.i = tail call i32 @bar(ptr noundef nonnull @.str.1)
28 sw.bb1: ; preds = %while.body
29 %call.i4 = tail call i32 @bar(ptr noundef nonnull @.str.2)
32 sw.bb2: ; preds = %while.body
33 %call.i5 = tail call i32 @bar(ptr noundef nonnull @.str.3)
36 sw.bb3: ; preds = %while.body
37 %call.i6 = tail call i32 @bar(ptr noundef nonnull @.str.4)
38 %call = tail call noundef i32 @foo()
39 %add = add nsw i32 %call, %num2
42 sw.default: ; preds = %while.body
45 sw.epilog: ; preds = %sw.bb3, %sw.bb2, %sw.bb1, %sw.bb
46 %num.addr.1 = phi i32 [ %add, %sw.bb3 ], [ 40, %sw.bb2 ], [ 20, %sw.bb1 ], [ 30, %sw.bb ]
51 define void @test2(i32 noundef %num, i32 noundef %num2) {
55 while.body: ; preds = %entry, %sw.epilog
56 %num.addr.0 = phi i32 [ %num, %entry ], [ %num.addr.1, %sw.epilog ]
57 switch i32 %num.addr.0, label %sw.default [
58 i32 10, label %sw.epilog
64 sw.bb1: ; preds = %while.body
67 sw.bb2: ; preds = %while.body
70 sw.bb3: ; preds = %while.body
73 sw.default: ; preds = %while.body
76 sw.epilog: ; preds = %while.body, %sw.bb3, %sw.bb2, %sw.bb1
77 %.str.4.sink = phi ptr [ @.str.4, %sw.bb3 ], [ @.str.3, %sw.bb2 ], [ @.str.2, %sw.bb1 ], [ @.str.1, %while.body ]
78 %num.addr.1 = phi i32 [ %num2, %sw.bb3 ], [ 40, %sw.bb2 ], [ 20, %sw.bb1 ], [ 30, %while.body ]
79 %call.i6 = tail call i32 @bar(ptr noundef nonnull %.str.4.sink)
84 define void @test3(i32 noundef %num, i32 noundef %num2) {
86 %add = add nsw i32 %num2, 40
89 while.body: ; preds = %entry, %sw.epilog
90 %num.addr.0 = phi i32 [ %num, %entry ], [ %num.addr.1, %sw.epilog ]
91 switch i32 %num.addr.0, label %sw.default [
98 sw.bb: ; preds = %while.body
99 %call.i = tail call i32 @bar(ptr noundef nonnull @.str.1)
102 sw.bb1: ; preds = %while.body
103 %call.i5 = tail call i32 @bar(ptr noundef nonnull @.str.2)
106 sw.bb2: ; preds = %while.body
107 %call.i6 = tail call i32 @bar(ptr noundef nonnull @.str.3)
110 sw.bb3: ; preds = %while.body
111 %call.i7 = tail call i32 @bar(ptr noundef nonnull @.str.4)
114 sw.default: ; preds = %while.body
117 sw.epilog: ; preds = %sw.bb3, %sw.bb2, %sw.bb1, %sw.bb
118 %num.addr.1 = phi i32 [ %add, %sw.bb3 ], [ 40, %sw.bb2 ], [ 20, %sw.bb1 ], [ 30, %sw.bb ]
123 declare noundef i32 @foo()
124 declare noundef i32 @bar(ptr nocapture noundef readonly)