1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt %s -passes=inline -inline-threshold=20 -S | FileCheck %s
4 declare i1 @llvm.is.constant.i64(i64)
7 define void @callee(i64 %val) {
8 ; CHECK-LABEL: define void @callee
9 ; CHECK-SAME: (i64 [[VAL:%.*]]) {
10 ; CHECK-NEXT: [[COND:%.*]] = call i1 @llvm.is.constant.i64(i64 [[VAL]])
11 ; CHECK-NEXT: br i1 [[COND]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
13 ; CHECK-NEXT: call void @foo()
14 ; CHECK-NEXT: call void @foo()
15 ; CHECK-NEXT: ret void
17 ; CHECK-NEXT: ret void
19 %cond = call i1 @llvm.is.constant.i64(i64 %val)
20 br i1 %cond, label %cond.true, label %cond.false
23 ; Rack up costs with a couple of function calls so that this function
24 ; gets inlined only when @llvm.is.constant.i64 is folded. In reality,
25 ; the "then" clause of __builtin_constant_p tends to have statements
26 ; that fold very well, so the cost of the "then" clause is not a huge
36 define void @caller(i64 %val) {
37 ; CHECK-LABEL: define void @caller
38 ; CHECK-SAME: (i64 [[VAL:%.*]]) {
39 ; CHECK-NEXT: [[COND_I:%.*]] = call i1 @llvm.is.constant.i64(i64 [[VAL]])
40 ; CHECK-NEXT: br i1 [[COND_I]], label [[COND_TRUE_I:%.*]], label [[COND_FALSE_I:%.*]]
42 ; CHECK-NEXT: call void @foo()
43 ; CHECK-NEXT: call void @foo()
44 ; CHECK-NEXT: br label [[CALLEE_EXIT:%.*]]
45 ; CHECK: cond.false.i:
46 ; CHECK-NEXT: br label [[CALLEE_EXIT]]
48 ; CHECK-NEXT: ret void
50 call void @callee(i64 %val)