1; Require asserts for -debug-only
2; REQUIRES: asserts
3
4; RUN: opt < %s -inline -debug-only=inline-cost -disable-output -print-instruction-comments 2>&1 | FileCheck %s
5
6; CHECK:       Analyzing call of callee1... (caller:foo)
7; CHECK: define i32 @callee1(i32 %x) {
8; CHECK: ; cost before = {{.*}}, cost after = {{.*}}, threshold before = {{.*}}, threshold after = {{.*}}, cost delta = 5
9; CHECK:   %x1 = add i32 %x, 1
10; CHECK: ; cost before = {{.*}}, cost after = {{.*}}, threshold before = {{.*}}, threshold after = {{.*}}, cost delta = 5
11; CHECK:   %x2 = add i32 %x1, 1
12; CHECK: ; cost before = {{.*}}, cost after = {{.*}}, threshold before = {{.*}}, threshold after = {{.*}}, cost delta = 5
13; CHECK:   %x3 = add i32 %x2, 1
14; CHECK: ; cost before = {{.*}}, cost after = {{.*}}, threshold before = {{.*}}, threshold after = {{.*}}, cost delta = 0
15; CHECK:   ret i32 %x3
16; CHECK: }
17; CHECK:      NumConstantArgs: 0
18; CHECK:      NumConstantOffsetPtrArgs: 0
19; CHECK:      NumAllocaArgs: 0
20; CHECK:      NumConstantPtrCmps: 0
21; CHECK:      NumConstantPtrDiffs: 0
22; CHECK:      NumInstructionsSimplified: 1
23; CHECK:      NumInstructions: 4
24; CHECK:      SROACostSavings: 0
25; CHECK:      SROACostSavingsLost: 0
26; CHECK:      LoadEliminationCost: 0
27; CHECK:      ContainsNoDuplicateCall: 0
28; CHECK:      Cost: {{.*}}
29; CHECK:      Threshold: {{.*}}
30
31define i32 @foo(i32 %y) {
32  %x = call i32 @callee1(i32 %y)
33  ret i32 %x
34}
35
36define i32 @callee1(i32 %x) {
37  %x1 = add i32 %x, 1
38  %x2 = add i32 %x1, 1
39  %x3 = add i32 %x2, 1
40  ret i32 %x3
41}
42