[PATCH] D100109: [RegisterScavenging] Add asserts for better errors

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 9 02:26:30 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGba217b465532: [RegisterScavenging] Add asserts for better errors (authored by sebastian-ne).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100109/new/

https://reviews.llvm.org/D100109

Files:
  llvm/lib/CodeGen/RegisterScavenging.cpp


Index: llvm/lib/CodeGen/RegisterScavenging.cpp
===================================================================
--- llvm/lib/CodeGen/RegisterScavenging.cpp
+++ llvm/lib/CodeGen/RegisterScavenging.cpp
@@ -369,6 +369,10 @@
   const TargetRegisterInfo &TRI = *MRI.getTargetRegisterInfo();
   LiveRegUnits Used(TRI);
 
+  assert(From->getParent() == To->getParent() &&
+         "Target instruction is in other than current basic block, use "
+         "enterBasicBlockEnd first");
+
   for (MachineBasicBlock::iterator I = From;; --I) {
     const MachineInstr &MI = *I;
 
@@ -423,6 +427,8 @@
       if (I == MBB.begin())
         break;
     }
+    assert(I != MBB.begin() && "Did not find target instruction while "
+                               "iterating backwards");
   }
 
   return std::make_pair(Survivor, Pos);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100109.336362.patch
Type: text/x-patch
Size: 822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210409/83b47954/attachment.bin>


More information about the llvm-commits mailing list