115 lines · plain
1; REQUIRES: x86_64-linux2;3; RUN: rm -rf %t4; RUN: split-file %s %t5;6; Test that the GUID metadata survives through thinlink.7; Also test that the flattener works correctly. f2 is called in 2 places, with8; different counter values, and we expect resulting flat profile to be the sum9; (of values at the same index).10;11; RUN: llvm-ctxprof-util fromYAML --input=%t/profile.yaml --output=%t/profile.ctxprofdata12;13; RUN: opt -module-summary -passes='thinlto-pre-link<O2>' -use-ctx-profile=%t/profile.ctxprofdata -o %t/m1.bc %t/m1.ll14; RUN: opt -module-summary -passes='thinlto-pre-link<O2>' -use-ctx-profile=%t/profile.ctxprofdata -o %t/m2.bc %t/m2.ll15;16; RUN: rm -rf %t/postlink17; RUN: mkdir %t/postlink18;19;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,plx27; 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.txt30; RUN: diff %t/expected.txt %t/profile.txt31;--- m1.ll32target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"33target triple = "x86_64-pc-linux-gnu"34 35source_filename = "random_path/m1.cc"36 37define private void @f2() #0 !guid !0 {38 ret void39}40 41define void @f1() #0 {42 call void @f2()43 ret void44}45 46define void @f3() #0 {47 call void @f2()48 ret void49}50 51attributes #0 = { noinline }52!0 = !{ i64 3087265239403591524 }53 54;--- m2.ll55target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"56target triple = "x86_64-pc-linux-gnu"57 58source_filename = "random_path/m2.cc"59 60declare void @f1()61declare void @f3()62 63define void @entrypoint() {64 call void @f1()65 call void @f3()66 ret void67}68;--- profile.yaml69Contexts:70 - Guid: 1050772190865101156671 TotalRootEntryCount: 1072 Counters: [1]73 Callsites: -74 - Guid: 207204599814180703775 Counters: [7]76 Callsites: -77 - Guid: 308726523940359152478 Counters: [10, 7]79 -80 - Guid: 419765023148182555981 Counters: [2]82 Callsites: -83 - Guid: 308726523940359152484 Counters: [1, 2]85;--- expected.txt86Function Info:872072045998141807037 : f1. MaxCounterID: 1. MaxCallsiteID: 1883087265239403591524 : f2.llvm.0. MaxCounterID: 1. MaxCallsiteID: 0894197650231481825559 : f3. MaxCounterID: 1. MaxCallsiteID: 19010507721908651011566 : entrypoint. MaxCounterID: 1. MaxCallsiteID: 291 92Current Profile:93 94Contexts:95 - Guid: 1050772190865101156696 TotalRootEntryCount: 1097 Counters: [ 1 ]98 Callsites:99 - - Guid: 2072045998141807037100 Counters: [ 7 ]101 Callsites:102 - - Guid: 3087265239403591524103 Counters: [ 10, 7 ]104 - - Guid: 4197650231481825559105 Counters: [ 2 ]106 Callsites:107 - - Guid: 3087265239403591524108 Counters: [ 1, 2 ]109 110Flat Profile:1112072045998141807037 : 70 1123087265239403591524 : 110 90 1134197650231481825559 : 20 11410507721908651011566 : 10 115