Skip to content

Commit

Permalink
[Analysis] Use llvm::append_range (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Dec 30, 2020
1 parent 096b02e commit f76e83b
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/DDG.h
Expand Up @@ -152,7 +152,7 @@ class SimpleDDGNode : public DDGNode {
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());
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/IntervalIterator.h
Expand Up @@ -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 *>,
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/AliasSetTracker.cpp
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/DDG.cpp
Expand Up @@ -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");
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Analysis/DependenceGraphBuilder.cpp
Expand Up @@ -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);
}
Expand Down
12 changes: 4 additions & 8 deletions llvm/lib/Analysis/IRSimilarityIdentifier.cpp
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/LazyValueInfo.cpp
Expand Up @@ -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));
}
}

Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/ScalarEvolution.cpp
Expand Up @@ -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))
Expand Down Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/TargetLibraryInfo.cpp
Expand Up @@ -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);
}

Expand Down

0 comments on commit f76e83b

Please sign in to comment.