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

[llvm] Use *::empty (NFC)

This commit is contained in:
Kazu Hirata 2021-01-16 09:40:54 -08:00
parent 8b192f274e
commit 3754cf9a03
15 changed files with 19 additions and 25 deletions

View File

@ -833,7 +833,7 @@ incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G,
CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR) {
using SCC = LazyCallGraph::SCC;
if (NewSCCRange.begin() == NewSCCRange.end())
if (NewSCCRange.empty())
return C;
// Add the current SCC to the worklist as its shape has changed.

View File

@ -1403,7 +1403,7 @@ ReoptimizeBlock:
LLVM_DEBUG(dbgs() << "\nMerging into block: " << PrevBB
<< "From MBB: " << *MBB);
// Remove redundant DBG_VALUEs first.
if (PrevBB.begin() != PrevBB.end()) {
if (!PrevBB.empty()) {
MachineBasicBlock::iterator PrevBBIter = PrevBB.end();
--PrevBBIter;
MachineBasicBlock::iterator MBBIter = MBB->begin();

View File

@ -434,7 +434,7 @@ public:
// To insert reload at the end of MBB, insert it before last instruction
// and then swap them.
assert(MBB->begin() != MBB->end() && "Empty block");
assert(!MBB->empty() && "Empty block");
--It;
TII.loadRegFromStackSlot(*MBB, It, Reg, FI, RC, &TRI);
MachineInstr *Reload = It->getPrevNode();

View File

@ -394,8 +394,7 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
}
LiveInterval &DestLI = LIS->getInterval(DestReg);
assert(DestLI.begin() != DestLI.end() &&
"PHIs should have nonempty LiveIntervals.");
assert(!DestLI.empty() && "PHIs should have nonempty LiveIntervals.");
if (DestLI.endIndex().isDead()) {
// A dead PHI's live range begins and ends at the start of the MBB, but
// the lowered copy, which will still be dead, needs to begin and end at

View File

@ -91,7 +91,7 @@ void RegScavenger::enterBasicBlockEnd(MachineBasicBlock &MBB) {
LiveUnits.addLiveOuts(MBB);
// Move internal iterator at the last instruction of the block.
if (MBB.begin() != MBB.end()) {
if (!MBB.empty()) {
MBBI = std::prev(MBB.end());
Tracking = true;
}

View File

@ -48,7 +48,7 @@ llvm::object::computeSymbolSizes(const ObjectFile &O) {
if (const auto *E = dyn_cast<ELFObjectFileBase>(&O)) {
auto Syms = E->symbols();
if (Syms.begin() == Syms.end())
if (Syms.empty())
Syms = E->getDynamicSymbolIterators();
for (ELFSymbolRef Sym : Syms)
Ret.push_back({Sym, Sym.getSize()});

View File

@ -441,7 +441,7 @@ MachineInstr *AMDGPUCFGStructurizer::insertInstrBefore(MachineBasicBlock *MBB,
const DebugLoc &DL) {
MachineInstr *MI =
MBB->getParent()->CreateMachineInstr(TII->get(NewOpcode), DL);
if (MBB->begin() != MBB->end())
if (!MBB->empty())
MBB->insert(MBB->begin(), MI);
else
MBB->push_back(MI);

View File

@ -2095,8 +2095,7 @@ static bool jumpTableFollowsTB(MachineInstr *JTMI, MachineInstr *CPEMI) {
MachineFunction *MF = MBB->getParent();
++MBB;
return MBB != MF->end() && MBB->begin() != MBB->end() &&
&*MBB->begin() == CPEMI;
return MBB != MF->end() && !MBB->empty() && &*MBB->begin() == CPEMI;
}
static void RemoveDeadAddBetweenLEAAndJT(MachineInstr *LEAMI,

View File

@ -1173,7 +1173,7 @@ bool HexagonExpandCondsets::coalesceRegisters(RegisterRef R1, RegisterRef R2) {
}
L1.addSegment(LiveRange::Segment(I->start, I->end, NewVN));
}
while (L2.begin() != L2.end())
while (!L2.empty())
L2.removeSegment(*L2.begin());
LIS->removeInterval(R2.Reg);

View File

@ -692,7 +692,7 @@ class TreeWalkerState {
public:
explicit TreeWalkerState(MachineInstr *Insert) {
const iterator_range<mop_iterator> &Range = Insert->explicit_uses();
if (Range.begin() != Range.end())
if (!Range.empty())
Worklist.push_back(reverse(Range));
}
@ -702,10 +702,9 @@ public:
RangeTy &Range = Worklist.back();
MachineOperand &Op = *Range.begin();
Range = drop_begin(Range, 1);
if (Range.begin() == Range.end())
if (Range.empty())
Worklist.pop_back();
assert((Worklist.empty() ||
Worklist.back().begin() != Worklist.back().end()) &&
assert((Worklist.empty() || !Worklist.back().empty()) &&
"Empty ranges shouldn't remain in the worklist");
return Op;
}
@ -713,7 +712,7 @@ public:
/// Push Instr's operands onto the stack to be visited.
void pushOperands(MachineInstr *Instr) {
const iterator_range<mop_iterator> &Range(Instr->explicit_uses());
if (Range.begin() != Range.end())
if (!Range.empty())
Worklist.push_back(reverse(Range));
}
@ -732,7 +731,7 @@ public:
if (Worklist.empty())
return false;
const RangeTy &Range = Worklist.back();
return Range.begin() != Range.end() && Range.begin()->getParent() == Instr;
return !Range.empty() && Range.begin()->getParent() == Instr;
}
/// Test whether the given register is present on the stack, indicating an

View File

@ -537,7 +537,7 @@ bool X86CmovConverterPass::checkForProfitableCmovCandidates(
// This is another conservative check to avoid converting CMOV instruction
// used with tree-search like algorithm, where the branch is unpredicted.
auto UIs = MRI->use_instructions(MI->defs().begin()->getReg());
if (UIs.begin() != UIs.end() && ++UIs.begin() == UIs.end()) {
if (!UIs.empty() && ++UIs.begin() == UIs.end()) {
unsigned Op = UIs.begin()->getOpcode();
if (Op == X86::MOV64rm || Op == X86::MOV32rm) {
WorthOpGroup = false;

View File

@ -21983,8 +21983,7 @@ static bool matchScalarReduction(SDValue Op, ISD::NodeType BinOp,
if (M == SrcOpMap.end()) {
VT = Src.getValueType();
// Quit if not the same type.
if (SrcOpMap.begin() != SrcOpMap.end() &&
VT != SrcOpMap.begin()->first.getValueType())
if (!SrcOpMap.empty() && VT != SrcOpMap.begin()->first.getValueType())
return false;
unsigned NumElts = VT.getVectorNumElements();
APInt EltCount = APInt::getNullValue(NumElts);

View File

@ -2113,8 +2113,7 @@ static bool isIntegerWideningViable(Partition &P, Type *AllocaTy,
// that we cover the alloca.
// FIXME: We shouldn't consider split slices that happen to start in the
// partition here...
bool WholeAllocaOp =
P.begin() != P.end() ? false : DL.isLegalInteger(SizeInBits);
bool WholeAllocaOp = P.empty() && DL.isLegalInteger(SizeInBits);
for (const Slice &S : P)
if (!isIntegerWideningViableForSlice(S, P.beginOffset(), AllocaTy, DL,

View File

@ -135,8 +135,7 @@ const PfmCountersInfo &ExegesisTarget::getPfmCounters(StringRef CpuName) const {
auto Found = llvm::lower_bound(CpuPfmCounters, CpuName);
if (Found == CpuPfmCounters.end() || StringRef(Found->CpuName) != CpuName) {
// Use the default.
if (CpuPfmCounters.begin() != CpuPfmCounters.end() &&
CpuPfmCounters.begin()->CpuName[0] == '\0') {
if (!CpuPfmCounters.empty() && CpuPfmCounters.begin()->CpuName[0] == '\0') {
Found = CpuPfmCounters.begin(); // The target specifies a default.
} else {
return PfmCountersInfo::Default; // No default for the target.

View File

@ -733,7 +733,7 @@ void ELFDumper<ELFT>::printSymbolsHelper(bool IsDynamic) const {
toString(SymsOrErr.takeError()));
Entries = DotSymtabSec->getEntityCount();
}
if (Syms.begin() == Syms.end())
if (Syms.empty())
return;
// The st_other field has 2 logical parts. The first two bits hold the symbol