mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-26 05:00:39 +00:00
Use the range variant of remove_if instead of unpacking begin/end
No functionality change is intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278475 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
33ebfce237
commit
5d08e375ab
@ -147,7 +147,7 @@ public:
|
||||
/// write it:
|
||||
///
|
||||
/// \code
|
||||
/// V.erase(std::remove_if(V.begin(), V.end(), P), V.end());
|
||||
/// V.erase(remove_if(V, P), V.end());
|
||||
/// \endcode
|
||||
///
|
||||
/// However, PriorityWorklist doesn't expose non-const iterators, making any
|
||||
@ -156,8 +156,8 @@ public:
|
||||
/// \returns true if any element is removed.
|
||||
template <typename UnaryPredicate>
|
||||
bool erase_if(UnaryPredicate P) {
|
||||
typename VectorT::iterator E = std::remove_if(
|
||||
V.begin(), V.end(), TestAndEraseFromMap<UnaryPredicate>(P, M));
|
||||
typename VectorT::iterator E =
|
||||
remove_if(V, TestAndEraseFromMap<UnaryPredicate>(P, M));
|
||||
if (E == V.end())
|
||||
return false;
|
||||
for (auto I = V.begin(); I != E; ++I)
|
||||
|
@ -176,7 +176,7 @@ public:
|
||||
/// write it:
|
||||
///
|
||||
/// \code
|
||||
/// V.erase(std::remove_if(V.begin(), V.end(), P), V.end());
|
||||
/// V.erase(remove_if(V, P), V.end());
|
||||
/// \endcode
|
||||
///
|
||||
/// However, SetVector doesn't expose non-const iterators, making any
|
||||
@ -185,9 +185,8 @@ public:
|
||||
/// \returns true if any element is removed.
|
||||
template <typename UnaryPredicate>
|
||||
bool remove_if(UnaryPredicate P) {
|
||||
typename vector_type::iterator I
|
||||
= std::remove_if(vector_.begin(), vector_.end(),
|
||||
TestAndEraseFromSet<UnaryPredicate>(P, set_));
|
||||
typename vector_type::iterator I =
|
||||
remove_if(vector_, TestAndEraseFromSet<UnaryPredicate>(P, set_));
|
||||
if (I == vector_.end())
|
||||
return false;
|
||||
vector_.erase(I, vector_.end());
|
||||
|
@ -9146,10 +9146,9 @@ static bool findArrayDimensionsRec(ScalarEvolution &SE,
|
||||
}
|
||||
|
||||
// Remove all SCEVConstants.
|
||||
Terms.erase(std::remove_if(Terms.begin(), Terms.end(), [](const SCEV *E) {
|
||||
return isa<SCEVConstant>(E);
|
||||
}),
|
||||
Terms.end());
|
||||
Terms.erase(
|
||||
remove_if(Terms, [](const SCEV *E) { return isa<SCEVConstant>(E); }),
|
||||
Terms.end());
|
||||
|
||||
if (Terms.size() > 0)
|
||||
if (!findArrayDimensionsRec(SE, Terms, Sizes))
|
||||
|
@ -571,7 +571,7 @@ void LiveRange::removeSegment(SlotIndex Start, SlotIndex End,
|
||||
/// Also remove the value# from value# list.
|
||||
void LiveRange::removeValNo(VNInfo *ValNo) {
|
||||
if (empty()) return;
|
||||
segments.erase(std::remove_if(begin(), end(), [ValNo](const Segment &S) {
|
||||
segments.erase(remove_if(*this, [ValNo](const Segment &S) {
|
||||
return S.valno == ValNo;
|
||||
}), end());
|
||||
// Now that ValNo is dead, remove it.
|
||||
|
@ -790,10 +790,10 @@ MachineBasicBlock *MachineBlockPlacement::selectBestCandidateBlock(
|
||||
// worklist of already placed entries.
|
||||
// FIXME: If this shows up on profiles, it could be folded (at the cost of
|
||||
// some code complexity) into the loop below.
|
||||
WorkList.erase(std::remove_if(WorkList.begin(), WorkList.end(),
|
||||
[&](MachineBasicBlock *BB) {
|
||||
return BlockToChain.lookup(BB) == &Chain;
|
||||
}),
|
||||
WorkList.erase(remove_if(WorkList,
|
||||
[&](MachineBasicBlock *BB) {
|
||||
return BlockToChain.lookup(BB) == &Chain;
|
||||
}),
|
||||
WorkList.end());
|
||||
|
||||
if (WorkList.empty())
|
||||
|
@ -272,8 +272,7 @@ StackMaps::parseRegisterLiveOutMask(const uint32_t *Mask) const {
|
||||
}
|
||||
|
||||
LiveOuts.erase(
|
||||
std::remove_if(LiveOuts.begin(), LiveOuts.end(),
|
||||
[](const LiveOutReg &LO) { return LO.Reg == 0; }),
|
||||
remove_if(LiveOuts, [](const LiveOutReg &LO) { return LO.Reg == 0; }),
|
||||
LiveOuts.end());
|
||||
|
||||
return LiveOuts;
|
||||
|
@ -196,8 +196,8 @@ SectionMemoryManager::applyMemoryGroupPermissions(MemoryGroup &MemGroup,
|
||||
|
||||
// Remove all blocks which are now empty
|
||||
MemGroup.FreeMem.erase(
|
||||
std::remove_if(MemGroup.FreeMem.begin(), MemGroup.FreeMem.end(),
|
||||
[](FreeMemBlock &FreeMB) { return FreeMB.Free.size() == 0; }),
|
||||
remove_if(MemGroup.FreeMem,
|
||||
[](FreeMemBlock &FreeMB) { return FreeMB.Free.size() == 0; }),
|
||||
MemGroup.FreeMem.end());
|
||||
|
||||
return std::error_code();
|
||||
|
@ -998,9 +998,7 @@ public:
|
||||
///
|
||||
/// Erases all attachments matching the \c shouldRemove predicate.
|
||||
template <class PredTy> void remove_if(PredTy shouldRemove) {
|
||||
Attachments.erase(
|
||||
std::remove_if(Attachments.begin(), Attachments.end(), shouldRemove),
|
||||
Attachments.end());
|
||||
Attachments.erase(remove_if(Attachments, shouldRemove), Attachments.end());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -807,15 +807,15 @@ IRLinker::linkAppendingVarProto(GlobalVariable *DstGV,
|
||||
|
||||
if (IsNewStructor)
|
||||
SrcElements.erase(
|
||||
std::remove_if(SrcElements.begin(), SrcElements.end(),
|
||||
[this](Constant *E) {
|
||||
auto *Key = dyn_cast<GlobalValue>(
|
||||
E->getAggregateElement(2)->stripPointerCasts());
|
||||
if (!Key)
|
||||
return false;
|
||||
GlobalValue *DGV = getLinkedToGlobal(Key);
|
||||
return !shouldLink(DGV, *Key);
|
||||
}),
|
||||
remove_if(SrcElements,
|
||||
[this](Constant *E) {
|
||||
auto *Key = dyn_cast<GlobalValue>(
|
||||
E->getAggregateElement(2)->stripPointerCasts());
|
||||
if (!Key)
|
||||
return false;
|
||||
GlobalValue *DGV = getLinkedToGlobal(Key);
|
||||
return !shouldLink(DGV, *Key);
|
||||
}),
|
||||
SrcElements.end());
|
||||
uint64_t NewSize = DstNumElements + SrcElements.size();
|
||||
ArrayType *NewType = ArrayType::get(EltTy, NewSize);
|
||||
|
@ -39,9 +39,9 @@ void ArgList::append(Arg *A) {
|
||||
}
|
||||
|
||||
void ArgList::eraseArg(OptSpecifier Id) {
|
||||
Args.erase(std::remove_if(begin(), end(),
|
||||
[=](Arg *A) { return A->getOption().matches(Id); }),
|
||||
end());
|
||||
Args.erase(
|
||||
remove_if(*this, [=](Arg *A) { return A->getOption().matches(Id); }),
|
||||
end());
|
||||
}
|
||||
|
||||
Arg *ArgList::getLastArgNoClaim(OptSpecifier Id) const {
|
||||
|
@ -1174,8 +1174,7 @@ bool HexagonAsmParser::isLabel(AsmToken &Token) {
|
||||
StringRef Raw (String.data(), Third.getString().data() - String.data() +
|
||||
Third.getString().size());
|
||||
std::string Collapsed = Raw;
|
||||
Collapsed.erase(std::remove_if(Collapsed.begin(), Collapsed.end(), isspace),
|
||||
Collapsed.end());
|
||||
Collapsed.erase(remove_if(Collapsed, isspace), Collapsed.end());
|
||||
StringRef Whole = Collapsed;
|
||||
std::pair<StringRef, StringRef> DotSplit = Whole.split('.');
|
||||
if (!matchRegister(DotSplit.first.lower()))
|
||||
@ -1219,8 +1218,7 @@ bool HexagonAsmParser::ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &En
|
||||
NeededWorkaround = NeededWorkaround || (Again && !(Contigious && Type));
|
||||
}
|
||||
std::string Collapsed = RawString;
|
||||
Collapsed.erase(std::remove_if(Collapsed.begin(), Collapsed.end(), isspace),
|
||||
Collapsed.end());
|
||||
Collapsed.erase(remove_if(Collapsed, isspace), Collapsed.end());
|
||||
StringRef FullString = Collapsed;
|
||||
std::pair<StringRef, StringRef> DotSplit = FullString.split('.');
|
||||
unsigned DotReg = matchRegister(DotSplit.first.lower());
|
||||
|
@ -639,8 +639,7 @@ void HexagonCommonGEP::common() {
|
||||
// Node for removal.
|
||||
Erase.insert(*I);
|
||||
}
|
||||
NodeVect::iterator NewE = std::remove_if(Nodes.begin(), Nodes.end(),
|
||||
in_set(Erase));
|
||||
NodeVect::iterator NewE = remove_if(Nodes, in_set(Erase));
|
||||
Nodes.resize(std::distance(Nodes.begin(), NewE));
|
||||
|
||||
DEBUG(dbgs() << "Gep nodes after post-commoning cleanup:\n" << Nodes);
|
||||
|
@ -398,8 +398,7 @@ void HexagonExpandCondsets::removeImpDefSegments(LiveRange &Range) {
|
||||
return S.start.isRegister() &&
|
||||
LocalImpDefs.count(LIS->getInstructionFromIndex(S.start));
|
||||
};
|
||||
Range.segments.erase(std::remove_if(Range.begin(), Range.end(), StartImpDef),
|
||||
Range.end());
|
||||
Range.segments.erase(remove_if(Range, StartImpDef), Range.end());
|
||||
}
|
||||
|
||||
void HexagonExpandCondsets::updateDeadsInRange(unsigned Reg, LaneBitmask LM,
|
||||
|
@ -1052,7 +1052,7 @@ void HexagonGenInsert::pruneCoveredSets(unsigned VR) {
|
||||
auto IsEmpty = [] (const IFRecordWithRegSet &IR) -> bool {
|
||||
return IR.second.empty();
|
||||
};
|
||||
auto End = std::remove_if(LL.begin(), LL.end(), IsEmpty);
|
||||
auto End = remove_if(LL, IsEmpty);
|
||||
if (End != LL.end())
|
||||
LL.erase(End, LL.end());
|
||||
} else {
|
||||
@ -1144,7 +1144,7 @@ void HexagonGenInsert::pruneRegCopies(unsigned VR) {
|
||||
auto IsCopy = [] (const IFRecordWithRegSet &IR) -> bool {
|
||||
return IR.first.Wdh == 32 && (IR.first.Off == 0 || IR.first.Off == 32);
|
||||
};
|
||||
auto End = std::remove_if(LL.begin(), LL.end(), IsCopy);
|
||||
auto End = remove_if(LL, IsCopy);
|
||||
if (End != LL.end())
|
||||
LL.erase(End, LL.end());
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ void HexagonSplitDoubleRegs::collectIndRegsForLoop(const MachineLoop *L,
|
||||
}
|
||||
return true;
|
||||
};
|
||||
UVect::iterator End = std::remove_if(DP.begin(), DP.end(), NoIndOp);
|
||||
UVect::iterator End = remove_if(DP, NoIndOp);
|
||||
Rs.insert(DP.begin(), End);
|
||||
Rs.insert(CmpR1);
|
||||
Rs.insert(CmpR2);
|
||||
|
@ -1886,8 +1886,7 @@ class BitPermutationSelector {
|
||||
}
|
||||
|
||||
void eraseMatchingBitGroups(function_ref<bool(const BitGroup &)> F) {
|
||||
BitGroups.erase(std::remove_if(BitGroups.begin(), BitGroups.end(), F),
|
||||
BitGroups.end());
|
||||
BitGroups.erase(remove_if(BitGroups, F), BitGroups.end());
|
||||
}
|
||||
|
||||
SmallVector<ValueBit, 64> Bits;
|
||||
|
@ -205,7 +205,7 @@ static std::string getSignature(FunctionType *FTy) {
|
||||
if (FTy->isVarArg())
|
||||
OS << "_...";
|
||||
Sig = OS.str();
|
||||
Sig.erase(std::remove_if(Sig.begin(), Sig.end(), isspace), Sig.end());
|
||||
Sig.erase(remove_if(Sig, isspace), Sig.end());
|
||||
// When s2wasm parses .s file, a comma means the end of an argument. So a
|
||||
// mangled function name can contain any character but a comma.
|
||||
std::replace(Sig.begin(), Sig.end(), ',', '.');
|
||||
|
@ -1740,9 +1740,8 @@ static void relocationViaAlloca(
|
||||
/// tests in ways which make them less useful in testing fused safepoints.
|
||||
template <typename T> static void unique_unsorted(SmallVectorImpl<T> &Vec) {
|
||||
SmallSet<T, 8> Seen;
|
||||
Vec.erase(std::remove_if(Vec.begin(), Vec.end(), [&](const T &V) {
|
||||
return !Seen.insert(V).second;
|
||||
}), Vec.end());
|
||||
Vec.erase(remove_if(Vec, [&](const T &V) { return !Seen.insert(V).second; }),
|
||||
Vec.end());
|
||||
}
|
||||
|
||||
/// Insert holders so that each Value is obviously live through the entire
|
||||
|
@ -995,10 +995,7 @@ AllocaSlices::AllocaSlices(const DataLayout &DL, AllocaInst &AI)
|
||||
return;
|
||||
}
|
||||
|
||||
Slices.erase(std::remove_if(Slices.begin(), Slices.end(),
|
||||
[](const Slice &S) {
|
||||
return S.isDead();
|
||||
}),
|
||||
Slices.erase(remove_if(Slices, [](const Slice &S) { return S.isDead(); }),
|
||||
Slices.end());
|
||||
|
||||
#ifndef NDEBUG
|
||||
@ -1814,10 +1811,10 @@ static VectorType *isVectorPromotionViable(Partition &P, const DataLayout &DL) {
|
||||
// do that until all the backends are known to produce good code for all
|
||||
// integer vector types.
|
||||
if (!HaveCommonEltTy) {
|
||||
CandidateTys.erase(std::remove_if(CandidateTys.begin(), CandidateTys.end(),
|
||||
[](VectorType *VTy) {
|
||||
return !VTy->getElementType()->isIntegerTy();
|
||||
}),
|
||||
CandidateTys.erase(remove_if(CandidateTys,
|
||||
[](VectorType *VTy) {
|
||||
return !VTy->getElementType()->isIntegerTy();
|
||||
}),
|
||||
CandidateTys.end());
|
||||
|
||||
// If there were no integer vector types, give up.
|
||||
@ -3461,63 +3458,60 @@ bool SROA::presplitLoadsAndStores(AllocaInst &AI, AllocaSlices &AS) {
|
||||
// match relative to their starting offset. We have to verify this prior to
|
||||
// any rewriting.
|
||||
Stores.erase(
|
||||
std::remove_if(Stores.begin(), Stores.end(),
|
||||
[&UnsplittableLoads, &SplitOffsetsMap](StoreInst *SI) {
|
||||
// Lookup the load we are storing in our map of split
|
||||
// offsets.
|
||||
auto *LI = cast<LoadInst>(SI->getValueOperand());
|
||||
// If it was completely unsplittable, then we're done,
|
||||
// and this store can't be pre-split.
|
||||
if (UnsplittableLoads.count(LI))
|
||||
return true;
|
||||
remove_if(Stores,
|
||||
[&UnsplittableLoads, &SplitOffsetsMap](StoreInst *SI) {
|
||||
// Lookup the load we are storing in our map of split
|
||||
// offsets.
|
||||
auto *LI = cast<LoadInst>(SI->getValueOperand());
|
||||
// If it was completely unsplittable, then we're done,
|
||||
// and this store can't be pre-split.
|
||||
if (UnsplittableLoads.count(LI))
|
||||
return true;
|
||||
|
||||
auto LoadOffsetsI = SplitOffsetsMap.find(LI);
|
||||
if (LoadOffsetsI == SplitOffsetsMap.end())
|
||||
return false; // Unrelated loads are definitely safe.
|
||||
auto &LoadOffsets = LoadOffsetsI->second;
|
||||
auto LoadOffsetsI = SplitOffsetsMap.find(LI);
|
||||
if (LoadOffsetsI == SplitOffsetsMap.end())
|
||||
return false; // Unrelated loads are definitely safe.
|
||||
auto &LoadOffsets = LoadOffsetsI->second;
|
||||
|
||||
// Now lookup the store's offsets.
|
||||
auto &StoreOffsets = SplitOffsetsMap[SI];
|
||||
// Now lookup the store's offsets.
|
||||
auto &StoreOffsets = SplitOffsetsMap[SI];
|
||||
|
||||
// If the relative offsets of each split in the load and
|
||||
// store match exactly, then we can split them and we
|
||||
// don't need to remove them here.
|
||||
if (LoadOffsets.Splits == StoreOffsets.Splits)
|
||||
return false;
|
||||
// If the relative offsets of each split in the load and
|
||||
// store match exactly, then we can split them and we
|
||||
// don't need to remove them here.
|
||||
if (LoadOffsets.Splits == StoreOffsets.Splits)
|
||||
return false;
|
||||
|
||||
DEBUG(dbgs()
|
||||
<< " Mismatched splits for load and store:\n"
|
||||
<< " " << *LI << "\n"
|
||||
<< " " << *SI << "\n");
|
||||
DEBUG(dbgs() << " Mismatched splits for load and store:\n"
|
||||
<< " " << *LI << "\n"
|
||||
<< " " << *SI << "\n");
|
||||
|
||||
// We've found a store and load that we need to split
|
||||
// with mismatched relative splits. Just give up on them
|
||||
// and remove both instructions from our list of
|
||||
// candidates.
|
||||
UnsplittableLoads.insert(LI);
|
||||
return true;
|
||||
}),
|
||||
// We've found a store and load that we need to split
|
||||
// with mismatched relative splits. Just give up on them
|
||||
// and remove both instructions from our list of
|
||||
// candidates.
|
||||
UnsplittableLoads.insert(LI);
|
||||
return true;
|
||||
}),
|
||||
Stores.end());
|
||||
// Now we have to go *back* through all the stores, because a later store may
|
||||
// have caused an earlier store's load to become unsplittable and if it is
|
||||
// unsplittable for the later store, then we can't rely on it being split in
|
||||
// the earlier store either.
|
||||
Stores.erase(std::remove_if(Stores.begin(), Stores.end(),
|
||||
[&UnsplittableLoads](StoreInst *SI) {
|
||||
auto *LI =
|
||||
cast<LoadInst>(SI->getValueOperand());
|
||||
return UnsplittableLoads.count(LI);
|
||||
}),
|
||||
Stores.erase(remove_if(Stores,
|
||||
[&UnsplittableLoads](StoreInst *SI) {
|
||||
auto *LI = cast<LoadInst>(SI->getValueOperand());
|
||||
return UnsplittableLoads.count(LI);
|
||||
}),
|
||||
Stores.end());
|
||||
// Once we've established all the loads that can't be split for some reason,
|
||||
// filter any that made it into our list out.
|
||||
Loads.erase(std::remove_if(Loads.begin(), Loads.end(),
|
||||
[&UnsplittableLoads](LoadInst *LI) {
|
||||
return UnsplittableLoads.count(LI);
|
||||
}),
|
||||
Loads.erase(remove_if(Loads,
|
||||
[&UnsplittableLoads](LoadInst *LI) {
|
||||
return UnsplittableLoads.count(LI);
|
||||
}),
|
||||
Loads.end());
|
||||
|
||||
|
||||
// If no loads or stores are left, there is no pre-splitting to be done for
|
||||
// this alloca.
|
||||
if (Loads.empty() && Stores.empty())
|
||||
@ -3775,9 +3769,7 @@ bool SROA::presplitLoadsAndStores(AllocaInst &AI, AllocaSlices &AS) {
|
||||
}
|
||||
|
||||
// Remove the killed slices that have ben pre-split.
|
||||
AS.erase(std::remove_if(AS.begin(), AS.end(), [](const Slice &S) {
|
||||
return S.isDead();
|
||||
}), AS.end());
|
||||
AS.erase(remove_if(AS, [](const Slice &S) { return S.isDead(); }), AS.end());
|
||||
|
||||
// Insert our new slices. This will sort and merge them into the sorted
|
||||
// sequence.
|
||||
@ -3792,8 +3784,8 @@ bool SROA::presplitLoadsAndStores(AllocaInst &AI, AllocaSlices &AS) {
|
||||
// Finally, don't try to promote any allocas that new require re-splitting.
|
||||
// They have already been added to the worklist above.
|
||||
PromotableAllocas.erase(
|
||||
std::remove_if(
|
||||
PromotableAllocas.begin(), PromotableAllocas.end(),
|
||||
remove_if(
|
||||
PromotableAllocas,
|
||||
[&](AllocaInst *AI) { return ResplitPromotableAllocas.count(AI); }),
|
||||
PromotableAllocas.end());
|
||||
|
||||
@ -4228,9 +4220,7 @@ PreservedAnalyses SROA::runImpl(Function &F, DominatorTree &RunDT,
|
||||
auto IsInSet = [&](AllocaInst *AI) { return DeletedAllocas.count(AI); };
|
||||
Worklist.remove_if(IsInSet);
|
||||
PostPromotionWorklist.remove_if(IsInSet);
|
||||
PromotableAllocas.erase(std::remove_if(PromotableAllocas.begin(),
|
||||
PromotableAllocas.end(),
|
||||
IsInSet),
|
||||
PromotableAllocas.erase(remove_if(PromotableAllocas, IsInSet),
|
||||
PromotableAllocas.end());
|
||||
DeletedAllocas.clear();
|
||||
}
|
||||
|
@ -478,10 +478,10 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI,
|
||||
// cases.
|
||||
assert(MaxPop > 0 && PopSucc);
|
||||
Default = PopSucc;
|
||||
Cases.erase(std::remove_if(
|
||||
Cases.begin(), Cases.end(),
|
||||
[PopSucc](const CaseRange &R) { return R.BB == PopSucc; }),
|
||||
Cases.end());
|
||||
Cases.erase(
|
||||
remove_if(Cases,
|
||||
[PopSucc](const CaseRange &R) { return R.BB == PopSucc; }),
|
||||
Cases.end());
|
||||
|
||||
// If there are no cases left, just branch.
|
||||
if (Cases.empty()) {
|
||||
|
@ -450,10 +450,8 @@ void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) {
|
||||
}
|
||||
|
||||
// Okay, delete instructions with no operand info left.
|
||||
auto I = std::remove_if(Instructions.begin(), Instructions.end(),
|
||||
[](AsmWriterInst &Inst) {
|
||||
return Inst.Operands.empty();
|
||||
});
|
||||
auto I = remove_if(Instructions,
|
||||
[](AsmWriterInst &Inst) { return Inst.Operands.empty(); });
|
||||
Instructions.erase(I, Instructions.end());
|
||||
|
||||
|
||||
|
@ -239,8 +239,7 @@ bool EEVT::TypeSet::EnforceInteger(TreePattern &TP) {
|
||||
TypeSet InputSet(*this);
|
||||
|
||||
// Filter out all the fp types.
|
||||
TypeVec.erase(std::remove_if(TypeVec.begin(), TypeVec.end(),
|
||||
std::not1(std::ptr_fun(isInteger))),
|
||||
TypeVec.erase(remove_if(TypeVec, std::not1(std::ptr_fun(isInteger))),
|
||||
TypeVec.end());
|
||||
|
||||
if (TypeVec.empty()) {
|
||||
@ -265,8 +264,7 @@ bool EEVT::TypeSet::EnforceFloatingPoint(TreePattern &TP) {
|
||||
TypeSet InputSet(*this);
|
||||
|
||||
// Filter out all the integer types.
|
||||
TypeVec.erase(std::remove_if(TypeVec.begin(), TypeVec.end(),
|
||||
std::not1(std::ptr_fun(isFloatingPoint))),
|
||||
TypeVec.erase(remove_if(TypeVec, std::not1(std::ptr_fun(isFloatingPoint))),
|
||||
TypeVec.end());
|
||||
|
||||
if (TypeVec.empty()) {
|
||||
@ -292,8 +290,7 @@ bool EEVT::TypeSet::EnforceScalar(TreePattern &TP) {
|
||||
TypeSet InputSet(*this);
|
||||
|
||||
// Filter out all the vector types.
|
||||
TypeVec.erase(std::remove_if(TypeVec.begin(), TypeVec.end(),
|
||||
std::not1(std::ptr_fun(isScalar))),
|
||||
TypeVec.erase(remove_if(TypeVec, std::not1(std::ptr_fun(isScalar))),
|
||||
TypeVec.end());
|
||||
|
||||
if (TypeVec.empty()) {
|
||||
@ -317,8 +314,7 @@ bool EEVT::TypeSet::EnforceVector(TreePattern &TP) {
|
||||
bool MadeChange = false;
|
||||
|
||||
// Filter out all the scalar types.
|
||||
TypeVec.erase(std::remove_if(TypeVec.begin(), TypeVec.end(),
|
||||
std::not1(std::ptr_fun(isVector))),
|
||||
TypeVec.erase(remove_if(TypeVec, std::not1(std::ptr_fun(isVector))),
|
||||
TypeVec.end());
|
||||
|
||||
if (TypeVec.empty()) {
|
||||
@ -395,16 +391,15 @@ bool EEVT::TypeSet::EnforceSmallerThan(EEVT::TypeSet &Other, TreePattern &TP) {
|
||||
A.getSizeInBits() < B.getSizeInBits());
|
||||
});
|
||||
|
||||
auto I = std::remove_if(Other.TypeVec.begin(), Other.TypeVec.end(),
|
||||
[Smallest](MVT OtherVT) {
|
||||
// Don't compare vector and non-vector types.
|
||||
if (OtherVT.isVector() != Smallest.isVector())
|
||||
return false;
|
||||
// The getSizeInBits() check here is only needed for vectors, but is
|
||||
// a subset of the scalar check for scalars so no need to qualify.
|
||||
return OtherVT.getScalarSizeInBits() <= Smallest.getScalarSizeInBits()||
|
||||
OtherVT.getSizeInBits() < Smallest.getSizeInBits();
|
||||
});
|
||||
auto I = remove_if(Other.TypeVec, [Smallest](MVT OtherVT) {
|
||||
// Don't compare vector and non-vector types.
|
||||
if (OtherVT.isVector() != Smallest.isVector())
|
||||
return false;
|
||||
// The getSizeInBits() check here is only needed for vectors, but is
|
||||
// a subset of the scalar check for scalars so no need to qualify.
|
||||
return OtherVT.getScalarSizeInBits() <= Smallest.getScalarSizeInBits() ||
|
||||
OtherVT.getSizeInBits() < Smallest.getSizeInBits();
|
||||
});
|
||||
MadeChange |= I != Other.TypeVec.end(); // If we're about to remove types.
|
||||
Other.TypeVec.erase(I, Other.TypeVec.end());
|
||||
|
||||
@ -428,14 +423,13 @@ bool EEVT::TypeSet::EnforceSmallerThan(EEVT::TypeSet &Other, TreePattern &TP) {
|
||||
(A.getScalarSizeInBits() == B.getScalarSizeInBits() &&
|
||||
A.getSizeInBits() < B.getSizeInBits());
|
||||
});
|
||||
auto I = std::remove_if(TypeVec.begin(), TypeVec.end(),
|
||||
[Largest](MVT OtherVT) {
|
||||
// Don't compare vector and non-vector types.
|
||||
if (OtherVT.isVector() != Largest.isVector())
|
||||
return false;
|
||||
return OtherVT.getScalarSizeInBits() >= Largest.getScalarSizeInBits() ||
|
||||
OtherVT.getSizeInBits() > Largest.getSizeInBits();
|
||||
});
|
||||
auto I = remove_if(TypeVec, [Largest](MVT OtherVT) {
|
||||
// Don't compare vector and non-vector types.
|
||||
if (OtherVT.isVector() != Largest.isVector())
|
||||
return false;
|
||||
return OtherVT.getScalarSizeInBits() >= Largest.getScalarSizeInBits() ||
|
||||
OtherVT.getSizeInBits() > Largest.getSizeInBits();
|
||||
});
|
||||
MadeChange |= I != TypeVec.end(); // If we're about to remove types.
|
||||
TypeVec.erase(I, TypeVec.end());
|
||||
|
||||
@ -460,10 +454,9 @@ bool EEVT::TypeSet::EnforceVectorEltTypeIs(MVT::SimpleValueType VT,
|
||||
TypeSet InputSet(*this);
|
||||
|
||||
// Filter out all the types which don't have the right element type.
|
||||
auto I = std::remove_if(TypeVec.begin(), TypeVec.end(),
|
||||
[VT](MVT VVT) {
|
||||
return VVT.getVectorElementType().SimpleTy != VT;
|
||||
});
|
||||
auto I = remove_if(TypeVec, [VT](MVT VVT) {
|
||||
return VVT.getVectorElementType().SimpleTy != VT;
|
||||
});
|
||||
MadeChange |= I != TypeVec.end();
|
||||
TypeVec.erase(I, TypeVec.end());
|
||||
|
||||
@ -547,10 +540,9 @@ bool EEVT::TypeSet::EnforceVectorSubVectorTypeIs(EEVT::TypeSet &VTOperand,
|
||||
// Only keep types that have less elements than VTOperand.
|
||||
TypeSet InputSet(VTOperand);
|
||||
|
||||
auto I = std::remove_if(VTOperand.TypeVec.begin(), VTOperand.TypeVec.end(),
|
||||
[NumElems](MVT VVT) {
|
||||
return VVT.getVectorNumElements() >= NumElems;
|
||||
});
|
||||
auto I = remove_if(VTOperand.TypeVec, [NumElems](MVT VVT) {
|
||||
return VVT.getVectorNumElements() >= NumElems;
|
||||
});
|
||||
MadeChange |= I != VTOperand.TypeVec.end();
|
||||
VTOperand.TypeVec.erase(I, VTOperand.TypeVec.end());
|
||||
|
||||
@ -571,10 +563,9 @@ bool EEVT::TypeSet::EnforceVectorSubVectorTypeIs(EEVT::TypeSet &VTOperand,
|
||||
// Only keep types that have more elements than 'this'.
|
||||
TypeSet InputSet(*this);
|
||||
|
||||
auto I = std::remove_if(TypeVec.begin(), TypeVec.end(),
|
||||
[NumElems](MVT VVT) {
|
||||
return VVT.getVectorNumElements() <= NumElems;
|
||||
});
|
||||
auto I = remove_if(TypeVec, [NumElems](MVT VVT) {
|
||||
return VVT.getVectorNumElements() <= NumElems;
|
||||
});
|
||||
MadeChange |= I != TypeVec.end();
|
||||
TypeVec.erase(I, TypeVec.end());
|
||||
|
||||
@ -609,10 +600,9 @@ bool EEVT::TypeSet::EnforceVectorSameNumElts(EEVT::TypeSet &VTOperand,
|
||||
// Only keep types that have same elements as 'this'.
|
||||
TypeSet InputSet(VTOperand);
|
||||
|
||||
auto I = std::remove_if(VTOperand.TypeVec.begin(), VTOperand.TypeVec.end(),
|
||||
[NumElems](MVT VVT) {
|
||||
return VVT.getVectorNumElements() != NumElems;
|
||||
});
|
||||
auto I = remove_if(VTOperand.TypeVec, [NumElems](MVT VVT) {
|
||||
return VVT.getVectorNumElements() != NumElems;
|
||||
});
|
||||
MadeChange |= I != VTOperand.TypeVec.end();
|
||||
VTOperand.TypeVec.erase(I, VTOperand.TypeVec.end());
|
||||
|
||||
@ -629,10 +619,9 @@ bool EEVT::TypeSet::EnforceVectorSameNumElts(EEVT::TypeSet &VTOperand,
|
||||
// Only keep types that have same elements as VTOperand.
|
||||
TypeSet InputSet(*this);
|
||||
|
||||
auto I = std::remove_if(TypeVec.begin(), TypeVec.end(),
|
||||
[NumElems](MVT VVT) {
|
||||
return VVT.getVectorNumElements() != NumElems;
|
||||
});
|
||||
auto I = remove_if(TypeVec, [NumElems](MVT VVT) {
|
||||
return VVT.getVectorNumElements() != NumElems;
|
||||
});
|
||||
MadeChange |= I != TypeVec.end();
|
||||
TypeVec.erase(I, TypeVec.end());
|
||||
|
||||
@ -663,10 +652,8 @@ bool EEVT::TypeSet::EnforceSameSize(EEVT::TypeSet &VTOperand,
|
||||
// Only keep types that have the same size as 'this'.
|
||||
TypeSet InputSet(VTOperand);
|
||||
|
||||
auto I = std::remove_if(VTOperand.TypeVec.begin(), VTOperand.TypeVec.end(),
|
||||
[&](MVT VT) {
|
||||
return VT.getSizeInBits() != Size;
|
||||
});
|
||||
auto I = remove_if(VTOperand.TypeVec,
|
||||
[&](MVT VT) { return VT.getSizeInBits() != Size; });
|
||||
MadeChange |= I != VTOperand.TypeVec.end();
|
||||
VTOperand.TypeVec.erase(I, VTOperand.TypeVec.end());
|
||||
|
||||
@ -683,10 +670,8 @@ bool EEVT::TypeSet::EnforceSameSize(EEVT::TypeSet &VTOperand,
|
||||
// Only keep types that have the same size as VTOperand.
|
||||
TypeSet InputSet(*this);
|
||||
|
||||
auto I = std::remove_if(TypeVec.begin(), TypeVec.end(),
|
||||
[&](MVT VT) {
|
||||
return VT.getSizeInBits() != Size;
|
||||
});
|
||||
auto I =
|
||||
remove_if(TypeVec, [&](MVT VT) { return VT.getSizeInBits() != Size; });
|
||||
MadeChange |= I != TypeVec.end();
|
||||
TypeVec.erase(I, TypeVec.end());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user