[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / ThinLTO / X86 / memprof-tailcall-nonunique.ll
bloba6863cb878be0cdcbaa677a948a7a248b958f234
1 ;; Test to make sure that missing tail call frames in memprof profiles are
2 ;; identified but not cloned when there are multiple non-unique possible
3 ;; tail call chains between the profiled frames.
5 ;; -stats requires asserts
6 ; REQUIRES: asserts
8 ; RUN: opt -thinlto-bc %s >%t.o
9 ; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \
10 ; RUN:  -supports-hot-cold-new \
11 ; RUN:  -r=%t.o,_Z3barv,plx \
12 ; RUN:  -r=%t.o,_Z5blah1v,plx \
13 ; RUN:  -r=%t.o,_Z5blah2v,plx \
14 ; RUN:  -r=%t.o,_Z4baz1v,plx \
15 ; RUN:  -r=%t.o,_Z4baz2v,plx \
16 ; RUN:  -r=%t.o,_Z3foob,plx \
17 ; RUN:  -r=%t.o,xyz,plx \
18 ; RUN:  -r=%t.o,main,plx \
19 ; RUN:  -r=%t.o,_Znam, \
20 ; RUN:  -stats -debug -save-temps \
21 ; RUN:  -o %t.out 2>&1 | FileCheck %s --check-prefix=STATS --check-prefix=DEBUG
23 ;; We should not see any type of cold attribute or cloning applied
24 ; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --implicit-check-not cold \
25 ; RUN:  --implicit-check-not ".memprof."
27 ;; Try again but with distributed ThinLTO
28 ; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \
29 ; RUN:  -supports-hot-cold-new \
30 ; RUN:  -thinlto-distributed-indexes \
31 ; RUN:  -r=%t.o,_Z3barv,plx \
32 ; RUN:  -r=%t.o,_Z5blah1v,plx \
33 ; RUN:  -r=%t.o,_Z5blah2v,plx \
34 ; RUN:  -r=%t.o,_Z4baz1v,plx \
35 ; RUN:  -r=%t.o,_Z4baz2v,plx \
36 ; RUN:  -r=%t.o,_Z3foob,plx \
37 ; RUN:  -r=%t.o,xyz,plx \
38 ; RUN:  -r=%t.o,main,plx \
39 ; RUN:  -r=%t.o,_Znam, \
40 ; RUN:  -stats -debug \
41 ; RUN:  -o %t2.out 2>&1 | FileCheck %s --check-prefix=STATS --check-prefix=DEBUG
43 ;; Run ThinLTO backend
44 ;; We should not see any type of cold attribute or cloning applied
45 ; RUN: opt -passes=memprof-context-disambiguation \
46 ; RUN:  -memprof-import-summary=%t.o.thinlto.bc \
47 ; RUN:  -stats %t.o -S 2>&1 | FileCheck %s --implicit-check-not cold \
48 ; RUN:  --implicit-check-not ".memprof."
50 ; DEBUG: Not found through unique tail call chain: 17377440600225628772 (_Z3barv) from 15822663052811949562 (main) that actually called 8716735811002003409 (xyz) (found multiple possible chains)
52 ; STATS: 1 memprof-context-disambiguation - Number of profiled callees found via multiple tail call chains
54 source_filename = "tailcall-nonunique.cc"
55 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"
56 target triple = "x86_64-unknown-linux-gnu"
58 ; Function Attrs: noinline
59 define dso_local ptr @_Z3barv() local_unnamed_addr #0 {
60 entry:
61   %call = tail call ptr @_Znam(i64 10) #2, !memprof !0, !callsite !9
62   ret ptr %call
65 ; Function Attrs: nobuiltin allocsize(0)
66 declare ptr @_Znam(i64) #1
68 ; Function Attrs: noinline
69 define dso_local ptr @_Z5blah1v() local_unnamed_addr #0 {
70 entry:
71   %call = tail call ptr @_Z3barv()
72   ret ptr %call
75 ; Function Attrs: noinline
76 define dso_local ptr @_Z5blah2v() local_unnamed_addr #0 {
77 entry:
78   %call = tail call ptr @_Z3barv()
79   ret ptr %call
82 ; Function Attrs: noinline
83 define dso_local ptr @_Z4baz1v() local_unnamed_addr #0 {
84 entry:
85   %call = tail call ptr @_Z5blah1v()
86   ret ptr %call
89 ; Function Attrs: noinline
90 define dso_local ptr @_Z4baz2v() local_unnamed_addr #0 {
91 entry:
92   %call = tail call ptr @_Z5blah2v()
93   ret ptr %call
96 ; Function Attrs: noinline
97 define dso_local ptr @_Z3foob(i1 %b) local_unnamed_addr #0 {
98 entry:
99   br i1 %b, label %if.then, label %if.else
101 if.then:                                          ; preds = %entry
102   %call = tail call ptr @_Z4baz1v()
103   br label %return
105 if.else:                                          ; preds = %entry
106   %call1 = tail call ptr @_Z4baz2v()
107   br label %return
109 return:                                           ; preds = %if.else, %if.then
110   %retval.0 = phi ptr [ %call, %if.then ], [ %call1, %if.else ]
111   ret ptr %retval.0
114 ; Function Attrs: noinline
115 define dso_local i32 @xyz() local_unnamed_addr #0 {
116 delete.end13:
117   %call = tail call ptr @_Z3foob(i1 true)
118   %call1 = tail call ptr @_Z3foob(i1 true)
119   %call2 = tail call ptr @_Z3foob(i1 false)
120   %call3 = tail call ptr @_Z3foob(i1 false)
121   ret i32 0
124 define dso_local i32 @main() local_unnamed_addr #0 {
125 delete.end13:
126   %call1 = tail call i32 @xyz(), !callsite !11
127   ret i32 0
130 attributes #0 = { noinline }
131 attributes #1 = { nobuiltin allocsize(0) }
132 attributes #2 = { builtin allocsize(0) }
134 !0 = !{!5, !7}
135 !5 = !{!6, !"notcold"}
136 !6 = !{i64 3186456655321080972, i64 8632435727821051414}
137 !7 = !{!8, !"cold"}
138 !8 = !{i64 3186456655321080972, i64 -3421689549917153178}
139 !9 = !{i64 3186456655321080972}
140 !11 = !{i64 -3421689549917153178}