mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
Use A.append(...) instead of A.insert(A.end(), ...) when A is a
SmallVector, and other SmallVector simplifications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106452 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
658ebcc7ec
commit
403a8cdda5
@ -1406,8 +1406,8 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
|
||||
while (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[Idx])) {
|
||||
// If we have an add, expand the add operands onto the end of the operands
|
||||
// list.
|
||||
Ops.insert(Ops.end(), Add->op_begin(), Add->op_end());
|
||||
Ops.erase(Ops.begin()+Idx);
|
||||
Ops.append(Add->op_begin(), Add->op_end());
|
||||
DeletedAdd = true;
|
||||
}
|
||||
|
||||
@ -1584,7 +1584,7 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
|
||||
AddRec->op_end());
|
||||
for (unsigned i = 0, e = OtherAddRec->getNumOperands(); i != e; ++i) {
|
||||
if (i >= NewOps.size()) {
|
||||
NewOps.insert(NewOps.end(), OtherAddRec->op_begin()+i,
|
||||
NewOps.append(OtherAddRec->op_begin()+i,
|
||||
OtherAddRec->op_end());
|
||||
break;
|
||||
}
|
||||
@ -1717,8 +1717,8 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
|
||||
while (const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(Ops[Idx])) {
|
||||
// If we have an mul, expand the mul operands onto the end of the operands
|
||||
// list.
|
||||
Ops.insert(Ops.end(), Mul->op_begin(), Mul->op_end());
|
||||
Ops.erase(Ops.begin()+Idx);
|
||||
Ops.append(Mul->op_begin(), Mul->op_end());
|
||||
DeletedMul = true;
|
||||
}
|
||||
|
||||
@ -1940,8 +1940,7 @@ const SCEV *ScalarEvolution::getAddRecExpr(const SCEV *Start,
|
||||
Operands.push_back(Start);
|
||||
if (const SCEVAddRecExpr *StepChrec = dyn_cast<SCEVAddRecExpr>(Step))
|
||||
if (StepChrec->getLoop() == L) {
|
||||
Operands.insert(Operands.end(), StepChrec->op_begin(),
|
||||
StepChrec->op_end());
|
||||
Operands.append(StepChrec->op_begin(), StepChrec->op_end());
|
||||
return getAddRecExpr(Operands, L);
|
||||
}
|
||||
|
||||
@ -2104,8 +2103,8 @@ ScalarEvolution::getSMaxExpr(SmallVectorImpl<const SCEV *> &Ops) {
|
||||
if (Idx < Ops.size()) {
|
||||
bool DeletedSMax = false;
|
||||
while (const SCEVSMaxExpr *SMax = dyn_cast<SCEVSMaxExpr>(Ops[Idx])) {
|
||||
Ops.insert(Ops.end(), SMax->op_begin(), SMax->op_end());
|
||||
Ops.erase(Ops.begin()+Idx);
|
||||
Ops.append(SMax->op_begin(), SMax->op_end());
|
||||
DeletedSMax = true;
|
||||
}
|
||||
|
||||
@ -2209,8 +2208,8 @@ ScalarEvolution::getUMaxExpr(SmallVectorImpl<const SCEV *> &Ops) {
|
||||
if (Idx < Ops.size()) {
|
||||
bool DeletedUMax = false;
|
||||
while (const SCEVUMaxExpr *UMax = dyn_cast<SCEVUMaxExpr>(Ops[Idx])) {
|
||||
Ops.insert(Ops.end(), UMax->op_begin(), UMax->op_end());
|
||||
Ops.erase(Ops.begin()+Idx);
|
||||
Ops.append(UMax->op_begin(), UMax->op_end());
|
||||
DeletedUMax = true;
|
||||
}
|
||||
|
||||
|
@ -288,11 +288,11 @@ static void SimplifyAddOperands(SmallVectorImpl<const SCEV *> &Ops,
|
||||
// the sum into a single value, so just use that.
|
||||
Ops.clear();
|
||||
if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Sum))
|
||||
Ops.insert(Ops.end(), Add->op_begin(), Add->op_end());
|
||||
Ops.append(Add->op_begin(), Add->op_end());
|
||||
else if (!Sum->isZero())
|
||||
Ops.push_back(Sum);
|
||||
// Then append the addrecs.
|
||||
Ops.insert(Ops.end(), AddRecs.begin(), AddRecs.end());
|
||||
Ops.append(AddRecs.begin(), AddRecs.end());
|
||||
}
|
||||
|
||||
/// SplitAddRecs - Flatten a list of add operands, moving addrec start values
|
||||
@ -315,7 +315,7 @@ static void SplitAddRecs(SmallVectorImpl<const SCEV *> &Ops,
|
||||
A->getLoop()));
|
||||
if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Start)) {
|
||||
Ops[i] = Zero;
|
||||
Ops.insert(Ops.end(), Add->op_begin(), Add->op_end());
|
||||
Ops.append(Add->op_begin(), Add->op_end());
|
||||
e += Add->getNumOperands();
|
||||
} else {
|
||||
Ops[i] = Start;
|
||||
@ -323,7 +323,7 @@ static void SplitAddRecs(SmallVectorImpl<const SCEV *> &Ops,
|
||||
}
|
||||
if (!AddRecs.empty()) {
|
||||
// Add the addrecs onto the end of the list.
|
||||
Ops.insert(Ops.end(), AddRecs.begin(), AddRecs.end());
|
||||
Ops.append(AddRecs.begin(), AddRecs.end());
|
||||
// Resort the operand list, moving any constants to the front.
|
||||
SimplifyAddOperands(Ops, Ty, SE);
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ SDNode *DAGTypeLegalizer::AnalyzeNewNode(SDNode *N) {
|
||||
NewOps.push_back(Op);
|
||||
} else if (Op != OrigOp) {
|
||||
// This is the first operand to change - add all operands so far.
|
||||
NewOps.insert(NewOps.end(), N->op_begin(), N->op_begin() + i);
|
||||
NewOps.append(N->op_begin(), N->op_begin() + i);
|
||||
NewOps.push_back(Op);
|
||||
}
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ MachineBasicBlock *ScheduleDAGSDNodes::EmitSchedule() {
|
||||
for (; PDI != PDE; ++PDI) {
|
||||
MachineInstr *DbgMI= Emitter.EmitDbgValue(*PDI, VRBaseMap);
|
||||
if (DbgMI)
|
||||
BB->insert(BB->end(), DbgMI);
|
||||
BB->push_back(DbgMI);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2626,7 +2626,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
|
||||
if (N1.getOpcode() == ISD::BUILD_VECTOR &&
|
||||
N2.getOpcode() == ISD::BUILD_VECTOR) {
|
||||
SmallVector<SDValue, 16> Elts(N1.getNode()->op_begin(), N1.getNode()->op_end());
|
||||
Elts.insert(Elts.end(), N2.getNode()->op_begin(), N2.getNode()->op_end());
|
||||
Elts.append(N2.getNode()->op_begin(), N2.getNode()->op_end());
|
||||
return getNode(ISD::BUILD_VECTOR, DL, VT, &Elts[0], Elts.size());
|
||||
}
|
||||
break;
|
||||
@ -3024,8 +3024,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
|
||||
N2.getOpcode() == ISD::BUILD_VECTOR &&
|
||||
N3.getOpcode() == ISD::BUILD_VECTOR) {
|
||||
SmallVector<SDValue, 16> Elts(N1.getNode()->op_begin(), N1.getNode()->op_end());
|
||||
Elts.insert(Elts.end(), N2.getNode()->op_begin(), N2.getNode()->op_end());
|
||||
Elts.insert(Elts.end(), N3.getNode()->op_begin(), N3.getNode()->op_end());
|
||||
Elts.append(N2.getNode()->op_begin(), N2.getNode()->op_end());
|
||||
Elts.append(N3.getNode()->op_begin(), N3.getNode()->op_end());
|
||||
return getNode(ISD::BUILD_VECTOR, DL, VT, &Elts[0], Elts.size());
|
||||
}
|
||||
break;
|
||||
|
@ -1951,7 +1951,7 @@ void LSRInstance::CollectInterestingTypesAndFactors() {
|
||||
Strides.insert(AR->getStepRecurrence(SE));
|
||||
Worklist.push_back(AR->getStart());
|
||||
} else if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(S)) {
|
||||
Worklist.insert(Worklist.end(), Add->op_begin(), Add->op_end());
|
||||
Worklist.append(Add->op_begin(), Add->op_end());
|
||||
}
|
||||
} while (!Worklist.empty());
|
||||
}
|
||||
@ -2118,7 +2118,7 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
|
||||
const SCEV *S = Worklist.pop_back_val();
|
||||
|
||||
if (const SCEVNAryExpr *N = dyn_cast<SCEVNAryExpr>(S))
|
||||
Worklist.insert(Worklist.end(), N->op_begin(), N->op_end());
|
||||
Worklist.append(N->op_begin(), N->op_end());
|
||||
else if (const SCEVCastExpr *C = dyn_cast<SCEVCastExpr>(S))
|
||||
Worklist.push_back(C->getOperand());
|
||||
else if (const SCEVUDivExpr *D = dyn_cast<SCEVUDivExpr>(S)) {
|
||||
@ -2248,11 +2248,10 @@ void LSRInstance::GenerateReassociations(LSRUse &LU, unsigned LUIdx,
|
||||
continue;
|
||||
|
||||
// Collect all operands except *J.
|
||||
SmallVector<const SCEV *, 8> InnerAddOps;
|
||||
for (SmallVectorImpl<const SCEV *>::const_iterator K = AddOps.begin(),
|
||||
KE = AddOps.end(); K != KE; ++K)
|
||||
if (K != J)
|
||||
InnerAddOps.push_back(*K);
|
||||
SmallVector<const SCEV *, 8> InnerAddOps
|
||||
( ((const SmallVector<const SCEV *, 8> &)AddOps).begin(), J);
|
||||
InnerAddOps.append
|
||||
(next(J), ((const SmallVector<const SCEV *, 8> &)AddOps).end());
|
||||
|
||||
// Don't leave just a constant behind in a register if the constant could
|
||||
// be folded into an immediate field.
|
||||
|
@ -603,9 +603,8 @@ ComputeLiveInBlocks(AllocaInst *AI, AllocaInfo &Info,
|
||||
// To determine liveness, we must iterate through the predecessors of blocks
|
||||
// where the def is live. Blocks are added to the worklist if we need to
|
||||
// check their predecessors. Start with all the using blocks.
|
||||
SmallVector<BasicBlock*, 64> LiveInBlockWorklist;
|
||||
LiveInBlockWorklist.insert(LiveInBlockWorklist.end(),
|
||||
Info.UsingBlocks.begin(), Info.UsingBlocks.end());
|
||||
SmallVector<BasicBlock*, 64> LiveInBlockWorklist(Info.UsingBlocks.begin(),
|
||||
Info.UsingBlocks.end());
|
||||
|
||||
// If any of the using blocks is also a definition block, check to see if the
|
||||
// definition occurs before or after the use. If it happens before the use,
|
||||
|
@ -2194,7 +2194,7 @@ Constant *llvm::ConstantFoldGetElementPtr(Constant *C,
|
||||
}
|
||||
|
||||
NewIndices.push_back(Combined);
|
||||
NewIndices.insert(NewIndices.end(), Idxs+1, Idxs+NumIdx);
|
||||
NewIndices.append(Idxs+1, Idxs+NumIdx);
|
||||
return (inBounds && cast<GEPOperator>(CE)->isInBounds()) ?
|
||||
ConstantExpr::getInBoundsGetElementPtr(CE->getOperand(0),
|
||||
&NewIndices[0],
|
||||
|
@ -1456,7 +1456,7 @@ void InsertValueInst::init(Value *Agg, Value *Val, const unsigned *Idx,
|
||||
Op<0>() = Agg;
|
||||
Op<1>() = Val;
|
||||
|
||||
Indices.insert(Indices.end(), Idx, Idx + NumIdx);
|
||||
Indices.append(Idx, Idx + NumIdx);
|
||||
setName(Name);
|
||||
}
|
||||
|
||||
@ -1509,7 +1509,7 @@ void ExtractValueInst::init(const unsigned *Idx, unsigned NumIdx,
|
||||
const Twine &Name) {
|
||||
assert(NumOperands == 1 && "NumOperands not initialized?");
|
||||
|
||||
Indices.insert(Indices.end(), Idx, Idx + NumIdx);
|
||||
Indices.append(Idx, Idx + NumIdx);
|
||||
setName(Name);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user