xref: /llvm-project/llvm/test/Instrumentation/InstrProfiling/always_inline.ll (revision 9ff36df5a4a7d52c51e950522870bb64912688d2)
19c056c9eSVedant Kumar; Check that '__attribute__((always_inline)) inline' functions are inlined.
29c056c9eSVedant Kumar
37c10129fSArthur Eubanks; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes='instrprof,inline' -S | FileCheck %s
49c056c9eSVedant Kumar
59c056c9eSVedant Kumartarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
69c056c9eSVedant Kumartarget triple = "x86_64-apple-macosx10.13.0"
79c056c9eSVedant Kumar
89f506fc7SFangrui Song;; Don't record the address of an available_externally alwaysinline function.
99f506fc7SFangrui Song; CHECK:      @__profd_foo = linkonce_odr hidden global
109f506fc7SFangrui Song; CHECK-NOT:  @foo
119f506fc7SFangrui Song; CHECK-SAME: , align 8
129f506fc7SFangrui Song
139c056c9eSVedant Kumar@__profn_foo = linkonce_odr hidden constant [3 x i8] c"foo"
149c056c9eSVedant Kumar
159c056c9eSVedant Kumar; CHECK-LABEL: @main
169c056c9eSVedant Kumar; CHECK-NOT: call
179c056c9eSVedant Kumardefine i32 @main() {
189c056c9eSVedant Kumarentry:
199c056c9eSVedant Kumar  %call = call i32 @foo()
209c056c9eSVedant Kumar  ret i32 %call
219c056c9eSVedant Kumar}
229c056c9eSVedant Kumar
23*9ff36df5SFangrui Songdeclare void @llvm.instrprof.increment(ptr, i64, i32, i32) #0
249c056c9eSVedant Kumar
259c056c9eSVedant Kumardefine available_externally i32 @foo() #1 {
269c056c9eSVedant Kumarentry:
27*9ff36df5SFangrui Song  call void @llvm.instrprof.increment(ptr @__profn_foo, i64 0, i32 1, i32 0)
289c056c9eSVedant Kumar  ret i32 0
299c056c9eSVedant Kumar}
309c056c9eSVedant Kumar
319c056c9eSVedant Kumarattributes #0 = { nounwind }
329c056c9eSVedant Kumarattributes #1 = { alwaysinline }
339f506fc7SFangrui Song
349f506fc7SFangrui Song!llvm.module.flags = !{!0}
359f506fc7SFangrui Song!0 = !{i32 2, !"EnableValueProfiling", i32 1}
36