1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Revert "[PGO] Include the mem ops into the function hash."

This reverts commit 120e66b3418b37b95fc1dbbb23e296a602a24fa8.

Due to a buildbot failure.
This commit is contained in:
Hiroshi Yamauchi 2020-07-29 15:04:57 -07:00
parent 13dfcf7ce3
commit ba8d265716
43 changed files with 72 additions and 136 deletions

View File

@ -261,10 +261,6 @@ 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) {
@ -624,8 +620,7 @@ public:
} // 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 are the CRC32 of the numbers
// of selects, indirect calls, mem ops and edges.
// value of each BB in the CFG. The higher 32 bits record the number of edges.
template <class Edge, class BBInfo>
void FuncPGOInstrumentation<Edge, BBInfo>::computeCFGHash() {
std::vector<uint8_t> Indexes;
@ -644,34 +639,12 @@ void FuncPGOInstrumentation<Edge, BBInfo>::computeCFGHash() {
}
JC.update(Indexes);
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.
union {
uint64_t N;
uint8_t C[8];
} Data;
Data.N = (uint64_t)SIVisitor.getNumOfSelectInsts();
JCH.update(Data.C);
Data.N = (uint64_t)ValueSites[IPVK_IndirectCallTarget].size();
JCH.update(Data.C);
Data.N = (uint64_t)ValueSites[IPVK_MemOPSize].size();
JCH.update(Data.C);
Data.N = (uint64_t)MST.AllEdges.size();
JCH.update(Data.C);
// Hash format for context sensitive profile. Reserve 4 bits for other
// information.
FunctionHash = (((uint64_t)JCH.getCRC()) << 28) + JC.getCRC();
}
// 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();
// Reserve bit 60-63 for other information purpose.
FunctionHash &= 0x0FFFFFFFFFFFFFFF;
if (IsCS)
@ -680,12 +653,8 @@ void FuncPGOInstrumentation<Edge, BBInfo>::computeCFGHash() {
<< " CRC = " << JC.getCRC()
<< ", Selects = " << SIVisitor.getNumOfSelectInsts()
<< ", Edges = " << MST.AllEdges.size() << ", ICSites = "
<< ValueSites[IPVK_IndirectCallTarget].size());
if (!PGOOldCFGHashing) {
LLVM_DEBUG(dbgs() << ", Memops = " << ValueSites[IPVK_MemOPSize].size()
<< ", High32 CRC = " << JCH.getCRC());
}
LLVM_DEBUG(dbgs() << ", Hash = " << FunctionHash << "\n";);
<< ValueSites[IPVK_IndirectCallTarget].size()
<< ", Hash = " << FunctionHash << "\n";);
}
// Check if we can safely rename this Comdat function.

View File

@ -1,6 +1,6 @@
:ir
foo
1096621588030135663
60927483247
4
3
2

View File

@ -1,6 +1,6 @@
:ir
f
1096621589180411894
62077759478
2
3
2

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_br_1
784007059655560962
25571299074
2
3
2

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_br_1
784007059655560962
25571299074
2
12884901888
8589934592

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_br_2
146835647075900052
29667547796
2
1
1

View File

@ -2,7 +2,7 @@
:ir
:entry_first
test_br_2
146835647075900052
29667547796
2
2
1

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_criticalEdge
93478046750287693
82323253069
8
2
1
@ -13,7 +13,7 @@ test_criticalEdge
1
<stdin>:bar
742261418966908927
12884901887
1
7

View File

@ -2,7 +2,7 @@
:ir
:entry_first
test_criticalEdge
93478046750287693
82323253069
8
7
2
@ -14,7 +14,7 @@ test_criticalEdge
1
<stdin>:bar
742261418966908927
12884901887
1
7

View File

@ -54,7 +54,7 @@ bar_m2
foo
# Func Hash:
1456607294772657484
1152921640672869708
# Num Counters:
10
# Counter Values:
@ -71,7 +71,7 @@ foo
foo
# Func Hash:
146835646621254984
29212902728
# Num Counters:
2
# Counter Values:
@ -80,7 +80,7 @@ foo
bar
# Func Hash:
1440408129826749777
1152921569533132113
# Num Counters:
5
# Counter Values:
@ -92,7 +92,7 @@ bar
bar
# Func Hash:
567185239050791137
56228292833
# Num Counters:
4
# Counter Values:
@ -103,7 +103,7 @@ bar
main
# Func Hash:
1895182923573755903
1152921517491748863
# Num Counters:
1
# Counter Values:
@ -111,7 +111,7 @@ main
main
# Func Hash:
742261418966908927
12884901887
# Num Counters:
1
# Counter Values:
@ -135,7 +135,7 @@ csfdo_plain.c:barbar
goo
# Func Hash:
1895182923573755903
1152921517491748863
# Num Counters:
1
# Counter Values:
@ -143,7 +143,7 @@ goo
goo
# Func Hash:
742261418966908927
12884901887
# Num Counters:
1
# Counter Values:

View File

@ -1,6 +1,6 @@
# :ir is the flag to indicate this is IR level profile.
:ir
foo
48277136972185599
12884901887
1
1

View File

@ -1,7 +1,7 @@
:ir
:entry_first
test_simple_for
1063705162469825436
34137660316
2
0
96

View File

@ -3,7 +3,7 @@
:entry_first
hot
# Func Hash:
742261418966908927
12884901887
# Num Counters:
1
# Counter Values:
@ -11,7 +11,7 @@ hot
cold
# Func Hash:
742261418966908927
12884901887
# Num Counters:
1
# Counter Values:
@ -19,7 +19,7 @@ cold
med
# Func Hash:
742261418966908927
12884901887
# Num Counters:
1
# Counter Values:

View File

@ -1,7 +1,7 @@
:ir
bar
# Func Hash:
170957022131388415
281487861612543
# Num Counters:
1
# Counter Values:
@ -19,7 +19,7 @@ func3:20
func1
# Func Hash:
742261418966908927
12884901887
# Num Counters:
1
# Counter Values:
@ -27,7 +27,7 @@ func1
func2
# Func Hash:
742261418966908927
12884901887
# Num Counters:
1
# Counter Values:
@ -35,7 +35,7 @@ func2
func3
# Func Hash:
742261418966908927
12884901887
# Num Counters:
1
# Counter Values:

View File

@ -2,7 +2,7 @@
:ir
foo
# Func Hash:
844982796158316421
47485104005
# Num Counters:
4
# Counter Values:

View File

@ -3,7 +3,7 @@
:entry_first
foo
# Func Hash:
844982796158316421
47485104005
# Num Counters:
4
# Counter Values:

View File

@ -1,7 +1,7 @@
:ir
_Z11irreducibleii
# Func Hash:
287486624745028451
64451410787
# Num Counters:
6
# Counter Values:
@ -14,7 +14,7 @@ _Z11irreducibleii
_Z11irreduciblePh
# Func Hash:
331779889035882993
104649601521
# Num Counters:
9
# Counter Values:

View File

@ -2,7 +2,7 @@
:entry_first
_Z11irreducibleii
# Func Hash:
287486624745028451
64451410787
# Num Counters:
6
# Counter Values:
@ -15,7 +15,7 @@ _Z11irreducibleii
_Z11irreduciblePh
# Func Hash:
331779889035882993
104649601521
# Num Counters:
9
# Counter Values:

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
foo
567185241952511723
59130013419
4
3
1
@ -9,7 +9,7 @@ foo
0
bar
784007058953177093
24868915205
2
3
2

View File

@ -2,7 +2,7 @@
:ir
:entry_first
foo
567185241952511723
59130013419
4
5
1
@ -10,7 +10,7 @@ foo
0
bar
784007058953177093
24868915205
2
3
2

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test
784007059655560962
25571299074
2
40000000000
20000000000

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_simple_for
1063705162469825436
34137660316
2
96
4

View File

@ -2,7 +2,7 @@
:ir
:entry_first
test_simple_for
1063705162469825436
34137660316
2
4
96

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_nested_for
798733566382720768
53929068288
3
33
10

View File

@ -2,7 +2,7 @@
:ir
:entry_first
test_nested_for
798733566382720768
53929068288
3
6
33

View File

@ -2,7 +2,7 @@
:ir
foo
# Func Hash:
687116424982578944
53929068288
# Num Counters:
3
# Counter Values:

View File

@ -2,7 +2,7 @@
:ir
bar
# Func Hash:
146835647075900052
29667547796
# Num Counters:
2
# Counter Values:

View File

@ -2,7 +2,7 @@
:ir
bar
# Func Hash:
146835647075900052
29667547796
# Num Counters:
2
# Counter Values:

View File

@ -3,7 +3,7 @@
:entry_first
bar
# Func Hash:
146835647075900052
29667547796
# Num Counters:
2
# Counter Values:

View File

@ -2,7 +2,7 @@
:ir
main
# Func Hash:
391331300939170156
74054140268
# Num Counters:
7
# Counter Values:

View File

@ -3,7 +3,7 @@
:entry_first
main
# Func Hash:
391331300939170156
74054140268
# Num Counters:
7
# Counter Values:

View File

@ -2,7 +2,7 @@
:ir
main
# Func Hash:
391331300939170156
74054140268
# Num Counters:
7
# Counter Values:

View File

@ -3,7 +3,7 @@
:entry_first
main
# Func Hash:
391331300939170156
74054140268
# Num Counters:
7
# Counter Values:

View File

@ -2,23 +2,13 @@
:ir
_Z3fooi
# Func Hash:
382993475055910911
72057606922829823
# 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
@ -27,16 +17,6 @@ _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
@ -46,15 +26,6 @@ _Z3bari
0
0
_Z4m2f1v
# Func Hash:
742261418966908927
# Num Counters:
1
# Counter Values:
1
# For -pgo-instr-old-cfg-hashing=true
_Z4m2f1v
# Func Hash:
12884901887
@ -62,3 +33,4 @@ _Z4m2f1v
1
# Counter Values:
1

View File

@ -2,7 +2,7 @@
:ir
foo
# Func Hash:
238984482720105921
36496524737
# Num Counters:
3
# Counter Values:

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
_ZN3foo3barERKN1N1XINS_4quuxEEE
784007059655560962
25571299074
2
3
2

View File

@ -1,7 +1,7 @@
:ir
:entry_first
test_br_2
942389667449461396
72057623705475732
3
5
1

View File

@ -3,7 +3,7 @@
:entry_first
foo
# Func Hash:
134732432632142748
72057628175588252
# Num Counters:
3
# Counter Values:

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_simple_for
1063705162469825436
34137660316
2
0
0

View File

@ -1,7 +1,7 @@
# :ir is the flag to indicate this is IR level profile.
:ir
test_switch
536873293052540031
46200943743
4
0
5

View File

@ -2,7 +2,7 @@
:ir
:entry_first
test_switch
536873293052540031
46200943743
4
10
5

View File

@ -10,7 +10,7 @@ cond.llvm.11253644763537639171
foo
# Func Hash:
1720106746050921044
29212902728
# Num Counters:
2
# Counter Values:
@ -19,7 +19,7 @@ foo
bar
# Func Hash:
1299757151682747028
1152921534274394772
# Num Counters:
2
# Counter Values:
@ -45,7 +45,7 @@ main
main
# Func Hash:
1895182923573755903
12884901887
# Num Counters:
1
# Counter Values:
@ -53,7 +53,7 @@ main
cspgo.c:foo
# Func Hash:
1720106746050921044
1152921563228422740
# Num Counters:
4
# Counter Values:

View File

@ -1,8 +1,6 @@
; 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"
@ -31,9 +29,6 @@ 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
}