make this more efficient. Scan up to 16 nodes, not the whole list.
authorChris Lattner <sabre@nondot.org>
Wed, 23 Feb 2005 16:53:04 +0000 (16:53 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 23 Feb 2005 16:53:04 +0000 (16:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20289 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/GlobalOpt.cpp
lib/VMCore/BasicBlock.cpp

index 59ea4a6f6f0a3c35d5fac7eb1eaec005893c82d2..4c8740072962eae519646afd931ee7954c252fbd 100644 (file)
@@ -377,7 +377,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) {
     else
       assert(0 && "Unknown aggregate sequential type!");
 
-    if (NumElements > 16 && GV->getNumUses() > 16)
+    if (NumElements > 16 && GV->hasNUsesOrMore(16))
       return 0; // It's not worth it.
     NewGlobals.reserve(NumElements);
     for (unsigned i = 0, e = NumElements; i != e; ++i) {
index ae6356bc705b715eec3a7d79609dd5f156366ce3..b22a54162b908d9b8deddef093bcd7872cb753bc 100644 (file)
@@ -136,7 +136,7 @@ void BasicBlock::dropAllReferences() {
 // called while the predecessor still refers to this block.
 //
 void BasicBlock::removePredecessor(BasicBlock *Pred) {
-  assert((getNumUses() > 16 ||// Reduce cost of this assertion for complex CFGs.
+  assert((hasNUsesOrMore(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!");