[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / ThinLTO / X86 / memprof-missing-callsite.ll
blob5ce786c63ac1a74cace664c43c79ec9bf1238e30
1 ;; Test callsite context graph generation for simple call graph with
2 ;; two memprof contexts and no inlining, where one callsite required for
3 ;; cloning is missing (e.g. unmatched). Use this to test aggressive hinting
4 ;; threshold.
5 ;;
6 ;; Original code looks like:
7 ;;
8 ;; char *foo() {
9 ;;   return new char[10];
10 ;; }
12 ;; int main(int argc, char **argv) {
13 ;;   char *x = foo();
14 ;;   char *y = foo();
15 ;;   memset(x, 0, 10);
16 ;;   memset(y, 0, 10);
17 ;;   delete[] x;
18 ;;   sleep(200);
19 ;;   delete[] y;
20 ;;   return 0;
21 ;; }
23 ; RUN: opt -thinlto-bc -memprof-report-hinted-sizes %s >%t.o
24 ; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \
25 ; RUN:  -supports-hot-cold-new \
26 ; RUN:  -r=%t.o,main,plx \
27 ; RUN:  -r=%t.o,_Znam, \
28 ; RUN:  -memprof-report-hinted-sizes \
29 ; RUN:  -pass-remarks=memprof-context-disambiguation -save-temps \
30 ; RUN:  -o %t.out 2>&1 | FileCheck %s --implicit-check-not "call in clone _Z3foov" \
31 ; RUN:  --check-prefix=SIZESUNHINTED
32 ; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --implicit-check-not "\"memprof\"=\"cold\""
34 ;; Check that we do hint with a sufficient -memprof-cloning-cold-threshold.
35 ; RUN: opt -thinlto-bc -memprof-report-hinted-sizes %s >%t.o
36 ; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \
37 ; RUN:  -supports-hot-cold-new \
38 ; RUN:  -r=%t.o,main,plx \
39 ; RUN:  -r=%t.o,_Znam, \
40 ; RUN:  -memprof-report-hinted-sizes -memprof-cloning-cold-threshold=80 \
41 ; RUN:  -pass-remarks=memprof-context-disambiguation -save-temps \
42 ; RUN:  -o %t.out 2>&1 | FileCheck %s --check-prefix=REMARKSHINTED \
43 ; RUN:  --check-prefix=SIZESHINTED
44 ; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --check-prefix=IRHINTED
46 ;; Check again that we hint with a sufficient -memprof-cloning-cold-threshold,
47 ;; even if we don't specify -memprof-report-hinted-sizes.
48 ; RUN: opt -thinlto-bc -memprof-report-hinted-sizes %s >%t.o
49 ; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \
50 ; RUN:  -supports-hot-cold-new \
51 ; RUN:  -r=%t.o,main,plx \
52 ; RUN:  -r=%t.o,_Znam, \
53 ; RUN:  -memprof-cloning-cold-threshold=80 \
54 ; RUN:  -pass-remarks=memprof-context-disambiguation -save-temps \
55 ; RUN:  -o %t.out 2>&1 | FileCheck %s --check-prefix=REMARKSHINTED
56 ; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --check-prefix=IRHINTED
58 source_filename = "memprof-missing-callsite.ll"
59 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
60 target triple = "x86_64-unknown-linux-gnu"
62 define i32 @main() #0 {
63 entry:
64   ;; Missing callsite metadata blocks cloning
65   %call = call ptr @_Z3foov()
66   %call1 = call ptr @_Z3foov()
67   ret i32 0
70 define internal ptr @_Z3foov() #0 {
71 entry:
72   %call = call ptr @_Znam(i64 0), !memprof !2, !callsite !7
73   ret ptr null
76 declare ptr @_Znam(i64)
78 ; uselistorder directives
79 uselistorder ptr @_Z3foov, { 1, 0 }
81 attributes #0 = { noinline optnone }
83 !2 = !{!3, !5}
84 !3 = !{!4, !"notcold", !10}
85 !4 = !{i64 9086428284934609951, i64 8632435727821051414}
86 !5 = !{!6, !"cold", !11, !12}
87 !6 = !{i64 9086428284934609951, i64 -3421689549917153178}
88 !7 = !{i64 9086428284934609951}
89 !10 = !{i64 123, i64 100}
90 !11 = !{i64 456, i64 200}
91 !12 = !{i64 789, i64 300}
93 ; SIZESUNHINTED: NotCold full allocation context 123 with total size 100 is NotColdCold after cloning
94 ; SIZESUNHINTED: Cold full allocation context 456 with total size 200 is NotColdCold after cloning
95 ; SIZESUNHINTED: Cold full allocation context 789 with total size 300 is NotColdCold after cloning
97 ; SIZESHINTED: NotCold full allocation context 123 with total size 100 is NotColdCold after cloning marked Cold due to cold byte percent
98 ; SIZESHINTED: Cold full allocation context 456 with total size 200 is NotColdCold after cloning marked Cold due to cold byte percent
99 ; SIZESHINTED: Cold full allocation context 789 with total size 300 is NotColdCold after cloning marked Cold due to cold byte percent
101 ; REMARKSHINTED: call in clone _Z3foov marked with memprof allocation attribute cold
103 ; IRHINTED: "memprof"="cold"