Skip to content

Commit 0f06f80

Browse files
committed
Add a flag to check whether dt exists
1 parent f7ef515 commit 0f06f80

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

llvm/include/llvm/CodeGen/MachineDominators.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ class MachineDominatorTree : public DomTreeBase<MachineBasicBlock> {
266266
/// \brief Analysis pass which computes a \c MachineDominatorTree.
267267
class MachineDominatorTreeWrapperPass : public MachineFunctionPass {
268268
MachineDominatorTree DT;
269+
bool IsDomTreeEmpty = true;
269270

270271
public:
271272
static char ID;

llvm/lib/CodeGen/MachineDominators.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ MachineDominatorTreeWrapperPass::MachineDominatorTreeWrapperPass()
7070
char &llvm::MachineDominatorsID = MachineDominatorTreeWrapperPass::ID;
7171

7272
bool MachineDominatorTreeWrapperPass::runOnMachineFunction(MachineFunction &F) {
73+
IsDomTreeEmpty = false;
7374
DT.calculate(F);
7475
return false;
7576
}
@@ -83,10 +84,11 @@ void MachineDominatorTree::calculate(MachineFunction &F) {
8384
void MachineDominatorTreeWrapperPass::releaseMemory() {
8485
DT.CriticalEdgesToSplit.clear();
8586
DT.reset();
87+
IsDomTreeEmpty = true;
8688
}
8789

8890
void MachineDominatorTreeWrapperPass::verifyAnalysis() const {
89-
if (VerifyMachineDomInfo)
91+
if (VerifyMachineDomInfo && !IsDomTreeEmpty)
9092
if (!DT.verify(MachineDominatorTree::VerificationLevel::Basic))
9193
report_fatal_error("MachineDominatorTree verification failed!");
9294
}

0 commit comments

Comments
 (0)