preserve-branchweights-partial.ll 1.0 KB

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