Andrew Trick | d3b4d2c | 2012-09-08 00:07:26 +0000 | [diff] [blame] | 1 | ; 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 | |
| 13 | declare void @foo() nounwind uwtable |
| 14 | |
| 15 | define void @func(i32 %A) nounwind uwtable { |
Stephen Lin | a76289a | 2013-07-14 01:50:49 +0000 | [diff] [blame] | 16 | ; CHECK-LABEL: define void @func( |
Andrew Trick | d3b4d2c | 2012-09-08 00:07:26 +0000 | [diff] [blame] | 17 | entry: |
| 18 | %cmp11 = icmp eq i32 %A, 1 |
| 19 | br i1 %cmp11, label %if.then, label %if.else, !prof !0 |
| 20 | |
| 21 | if.then: |
| 22 | call void @foo() |
| 23 | ; CHECK: call void @foo() |
| 24 | br label %if.else |
| 25 | |
| 26 | if.else: |
| 27 | %cmp17 = icmp eq i32 %A, 2 |
| 28 | br i1 %cmp17, label %if.then2, label %if.end |
| 29 | |
| 30 | if.then2: |
| 31 | br label %if.end |
| 32 | |
| 33 | if.end: |
| 34 | ret void |
| 35 | } |
| 36 | |
| 37 | !0 = metadata !{metadata !"branch_weights", i32 1, i32 0} |