diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2020-01-27 10:05:54 -0800 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2020-01-28 10:58:46 -0800 |
commit | 2c03c899d505e264b26ca20237ea455d85e51bed (patch) | |
tree | 5a52ebeb7c21103706ce80c82dd5a430729743e4 /llvm/lib/CodeGen/BranchFolding.cpp | |
parent | b8d9ac08703b1ae9c3cd721c39774053786a9980 (diff) | |
download | llvm-2c03c899d505e264b26ca20237ea455d85e51bed.zip llvm-2c03c899d505e264b26ca20237ea455d85e51bed.tar.gz llvm-2c03c899d505e264b26ca20237ea455d85e51bed.tar.bz2 |
[MBFI] Move BranchFolding::MBFIWrapper to its own files. NFC.
Summary:
To avoid header file circular dependency issues in passing updated MBFI (in
MBFIWrapper) to the interface of profile guided size optimizations.
A prep step for (and split off of) D73381.
Reviewers: davidxl
Subscribers: mgorny, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73494
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index a38c4f3..eb4e076 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -129,7 +129,7 @@ bool BranchFolderPass::runOnMachineFunction(MachineFunction &MF) { // HW that requires structurized CFG. bool EnableTailMerge = !MF.getTarget().requiresStructuredCFG() && PassConfig->getEnableTailMerge(); - BranchFolder::MBFIWrapper MBBFreqInfo( + MBFIWrapper MBBFreqInfo( getAnalysis<MachineBlockFrequencyInfo>()); BranchFolder Folder(EnableTailMerge, /*CommonHoist=*/true, MBBFreqInfo, getAnalysis<MachineBranchProbabilityInfo>(), @@ -501,42 +501,6 @@ BranchFolder::MergePotentialsElt::operator<(const MergePotentialsElt &o) const { #endif } -BlockFrequency -BranchFolder::MBFIWrapper::getBlockFreq(const MachineBasicBlock *MBB) const { - auto I = MergedBBFreq.find(MBB); - - if (I != MergedBBFreq.end()) - return I->second; - - return MBFI.getBlockFreq(MBB); -} - -void BranchFolder::MBFIWrapper::setBlockFreq(const MachineBasicBlock *MBB, - BlockFrequency F) { - MergedBBFreq[MBB] = F; -} - -raw_ostream & -BranchFolder::MBFIWrapper::printBlockFreq(raw_ostream &OS, - const MachineBasicBlock *MBB) const { - return MBFI.printBlockFreq(OS, getBlockFreq(MBB)); -} - -raw_ostream & -BranchFolder::MBFIWrapper::printBlockFreq(raw_ostream &OS, - const BlockFrequency Freq) const { - return MBFI.printBlockFreq(OS, Freq); -} - -void BranchFolder::MBFIWrapper::view(const Twine &Name, bool isSimple) { - MBFI.view(Name, isSimple); -} - -uint64_t -BranchFolder::MBFIWrapper::getEntryFreq() const { - return MBFI.getEntryFreq(); -} - /// CountTerminators - Count the number of terminators in the given /// block and set I to the position of the first non-terminator, if there /// is one, or MBB->end() otherwise. @@ -591,7 +555,7 @@ ProfitableToMerge(MachineBasicBlock *MBB1, MachineBasicBlock *MBB2, MachineBasicBlock *PredBB, DenseMap<const MachineBasicBlock *, int> &EHScopeMembership, bool AfterPlacement, - BranchFolder::MBFIWrapper &MBBFreqInfo, + MBFIWrapper &MBBFreqInfo, ProfileSummaryInfo *PSI) { // It is never profitable to tail-merge blocks from two different EH scopes. if (!EHScopeMembership.empty()) { |