Home | History | Annotate | Download | only in SimplifyCFG
      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 {
     16 ; CHECK-LABEL: define void @func(
     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 = !{!"branch_weights", i32 1, i32 0}
     38