1 ; REQUIRES: x86_64-linux
4 ; RUN: split-file %s %t
6 ; Test that the GUID metadata survives through thinlink.
7 ; Also test that the flattener works correctly. f2 is called in 2 places, with
8 ; different counter values, and we expect resulting flat profile to be the sum
9 ; (of values at the same index).
11 ; RUN: llvm-ctxprof-util fromJSON --input=%t/profile.json --output=%t/profile.ctxprofdata
13 ; RUN: opt -module-summary -passes='thinlto-pre-link<O2>' -use-ctx-profile=%t/profile.ctxprofdata -o %t/m1.bc %t/m1.ll
14 ; RUN: opt -module-summary -passes='thinlto-pre-link<O2>' -use-ctx-profile=%t/profile.ctxprofdata -o %t/m2.bc %t/m2.ll
16 ; RUN: rm -rf %t/postlink
17 ; RUN: mkdir %t/postlink
20 ; RUN: llvm-lto2 run %t/m1.bc %t/m2.bc -o %t/ -thinlto-distributed-indexes \
21 ; RUN: -use-ctx-profile=%t/profile.ctxprofdata \
22 ; RUN: -r %t/m1.bc,f1,plx \
23 ; RUN: -r %t/m1.bc,f3,plx \
24 ; RUN: -r %t/m2.bc,f1 \
25 ; RUN: -r %t/m2.bc,f3 \
26 ; RUN: -r %t/m2.bc,entrypoint,plx
27 ; RUN: opt --passes='function-import,require<ctx-prof-analysis>,print<ctx-prof-analysis>' -ctx-profile-printer-level=everything \
28 ; RUN: -summary-file=%t/m2.bc.thinlto.bc -use-ctx-profile=%t/profile.ctxprofdata %t/m2.bc \
29 ; RUN: -S -o %t/m2.post.ll 2> %t/profile.txt
30 ; RUN: diff %t/expected.txt %t/profile.txt
32 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
33 target triple = "x86_64-pc-linux-gnu"
35 source_filename = "random_path/m1.cc"
37 define private void @f2() #0 !guid !0 {
41 define void @f1() #0 {
46 define void @f3() #0 {
51 attributes #0 = { noinline }
52 !0 = !{ i64 3087265239403591524 }
55 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
56 target triple = "x86_64-pc-linux-gnu"
58 source_filename = "random_path/m2.cc"
63 define void @entrypoint() {
81 "Guid": 3087265239403591524
88 "Guid": 2072045998141807037
100 "Guid": 3087265239403591524
107 "Guid": 4197650231481825559
114 "Guid": 10507721908651011566
119 2072045998141807037 : f1. MaxCounterID: 1. MaxCallsiteID: 1
120 3087265239403591524 : f2.llvm.0. MaxCounterID: 1. MaxCallsiteID: 0
121 4197650231481825559 : f3. MaxCounterID: 1. MaxCallsiteID: 1
122 10507721908651011566 : entrypoint. MaxCounterID: 1. MaxCallsiteID: 2
137 "Guid": 3087265239403591524
144 "Guid": 2072045998141807037
156 "Guid": 3087265239403591524
163 "Guid": 4197650231481825559
170 "Guid": 10507721908651011566
175 2072045998141807037 : 7
176 3087265239403591524 : 11 9
177 4197650231481825559 : 2
178 10507721908651011566 : 1