branch-fold-threshold.ll 765 B

12345678910111213141516171819202122232425262728
  1. ; RUN: opt %s -simplifycfg -S | FileCheck %s --check-prefix=NORMAL
  2. ; RUN: opt %s -simplifycfg -S -bonus-inst-threshold=2 | FileCheck %s --check-prefix=AGGRESSIVE
  3. define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input) {
  4. ; NORMAL-LABEL: @foo(
  5. ; AGGRESSIVE-LABEL: @foo(
  6. entry:
  7. %cmp = icmp sgt i32 %d, 3
  8. br i1 %cmp, label %cond.end, label %lor.lhs.false
  9. ; NORMAL: br i1
  10. ; AGGRESSIVE: br i1
  11. lor.lhs.false:
  12. %mul = shl i32 %c, 1
  13. %add = add nsw i32 %mul, %a
  14. %cmp1 = icmp slt i32 %add, %b
  15. br i1 %cmp1, label %cond.false, label %cond.end
  16. ; NORMAL: br i1
  17. ; AGGRESSIVE-NOT: br i1
  18. cond.false:
  19. %0 = load i32, i32* %input, align 4
  20. br label %cond.end
  21. cond.end:
  22. %cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ]
  23. ret i32 %cond
  24. }