Add SSA verification to MachineVerifier.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 10 Mar 2012 00:36:06 +0000 (00:36 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sat, 10 Mar 2012 00:36:06 +0000 (00:36 +0000)
Somehow we never verified SSA dominance before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152458 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineVerifier.cpp

index f26886fd20f8fd18cc5b97acb41f01cd242d5b0f..91a536d0631fc84198f31fced484d347a3ff8861 100644 (file)
@@ -1014,8 +1014,18 @@ void MachineVerifier::visitMachineFunctionAfter() {
   }
 
   // Now check liveness info if available
-  if (LiveVars || LiveInts)
-    calcRegsRequired();
+  calcRegsRequired();
+
+  if (MRI->isSSA() && !MF->empty()) {
+    BBInfo &MInfo = MBBInfoMap[&MF->front()];
+    for (RegSet::iterator
+         I = MInfo.vregsRequired.begin(), E = MInfo.vregsRequired.end(); I != E;
+         ++I) {
+      report("Virtual register def doesn't dominate all uses.", MF);
+      *OS << "- register:\t" << PrintReg(*I) << '\n';
+    }
+  }
+
   if (LiveVars)
     verifyLiveVariables();
   if (LiveInts)