1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

[Transforms] Use llvm::append_range (NFC)

This commit is contained in:
Kazu Hirata 2021-01-20 21:35:53 -08:00
parent 3d7023e152
commit bc78fac755
14 changed files with 18 additions and 38 deletions

View File

@ -130,8 +130,7 @@ bool TruncInstCombine::buildTruncExpressionDag() {
case Instruction::Select: {
SmallVector<Value *, 2> Operands;
getRelevantOperands(I, Operands);
for (Value *Operand : Operands)
Worklist.push_back(Operand);
append_range(Worklist, Operands);
break;
}
default:

View File

@ -1933,8 +1933,7 @@ static void makeAllConstantUsesInstructions(Constant *C) {
SmallVector<Value*,4> UUsers;
for (auto *U : Users) {
UUsers.clear();
for (auto *UU : U->users())
UUsers.push_back(UU);
append_range(UUsers, U->users());
for (auto *UU : UUsers) {
Instruction *UI = cast<Instruction>(UU);
Instruction *NewU = U->getAsInstruction();

View File

@ -334,8 +334,7 @@ void splitAndWriteThinLTOBitcode(
Linkage = CFL_Declaration;
Elts.push_back(ConstantAsMetadata::get(
llvm::ConstantInt::get(Type::getInt8Ty(Ctx), Linkage)));
for (auto Type : Types)
Elts.push_back(Type);
append_range(Elts, Types);
CfiFunctionMDs.push_back(MDTuple::get(Ctx, Elts));
}

View File

@ -1279,8 +1279,7 @@ void DevirtModule::applyICallBranchFunnel(VTableSlotInfo &SlotInfo,
// x86_64.
std::vector<Type *> NewArgs;
NewArgs.push_back(Int8PtrTy);
for (Type *T : CB.getFunctionType()->params())
NewArgs.push_back(T);
append_range(NewArgs, CB.getFunctionType()->params());
FunctionType *NewFT =
FunctionType::get(CB.getFunctionType()->getReturnType(), NewArgs,
CB.getFunctionType()->isVarArg());

View File

@ -753,8 +753,7 @@ static bool isObjectSizeLessThanOrEq(Value *V, uint64_t MaxSize,
}
if (PHINode *PN = dyn_cast<PHINode>(P)) {
for (Value *IncValue : PN->incoming_values())
Worklist.push_back(IncValue);
append_range(Worklist, PN->incoming_values());
continue;
}

View File

@ -3827,8 +3827,7 @@ static bool prepareICWorklistFromFunction(Function &F, const DataLayout &DL,
}
}
for (BasicBlock *SuccBB : successors(TI))
Worklist.push_back(SuccBB);
append_range(Worklist, successors(TI));
} while (!Worklist.empty());
// Remove instructions inside unreachable blocks. This prevents the

View File

@ -366,9 +366,7 @@ GVN::Expression GVN::ValueTable::createExtractvalueExpr(ExtractValueInst *EI) {
OI != OE; ++OI)
e.varargs.push_back(lookupOrAdd(*OI));
for (ExtractValueInst::idx_iterator II = EI->idx_begin(), IE = EI->idx_end();
II != IE; ++II)
e.varargs.push_back(*II);
append_range(e.varargs, EI->indices());
return e;
}

View File

@ -754,8 +754,7 @@ Optional<SinkingInstructionCandidate> GVNSink::analyzeInstructionForSinking(
Cand.NumMemoryInsts = MemoryInstNum;
Cand.NumBlocks = ActivePreds.size();
Cand.NumPHIs = NeededPHIs.size();
for (auto *C : ActivePreds)
Cand.Blocks.push_back(C);
append_range(Cand.Blocks, ActivePreds);
return Cand;
}

View File

@ -929,16 +929,14 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
User *U = srcUseList.pop_back_val();
if (isa<BitCastInst>(U) || isa<AddrSpaceCastInst>(U)) {
for (User *UU : U->users())
srcUseList.push_back(UU);
append_range(srcUseList, U->users());
continue;
}
if (GetElementPtrInst *G = dyn_cast<GetElementPtrInst>(U)) {
if (!G->hasAllZeroIndices())
return false;
for (User *UU : U->users())
srcUseList.push_back(UU);
append_range(srcUseList, U->users());
continue;
}
if (const IntrinsicInst *IT = dyn_cast<IntrinsicInst>(U))

View File

@ -433,9 +433,7 @@ void PruningFunctionCloner::CloneBlock(const BasicBlock *BB,
CodeInfo->OperandBundleCallSites.push_back(NewInst);
// Recursively clone any reachable successor blocks.
const Instruction *TI = BB->getTerminator();
for (const BasicBlock *Succ : successors(TI))
ToClone.push_back(Succ);
append_range(ToClone, successors(BB->getTerminator()));
}
if (CodeInfo) {

View File

@ -317,9 +317,7 @@ static bool FixIrreducibleImpl(Function &F, LoopInfo &LI, DominatorTree &DT) {
// Any SCCs reduced are now already in the list of top-level loops, so simply
// add them all to the worklist.
for (auto L : LI) {
WorkList.push_back(L);
}
append_range(WorkList, LI);
while (!WorkList.empty()) {
auto L = WorkList.back();

View File

@ -171,9 +171,7 @@ static void addBlockAndPredsToSet(BasicBlock *InputBB, BasicBlock *StopBlock,
if (Blocks.insert(BB).second && BB != StopBlock)
// If BB is not already processed and it is not a stop block then
// insert its predecessor in the work list
for (BasicBlock *WBB : predecessors(BB)) {
Worklist.push_back(WBB);
}
append_range(Worklist, predecessors(BB));
} while (!Worklist.empty());
}

View File

@ -253,12 +253,10 @@ public:
// We can get our predecessor info by walking the pred_iterator list,
// but it is relatively slow. If we already have PHI nodes in this
// block, walk one of them to get the predecessor list instead.
if (PHINode *SomePhi = dyn_cast<PHINode>(BB->begin())) {
Preds->append(SomePhi->block_begin(), SomePhi->block_end());
} else {
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
Preds->push_back(*PI);
}
if (PHINode *SomePhi = dyn_cast<PHINode>(BB->begin()))
append_range(*Preds, SomePhi->blocks());
else
append_range(*Preds, predecessors(BB));
}
/// GetUndefVal - Get an undefined value of the same type as the value

View File

@ -7009,8 +7009,7 @@ void LoopVectorizationCostModel::setCostBasedWideningDecision(ElementCount VF) {
// Add all instructions used to generate the addresses.
SmallVector<Instruction *, 4> Worklist;
for (auto *I : AddrDefs)
Worklist.push_back(I);
append_range(Worklist, AddrDefs);
while (!Worklist.empty()) {
Instruction *I = Worklist.pop_back_val();
for (auto &Op : I->operands())