mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-15 09:51:00 +00:00
[Dominators][CodeGen] Add MachinePostDominatorTree verification
Summary: This patch implements Machine PostDominator Tree verification and ensures that the verification doesn't fail the in-tree tests. MPDT verification can be enabled using `verify-machine-dom-info` -- the same flag used by Machine Dominator Tree verification. Flipping the flag revealed that MachineSink falsely claimed to preserve CFG and MDT/MPDT. This patch fixes that. Reviewers: arsenm, hliao, rampitec, vpykhtin, grosser Reviewed By: hliao Subscribers: wdng, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68235 llvm-svn: 373341
This commit is contained in:
parent
947cafdb7b
commit
c1f3d6cc06
@ -85,6 +85,7 @@ public:
|
||||
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
void releaseMemory() override { PDT.reset(nullptr); }
|
||||
void verifyAnalysis() const override;
|
||||
void print(llvm::raw_ostream &OS, const Module *M = nullptr) const override;
|
||||
};
|
||||
} //end of namespace llvm
|
||||
|
@ -18,12 +18,15 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
// Always verify dominfo if expensive checking is enabled.
|
||||
#ifdef EXPENSIVE_CHECKS
|
||||
static bool VerifyMachineDomInfo = true;
|
||||
bool VerifyMachineDomInfo = true;
|
||||
#else
|
||||
static bool VerifyMachineDomInfo = false;
|
||||
bool VerifyMachineDomInfo = false;
|
||||
#endif
|
||||
} // namespace llvm
|
||||
|
||||
static cl::opt<bool, true> VerifyMachineDomInfoX(
|
||||
"verify-machine-dom-info", cl::location(VerifyMachineDomInfo), cl::Hidden,
|
||||
cl::desc("Verify machine dominator info (time consuming)"));
|
||||
|
@ -13,13 +13,13 @@
|
||||
|
||||
#include "llvm/CodeGen/MachinePostDominators.h"
|
||||
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
template class DominatorTreeBase<MachineBasicBlock, true>; // PostDomTreeBase
|
||||
}
|
||||
|
||||
extern bool VerifyMachineDomInfo;
|
||||
} // namespace llvm
|
||||
|
||||
char MachinePostDominatorTree::ID = 0;
|
||||
|
||||
@ -63,6 +63,15 @@ MachineBasicBlock *MachinePostDominatorTree::findNearestCommonDominator(
|
||||
return NCD;
|
||||
}
|
||||
|
||||
void MachinePostDominatorTree::verifyAnalysis() const {
|
||||
if (PDT && VerifyMachineDomInfo)
|
||||
if (!PDT->verify(PostDomTreeT::VerificationLevel::Basic)) {
|
||||
errs() << "MachinePostDominatorTree verification failed\n";
|
||||
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void MachinePostDominatorTree::print(llvm::raw_ostream &OS,
|
||||
const Module *M) const {
|
||||
PDT->print(OS);
|
||||
|
@ -115,15 +115,12 @@ namespace {
|
||||
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
AU.setPreservesCFG();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
AU.addRequired<AAResultsWrapperPass>();
|
||||
AU.addRequired<MachineDominatorTree>();
|
||||
AU.addRequired<MachinePostDominatorTree>();
|
||||
AU.addRequired<MachineLoopInfo>();
|
||||
AU.addRequired<MachineBranchProbabilityInfo>();
|
||||
AU.addPreserved<MachineDominatorTree>();
|
||||
AU.addPreserved<MachinePostDominatorTree>();
|
||||
AU.addPreserved<MachineLoopInfo>();
|
||||
if (UseBlockFreqInfo)
|
||||
AU.addRequired<MachineBlockFrequencyInfo>();
|
||||
|
@ -114,6 +114,7 @@
|
||||
; CHECK-NEXT: Live Variable Analysis
|
||||
; CHECK-NEXT: Eliminate PHI nodes for register allocation
|
||||
; CHECK-NEXT: Two-Address instruction pass
|
||||
; CHECK-NEXT: MachineDominator Tree Construction
|
||||
; CHECK-NEXT: Slot index numbering
|
||||
; CHECK-NEXT: Live Interval Analysis
|
||||
; CHECK-NEXT: Simple Register Coalescing
|
||||
|
Loading…
x
Reference in New Issue
Block a user