diff options
author | Hongtao Yu <hoy@fb.com> | 2021-06-17 11:09:13 -0700 |
---|---|---|
committer | Hongtao Yu <hoy@fb.com> | 2021-06-18 15:14:11 -0700 |
commit | bd52495518808bdbf24f4d8e9e20774d6d2e3333 (patch) | |
tree | 584ed0830c3b5ad0a0e9e5007b07972392df3d57 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 36f93fc594ea168d541bb2fde95014a5502bef88 (diff) | |
download | llvm-bd52495518808bdbf24f4d8e9e20774d6d2e3333.zip llvm-bd52495518808bdbf24f4d8e9e20774d6d2e3333.tar.gz llvm-bd52495518808bdbf24f4d8e9e20774d6d2e3333.tar.bz2 |
[CSSPGO] Undoing the concept of dangling pseudo probe
As a follow-up to https://reviews.llvm.org/D104129, I'm cleaning up the danling probe related code in both the compiler and llvm-profgen.
I'm seeing a 5% size win for the pseudo_probe section for SPEC2017 and 10% for Ciner. Certain benchmark such as 602.gcc has a 20% size win. No obvious difference seen on build time for SPEC2017 and Cinder.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D104477
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 1011f52..c6914dc 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -901,32 +901,6 @@ MachineBasicBlock::transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB) { normalizeSuccProbs(); } -/// A block emptied (i.e., with all instructions moved out of it) won't be -/// sampled at run time. In such cases, AutoFDO will be informed of zero samples -/// collected for the block. This is not accurate and could lead to misleading -/// weights assigned for the block. A way to mitigate that is to treat such -/// block as having unknown counts in the AutoFDO profile loader and allow the -/// counts inference tool a chance to calculate a relatively reasonable weight -/// for it. This can be done by moving all pseudo probes in the emptied block -/// i.e, /c this, to before /c ToMBB and tag them dangling. Note that this is -/// not needed for dead blocks which really have a zero weight. It's per -/// transforms to decide whether to call this function or not. -void MachineBasicBlock::moveAndDanglePseudoProbes(MachineBasicBlock *ToMBB) { - SmallVector<MachineInstr *, 4> ToBeMoved; - for (MachineInstr &MI : instrs()) { - if (MI.isPseudoProbe()) { - MI.addPseudoProbeAttribute(PseudoProbeAttributes::Dangling); - ToBeMoved.push_back(&MI); - } - } - - MachineBasicBlock::iterator I = ToMBB->getFirstTerminator(); - for (MachineInstr *MI : ToBeMoved) { - MI->removeFromParent(); - ToMBB->insert(I, MI); - } -} - bool MachineBasicBlock::isPredecessor(const MachineBasicBlock *MBB) const { return is_contained(predecessors(), MBB); } |