xref: /llvm-project/llvm/test/Instrumentation/InstrProfiling/always_inline.ll (revision 9ff36df5a4a7d52c51e950522870bb64912688d2)
1; Check that '__attribute__((always_inline)) inline' functions are inlined.
2
3; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes='instrprof,inline' -S | FileCheck %s
4
5target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-apple-macosx10.13.0"
7
8;; Don't record the address of an available_externally alwaysinline function.
9; CHECK:      @__profd_foo = linkonce_odr hidden global
10; CHECK-NOT:  @foo
11; CHECK-SAME: , align 8
12
13@__profn_foo = linkonce_odr hidden constant [3 x i8] c"foo"
14
15; CHECK-LABEL: @main
16; CHECK-NOT: call
17define i32 @main() {
18entry:
19  %call = call i32 @foo()
20  ret i32 %call
21}
22
23declare void @llvm.instrprof.increment(ptr, i64, i32, i32) #0
24
25define available_externally i32 @foo() #1 {
26entry:
27  call void @llvm.instrprof.increment(ptr @__profn_foo, i64 0, i32 1, i32 0)
28  ret i32 0
29}
30
31attributes #0 = { nounwind }
32attributes #1 = { alwaysinline }
33
34!llvm.module.flags = !{!0}
35!0 = !{i32 2, !"EnableValueProfiling", i32 1}
36