Skip to content

Commit b2b4ffb

Browse files
[Instrumentation] Remove -pgo-instr-old-cfg-hashing (llvm#77357)
It's been more than 3 years since -pgo-instr-old-cfg-hashing was introduced by: commit 120e66b Author: Hiroshi Yamauchi <[email protected]> Date: Tue Jul 28 10:09:49 2020 -0700 I don't think anyone really cares about the ability to use the old CFG hashing at this point.
1 parent f6dbd4c commit b2b4ffb

File tree

3 files changed

+18
-66
lines changed

3 files changed

+18
-66
lines changed

llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,6 @@ extern cl::opt<std::string> ViewBlockFreqFuncName;
330330
extern cl::opt<InstrProfCorrelator::ProfCorrelatorKind> ProfileCorrelate;
331331
} // namespace llvm
332332

333-
static cl::opt<bool>
334-
PGOOldCFGHashing("pgo-instr-old-cfg-hashing", cl::init(false), cl::Hidden,
335-
cl::desc("Use the old CFG function hashing"));
336-
337333
// Return a string describing the branch condition that can be
338334
// used in static branch probability heuristics:
339335
static std::string getBranchCondString(Instruction *TI) {
@@ -635,34 +631,25 @@ void FuncPGOInstrumentation<Edge, BBInfo>::computeCFGHash() {
635631
JC.update(Indexes);
636632

637633
JamCRC JCH;
638-
if (PGOOldCFGHashing) {
639-
// Hash format for context sensitive profile. Reserve 4 bits for other
640-
// information.
641-
FunctionHash = (uint64_t)SIVisitor.getNumOfSelectInsts() << 56 |
642-
(uint64_t)ValueSites[IPVK_IndirectCallTarget].size() << 48 |
643-
//(uint64_t)ValueSites[IPVK_MemOPSize].size() << 40 |
644-
(uint64_t)MST.numEdges() << 32 | JC.getCRC();
634+
// The higher 32 bits.
635+
auto updateJCH = [&JCH](uint64_t Num) {
636+
uint8_t Data[8];
637+
support::endian::write64le(Data, Num);
638+
JCH.update(Data);
639+
};
640+
updateJCH((uint64_t)SIVisitor.getNumOfSelectInsts());
641+
updateJCH((uint64_t)ValueSites[IPVK_IndirectCallTarget].size());
642+
updateJCH((uint64_t)ValueSites[IPVK_MemOPSize].size());
643+
if (BCI) {
644+
updateJCH(BCI->getInstrumentedBlocksHash());
645645
} else {
646-
// The higher 32 bits.
647-
auto updateJCH = [&JCH](uint64_t Num) {
648-
uint8_t Data[8];
649-
support::endian::write64le(Data, Num);
650-
JCH.update(Data);
651-
};
652-
updateJCH((uint64_t)SIVisitor.getNumOfSelectInsts());
653-
updateJCH((uint64_t)ValueSites[IPVK_IndirectCallTarget].size());
654-
updateJCH((uint64_t)ValueSites[IPVK_MemOPSize].size());
655-
if (BCI) {
656-
updateJCH(BCI->getInstrumentedBlocksHash());
657-
} else {
658-
updateJCH((uint64_t)MST.numEdges());
659-
}
660-
661-
// Hash format for context sensitive profile. Reserve 4 bits for other
662-
// information.
663-
FunctionHash = (((uint64_t)JCH.getCRC()) << 28) + JC.getCRC();
646+
updateJCH((uint64_t)MST.numEdges());
664647
}
665648

649+
// Hash format for context sensitive profile. Reserve 4 bits for other
650+
// information.
651+
FunctionHash = (((uint64_t)JCH.getCRC()) << 28) + JC.getCRC();
652+
666653
// Reserve bit 60-63 for other information purpose.
667654
FunctionHash &= 0x0FFFFFFFFFFFFFFF;
668655
if (IsCS)
@@ -672,10 +659,8 @@ void FuncPGOInstrumentation<Edge, BBInfo>::computeCFGHash() {
672659
<< ", Selects = " << SIVisitor.getNumOfSelectInsts()
673660
<< ", Edges = " << MST.numEdges() << ", ICSites = "
674661
<< ValueSites[IPVK_IndirectCallTarget].size());
675-
if (!PGOOldCFGHashing) {
676-
LLVM_DEBUG(dbgs() << ", Memops = " << ValueSites[IPVK_MemOPSize].size()
677-
<< ", High32 CRC = " << JCH.getCRC());
678-
}
662+
LLVM_DEBUG(dbgs() << ", Memops = " << ValueSites[IPVK_MemOPSize].size()
663+
<< ", High32 CRC = " << JCH.getCRC());
679664
LLVM_DEBUG(dbgs() << ", Hash = " << FunctionHash << "\n";);
680665

681666
if (PGOTraceFuncHash != "-" && F.getName().contains(PGOTraceFuncHash))

llvm/test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ _Z3fooi
99
18
1010
12
1111

12-
# For -pgo-instr-old-cfg-hashing=true
13-
_Z3fooi
14-
# Func Hash:
15-
72057606922829823
16-
# Num Counters:
17-
2
18-
# Counter Values:
19-
18
20-
6
21-
2212
_Z3fooi
2313
# Func Hash:
2414
12884901887
@@ -36,29 +26,10 @@ _Z3bari
3626
0
3727
0
3828

39-
# For -pgo-instr-old-cfg-hashing=true
40-
_Z3bari
41-
# Func Hash:
42-
72057606922829823
43-
# Num Counters:
44-
2
45-
# Counter Values:
46-
0
47-
0
48-
4929
_Z4m2f1v
5030
# Func Hash:
5131
742261418966908927
5232
# Num Counters:
5333
1
5434
# Counter Values:
5535
1
56-
57-
# For -pgo-instr-old-cfg-hashing=true
58-
_Z4m2f1v
59-
# Func Hash:
60-
12884901887
61-
# Num Counters:
62-
1
63-
# Counter Values:
64-
1

llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
; RUN: llvm-profdata merge %S/Inputs/multiple_hash_profile.proftext -o %t.profdata
22
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s
3-
; 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
43
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
54
target triple = "x86_64-unknown-linux-gnu"
65

@@ -29,9 +28,6 @@ entry:
2928
; CHECK: %mul.i = select i1 %cmp.i, i32 1, i32 %i
3029
; CHECK-SAME: !prof ![[BW:[0-9]+]]
3130
; CHECK: ![[BW]] = !{!"branch_weights", i32 12, i32 6}
32-
; CHECKOLDHASH: %mul.i = select i1 %cmp.i, i32 1, i32 %i
33-
; CHECKOLDHASH-SAME: !prof ![[BW:[0-9]+]]
34-
; CHECKOLDHASH: ![[BW]] = !{!"branch_weights", i32 6, i32 12}
3531
%retval.0.i = mul nsw i32 %mul.i, %i
3632
ret i32 %retval.0.i
3733
}

0 commit comments

Comments
 (0)