Reduce the amount of searching this assertion does. On a testcase of mine,
authorChris Lattner <sabre@nondot.org>
Wed, 23 Feb 2005 07:09:08 +0000 (07:09 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 23 Feb 2005 07:09:08 +0000 (07:09 +0000)
this reduces the time for -simplifycfg in a debug build from 106s to 14.82s

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

lib/VMCore/BasicBlock.cpp

index 87b9ddd3808ca5d826239521edd3237d79011601..ae6356bc705b715eec3a7d79609dd5f156366ce3 100644 (file)
@@ -136,8 +136,10 @@ void BasicBlock::dropAllReferences() {
 // called while the predecessor still refers to this block.
 //
 void BasicBlock::removePredecessor(BasicBlock *Pred) {
-  assert(find(pred_begin(this), pred_end(this), Pred) != pred_end(this) &&
+  assert((getNumUses() > 16 ||// Reduce cost of this assertion for complex CFGs.
+          find(pred_begin(this), pred_end(this), Pred) != pred_end(this)) &&
         "removePredecessor: BB is not a predecessor!");
+
   if (InstList.empty()) return;
   PHINode *APN = dyn_cast<PHINode>(&front());
   if (!APN) return;   // Quick exit.