[llvm] Adding Matching and Inference Functionality to Propeller-Patch 1 (PR #140886)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 22 02:28:12 PDT 2025
================
@@ -0,0 +1,104 @@
+#include "llvm/CodeGen/MachineBlockHashInfo.h"
+#include "llvm/CodeGen/Passes.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/InitializePasses.h"
+
+using namespace llvm;
+
+using OperandHashFuncTy = function_ref<uint64_t(uint64_t &, const MachineOperand &)>;
+
+uint64_t hashBlock(const MachineBasicBlock &MBB, OperandHashFuncTy OperandHashFunc) {
+ uint64_t Hash = 0;
+ for (const MachineInstr &MI : MBB) {
+ if (MI.isPseudo())
----------------
wdx727 wrote:
For stale profile, the ordering of basic blocks is prone to changes. In the Matching and Inference technique, hashes of basic blocks are used to accurately match basic blocks even when their ordering changes. We disregard pseudo-instructions, nop instructions, and unconditional jumps, as these are frequently added or removed due to basic block reordering. For more detailed explanations, refer to Section 3.1 of the Matching and Inference paper (https://arxiv.org/abs/2401.17168).
https://github.com/llvm/llvm-project/pull/140886
More information about the llvm-commits
mailing list