[llvm] r341917 - [NFC] Sanitizing asserts for OrderedBasicBlock

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 11 01:46:19 PDT 2018


Author: mkazantsev
Date: Tue Sep 11 01:46:19 2018
New Revision: 341917

URL: http://llvm.org/viewvc/llvm-project?rev=341917&view=rev
Log:
[NFC] Sanitizing asserts for OrderedBasicBlock

Modified:
    llvm/trunk/lib/Analysis/OrderedBasicBlock.cpp

Modified: llvm/trunk/lib/Analysis/OrderedBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/OrderedBasicBlock.cpp?rev=341917&r1=341916&r2=341917&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/OrderedBasicBlock.cpp (original)
+++ llvm/trunk/lib/Analysis/OrderedBasicBlock.cpp Tue Sep 11 01:46:19 2018
@@ -37,6 +37,8 @@ bool OrderedBasicBlock::comesBefore(cons
   const Instruction *Inst = nullptr;
   assert(!(LastInstFound == BB->end() && NextInstPos != 0) &&
          "Instruction supposed to be in NumberedInsts");
+  assert(A->getParent() == BB && "Instruction supposed to be in the block!");
+  assert(B->getParent() == BB && "Instruction supposed to be in the block!");
 
   // Start the search with the instruction found in the last lookup round.
   auto II = BB->begin();
@@ -65,6 +67,7 @@ bool OrderedBasicBlock::comesBefore(cons
 bool OrderedBasicBlock::dominates(const Instruction *A, const Instruction *B) {
   assert(A->getParent() == B->getParent() &&
          "Instructions must be in the same basic block!");
+  assert(A->getParent() == BB && "Instructions must be in the tracked block!");
 
   // First we lookup the instructions. If they don't exist, lookup will give us
   // back ::end(). If they both exist, we compare the numbers. Otherwise, if NA




More information about the llvm-commits mailing list