Jingyue Wu | fc02967 | 2014-09-30 22:23:38 +0000 | [diff] [blame^] | 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 | |
| 4 | define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input) { |
| 5 | ; NORMAL-LABEL: @foo( |
| 6 | ; AGGRESSIVE-LABEL: @foo( |
| 7 | entry: |
| 8 | %cmp = icmp sgt i32 %d, 3 |
| 9 | br i1 %cmp, label %cond.end, label %lor.lhs.false |
| 10 | ; NORMAL: br i1 |
| 11 | ; AGGRESSIVE: br i1 |
| 12 | |
| 13 | lor.lhs.false: |
| 14 | %mul = shl i32 %c, 1 |
| 15 | %add = add nsw i32 %mul, %a |
| 16 | %cmp1 = icmp slt i32 %add, %b |
| 17 | br i1 %cmp1, label %cond.false, label %cond.end |
| 18 | ; NORMAL: br i1 |
| 19 | ; AGGRESSIVE-NOT: br i1 |
| 20 | |
| 21 | cond.false: |
| 22 | %0 = load i32* %input, align 4 |
| 23 | br label %cond.end |
| 24 | |
| 25 | cond.end: |
| 26 | %cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ] |
| 27 | ret i32 %cond |
| 28 | } |