summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachinePostDominators.cpp
diff options
context:
space:
mode:
authorJakub Kuderski <kubakuderski@gmail.com>2019-10-01 15:23:27 +0000
committerJakub Kuderski <kubakuderski@gmail.com>2019-10-01 15:23:27 +0000
commit56b52a207fef1edb19b0828a21e901627eb9155b (patch)
tree04dbaee3f24bf809a97f8108a297f82f15011739 /llvm/lib/CodeGen/MachinePostDominators.cpp
parentfd019ed54e36179d0b69d93822164ec2e5689e36 (diff)
downloadbcm5719-llvm-56b52a207fef1edb19b0828a21e901627eb9155b.tar.gz
bcm5719-llvm-56b52a207fef1edb19b0828a21e901627eb9155b.zip
[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
Diffstat (limited to 'llvm/lib/CodeGen/MachinePostDominators.cpp')
-rw-r--r--llvm/lib/CodeGen/MachinePostDominators.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachinePostDominators.cpp b/llvm/lib/CodeGen/MachinePostDominators.cpp
index f2fc9f814f8..f4daff667e8 100644
--- a/llvm/lib/CodeGen/MachinePostDominators.cpp
+++ b/llvm/lib/CodeGen/MachinePostDominators.cpp
@@ -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);
OpenPOWER on IntegriCloud