xref: /llvm-project/llvm/test/Transforms/Inline/inline-call-penalty-option.ll (revision e5369823bc0655806469724335d0ca5a4c17d8c7)
1; Check that calls are not inlined if the call penalty is low. The value of the
2; call penalty is provided with the '--inline-call-penalty' option.
3;
4; RUN: opt < %s -passes=inline --inline-call-penalty=0 --inline-threshold=5 -S | FileCheck %s
5; RUN: opt < %s -passes=inline --inline-threshold=5 -S | FileCheck %s -check-prefix=DEFAULT_CALL_PENALTY
6
7declare void @extern()
8
9define void @X9() nounwind {
10  call void @extern() "call-inline-cost"="30"
11  ret void
12}
13
14define void @f1() nounwind {
15  call void @X9()
16  ret void
17; CHECK-LABEL: @f1(
18; CHECK: call void @X9
19
20; DEFAULT_CALL_PENALTY-LABEL: @f1(
21; DEFAULT_CALL_PENALTY: call void @extern
22; DEFAULT_CALL_PENALTY-NOT: call void @X9
23}
24