summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2023-04-19 14:51:10 -0700
committerTeresa Johnson <tejohnson@google.com>2023-04-20 11:45:15 -0700
commit3adc6e03080c6d38a51f5c5b6744b7c0d9c7541b (patch)
treee95855cb0ec33430203bd1d118fa48d6990f2af0
parent3ba4d082da3dd6856887774fab694f81adc15a64 (diff)
downloadllvm-3adc6e03080c6d38a51f5c5b6744b7c0d9c7541b.tar.gz
[ThinLTO] Remove BlockCount for non partial sample profile builds
As pointed out in https://discourse.llvm.org/t/undeterministic-thin-index-file/69985, the block count added to distributed ThinLTO index files breaks incremental builds on ThinLTO - if any linked file has a different number of BBs, then the accumulated sum placed in the index files will change, causing all ThinLTO backend compiles to be redone. The block count is only used for scaling of partial sample profiles, and was added in D80403 for D79831. This patch simply removes this field from the index files of non partial sample profile compiles, which is NFC on the output of the compiler. We subsequently need to see if this can be removed for partial sample profiles without signficant performance loss, or redesigned in a way that does not destroy caching. Differential Revision: https://reviews.llvm.org/D148746
-rw-r--r--lld/test/COFF/thinlto-index-only.ll1
-rw-r--r--lld/test/ELF/lto/thinlto-emit-index.ll1
-rw-r--r--lld/test/ELF/lto/thinlto-index-only.ll1
-rw-r--r--lld/test/MachO/thinlto-emit-index.ll1
-rw-r--r--lld/test/MachO/thinlto-index-only.ll1
-rw-r--r--llvm/include/llvm/IR/ModuleSummaryIndex.h5
-rw-r--r--llvm/lib/Analysis/ModuleSummaryAnalysis.cpp6
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp10
-rw-r--r--llvm/test/Bitcode/Inputs/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll50
-rw-r--r--llvm/test/Bitcode/thinlto-alias.ll4
-rw-r--r--llvm/test/Bitcode/thinlto-alias2.ll1
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-callgraph-cast.ll1
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll126
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll2
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll2
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-callgraph-relbf.ll1
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-callgraph-sample-profile-summary.ll2
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-callgraph.ll2
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-originalnames.ll1
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll1
-rw-r--r--llvm/test/Bitcode/thinlto-function-summary.ll1
-rw-r--r--llvm/test/Bitcode/thinlto-index-disassembled-by-llvm-dis.ll1
-rw-r--r--llvm/test/ThinLTO/X86/distributed_indexes.ll2
-rw-r--r--llvm/test/tools/gold/X86/thinlto.ll3
-rw-r--r--llvm/test/tools/llvm-lto/thinlto.ll1
25 files changed, 192 insertions, 35 deletions
diff --git a/lld/test/COFF/thinlto-index-only.ll b/lld/test/COFF/thinlto-index-only.ll
index 8abc7b5213c9..996c888cbe22 100644
--- a/lld/test/COFF/thinlto-index-only.ll
+++ b/lld/test/COFF/thinlto-index-only.ll
@@ -39,7 +39,6 @@
; BACKEND2-NEXT: <FLAGS
; BACKEND2-NEXT: <VALUE_GUID op0=1 op1=-5300342847281564238
; BACKEND2-NEXT: <COMBINED
-; BACKEND2-NEXT: <BLOCK_COUNT op0=2/>
; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; Thin archive tests. Check that the module paths point to the original files.
diff --git a/lld/test/ELF/lto/thinlto-emit-index.ll b/lld/test/ELF/lto/thinlto-emit-index.ll
index 643ecb9b2879..ae8b4ddeb1bf 100644
--- a/lld/test/ELF/lto/thinlto-emit-index.ll
+++ b/lld/test/ELF/lto/thinlto-emit-index.ll
@@ -92,7 +92,6 @@
; BACKEND2-NEXT: <FLAGS
; BACKEND2-NEXT: <VALUE_GUID op0=1 op1=-5300342847281564238
; BACKEND2-NEXT: <COMBINED
-; BACKEND2-NEXT: <BLOCK_COUNT op0=2/>
; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/lld/test/ELF/lto/thinlto-index-only.ll b/lld/test/ELF/lto/thinlto-index-only.ll
index dc84df9b870c..0b64958007b2 100644
--- a/lld/test/ELF/lto/thinlto-index-only.ll
+++ b/lld/test/ELF/lto/thinlto-index-only.ll
@@ -90,7 +90,6 @@
; BACKEND2-NEXT: <FLAGS
; BACKEND2-NEXT: <VALUE_GUID op0=1 op1=-5300342847281564238
; BACKEND2-NEXT: <COMBINED
-; BACKEND2-NEXT: <BLOCK_COUNT op0=2/>
; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/lld/test/MachO/thinlto-emit-index.ll b/lld/test/MachO/thinlto-emit-index.ll
index fdc1f4850902..6f8d552f1435 100644
--- a/lld/test/MachO/thinlto-emit-index.ll
+++ b/lld/test/MachO/thinlto-emit-index.ll
@@ -92,7 +92,6 @@
; BACKEND2-NEXT: <FLAGS
; BACKEND2-NEXT: <VALUE_GUID op0=1 op1=-5300342847281564238
; BACKEND2-NEXT: <COMBINED
-; BACKEND2-NEXT: <BLOCK_COUNT op0=2/>
; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
diff --git a/lld/test/MachO/thinlto-index-only.ll b/lld/test/MachO/thinlto-index-only.ll
index 54819a2d397b..a97cd126ad5b 100644
--- a/lld/test/MachO/thinlto-index-only.ll
+++ b/lld/test/MachO/thinlto-index-only.ll
@@ -91,7 +91,6 @@
; BACKEND2-NEXT: <FLAGS
; BACKEND2-NEXT: <VALUE_GUID op0=1 op1=-5300342847281564238
; BACKEND2-NEXT: <COMBINED
-; BACKEND2-NEXT: <BLOCK_COUNT op0=2/>
; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
;--- f.ll
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 0c178ccef3bb..39f44791921a 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -1333,6 +1333,11 @@ private:
// The total number of basic blocks in the module in the per-module summary or
// the total number of basic blocks in the LTO unit in the combined index.
+ // FIXME: Putting this in the distributed ThinLTO index files breaks LTO
+ // backend caching on any BB change to any linked file. It is currently not
+ // used except in the case of a SamplePGO partial profile, and should be
+ // reevaluated/redesigned to allow more effective incremental builds in that
+ // case.
uint64_t BlockCount;
// List of unique stack ids (hashes). We use a 4B index of the id in the
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index 26ff84f2324c..d84cfbfe80f5 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -80,6 +80,8 @@ static cl::opt<std::string> ModuleSummaryDotFile(
"module-summary-dot-file", cl::Hidden, cl::value_desc("filename"),
cl::desc("File to emit dot graph of new summary into"));
+extern cl::opt<bool> ScalePartialSampleProfileWorkingSetSize;
+
// Walk through the operands of a given User via worklist iteration and populate
// the set of GlobalValue references encountered. Invoked either on an
// Instruction or a GlobalVariable (which walks its initializer).
@@ -477,7 +479,9 @@ static void computeFunctionSummary(
}
}
}
- Index.addBlockCount(F.size());
+
+ if (PSI->hasPartialSampleProfile() && ScalePartialSampleProfileWorkingSetSize)
+ Index.addBlockCount(F.size());
std::vector<ValueInfo> Refs;
if (IsThinLTO) {
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index a368ac303bd9..bedae66df69e 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -4247,8 +4247,9 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
NameVals.clear();
}
- Stream.EmitRecord(bitc::FS_BLOCK_COUNT,
- ArrayRef<uint64_t>{Index->getBlockCount()});
+ if (Index->getBlockCount())
+ Stream.EmitRecord(bitc::FS_BLOCK_COUNT,
+ ArrayRef<uint64_t>{Index->getBlockCount()});
Stream.ExitBlock();
}
@@ -4578,8 +4579,9 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
}
}
- Stream.EmitRecord(bitc::FS_BLOCK_COUNT,
- ArrayRef<uint64_t>{Index.getBlockCount()});
+ if (Index.getBlockCount())
+ Stream.EmitRecord(bitc::FS_BLOCK_COUNT,
+ ArrayRef<uint64_t>{Index.getBlockCount()});
Stream.ExitBlock();
}
diff --git a/llvm/test/Bitcode/Inputs/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll b/llvm/test/Bitcode/Inputs/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll
new file mode 100644
index 000000000000..a0ef4f937005
--- /dev/null
+++ b/llvm/test/Bitcode/Inputs/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll
@@ -0,0 +1,50 @@
+; ModuleID = 'thinlto-function-summary-callgraph-profile-summary2.ll'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @hot1() #1 {
+ ret void
+}
+define void @hot2() #1 {
+ ret void
+}
+define void @hot3() #1 {
+ ret void
+}
+define void @cold1() #1 {
+ ret void
+}
+define void @cold2() #1 {
+ ret void
+}
+define void @cold3() #1 {
+ ret void
+}
+define void @none1() #1 {
+ ret void
+}
+define void @none2() #1 {
+ ret void
+}
+define void @none3() #1 {
+ ret void
+}
+
+!llvm.module.flags = !{!1}
+
+!1 = !{i32 1, !"ProfileSummary", !2}
+!2 = !{!3, !4, !5, !6, !7, !8, !9, !10, !11, !12}
+!3 = !{!"ProfileFormat", !"SampleProfile"}
+!4 = !{!"TotalCount", i64 10000}
+!5 = !{!"MaxCount", i64 10}
+!6 = !{!"MaxInternalCount", i64 1}
+!7 = !{!"MaxFunctionCount", i64 1000}
+!8 = !{!"NumCounts", i64 3}
+!9 = !{!"NumFunctions", i64 3}
+!10 = !{!"IsPartialProfile", i64 1}
+!11 = !{!"PartialProfileRatio", double 0.5}
+!12 = !{!"DetailedSummary", !13}
+!13 = !{!14, !15, !16}
+!14 = !{i32 10000, i64 100, i32 1}
+!15 = !{i32 999000, i64 100, i32 1}
+!16 = !{i32 999999, i64 1, i32 2}
diff --git a/llvm/test/Bitcode/thinlto-alias.ll b/llvm/test/Bitcode/thinlto-alias.ll
index c4ac730ecce4..373dc715de51 100644
--- a/llvm/test/Bitcode/thinlto-alias.ll
+++ b/llvm/test/Bitcode/thinlto-alias.ll
@@ -22,7 +22,6 @@
; See if the call to func is registered.
; The value id 1 matches the second FUNCTION record above.
; CHECK-NEXT: <PERMODULE {{.*}} op7=1/>
-; CHECK-NEXT: <BLOCK_COUNT op0=1/>
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; CHECK: <STRTAB_BLOCK
@@ -38,7 +37,6 @@
; COMBINED-NEXT: <COMBINED {{.*}} op9=[[ALIASID]]/>
; COMBINED-NEXT: <COMBINED {{.*}}
; COMBINED-NEXT: <COMBINED_ALIAS {{.*}} op3=[[ALIASEEID]]
-; COMBINED-NEXT: <BLOCK_COUNT op0=2/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; ModuleID = 'thinlto-function-summary-callgraph.ll'
@@ -57,11 +55,9 @@ declare void @analias(...)
; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0))
; DIS: ^1 = gv: (name: "analias", summaries: (alias: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), aliasee: ^2))) ; guid = 12695095382722328222
; DIS: ^2 = gv: (name: "aliasee", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 1))) ; guid = 17407585008595848568
-; DIS: ^3 = blockcount: 1
; COMBINED-DIS: ^0 = module: (path: "{{.*}}thinlto-alias.ll.tmp.o", hash: (0, 0, 0, 0, 0))
; COMBINED-DIS: ^1 = module: (path: "{{.*}}thinlto-alias.ll.tmp2.o", hash: (0, 0, 0, 0, 0))
; COMBINED-DIS: ^2 = gv: (guid: 12695095382722328222, summaries: (alias: (module: ^1, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), aliasee: ^4)))
; COMBINED-DIS: ^3 = gv: (guid: 15822663052811949562, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 2, calls: ((callee: ^2)))))
; COMBINED-DIS: ^4 = gv: (guid: 17407585008595848568, summaries: (function: (module: ^1, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 1)))
-; COMBINED-DIS: ^5 = blockcount: 2
diff --git a/llvm/test/Bitcode/thinlto-alias2.ll b/llvm/test/Bitcode/thinlto-alias2.ll
index 22815f8ec24c..d43870632743 100644
--- a/llvm/test/Bitcode/thinlto-alias2.ll
+++ b/llvm/test/Bitcode/thinlto-alias2.ll
@@ -8,7 +8,6 @@
; CHECK-NEXT: <PERMODULE {{.*}} op4=0 op5=0 op6=0 op7=[[ALIASID:[0-9]+]]/>
; CHECK-NEXT: <PERMODULE {{.*}} op0=[[ALIASEEID:[0-9]+]]
; CHECK-NEXT: <ALIAS {{.*}} op0=[[ALIASID]] {{.*}} op2=[[ALIASEEID]]/>
-; CHECK-NEXT: <BLOCK_COUNT op0=2/>
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; ModuleID = 'thinlto-alias2.ll'
diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph-cast.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph-cast.ll
index 4d52edd6a085..83d12210a549 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-callgraph-cast.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph-cast.ll
@@ -12,7 +12,6 @@
; CHECK-NEXT: <PERMODULE {{.*}}/>
; CHECK-NEXT: <PERMODULE {{.*}} op0=[[ALIASEEID:[0-9]+]]
; CHECK-NEXT: <ALIAS {{.*}} op0=[[ALIASID]] {{.*}} op2=[[ALIASEEID]]/>
-; CHECK-NEXT: <BLOCK_COUNT op0=3/>
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; ModuleID = 'thinlto-function-summary-callgraph-cast.ll'
diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll
new file mode 100644
index 000000000000..1906229879f5
--- /dev/null
+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll
@@ -0,0 +1,126 @@
+; Test to check the callgraph in summary when there is PGO
+; RUN: opt -module-summary %s -o %t.o
+; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
+; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll -o %t2.o
+; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
+; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
+
+
+; CHECK: <SOURCE_FILENAME
+; "hot_function"
+; CHECK-NEXT: <FUNCTION op0=0 op1=12
+; "hot1"
+; CHECK-NEXT: <FUNCTION op0=12 op1=4
+; "hot2"
+; CHECK-NEXT: <FUNCTION op0=16 op1=4
+; "hot3"
+; CHECK-NEXT: <FUNCTION op0=20 op1=4
+; "hot4"
+; CHECK-NEXT: <FUNCTION op0=24 op1=5
+; "cold"
+; CHECK-NEXT: <FUNCTION op0=29 op1=5
+; "none1"
+; CHECK-NEXT: <FUNCTION op0=34 op1=5
+; "none2"
+; CHECK-NEXT: <FUNCTION op0=39 op1=5
+; "none3"
+; CHECK-NEXT: <FUNCTION op0=44 op1=5
+; CHECK-NEXT: <FUNCTION op0=49 op1=5
+
+; CHECK-LABEL: <GLOBALVAL_SUMMARY_BLOCK
+; CHECK-NEXT: <VERSION
+; CHECK-NEXT: <FLAGS
+; CHECK-NEXT: <VALUE_GUID op0=27 op1=123/>
+; op4=none1 op6=hot1 op8=cold1 op10=none2 op12=hot2 op14=cold2 op16=none3 op18=hot3 op20=cold3 op22=123
+; CHECK-NEXT: <PERMODULE_PROFILE {{.*}} op7=7 op8=0 op9=1 op10=3 op11=4 op12=1 op13=8 op14=0 op15=2 op16=3 op17=5 op18=1 op19=9 op20=0 op21=3 op22=3 op23=6 op24=1 op25=27 op26=4/>
+; CHECK-NEXT: <BLOCK_COUNT op0=4/>
+; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
+
+; CHECK: <STRTAB_BLOCK
+; CHECK-NEXT: blob data = 'hot_functionhot1hot2hot3cold1cold2cold3none1none2none3{{.*}}'
+
+; COMBINED: <GLOBALVAL_SUMMARY_BLOCK
+; COMBINED-NEXT: <VERSION
+; COMBINED-NEXT: <FLAGS
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <VALUE_GUID
+; COMBINED-NEXT: <COMBINED abbrevid=
+; COMBINED-NEXT: <COMBINED abbrevid=
+; COMBINED-NEXT: <COMBINED abbrevid=
+; COMBINED-NEXT: <COMBINED abbrevid=
+; COMBINED-NEXT: <COMBINED abbrevid=
+; COMBINED-NEXT: <COMBINED abbrevid=
+; COMBINED-NEXT: <COMBINED abbrevid=
+; COMBINED-NEXT: <COMBINED abbrevid=
+; COMBINED-NEXT: <COMBINED_PROFILE {{.*}} op9=[[NONE1:.*]] op10=0 op11=[[HOT1:.*]] op12=3 op13=[[COLD1:.*]] op14=1 op15=[[NONE2:.*]] op16=0 op17=[[HOT2:.*]] op18=3 op19=[[COLD2:.*]] op20=1 op21=[[NONE3:.*]] op22=0 op23=[[HOT3:.*]] op24=3 op25=[[COLD3:.*]] op26=1/>
+; COMBINED-NEXT: <COMBINED abbrevid=
+; COMBINED-NEXT: <BLOCK_COUNT op0=13/>
+; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
+
+
+; ModuleID = 'thinlto-function-summary-callgraph.ll'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; This function have high profile count, so entry block is hot.
+define void @hot_function(i1 %a, i1 %a2) !prof !20 {
+entry:
+ call void @none1()
+ call void @hot1(), !prof !17
+ call void @cold1(), !prof !18
+ br i1 %a, label %Cold, label %Hot, !prof !41
+Cold: ; 1/1000 goes here
+ call void @none2()
+ call void @hot2(), !prof !17
+ call void @cold2(), !prof !18
+ br label %exit
+Hot: ; 999/1000 goes here
+ call void @none3()
+ call void @hot3(), !prof !17
+ call void @cold3(), !prof !18
+ br label %exit
+exit:
+ ret void
+}
+
+declare void @hot1() #1
+declare void @hot2() #1
+declare void @hot3() #1
+declare void @cold1() #1
+declare void @cold2() #1
+declare void @cold3() #1
+declare void @none1() #1
+declare void @none2() #1
+declare void @none3() #1
+
+!41 = !{!"branch_weights", i32 1, i32 1000}
+
+!llvm.module.flags = !{!1}
+!20 = !{!"function_entry_count", i64 110, i64 123}
+
+!1 = !{i32 1, !"ProfileSummary", !2}
+!2 = !{!3, !4, !5, !6, !7, !8, !9, !10, !11, !12}
+!3 = !{!"ProfileFormat", !"SampleProfile"}
+!4 = !{!"TotalCount", i64 10000}
+!5 = !{!"MaxCount", i64 10}
+!6 = !{!"MaxInternalCount", i64 1}
+!7 = !{!"MaxFunctionCount", i64 1000}
+!8 = !{!"NumCounts", i64 3}
+!9 = !{!"NumFunctions", i64 3}
+!10 = !{!"IsPartialProfile", i64 1}
+!11 = !{!"PartialProfileRatio", double 0.5}
+!12 = !{!"DetailedSummary", !13}
+!13 = !{!14, !15, !16}
+!14 = !{i32 10000, i64 100, i32 1}
+!15 = !{i32 999000, i64 100, i32 1}
+!16 = !{i32 999999, i64 1, i32 2}
+!17 = !{!"branch_weights", i32 100}
+!18 = !{!"branch_weights", i32 1}
diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
index c353b0a8b836..2bbab0c6bb0d 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
@@ -19,7 +19,6 @@
; CHECK-NEXT: <FLAGS
; See if the call to func is registered, using the expected hotness type.
; CHECK-NEXT: <PERMODULE_PROFILE {{.*}} op7=1 op8=2/>
-; CHECK-NEXT: <BLOCK_COUNT op0=1/>
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; CHECK: <STRTAB_BLOCK
; CHECK-NEXT: blob data = 'mainfunc{{.*}}'
@@ -33,7 +32,6 @@
; See if the call to func is registered, using the expected hotness type.
; op6=2 which is hotnessType::None.
; COMBINED-NEXT: <COMBINED_PROFILE {{.*}} op9=[[FUNCID]] op10=2/>
-; COMBINED-NEXT: <BLOCK_COUNT op0=2/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; ModuleID = 'thinlto-function-summary-callgraph.ll'
diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll
index 0cb8ef39cb5c..c8df387fca45 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll
@@ -50,7 +50,6 @@
; CHECK-NEXT: <VALUE_GUID op0=25 op1=123/>
; op4=hot1 op6=cold op8=hot2 op10=hot4 op12=none1 op14=hot3 op16=none2 op18=none3 op20=123
; CHECK-NEXT: <PERMODULE_PROFILE {{.*}} op7=1 op8=3 op9=5 op10=1 op11=2 op12=3 op13=4 op14=1 op15=6 op16=2 op17=3 op18=3 op19=7 op20=2 op21=8 op22=2 op23=25 op24=4/>
-; CHECK-NEXT: <BLOCK_COUNT op0=6/>
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; CHECK: <STRTAB_BLOCK
@@ -75,7 +74,6 @@
; COMBINED-NEXT: <COMBINED abbrevid=
; COMBINED-NEXT: <COMBINED_PROFILE {{.*}} op9=[[HOT1:.*]] op10=3 op11=[[COLD:.*]] op12=1 op13=[[HOT2:.*]] op14=3 op15=[[NONE1:.*]] op16=2 op17=[[HOT3:.*]] op18=3 op19=[[NONE2:.*]] op20=2 op21=[[NONE3:.*]] op22=2/>
; COMBINED-NEXT: <COMBINED abbrevid=
-; COMBINED-NEXT: <BLOCK_COUNT op0=13/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph-relbf.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph-relbf.ll
index f72bf9db5ed7..ca4f62907cb0 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-callgraph-relbf.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph-relbf.ll
@@ -15,7 +15,6 @@
; CHECK-NEXT: <FLAGS
; See if the call to func is registered.
; CHECK-NEXT: <PERMODULE_RELBF {{.*}} op4=1 {{.*}} op9=256
-; CHECK-NEXT: <BLOCK_COUNT op0=1/>
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; CHECK: <STRTAB_BLOCK
; CHECK-NEXT: blob data = 'undefinedglobmainfunc{{.*}}'
diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph-sample-profile-summary.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph-sample-profile-summary.ll
index a59bae3cd757..e8e2b0de91b6 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-callgraph-sample-profile-summary.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph-sample-profile-summary.ll
@@ -33,7 +33,6 @@
; CHECK-NEXT: <VALUE_GUID op0=26 op1=123/>
; op4=none1 op6=hot1 op8=cold1 op10=none2 op12=hot2 op14=cold2 op16=none3 op18=hot3 op20=cold3 op22=123
; CHECK-NEXT: <PERMODULE_PROFILE {{.*}} op7=7 op8=0 op9=1 op10=3 op11=4 op12=1 op13=8 op14=0 op15=2 op16=3 op17=5 op18=1 op19=9 op20=0 op21=3 op22=3 op23=6 op24=1 op25=26 op26=4/>
-; CHECK-NEXT: <BLOCK_COUNT op0=4/>
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; CHECK: <STRTAB_BLOCK
@@ -62,7 +61,6 @@
; COMBINED-NEXT: <COMBINED abbrevid=
; COMBINED-NEXT: <COMBINED_PROFILE {{.*}} op9=[[NONE1:.*]] op10=0 op11=[[HOT1:.*]] op12=3 op13=[[COLD1:.*]] op14=1 op15=[[NONE2:.*]] op16=0 op17=[[HOT2:.*]] op18=3 op19=[[COLD2:.*]] op20=1 op21=[[NONE3:.*]] op22=0 op23=[[HOT3:.*]] op24=3 op25=[[COLD3:.*]] op26=1/>
; COMBINED-NEXT: <COMBINED abbrevid=
-; COMBINED-NEXT: <BLOCK_COUNT op0=13/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph.ll
index 19cfbf7931a3..765efcf7b822 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-callgraph.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph.ll
@@ -20,7 +20,6 @@
; CHECK-NEXT: <FLAGS
; See if the call to func is registered
; CHECK-NEXT: <PERMODULE {{.*}} op4=1
-; CHECK-NEXT: <BLOCK_COUNT op0=1/>
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; CHECK: <STRTAB_BLOCK
; CHECK-NEXT: blob data = 'undefinedglobmainfunc{{.*}}'
@@ -36,7 +35,6 @@
; COMBINED-NEXT: <COMBINED
; See if the call to func is registered.
; COMBINED-NEXT: <COMBINED {{.*}} op9=[[FUNCID]]/>
-; COMBINED-NEXT: <BLOCK_COUNT op0=2/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; ModuleID = 'thinlto-function-summary-callgraph.ll'
diff --git a/llvm/test/Bitcode/thinlto-function-summary-originalnames.ll b/llvm/test/Bitcode/thinlto-function-summary-originalnames.ll
index 208ded58d683..4d840d1f8ec8 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-originalnames.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-originalnames.ll
@@ -15,7 +15,6 @@
; COMBINED-DAG: <COMBINED_ORIGINAL_NAME op0=-2012135647395072713/>
; COMBINED-DAG: <COMBINED_ALIAS
; COMBINED-DAG: <COMBINED_ORIGINAL_NAME op0=-4170563161550796836/>
-; COMBINED-NEXT: <BLOCK_COUNT op0=1/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
source_filename = "/path/to/source.c"
diff --git a/llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll b/llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll
index 8b6b0bb48ff9..96a783fdb3e2 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll
@@ -338,4 +338,3 @@ entry:
; COMBINED-NEXT: <COMBINED abbrevid=4 op0=18
; COMBINED-NEXT: <PARAM_ACCESS op0=0 op1=0 op2=0 op3=1 op4=0 op5=[[CALLEE2]] op6=1431 op7=250/>
; COMBINED-NEXT: <COMBINED abbrevid=4 op0=19
-; COMBINED-NEXT: <BLOCK_COUNT op0=19/> \ No newline at end of file
diff --git a/llvm/test/Bitcode/thinlto-function-summary.ll b/llvm/test/Bitcode/thinlto-function-summary.ll
index e51cf1049108..6aee2636fa3b 100644
--- a/llvm/test/Bitcode/thinlto-function-summary.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary.ll
@@ -24,7 +24,6 @@
; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=7
; BC-NEXT: <PERMODULE {{.*}} op0=4 op1=0 op2=4 op3=0
; BC-NEXT: <ALIAS {{.*}} op0=6 op1=0 op2=3
-; BC-NEXT: <BLOCK_COUNT op0=5/>
; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; BC: <STRTAB_BLOCK
; BC-NEXT: blob data = 'hfoobaranon.{{................................}}.0variadicllvm.va_startf{{.*}}'
diff --git a/llvm/test/Bitcode/thinlto-index-disassembled-by-llvm-dis.ll b/llvm/test/Bitcode/thinlto-index-disassembled-by-llvm-dis.ll
index ca18a912f9fa..0d6a8e3b4b8d 100644
--- a/llvm/test/Bitcode/thinlto-index-disassembled-by-llvm-dis.ll
+++ b/llvm/test/Bitcode/thinlto-index-disassembled-by-llvm-dis.ll
@@ -19,7 +19,6 @@
; DIS: ^0 = module: (path: "{{.*}}thinlto-index-disassembled-by-llvm-dis.ll.tmp
; DIS: ^1 = gv: (name: "aplusb", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 2))) ; guid =
-; DIS: ^2 = blockcount: 1
source_filename = "add.cpp"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/test/ThinLTO/X86/distributed_indexes.ll b/llvm/test/ThinLTO/X86/distributed_indexes.ll
index 496fa4b00c29..6dc03e41a064 100644
--- a/llvm/test/ThinLTO/X86/distributed_indexes.ll
+++ b/llvm/test/ThinLTO/X86/distributed_indexes.ll
@@ -25,7 +25,6 @@
; BACKEND1-NEXT: <COMBINED {{.*}} op1=0
; BACKEND1-NEXT: <COMBINED {{.*}} op1=1
; BACKEND1-NEXT: <COMBINED_ALIAS {{.*}} op1=1
-; BACKEND1-NEXT: <BLOCK_COUNT op0=4/>
; BACKEND1-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; The backend index for Input/distributed_indexes.ll contains summaries from
@@ -41,7 +40,6 @@
; BACKEND2-NEXT: <COMBINED
; BACKEND2-NEXT: <COMBINED
; BACKEND2-NEXT: <COMBINED_ALIAS
-; BACKEND2-NEXT: <BLOCK_COUNT op0=4/>
; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; Make sure that when the alias is imported as a copy of the aliasee, but the
diff --git a/llvm/test/tools/gold/X86/thinlto.ll b/llvm/test/tools/gold/X86/thinlto.ll
index b1a4d3caef91..1745f0382b81 100644
--- a/llvm/test/tools/gold/X86/thinlto.ll
+++ b/llvm/test/tools/gold/X86/thinlto.ll
@@ -107,7 +107,6 @@
; BACKEND1-NEXT: <VALUE_GUID op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
; BACKEND1-NEXT: <COMBINED
; BACKEND1-NEXT: <COMBINED
-; BACKEND1-NEXT: <BLOCK_COUNT
; BACKEND1-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; The backend index for Input/thinlto.ll contains summaries from itself only,
@@ -120,7 +119,6 @@
; BACKEND2-NEXT: <FLAGS
; BACKEND2-NEXT: <VALUE_GUID op0=1 op1=-5300342847281564238
; BACKEND2-NEXT: <COMBINED
-; BACKEND2-NEXT: <BLOCK_COUNT
; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; DIS1: ^0 = module: (path: "{{.*}}thinlto.ll.tmp.o", hash: (0, 0, 0, 0, 0))
@@ -142,7 +140,6 @@
; COMBINED-NEXT: <VALUE_GUID op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
; COMBINED-NEXT: <COMBINED
; COMBINED-NEXT: <COMBINED
-; COMBINED-NEXT: <BLOCK_COUNT
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/test/tools/llvm-lto/thinlto.ll b/llvm/test/tools/llvm-lto/thinlto.ll
index 542525039a0d..23843e07d6a5 100644
--- a/llvm/test/tools/llvm-lto/thinlto.ll
+++ b/llvm/test/tools/llvm-lto/thinlto.ll
@@ -16,7 +16,6 @@
; COMBINED-NEXT: <VALUE_GUID op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
; COMBINED-NEXT: <COMBINED
; COMBINED-NEXT: <COMBINED
-; COMBINED-NEXT: <BLOCK_COUNT op0=2/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"