[NFC][ARM] LowOverheadLoop DEBUG statements
authorSam Parker <sam.parker@arm.com>
Thu, 1 Oct 2020 12:37:47 +0000 (13:37 +0100)
committerSam Parker <sam.parker@arm.com>
Thu, 1 Oct 2020 12:38:16 +0000 (13:38 +0100)
llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp

index ac787a1..d642499 100644 (file)
@@ -603,8 +603,10 @@ bool LowOverheadLoop::ValidateTailPredicate() {
     return false;
   }
 
-  if (!VPTState::isValid(RDA))
+  if (!VPTState::isValid(RDA)) {
+    LLVM_DEBUG(dbgs() << "ARM Loops: Invalid VPT state.\n");
     return false;
+  }
 
   if (!ValidateLiveOuts()) {
     LLVM_DEBUG(dbgs() << "ARM Loops: Invalid live outs.\n");
@@ -655,9 +657,13 @@ bool LowOverheadLoop::ValidateTailPredicate() {
   // instructions in the preheader.
   auto CannotInsertWDLSTPBetween = [](MachineBasicBlock::iterator I,
                                       MachineBasicBlock::iterator E) {
-    for (; I != E; ++I)
-      if (shouldInspect(*I))
+    for (; I != E; ++I) {
+      if (shouldInspect(*I)) {
+        LLVM_DEBUG(dbgs() << "ARM Loops: Instruction blocks [W|D]LSTP"
+                   << " insertion: " << *I);
         return true;
+      }
+    }
     return false;
   };
 
@@ -719,11 +725,17 @@ bool LowOverheadLoop::ValidateTailPredicate() {
           continue;
 
         if (isSubImmOpcode(MI->getOpcode())) {
-          if (FoundSub || !IsValidSub(MI, ExpectedVectorWidth))
+          if (FoundSub || !IsValidSub(MI, ExpectedVectorWidth)) {
+            LLVM_DEBUG(dbgs() << "ARM Loops: Unexpected instruction in element"
+                       " count: " << *MI);
             return false;
+          }
           FoundSub = true;
-        } else
+        } else {
+          LLVM_DEBUG(dbgs() << "ARM Loops: Unexpected instruction in element"
+                     " count: " << *MI);
           return false;
+        }
       }
       ToRemove.insert(ElementChain.begin(), ElementChain.end());
     }
@@ -1082,8 +1094,14 @@ void LowOverheadLoop::Validate(ARMBasicBlockUtils *BBUtils) {
     Revert = true;
     return;
   }
-
   TryAdjustInsertionPoint(StartInsertPt, Start, RDA);
+  LLVM_DEBUG(if (StartInsertPt == StartInsertBB->end())
+               dbgs() << "ARM Loops: Will insert LoopStart at end of block\n";
+             else
+               dbgs() << "ARM Loops: Will insert LoopStart at "
+               << *StartInsertPt
+            );
+
   Revert = !ValidateRanges(Start, End, BBUtils, ML);
   CannotTailPredicate = !ValidateTailPredicate();
 }