blob: 8cc07e39a180af78617cae1b24e8a28296c9faf7 [file] [log] [blame]
Andrew Trickd3b4d2c2012-09-08 00:07:26 +00001; RUN: opt -simplifycfg -S -o - < %s | FileCheck %s
2
3; This test case was written to trigger an incorrect assert statement in
4; -simplifycfg. Thus we don't actually want to check the output, just that
5; -simplifycfg ran successfully. Thus we only check that the function still
6; exists, and that it still calls foo().
7;
8; NOTE: There are some obviously dead blocks and missing branch weight
9; metadata. Both of these features were key to triggering the assert.
10; Additionally, the not-taken weight of the branch with a weight had to
11; be 0 to trigger the assert.
12
13declare void @foo() nounwind uwtable
14
15define void @func(i32 %A) nounwind uwtable {
Stephen Lina76289a2013-07-14 01:50:49 +000016; CHECK-LABEL: define void @func(
Andrew Trickd3b4d2c2012-09-08 00:07:26 +000017entry:
18 %cmp11 = icmp eq i32 %A, 1
19 br i1 %cmp11, label %if.then, label %if.else, !prof !0
20
21if.then:
22 call void @foo()
23; CHECK: call void @foo()
24 br label %if.else
25
26if.else:
27 %cmp17 = icmp eq i32 %A, 2
28 br i1 %cmp17, label %if.then2, label %if.end
29
30if.then2:
31 br label %if.end
32
33if.end:
34 ret void
35}
36
37!0 = metadata !{metadata !"branch_weights", i32 1, i32 0}