summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-09-09 17:49:46 +0000
committerMatthias Braun <matze@braunis.de>2015-09-09 17:49:46 +0000
commit80595460d85d586c22e67bf3b2828d5dc2ecdbf7 (patch)
tree7d36944fb2406e5239d1195120a041d58f696880 /llvm/lib/CodeGen/MachineVerifier.cpp
parent7da94a58a0ede3e283de613c1da6e4947e1e2b3d (diff)
downloadbcm5719-llvm-80595460d85d586c22e67bf3b2828d5dc2ecdbf7.tar.gz
bcm5719-llvm-80595460d85d586c22e67bf3b2828d5dc2ecdbf7.zip
MachineVerifier: Check that SlotIndex MBBIndexList is sorted.
This introduces a check that the MBBIndexList is sorted as proposed in http://reviews.llvm.org/D12443 but split up into a separate commit. llvm-svn: 247166
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index 6eb9d342ba2..f131d99f417 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -236,6 +236,8 @@ namespace {
void verifyLiveRange(const LiveRange&, unsigned, unsigned LaneMask = 0);
void verifyStackFrame();
+
+ void verifySlotIndexes() const;
};
struct MachineVerifierPass : public MachineFunctionPass {
@@ -273,6 +275,19 @@ void MachineFunction::verify(Pass *p, const char *Banner) const {
.runOnMachineFunction(const_cast<MachineFunction&>(*this));
}
+void MachineVerifier::verifySlotIndexes() const {
+ if (Indexes == nullptr)
+ return;
+
+ // Ensure the IdxMBB list is sorted by slot indexes.
+ SlotIndex Last;
+ for (SlotIndexes::MBBIndexIterator I = Indexes->MBBIndexBegin(),
+ E = Indexes->MBBIndexEnd(); I != E; ++I) {
+ assert(!Last.isValid() || I->first > Last);
+ Last = I->first;
+ }
+}
+
bool MachineVerifier::runOnMachineFunction(MachineFunction &MF) {
foundErrors = 0;
@@ -295,6 +310,8 @@ bool MachineVerifier::runOnMachineFunction(MachineFunction &MF) {
Indexes = PASS->getAnalysisIfAvailable<SlotIndexes>();
}
+ verifySlotIndexes();
+
visitMachineFunctionBefore();
for (MachineFunction::const_iterator MFI = MF.begin(), MFE = MF.end();
MFI!=MFE; ++MFI) {
OpenPOWER on IntegriCloud