[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / ThinLTO / X86 / memprof-tailcall-aliased-location1.ll
blob3f5dc7732dc5c3a6859d3651793f6b37e2361ac7
1 ;; Test to ensure a call to a different callee but with the same debug info
2 ;; (and therefore callsite metadata) as a preceding tail call in the alloc
3 ;; context does not cause missing or incorrect cloning. This test is otherwise
4 ;; the same as memprof-tailcall.ll.
6 ;; -stats requires asserts
7 ; REQUIRES: asserts
9 ; RUN: opt -thinlto-bc %s >%t.o
10 ; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \
11 ; RUN:  -supports-hot-cold-new \
12 ; RUN:  -r=%t.o,_Z3barv,plx \
13 ; RUN:  -r=%t.o,_Z3bazv,plx \
14 ; RUN:  -r=%t.o,_Z3foov,plx \
15 ; RUN:  -r=%t.o,main,plx \
16 ; RUN:  -r=%t.o,_Znam, \
17 ; RUN:  -r=%t.o,blah, \
18 ; RUN:  -stats -save-temps \
19 ; RUN:  -o %t.out 2>&1 | FileCheck %s --check-prefix=STATS
21 ; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --check-prefix=IR
23 ; STATS: 2 memprof-context-disambiguation - Number of profiled callees found via tail calls
24 ; STATS: 4 memprof-context-disambiguation - Aggregate depth of profiled callees found via tail calls
25 ; STATS: 2 memprof-context-disambiguation - Maximum depth of profiled callees found via tail calls
27 source_filename = "memprof-tailcall-aliased-location1.cc"
28 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
29 target triple = "x86_64-unknown-linux-gnu"
31 ; Function Attrs: noinline
32 ; IR-LABEL: @_Z3barv()
33 define ptr @_Z3barv() local_unnamed_addr #0 {
34 entry:
35   ; IR: call {{.*}} @_Znam(i64 10) #[[NOTCOLD:[0-9]+]]
36   %call = tail call ptr @_Znam(i64 10) #2, !memprof !0, !callsite !5
37   ret ptr %call
40 ; Function Attrs: nobuiltin allocsize(0)
41 declare ptr @_Znam(i64) #1
42 declare void @blah()
44 ; Function Attrs: noinline
45 ; IR-LABEL: @_Z3bazv()
46 define ptr @_Z3bazv() #0 {
47 entry:
48   ; IR: call ptr @_Z3barv()
49   %call = tail call ptr @_Z3barv()
50   ret ptr %call
53 ; Function Attrs: noinline
54 ; IR-LABEL: @_Z3foov()
55 define ptr @_Z3foov() #0 {
56 entry:
57   ; IR: call ptr @_Z3bazv()
58   %call = tail call ptr @_Z3bazv()
59   ret ptr %call
62 ; Function Attrs: noinline
63 ; IR-LABEL: @main()
64 define i32 @main() #0 {
65   ;; Preceding call to another callee but with the same debug location / callsite id
66   call void @blah(), !callsite !6
67   ;; The first call to foo is part of a cold context, and should use the
68   ;; original functions.
69   ; IR: call ptr @_Z3foov()
70   %call = tail call ptr @_Z3foov(), !callsite !6
71   ;; The second call to foo is part of a cold context, and should call the
72   ;; cloned functions.
73   ; IR: call ptr @_Z3foov.memprof.1()
74   %call1 = tail call ptr @_Z3foov(), !callsite !7
75   ret i32 0
78 ; IR-LABEL: @_Z3barv.memprof.1()
79 ; IR: call {{.*}} @_Znam(i64 10) #[[COLD:[0-9]+]]
80 ; IR-LABEL: @_Z3bazv.memprof.1()
81 ; IR: call ptr @_Z3barv.memprof.1()
82 ; IR-LABEL: @_Z3foov.memprof.1()
83 ; IR: call ptr @_Z3bazv.memprof.1()
85 ; IR: attributes #[[NOTCOLD]] = { builtin allocsize(0) "memprof"="notcold" }
86 ; IR: attributes #[[COLD]] = { builtin allocsize(0) "memprof"="cold" }
88 attributes #0 = { noinline }
89 attributes #1 = { nobuiltin allocsize(0) }
90 attributes #2 = { builtin allocsize(0) }
92 !0 = !{!1, !3}
93 !1 = !{!2, !"notcold"}
94 !2 = !{i64 3186456655321080972, i64 8632435727821051414}
95 !3 = !{!4, !"cold"}
96 !4 = !{i64 3186456655321080972, i64 -3421689549917153178}
97 !5 = !{i64 3186456655321080972}
98 !6 = !{i64 8632435727821051414}
99 !7 = !{i64 -3421689549917153178}