diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-22 22:48:58 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-22 22:48:58 +0000 |
commit | 0fb303d3c05cf791b225785723f07373bbc91fa3 (patch) | |
tree | 7f9880c6d2df3003a4e58645dba14c788151546e /llvm/lib/CodeGen/MachineVerifier.cpp | |
parent | 4cf8fe31bb7d84146d353c49b877f9e2a37510d0 (diff) | |
download | bcm5719-llvm-0fb303d3c05cf791b225785723f07373bbc91fa3.tar.gz bcm5719-llvm-0fb303d3c05cf791b225785723f07373bbc91fa3.zip |
Add more verification of LiveIntervals.
llvm-svn: 117170
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineVerifier.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp index 41a13436d90..eb8375dccc2 100644 --- a/llvm/lib/CodeGen/MachineVerifier.cpp +++ b/llvm/lib/CodeGen/MachineVerifier.cpp @@ -921,8 +921,37 @@ void MachineVerifier::verifyLiveIntervals() { report("Live range at def has different valno", MF); *OS << "Valno #" << VNI->id << " is defined at " << VNI->def << " where valno #" << DefVNI->id << " is live.\n"; + continue; } + const MachineBasicBlock *MBB = LiveInts->getMBBFromIndex(VNI->def); + if (!MBB) { + report("Invalid definition index", MF); + *OS << "Valno #" << VNI->id << " is defined at " << VNI->def << '\n'; + continue; + } + + if (VNI->isPHIDef()) { + if (VNI->def != LiveInts->getMBBStartIdx(MBB)) { + report("PHIDef value is not defined at MBB start", MF); + *OS << "Valno #" << VNI->id << " is defined at " << VNI->def + << ", not at the beginning of BB#" << MBB->getNumber() << '\n'; + } + } else { + // Non-PHI def. + if (!VNI->def.isDef()) { + report("Non-PHI def must be at a DEF slot", MF); + *OS << "Valno #" << VNI->id << " is defined at " << VNI->def << '\n'; + } + const MachineInstr *MI = LiveInts->getInstructionFromIndex(VNI->def); + if (!MI) { + report("No instruction at def index", MF); + *OS << "Valno #" << VNI->id << " is defined at " << VNI->def << '\n'; + } else if (!MI->modifiesRegister(LI.reg, TRI)) { + report("Defining instruction does not modify register", MI); + *OS << "Valno #" << VNI->id << " in " << LI << '\n'; + } + } } for (LiveInterval::const_iterator I = LI.begin(), E = LI.end(); I!=E; ++I) { |