[PATCH] D144306: [BOLT] adding hash computation for basic blocks
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 26 12:49:51 PDT 2023
Amir added a comment.
Looks good in general with a couple of nits. Testing with a full battery of tests.
================
Comment at: bolt/lib/Core/BinaryFunction.cpp:3608-3610
for (const BinaryBasicBlock *BB : Order) {
- for (const MCInst &Inst : *BB) {
- unsigned Opcode = Inst.getOpcode();
-
- if (BC.MIB->isPseudo(Inst))
- continue;
-
- // Ignore unconditional jumps since we check CFG consistency by processing
- // basic blocks in order and do not rely on branches to be in-sync with
- // CFG. Note that we still use condition code of conditional jumps.
- if (BC.MIB->isUnconditionalBranch(Inst))
- continue;
-
- if (Opcode == 0)
- HashString.push_back(0);
-
- while (Opcode) {
- uint8_t LSB = Opcode & 0xff;
- HashString.push_back(LSB);
- Opcode = Opcode >> 8;
- }
-
- for (const MCOperand &Op : MCPlus::primeOperands(Inst))
- HashString.append(OperandHashFunc(Op));
- }
+ HashString.append(hashBlock(BC, *BB, OperandHashFunc));
}
----------------
================
Comment at: bolt/lib/Profile/YAMLProfileWriter.cpp:123-125
+ BB->branch_info()) {
SuccessorExecCount += BranchInfo.Count;
+ }
----------------
================
Comment at: bolt/lib/Profile/YAMLProfileWriter.cpp:127-129
+ for (auto Pred : BB->predecessors()) {
+ PredecessorExecCount += Pred->getBranchInfo(*BB).Count;
+ }
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144306/new/
https://reviews.llvm.org/D144306
More information about the llvm-commits
mailing list