|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs --version 5 |
| 2 | +; RUN: opt -passes="ipsccp<func-spec>" -funcspec-min-function-size=1 \ |
| 3 | +; RUN: -funcspec-for-literal-constant=true \ |
| 4 | +; RUN: -funcspec-min-codesize-savings=50 \ |
| 5 | +; RUN: -funcspec-min-latency-savings=0 \ |
| 6 | +; RUN: -S < %s | FileCheck %s |
| 7 | + |
| 8 | +; Verify that we are able to estimate the codesize savings by looking through |
| 9 | +; calls to ssa_copy intrinsics, which are inserted by PredicateInfo when IPSCCP |
| 10 | +; is run prior to FunctionSpecialization. |
| 11 | +; FIXME: We should be able to specialize this, but we currently do not handle |
| 12 | +; FIXME: llvm.ssa.copy calls in InstCostVisitor. |
| 13 | +define i32 @main() { |
| 14 | +entry: |
| 15 | + %res = call i32 @test_ssa_copy(i32 0) |
| 16 | + ret i32 %res |
| 17 | +} |
| 18 | + |
| 19 | +define i32 @test_ssa_copy(i32 %x) { |
| 20 | +entry: |
| 21 | + br label %block1 |
| 22 | + |
| 23 | +block1: |
| 24 | + %cmp = icmp eq i32 %x, 0 |
| 25 | + br i1 %cmp, label %block2, label %exit1 |
| 26 | + |
| 27 | +block2: |
| 28 | + br i1 %cmp, label %block3, label %exit2 |
| 29 | + |
| 30 | +block3: |
| 31 | + br i1 %cmp, label %exit4, label %exit3 |
| 32 | + |
| 33 | +exit1: |
| 34 | + ret i32 %x |
| 35 | + |
| 36 | +exit2: |
| 37 | + ret i32 %x |
| 38 | + |
| 39 | +exit3: |
| 40 | + ret i32 %x |
| 41 | + |
| 42 | +exit4: |
| 43 | + ret i32 999 |
| 44 | +} |
| 45 | + |
| 46 | +; CHECK-LABEL: define range(i32 1, 0) i32 @main() { |
| 47 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 48 | +; CHECK-NEXT: [[RES:%.*]] = call i32 @test_ssa_copy(i32 0) |
| 49 | +; CHECK-NEXT: ret i32 [[RES]] |
| 50 | +; |
| 51 | +; |
| 52 | +; CHECK-LABEL: define range(i32 1, 0) i32 @test_ssa_copy( |
| 53 | +; CHECK-SAME: i32 [[X:%.*]]) { |
| 54 | +; CHECK-NEXT: [[ENTRY:.*:]] |
| 55 | +; CHECK-NEXT: br label %[[BLOCK1:.*]] |
| 56 | +; CHECK: [[BLOCK1]]: |
| 57 | +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], 0 |
| 58 | +; CHECK-NEXT: br i1 [[CMP]], label %[[BLOCK2:.*]], label %[[EXIT1:.*]] |
| 59 | +; CHECK: [[BLOCK2]]: |
| 60 | +; CHECK-NEXT: br label %[[BLOCK3:.*]] |
| 61 | +; CHECK: [[BLOCK3]]: |
| 62 | +; CHECK-NEXT: br label %[[EXIT4:.*]] |
| 63 | +; CHECK: [[EXIT1]]: |
| 64 | +; CHECK-NEXT: ret i32 [[X]] |
| 65 | +; CHECK: [[EXIT4]]: |
| 66 | +; CHECK-NEXT: ret i32 999 |
| 67 | +; |
0 commit comments