[Analysis] Use llvm::append_range (NFC)
authorKazu Hirata <kazu@google.com>
Wed, 30 Dec 2020 03:23:21 +0000 (19:23 -0800)
committerKazu Hirata <kazu@google.com>
Wed, 30 Dec 2020 03:23:21 +0000 (19:23 -0800)
llvm/include/llvm/Analysis/DDG.h
llvm/include/llvm/Analysis/IntervalIterator.h
llvm/lib/Analysis/AliasSetTracker.cpp
llvm/lib/Analysis/DDG.cpp
llvm/lib/Analysis/DependenceGraphBuilder.cpp
llvm/lib/Analysis/IRSimilarityIdentifier.cpp
llvm/lib/Analysis/LazyValueInfo.cpp
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/lib/Analysis/TargetLibraryInfo.cpp

index 8d225c1..e3bef33 100644 (file)
@@ -152,7 +152,7 @@ private:
     setKind((InstList.size() == 0 && Input.size() == 1)
                 ? NodeKind::SingleInstruction
                 : NodeKind::MultiInstruction);
-    InstList.insert(InstList.end(), Input.begin(), Input.end());
+    llvm::append_range(InstList, Input);
   }
   void appendInstructions(const SimpleDDGNode &Input) {
     appendInstructions(Input.getInstructions());
index 38bb3bb..8e22736 100644 (file)
@@ -81,7 +81,7 @@ inline void addNodeToInterval(Interval *Int, BasicBlock *BB) {
 // BasicBlocks are added to the interval.
 inline void addNodeToInterval(Interval *Int, Interval *I) {
   // Add all of the nodes in I as new nodes in Int.
-  Int->Nodes.insert(Int->Nodes.end(), I->Nodes.begin(), I->Nodes.end());
+  llvm::append_range(Int->Nodes, I->Nodes);
 }
 
 template<class NodeTy, class OrigContainer_t, class GT = GraphTraits<NodeTy *>,
index 77dba34..9b21fbf 100644 (file)
@@ -83,7 +83,7 @@ void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST) {
       addRef();
     }
   } else if (ASHadUnknownInsts) {
-    UnknownInsts.insert(UnknownInsts.end(), AS.UnknownInsts.begin(), AS.UnknownInsts.end());
+    llvm::append_range(UnknownInsts, AS.UnknownInsts);
     AS.UnknownInsts.clear();
   }
 
index 280d9ef..b2aa322 100644 (file)
@@ -49,7 +49,7 @@ bool DDGNode::collectInstructions(
       assert(!isa<PiBlockDDGNode>(PN) && "Nested PiBlocks are not supported.");
       SmallVector<Instruction *, 8> TmpIList;
       PN->collectInstructions(Pred, TmpIList);
-      IList.insert(IList.end(), TmpIList.begin(), TmpIList.end());
+      llvm::append_range(IList, TmpIList);
     }
   } else
     llvm_unreachable("unimplemented type of node");
index 7a98d84..fbf0f66 100644 (file)
@@ -492,8 +492,7 @@ void AbstractDependenceGraphBuilder<G>::sortNodesTopologically() {
       // Put members of the pi-block right after the pi-block itself, for
       // convenience.
       const NodeListType &PiBlockMembers = getNodesInPiBlock(*N);
-      NodesInPO.insert(NodesInPO.end(), PiBlockMembers.begin(),
-                       PiBlockMembers.end());
+      llvm::append_range(NodesInPO, PiBlockMembers);
     }
     NodesInPO.push_back(N);
   }
index 4ee1524..141c1e0 100644 (file)
@@ -138,10 +138,8 @@ void IRInstructionMapper::convertToUnsignedVec(
     mapToIllegalUnsigned(It, IntegerMappingForBB, InstrListForBB, true);
     for_each(InstrListForBB,
              [this](IRInstructionData *ID) { this->IDL->push_back(*ID); });
-    InstrList.insert(InstrList.end(), InstrListForBB.begin(),
-                     InstrListForBB.end());
-    IntegerMapping.insert(IntegerMapping.end(), IntegerMappingForBB.begin(),
-                          IntegerMappingForBB.end());
+    llvm::append_range(InstrList, InstrListForBB);
+    llvm::append_range(IntegerMapping, IntegerMappingForBB);
   }
 }
 
@@ -639,11 +637,9 @@ void IRSimilarityIdentifier::populateMapper(
 
   // Insert the InstrListForModule at the end of the overall InstrList so that
   // we can have a long InstrList for the entire set of Modules being analyzed.
-  InstrList.insert(InstrList.end(), InstrListForModule.begin(),
-                   InstrListForModule.end());
+  llvm::append_range(InstrList, InstrListForModule);
   // Do the same as above, but for IntegerMapping.
-  IntegerMapping.insert(IntegerMapping.end(), IntegerMappingForModule.begin(),
-                     IntegerMappingForModule.end());
+  llvm::append_range(IntegerMapping, IntegerMappingForModule);
 }
 
 void IRSimilarityIdentifier::populateMapper(
index aadb90d..d95c906 100644 (file)
@@ -333,7 +333,7 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc,
 
     if (!changed) continue;
 
-    worklist.insert(worklist.end(), succ_begin(ToUpdate), succ_end(ToUpdate));
+    llvm::append_range(worklist, successors(ToUpdate));
   }
 }
 
index 361a143..b0ead73 100644 (file)
@@ -11961,7 +11961,7 @@ void ScalarEvolution::SCEVCallbackVH::allUsesReplacedWith(Value *V) {
     if (PHINode *PN = dyn_cast<PHINode>(U))
       SE->ConstantEvolutionLoopExitValue.erase(PN);
     SE->eraseValueFromMap(U);
-    Worklist.insert(Worklist.end(), U->user_begin(), U->user_end());
+    llvm::append_range(Worklist, U->users());
   }
   // Delete the Old value.
   if (PHINode *PN = dyn_cast<PHINode>(Old))
@@ -12526,7 +12526,7 @@ void ScalarEvolution::verify() const {
 
   while (!LoopStack.empty()) {
     auto *L = LoopStack.pop_back_val();
-    LoopStack.insert(LoopStack.end(), L->begin(), L->end());
+    llvm::append_range(LoopStack, *L);
 
     auto *CurBECount = SCM.visit(
         const_cast<ScalarEvolution *>(this)->getBackedgeTakenCount(L));
index 53283c4..26972b2 100644 (file)
@@ -1543,10 +1543,10 @@ static bool compareWithVectorFnName(const VecDesc &LHS, StringRef S) {
 }
 
 void TargetLibraryInfoImpl::addVectorizableFunctions(ArrayRef<VecDesc> Fns) {
-  VectorDescs.insert(VectorDescs.end(), Fns.begin(), Fns.end());
+  llvm::append_range(VectorDescs, Fns);
   llvm::sort(VectorDescs, compareByScalarFnName);
 
-  ScalarDescs.insert(ScalarDescs.end(), Fns.begin(), Fns.end());
+  llvm::append_range(ScalarDescs, Fns);
   llvm::sort(ScalarDescs, compareByVectorFnName);
 }