mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[CodeGen] Construct SmallVector with iterator ranges (NFC)
This commit is contained in:
parent
90a712d144
commit
183de26ac5
@ -562,7 +562,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
|
|||||||
// are removed.
|
// are removed.
|
||||||
SmallSetVector<BasicBlock*, 8> WorkList;
|
SmallSetVector<BasicBlock*, 8> WorkList;
|
||||||
for (BasicBlock &BB : F) {
|
for (BasicBlock &BB : F) {
|
||||||
SmallVector<BasicBlock *, 2> Successors(succ_begin(&BB), succ_end(&BB));
|
SmallVector<BasicBlock *, 2> Successors(successors(&BB));
|
||||||
MadeChange |= ConstantFoldTerminator(&BB, true);
|
MadeChange |= ConstantFoldTerminator(&BB, true);
|
||||||
if (!MadeChange) continue;
|
if (!MadeChange) continue;
|
||||||
|
|
||||||
@ -576,7 +576,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
|
|||||||
MadeChange |= !WorkList.empty();
|
MadeChange |= !WorkList.empty();
|
||||||
while (!WorkList.empty()) {
|
while (!WorkList.empty()) {
|
||||||
BasicBlock *BB = WorkList.pop_back_val();
|
BasicBlock *BB = WorkList.pop_back_val();
|
||||||
SmallVector<BasicBlock*, 2> Successors(succ_begin(BB), succ_end(BB));
|
SmallVector<BasicBlock*, 2> Successors(successors(BB));
|
||||||
|
|
||||||
DeleteDeadBlock(BB);
|
DeleteDeadBlock(BB);
|
||||||
|
|
||||||
@ -5328,7 +5328,7 @@ bool CodeGenPrepare::optimizeGatherScatterInst(Instruction *MemoryInst,
|
|||||||
if (MemoryInst->getParent() != GEP->getParent())
|
if (MemoryInst->getParent() != GEP->getParent())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SmallVector<Value *, 2> Ops(GEP->op_begin(), GEP->op_end());
|
SmallVector<Value *, 2> Ops(GEP->operands());
|
||||||
|
|
||||||
bool RewriteGEP = false;
|
bool RewriteGEP = false;
|
||||||
|
|
||||||
|
@ -2264,8 +2264,7 @@ void IfConverter::MergeBlocks(BBInfo &ToBBI, BBInfo &FromBBI, bool AddEdges) {
|
|||||||
if (ToBBI.IsBrAnalyzable)
|
if (ToBBI.IsBrAnalyzable)
|
||||||
ToBBI.BB->normalizeSuccProbs();
|
ToBBI.BB->normalizeSuccProbs();
|
||||||
|
|
||||||
SmallVector<MachineBasicBlock *, 4> FromSuccs(FromMBB.succ_begin(),
|
SmallVector<MachineBasicBlock *, 4> FromSuccs(FromMBB.successors());
|
||||||
FromMBB.succ_end());
|
|
||||||
MachineBasicBlock *NBB = getNextBlock(FromMBB);
|
MachineBasicBlock *NBB = getNextBlock(FromMBB);
|
||||||
MachineBasicBlock *FallThrough = FromBBI.HasFallThrough ? NBB : nullptr;
|
MachineBasicBlock *FallThrough = FromBBI.HasFallThrough ? NBB : nullptr;
|
||||||
// The edge probability from ToBBI.BB to FromMBB, which is only needed when
|
// The edge probability from ToBBI.BB to FromMBB, which is only needed when
|
||||||
|
@ -3160,8 +3160,8 @@ void MachineBlockPlacement::findDuplicateCandidates(
|
|||||||
MachineBasicBlock *Fallthrough = nullptr;
|
MachineBasicBlock *Fallthrough = nullptr;
|
||||||
BranchProbability DefaultBranchProb = BranchProbability::getZero();
|
BranchProbability DefaultBranchProb = BranchProbability::getZero();
|
||||||
BlockFrequency BBDupThreshold(scaleThreshold(BB));
|
BlockFrequency BBDupThreshold(scaleThreshold(BB));
|
||||||
SmallVector<MachineBasicBlock *, 8> Preds(BB->pred_begin(), BB->pred_end());
|
SmallVector<MachineBasicBlock *, 8> Preds(BB->predecessors());
|
||||||
SmallVector<MachineBasicBlock *, 8> Succs(BB->succ_begin(), BB->succ_end());
|
SmallVector<MachineBasicBlock *, 8> Succs(BB->successors());
|
||||||
|
|
||||||
// Sort for highest frequency.
|
// Sort for highest frequency.
|
||||||
auto CmpSucc = [&](MachineBasicBlock *A, MachineBasicBlock *B) {
|
auto CmpSucc = [&](MachineBasicBlock *A, MachineBasicBlock *B) {
|
||||||
|
@ -745,8 +745,7 @@ MachineSinking::GetAllSortedSuccessors(MachineInstr &MI, MachineBasicBlock *MBB,
|
|||||||
if (Succs != AllSuccessors.end())
|
if (Succs != AllSuccessors.end())
|
||||||
return Succs->second;
|
return Succs->second;
|
||||||
|
|
||||||
SmallVector<MachineBasicBlock *, 4> AllSuccs(MBB->succ_begin(),
|
SmallVector<MachineBasicBlock *, 4> AllSuccs(MBB->successors());
|
||||||
MBB->succ_end());
|
|
||||||
|
|
||||||
// Handle cases where sinking can happen but where the sink point isn't a
|
// Handle cases where sinking can happen but where the sink point isn't a
|
||||||
// successor. For example:
|
// successor. For example:
|
||||||
|
@ -96,7 +96,7 @@ static bool lowerObjCCall(Function &F, const char *NewFn,
|
|||||||
++I;
|
++I;
|
||||||
|
|
||||||
IRBuilder<> Builder(CI->getParent(), CI->getIterator());
|
IRBuilder<> Builder(CI->getParent(), CI->getIterator());
|
||||||
SmallVector<Value *, 8> Args(CI->arg_begin(), CI->arg_end());
|
SmallVector<Value *, 8> Args(CI->args());
|
||||||
CallInst *NewCI = Builder.CreateCall(FCache, Args);
|
CallInst *NewCI = Builder.CreateCall(FCache, Args);
|
||||||
NewCI->setName(CI->getName());
|
NewCI->setName(CI->getName());
|
||||||
|
|
||||||
|
@ -377,9 +377,7 @@ void ReachingDefAnalysis::getGlobalUses(MachineInstr *MI, MCRegister PhysReg,
|
|||||||
if (LiveOut != MI)
|
if (LiveOut != MI)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SmallVector<MachineBasicBlock*, 4> ToVisit;
|
SmallVector<MachineBasicBlock *, 4> ToVisit(MBB->successors());
|
||||||
ToVisit.insert(ToVisit.begin(), MBB->successors().begin(),
|
|
||||||
MBB->successors().end());
|
|
||||||
SmallPtrSet<MachineBasicBlock*, 4>Visited;
|
SmallPtrSet<MachineBasicBlock*, 4>Visited;
|
||||||
while (!ToVisit.empty()) {
|
while (!ToVisit.empty()) {
|
||||||
MachineBasicBlock *MBB = ToVisit.back();
|
MachineBasicBlock *MBB = ToVisit.back();
|
||||||
|
@ -172,7 +172,7 @@ static bool AddGlue(SDNode *N, SDValue Glue, bool AddGlue, SelectionDAG *DAG) {
|
|||||||
// Don't add glue to something that already has a glue value.
|
// Don't add glue to something that already has a glue value.
|
||||||
if (N->getValueType(N->getNumValues() - 1) == MVT::Glue) return false;
|
if (N->getValueType(N->getNumValues() - 1) == MVT::Glue) return false;
|
||||||
|
|
||||||
SmallVector<EVT, 4> VTs(N->value_begin(), N->value_end());
|
SmallVector<EVT, 4> VTs(N->values());
|
||||||
if (AddGlue)
|
if (AddGlue)
|
||||||
VTs.push_back(MVT::Glue);
|
VTs.push_back(MVT::Glue);
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ static void MarkBlocksLiveIn(BasicBlock *BB,
|
|||||||
/// instruction with those returned by the personality function.
|
/// instruction with those returned by the personality function.
|
||||||
void SjLjEHPrepare::substituteLPadValues(LandingPadInst *LPI, Value *ExnVal,
|
void SjLjEHPrepare::substituteLPadValues(LandingPadInst *LPI, Value *ExnVal,
|
||||||
Value *SelVal) {
|
Value *SelVal) {
|
||||||
SmallVector<Value *, 8> UseWorkList(LPI->user_begin(), LPI->user_end());
|
SmallVector<Value *, 8> UseWorkList(LPI->users());
|
||||||
while (!UseWorkList.empty()) {
|
while (!UseWorkList.empty()) {
|
||||||
Value *Val = UseWorkList.pop_back_val();
|
Value *Val = UseWorkList.pop_back_val();
|
||||||
auto *EVI = dyn_cast<ExtractValueInst>(Val);
|
auto *EVI = dyn_cast<ExtractValueInst>(Val);
|
||||||
|
@ -720,8 +720,7 @@ bool TailDuplicator::duplicateSimpleBB(
|
|||||||
SmallVectorImpl<MachineInstr *> &Copies) {
|
SmallVectorImpl<MachineInstr *> &Copies) {
|
||||||
SmallPtrSet<MachineBasicBlock *, 8> Succs(TailBB->succ_begin(),
|
SmallPtrSet<MachineBasicBlock *, 8> Succs(TailBB->succ_begin(),
|
||||||
TailBB->succ_end());
|
TailBB->succ_end());
|
||||||
SmallVector<MachineBasicBlock *, 8> Preds(TailBB->pred_begin(),
|
SmallVector<MachineBasicBlock *, 8> Preds(TailBB->predecessors());
|
||||||
TailBB->pred_end());
|
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (MachineBasicBlock *PredBB : Preds) {
|
for (MachineBasicBlock *PredBB : Preds) {
|
||||||
if (PredBB->hasEHPadSuccessor() || PredBB->mayHaveInlineAsmBr())
|
if (PredBB->hasEHPadSuccessor() || PredBB->mayHaveInlineAsmBr())
|
||||||
|
@ -204,7 +204,7 @@ bool WasmEHPrepare::prepareThrows(Function &F) {
|
|||||||
continue;
|
continue;
|
||||||
Changed = true;
|
Changed = true;
|
||||||
auto *BB = ThrowI->getParent();
|
auto *BB = ThrowI->getParent();
|
||||||
SmallVector<BasicBlock *, 4> Succs(succ_begin(BB), succ_end(BB));
|
SmallVector<BasicBlock *, 4> Succs(successors(BB));
|
||||||
auto &InstList = BB->getInstList();
|
auto &InstList = BB->getInstList();
|
||||||
InstList.erase(std::next(BasicBlock::iterator(ThrowI)), InstList.end());
|
InstList.erase(std::next(BasicBlock::iterator(ThrowI)), InstList.end());
|
||||||
IRB.SetInsertPoint(BB);
|
IRB.SetInsertPoint(BB);
|
||||||
|
Loading…
Reference in New Issue
Block a user