[clang] 3d6f530 - [PGO] Include the mem ops into the function hash.
Hiroshi Yamauchi via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 30 09:26:32 PDT 2020
Author: Hiroshi Yamauchi
Date: 2020-07-30T09:26:20-07:00
New Revision: 3d6f53018f845e893ad34f64ff2851a2e5c3ba1d
URL: https://github.com/llvm/llvm-project/commit/3d6f53018f845e893ad34f64ff2851a2e5c3ba1d
DIFF: https://github.com/llvm/llvm-project/commit/3d6f53018f845e893ad34f64ff2851a2e5c3ba1d.diff
LOG: [PGO] Include the mem ops into the function hash.
To avoid hash collisions when the only difference is in mem ops.
Added:
Modified:
clang/test/CodeGen/Inputs/thinlto_expect1.proftext
clang/test/CodeGen/Inputs/thinlto_expect2.proftext
clang/test/CodeGenCXX/Inputs/profile-remap.proftext
clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext
clang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext
clang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
compiler-rt/test/profile/Linux/instrprof-value-merge.c
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/test/Transforms/PGOProfile/Inputs/PR41279.proftext
llvm/test/Transforms/PGOProfile/Inputs/PR41279_2.proftext
llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext
llvm/test/Transforms/PGOProfile/Inputs/branch1_large_count.proftext
llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext
llvm/test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext
llvm/test/Transforms/PGOProfile/Inputs/criticaledge_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/cspgo.proftext
llvm/test/Transforms/PGOProfile/Inputs/diag_no_value_sites.proftext
llvm/test/Transforms/PGOProfile/Inputs/fix_entry_count.proftext
llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/indirect_call.proftext
llvm/test/Transforms/PGOProfile/Inputs/indirectbr.proftext
llvm/test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/irreducible.proftext
llvm/test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext
llvm/test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/large_count_remarks.proftext
llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext
llvm/test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext
llvm/test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/memop_size_annotation.proftext
llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch-correct.proftext
llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch.proftext
llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct.proftext
llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch.proftext
llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext
llvm/test/Transforms/PGOProfile/Inputs/noreturncall.proftext
llvm/test/Transforms/PGOProfile/Inputs/remap.proftext
llvm/test/Transforms/PGOProfile/Inputs/select1.proftext
llvm/test/Transforms/PGOProfile/Inputs/select2.proftext
llvm/test/Transforms/PGOProfile/Inputs/suppl-profile.proftext
llvm/test/Transforms/PGOProfile/Inputs/switch.proftext
llvm/test/Transforms/PGOProfile/Inputs/switch_entry.proftext
llvm/test/Transforms/PGOProfile/Inputs/thinlto_cs.proftext
llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll
Removed:
################################################################################
diff --git a/clang/test/CodeGen/Inputs/thinlto_expect1.proftext b/clang/test/CodeGen/Inputs/thinlto_expect1.proftext
index e7ce3a4ee237..0c904e2ea1c8 100644
--- a/clang/test/CodeGen/Inputs/thinlto_expect1.proftext
+++ b/clang/test/CodeGen/Inputs/thinlto_expect1.proftext
@@ -2,7 +2,7 @@
:ir
foo
# Func Hash:
-25571299074
+784007059655560962
# Num Counters:
2
# Counter Values:
diff --git a/clang/test/CodeGen/Inputs/thinlto_expect2.proftext b/clang/test/CodeGen/Inputs/thinlto_expect2.proftext
index f9de785587ab..c240a442c465 100644
--- a/clang/test/CodeGen/Inputs/thinlto_expect2.proftext
+++ b/clang/test/CodeGen/Inputs/thinlto_expect2.proftext
@@ -2,7 +2,7 @@
:csir
foo
# Func Hash:
-25571299074
+784007059655560962
# Num Counters:
2
# Counter Values:
@@ -11,7 +11,7 @@ foo
foo
# Func Hash:
-1152921530178146050
+1936928564262407938
# Num Counters:
2
# Counter Values:
diff --git a/clang/test/CodeGenCXX/Inputs/profile-remap.proftext b/clang/test/CodeGenCXX/Inputs/profile-remap.proftext
index a1f90cfa6e9e..bf57fc696c49 100644
--- a/clang/test/CodeGenCXX/Inputs/profile-remap.proftext
+++ b/clang/test/CodeGenCXX/Inputs/profile-remap.proftext
@@ -1,6 +1,6 @@
:ir
_ZN3Foo8functionENS_1XE
-29667547796
+146835647075900052
2
10
90
diff --git a/clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext b/clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext
index 65bc6ff46711..89772cd7644f 100644
--- a/clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext
+++ b/clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext
@@ -1,7 +1,7 @@
:ir
:entry_first
_ZN3Foo8functionENS_1XE
-29667547796
+146835647075900052
2
100
90
diff --git a/clang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext b/clang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext
index 64d18116ed64..0f39af77715d 100644
--- a/clang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext
+++ b/clang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext
@@ -2,7 +2,7 @@
:ir
main
# Func Hash:
-34137660316
+1063705162469825436
# Num Counters:
2
# Counter Values:
diff --git a/clang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext b/clang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
index 4903f56c419e..d60162c0f529 100644
--- a/clang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
+++ b/clang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
@@ -3,7 +3,7 @@
:entry_first
main
# Func Hash:
-34137660316
+1063705162469825436
# Num Counters:
2
# Counter Values:
diff --git a/compiler-rt/test/profile/Linux/instrprof-value-merge.c b/compiler-rt/test/profile/Linux/instrprof-value-merge.c
index 902430a4a968..2619a1d00336 100644
--- a/compiler-rt/test/profile/Linux/instrprof-value-merge.c
+++ b/compiler-rt/test/profile/Linux/instrprof-value-merge.c
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
// CHECK: Counters:
// CHECK: main:
-// CHECK: Hash: 0x00030012a7ab6e87
+// CHECK: Hash: 0x0a9bd81e87ab6e87
// CHECK: Counters: 6
// CHECK: Indirect Call Site Count: 3
// CHECK: Number of Memory Intrinsics Calls: 3
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 7a14f777b565..5a0185600e06 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -261,6 +261,10 @@ extern cl::opt<PGOViewCountsType> PGOViewCounts;
// Defined in Analysis/BlockFrequencyInfo.cpp: -view-bfi-func-name=
extern cl::opt<std::string> ViewBlockFreqFuncName;
+static cl::opt<bool>
+ PGOOldCFGHashing("pgo-instr-old-cfg-hashing", cl::init(false), cl::Hidden,
+ cl::desc("Use the old CFG function hashing"));
+
// Return a string describing the branch condition that can be
// used in static branch probability heuristics:
static std::string getBranchCondString(Instruction *TI) {
@@ -620,7 +624,8 @@ template <class Edge, class BBInfo> class FuncPGOInstrumentation {
} // end anonymous namespace
// Compute Hash value for the CFG: the lower 32 bits are CRC32 of the index
-// value of each BB in the CFG. The higher 32 bits record the number of edges.
+// value of each BB in the CFG. The higher 32 bits are the CRC32 of the numbers
+// of selects, indirect calls, mem ops and edges.
template <class Edge, class BBInfo>
void FuncPGOInstrumentation<Edge, BBInfo>::computeCFGHash() {
std::vector<uint8_t> Indexes;
@@ -639,12 +644,31 @@ void FuncPGOInstrumentation<Edge, BBInfo>::computeCFGHash() {
}
JC.update(Indexes);
- // Hash format for context sensitive profile. Reserve 4 bits for other
- // information.
- FunctionHash = (uint64_t)SIVisitor.getNumOfSelectInsts() << 56 |
- (uint64_t)ValueSites[IPVK_IndirectCallTarget].size() << 48 |
- //(uint64_t)ValueSites[IPVK_MemOPSize].size() << 40 |
- (uint64_t)MST.AllEdges.size() << 32 | JC.getCRC();
+ JamCRC JCH;
+ if (PGOOldCFGHashing) {
+ // Hash format for context sensitive profile. Reserve 4 bits for other
+ // information.
+ FunctionHash = (uint64_t)SIVisitor.getNumOfSelectInsts() << 56 |
+ (uint64_t)ValueSites[IPVK_IndirectCallTarget].size() << 48 |
+ //(uint64_t)ValueSites[IPVK_MemOPSize].size() << 40 |
+ (uint64_t)MST.AllEdges.size() << 32 | JC.getCRC();
+ } else {
+ // The higher 32 bits.
+ auto updateJCH = [&JCH](uint64_t Num) {
+ uint8_t Data[8];
+ support::endian::write64le(Data, Num);
+ JCH.update(Data);
+ };
+ updateJCH((uint64_t)SIVisitor.getNumOfSelectInsts());
+ updateJCH((uint64_t)ValueSites[IPVK_IndirectCallTarget].size());
+ updateJCH((uint64_t)ValueSites[IPVK_MemOPSize].size());
+ updateJCH((uint64_t)MST.AllEdges.size());
+
+ // Hash format for context sensitive profile. Reserve 4 bits for other
+ // information.
+ FunctionHash = (((uint64_t)JCH.getCRC()) << 28) + JC.getCRC();
+ }
+
// Reserve bit 60-63 for other information purpose.
FunctionHash &= 0x0FFFFFFFFFFFFFFF;
if (IsCS)
@@ -653,8 +677,12 @@ void FuncPGOInstrumentation<Edge, BBInfo>::computeCFGHash() {
<< " CRC = " << JC.getCRC()
<< ", Selects = " << SIVisitor.getNumOfSelectInsts()
<< ", Edges = " << MST.AllEdges.size() << ", ICSites = "
- << ValueSites[IPVK_IndirectCallTarget].size()
- << ", Hash = " << FunctionHash << "\n";);
+ << ValueSites[IPVK_IndirectCallTarget].size());
+ if (!PGOOldCFGHashing) {
+ LLVM_DEBUG(dbgs() << ", Memops = " << ValueSites[IPVK_MemOPSize].size()
+ << ", High32 CRC = " << JCH.getCRC());
+ }
+ LLVM_DEBUG(dbgs() << ", Hash = " << FunctionHash << "\n";);
}
// Check if we can safely rename this Comdat function.
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/PR41279.proftext b/llvm/test/Transforms/PGOProfile/Inputs/PR41279.proftext
index 58c3e89f089c..ce657e720c57 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/PR41279.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/PR41279.proftext
@@ -1,6 +1,6 @@
:ir
foo
-60927483247
+1096621588030135663
4
3
2
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/PR41279_2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/PR41279_2.proftext
index adc16bbad92c..c6cb02aaddd1 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/PR41279_2.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/PR41279_2.proftext
@@ -1,6 +1,6 @@
:ir
f
-62077759478
+1096621589180411894
2
3
2
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext
index 8ca9db9c0515..d5f9123fcc24 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_br_1
-25571299074
+784007059655560962
2
3
2
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch1_large_count.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch1_large_count.proftext
index a5b1f8204e80..4fd528ee076f 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/branch1_large_count.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/branch1_large_count.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_br_1
-25571299074
+784007059655560962
2
12884901888
8589934592
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext
index b5fee2b6f4fa..3e20359b1b84 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_br_2
-29667547796
+146835647075900052
2
1
1
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch2_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
index 51de52d82492..31710fc8f4bd 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
@@ -2,7 +2,7 @@
:ir
:entry_first
test_br_2
-29667547796
+146835647075900052
2
2
1
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext b/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext
index 7613b643b163..85b9779abeec 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_criticalEdge
-82323253069
+93478046750287693
8
2
1
@@ -13,7 +13,7 @@ test_criticalEdge
1
<stdin>:bar
-12884901887
+742261418966908927
1
7
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/criticaledge_entry.proftext
index 79754261d2f8..f1497d6c01c9 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/criticaledge_entry.proftext
@@ -2,7 +2,7 @@
:ir
:entry_first
test_criticalEdge
-82323253069
+93478046750287693
8
7
2
@@ -14,7 +14,7 @@ test_criticalEdge
1
<stdin>:bar
-12884901887
+742261418966908927
1
7
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/cspgo.proftext b/llvm/test/Transforms/PGOProfile/Inputs/cspgo.proftext
index e40a0f29fccc..6d6d86cfb50b 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/cspgo.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/cspgo.proftext
@@ -54,7 +54,7 @@ bar_m2
foo
# Func Hash:
-1152921640672869708
+1456607294772657484
# Num Counters:
10
# Counter Values:
@@ -71,7 +71,7 @@ foo
foo
# Func Hash:
-29212902728
+146835646621254984
# Num Counters:
2
# Counter Values:
@@ -80,7 +80,7 @@ foo
bar
# Func Hash:
-1152921569533132113
+1440408129826749777
# Num Counters:
5
# Counter Values:
@@ -92,7 +92,7 @@ bar
bar
# Func Hash:
-56228292833
+567185239050791137
# Num Counters:
4
# Counter Values:
@@ -103,7 +103,7 @@ bar
main
# Func Hash:
-1152921517491748863
+1895182923573755903
# Num Counters:
1
# Counter Values:
@@ -111,7 +111,7 @@ main
main
# Func Hash:
-12884901887
+742261418966908927
# Num Counters:
1
# Counter Values:
@@ -135,7 +135,7 @@ csfdo_plain.c:barbar
goo
# Func Hash:
-1152921517491748863
+1895182923573755903
# Num Counters:
1
# Counter Values:
@@ -143,7 +143,7 @@ goo
goo
# Func Hash:
-12884901887
+742261418966908927
# Num Counters:
1
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/diag_no_value_sites.proftext b/llvm/test/Transforms/PGOProfile/Inputs/diag_no_value_sites.proftext
index b7ba652292ca..182778755f4b 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/diag_no_value_sites.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/diag_no_value_sites.proftext
@@ -1,6 +1,6 @@
# :ir is the flag to indicate this is IR level profile.
:ir
foo
-12884901887
+48277136972185599
1
1
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/fix_entry_count.proftext b/llvm/test/Transforms/PGOProfile/Inputs/fix_entry_count.proftext
index de4771beaacc..7ca97aa29dbc 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/fix_entry_count.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/fix_entry_count.proftext
@@ -1,7 +1,7 @@
:ir
:entry_first
test_simple_for
-34137660316
+1063705162469825436
2
0
96
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext
index 60c49bf73095..6d92958e89b8 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext
@@ -3,7 +3,7 @@
:entry_first
hot
# Func Hash:
-12884901887
+742261418966908927
# Num Counters:
1
# Counter Values:
@@ -11,7 +11,7 @@ hot
cold
# Func Hash:
-12884901887
+742261418966908927
# Num Counters:
1
# Counter Values:
@@ -19,7 +19,7 @@ cold
med
# Func Hash:
-12884901887
+742261418966908927
# Num Counters:
1
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/indirect_call.proftext b/llvm/test/Transforms/PGOProfile/Inputs/indirect_call.proftext
index d453090d1c58..bb48ccc57a8b 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/indirect_call.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/indirect_call.proftext
@@ -1,7 +1,7 @@
:ir
bar
# Func Hash:
-281487861612543
+170957022131388415
# Num Counters:
1
# Counter Values:
@@ -19,7 +19,7 @@ func3:20
func1
# Func Hash:
-12884901887
+742261418966908927
# Num Counters:
1
# Counter Values:
@@ -27,7 +27,7 @@ func1
func2
# Func Hash:
-12884901887
+742261418966908927
# Num Counters:
1
# Counter Values:
@@ -35,7 +35,7 @@ func2
func3
# Func Hash:
-12884901887
+742261418966908927
# Num Counters:
1
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/indirectbr.proftext b/llvm/test/Transforms/PGOProfile/Inputs/indirectbr.proftext
index 390996847627..49fafd9d99bf 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/indirectbr.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/indirectbr.proftext
@@ -2,7 +2,7 @@
:ir
foo
# Func Hash:
-47485104005
+844982796158316421
# Num Counters:
4
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
index 7173269d20cc..6910f7e21d67 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
@@ -3,7 +3,7 @@
:entry_first
foo
# Func Hash:
-47485104005
+844982796158316421
# Num Counters:
4
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/irreducible.proftext b/llvm/test/Transforms/PGOProfile/Inputs/irreducible.proftext
index 9b0210d9a309..24eacb886489 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/irreducible.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/irreducible.proftext
@@ -1,7 +1,7 @@
:ir
_Z11irreducibleii
# Func Hash:
-64451410787
+287486624745028451
# Num Counters:
6
# Counter Values:
@@ -14,7 +14,7 @@ _Z11irreducibleii
_Z11irreduciblePh
# Func Hash:
-104649601521
+331779889035882993
# Num Counters:
9
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
index d04cfddda896..702c42d1addc 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
@@ -2,7 +2,7 @@
:entry_first
_Z11irreducibleii
# Func Hash:
-64451410787
+287486624745028451
# Num Counters:
6
# Counter Values:
@@ -15,7 +15,7 @@ _Z11irreducibleii
_Z11irreduciblePh
# Func Hash:
-104649601521
+331779889035882993
# Num Counters:
9
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext b/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext
index c71fd04170be..7a74b296e55f 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
foo
-59130013419
+567185241952511723
4
3
1
@@ -9,7 +9,7 @@ foo
0
bar
-24868915205
+784007058953177093
2
3
2
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
index 3175d9c0d630..9b604038abcc 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
@@ -2,7 +2,7 @@
:ir
:entry_first
foo
-59130013419
+567185241952511723
4
5
1
@@ -10,7 +10,7 @@ foo
0
bar
-24868915205
+784007058953177093
2
3
2
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/large_count_remarks.proftext b/llvm/test/Transforms/PGOProfile/Inputs/large_count_remarks.proftext
index 814af7402b28..8e23ae6906b0 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/large_count_remarks.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/large_count_remarks.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test
-25571299074
+784007059655560962
2
40000000000
20000000000
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext
index c19737149ca2..25eeefe33c11 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_simple_for
-34137660316
+1063705162469825436
2
96
4
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop1_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
index b61634d94689..56f04e808aee 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
@@ -2,7 +2,7 @@
:ir
:entry_first
test_simple_for
-34137660316
+1063705162469825436
2
4
96
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext
index af3a71df1e6b..7ab9cd6b946e 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_nested_for
-53929068288
+798733566382720768
3
33
10
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop2_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
index ac8536a52675..bde1b7e4a4c1 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
@@ -2,7 +2,7 @@
:ir
:entry_first
test_nested_for
-53929068288
+798733566382720768
3
6
33
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/memop_size_annotation.proftext b/llvm/test/Transforms/PGOProfile/Inputs/memop_size_annotation.proftext
index cce1a67a9457..83aec54f2328 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/memop_size_annotation.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/memop_size_annotation.proftext
@@ -2,7 +2,7 @@
:ir
foo
# Func Hash:
-53929068288
+687116424982578944
# Num Counters:
3
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch-correct.proftext b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch-correct.proftext
index c785a40efea5..24c9746262bd 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch-correct.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch-correct.proftext
@@ -2,7 +2,7 @@
:ir
bar
# Func Hash:
-29667547796
+146835647075900052
# Num Counters:
2
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch.proftext b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch.proftext
index 36eaa3462782..5505df737527 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch.proftext
@@ -2,7 +2,7 @@
:ir
bar
# Func Hash:
-29667547796
+146835647075900052
# Num Counters:
2
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch_entry.proftext
index df7d6cf80466..752b885ad2b2 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch_entry.proftext
@@ -3,7 +3,7 @@
:entry_first
bar
# Func Hash:
-29667547796
+146835647075900052
# Num Counters:
2
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct.proftext b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct.proftext
index b0924938ea83..39864486bb96 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct.proftext
@@ -2,7 +2,7 @@
:ir
main
# Func Hash:
-74054140268
+391331300939170156
# Num Counters:
7
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct_entry.proftext
index 4686fec3bee7..c74f3230939e 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct_entry.proftext
@@ -3,7 +3,7 @@
:entry_first
main
# Func Hash:
-74054140268
+391331300939170156
# Num Counters:
7
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch.proftext b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch.proftext
index 8e8049f3dc62..ea50f6b6043f 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch.proftext
@@ -2,7 +2,7 @@
:ir
main
# Func Hash:
-74054140268
+391331300939170156
# Num Counters:
7
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch_entry.proftext
index 3da4c10ac19d..6afb6c9019f2 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch_entry.proftext
@@ -3,7 +3,7 @@
:entry_first
main
# Func Hash:
-74054140268
+391331300939170156
# Num Counters:
7
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext b/llvm/test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext
index 5bf67fb2bfaf..77f8d5a5ade3 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext
@@ -2,13 +2,23 @@
:ir
_Z3fooi
# Func Hash:
-72057606922829823
+382993475055910911
# Num Counters:
2
# Counter Values:
18
12
+# For -pgo-instr-old-cfg-hashing=true
+_Z3fooi
+# Func Hash:
+72057606922829823
+# Num Counters:
+2
+# Counter Values:
+18
+6
+
_Z3fooi
# Func Hash:
12884901887
@@ -17,6 +27,16 @@ _Z3fooi
# Counter Values:
0
+_Z3bari
+# Func Hash:
+382993475055910911
+# Num Counters:
+2
+# Counter Values:
+0
+0
+
+# For -pgo-instr-old-cfg-hashing=true
_Z3bari
# Func Hash:
72057606922829823
@@ -28,9 +48,17 @@ _Z3bari
_Z4m2f1v
# Func Hash:
-12884901887
+742261418966908927
# Num Counters:
1
# Counter Values:
1
+# For -pgo-instr-old-cfg-hashing=true
+_Z4m2f1v
+# Func Hash:
+12884901887
+# Num Counters:
+1
+# Counter Values:
+1
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/noreturncall.proftext b/llvm/test/Transforms/PGOProfile/Inputs/noreturncall.proftext
index 1bedce5b9f9b..bb4b0719cf12 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/noreturncall.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/noreturncall.proftext
@@ -2,7 +2,7 @@
:ir
foo
# Func Hash:
-36496524737
+238984482720105921
# Num Counters:
3
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/remap.proftext b/llvm/test/Transforms/PGOProfile/Inputs/remap.proftext
index 40054d78f5aa..d9b22637d3a7 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/remap.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/remap.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
_ZN3foo3barERKN1N1XINS_4quuxEEE
-25571299074
+784007059655560962
2
3
2
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/select1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/select1.proftext
index 60663e02ffb4..c4d6d56073b0 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/select1.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/select1.proftext
@@ -1,7 +1,7 @@
:ir
:entry_first
test_br_2
-72057623705475732
+942389667449461396
3
5
1
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/select2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/select2.proftext
index 8f3c562097fa..0d4b003ec066 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/select2.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/select2.proftext
@@ -3,7 +3,7 @@
:entry_first
foo
# Func Hash:
-72057628175588252
+134732432632142748
# Num Counters:
3
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/suppl-profile.proftext b/llvm/test/Transforms/PGOProfile/Inputs/suppl-profile.proftext
index c82311b3e0c0..41f4fbe655fa 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/suppl-profile.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/suppl-profile.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_simple_for
-34137660316
+1063705162469825436
2
0
0
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext b/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext
index bebd65fa4c9f..cf73ed083794 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext
@@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_switch
-46200943743
+536873293052540031
4
0
5
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/switch_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/switch_entry.proftext
index 20df873608c1..cf079893e340 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/switch_entry.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/switch_entry.proftext
@@ -2,7 +2,7 @@
:ir
:entry_first
test_switch
-46200943743
+536873293052540031
4
10
5
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cs.proftext b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cs.proftext
index 4717752da716..1b9f19e7f7fa 100644
--- a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cs.proftext
+++ b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cs.proftext
@@ -10,7 +10,7 @@ cond.llvm.11253644763537639171
foo
# Func Hash:
-29212902728
+1720106746050921044
# Num Counters:
2
# Counter Values:
@@ -19,7 +19,7 @@ foo
bar
# Func Hash:
-1152921534274394772
+1299757151682747028
# Num Counters:
2
# Counter Values:
@@ -45,7 +45,7 @@ main
main
# Func Hash:
-12884901887
+1895182923573755903
# Num Counters:
1
# Counter Values:
@@ -53,7 +53,7 @@ main
cspgo.c:foo
# Func Hash:
-1152921563228422740
+1720106746050921044
# Num Counters:
4
# Counter Values:
diff --git a/llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll b/llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll
index fdfb16b9e2e5..f0011114f0d0 100644
--- a/llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll
+++ b/llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll
@@ -1,6 +1,8 @@
; RUN: llvm-profdata merge %S/Inputs/multiple_hash_profile.proftext -o %t.profdata
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s
+; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-old-cfg-hashing=true -S | FileCheck -check-prefix=CHECKOLDHASH %s
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s
+; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-old-cfg-hashing=true -S | FileCheck -check-prefix=CHECKOLDHASH %s
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@@ -29,6 +31,9 @@ entry:
; CHECK: %mul.i = select i1 %cmp.i, i32 1, i32 %i
; CHECK-SAME: !prof ![[BW:[0-9]+]]
; CHECK: ![[BW]] = !{!"branch_weights", i32 12, i32 6}
+; CHECKOLDHASH: %mul.i = select i1 %cmp.i, i32 1, i32 %i
+; CHECKOLDHASH-SAME: !prof ![[BW:[0-9]+]]
+; CHECKOLDHASH: ![[BW]] = !{!"branch_weights", i32 6, i32 12}
%retval.0.i = mul nsw i32 %mul.i, %i
ret i32 %retval.0.i
}
More information about the cfe-commits
mailing list