forked from OSchip/llvm-project
Use drop_begin (NFC)
This commit is contained in:
parent
71336d03f1
commit
bf6021709a
|
@ -288,12 +288,12 @@ Inliner::inlineCall(BinaryBasicBlock &CallerBB,
|
|||
// Copy basic blocks and maintain a map from their origin.
|
||||
std::unordered_map<const BinaryBasicBlock *, BinaryBasicBlock *> InlinedBBMap;
|
||||
InlinedBBMap[&Callee.front()] = FirstInlinedBB;
|
||||
for (auto BBI = std::next(Callee.begin()); BBI != Callee.end(); ++BBI) {
|
||||
for (const BinaryBasicBlock &BB : llvm::drop_begin(Callee)) {
|
||||
BinaryBasicBlock *InlinedBB = CallerFunction.addBasicBlock();
|
||||
InlinedBBMap[&*BBI] = InlinedBB;
|
||||
InlinedBBMap[&BB] = InlinedBB;
|
||||
InlinedBB->setCFIState(FirstInlinedBB->getCFIState());
|
||||
if (Callee.hasValidProfile())
|
||||
InlinedBB->setExecutionCount(BBI->getKnownExecutionCount());
|
||||
InlinedBB->setExecutionCount(BB.getKnownExecutionCount());
|
||||
else
|
||||
InlinedBB->setExecutionCount(FirstInlinedBBCount);
|
||||
}
|
||||
|
|
|
@ -59,10 +59,11 @@ void SimpleLoopSafetyInfo::computeLoopSafetyInfo(const Loop *CurLoop) {
|
|||
// The first block in loopinfo.Blocks is guaranteed to be the header.
|
||||
assert(Header == *CurLoop->getBlocks().begin() &&
|
||||
"First block must be header");
|
||||
for (Loop::block_iterator BB = std::next(CurLoop->block_begin()),
|
||||
BBE = CurLoop->block_end();
|
||||
(BB != BBE) && !MayThrow; ++BB)
|
||||
MayThrow |= !isGuaranteedToTransferExecutionToSuccessor(*BB);
|
||||
for (const BasicBlock *BB : llvm::drop_begin(CurLoop->blocks())) {
|
||||
MayThrow |= !isGuaranteedToTransferExecutionToSuccessor(BB);
|
||||
if (MayThrow)
|
||||
break;
|
||||
}
|
||||
|
||||
computeBlockColors(CurLoop);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/LineEditor/LineEditor.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Config/config.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
|
@ -37,13 +38,11 @@ std::string LineEditor::ListCompleterConcept::getCommonPrefix(
|
|||
assert(!Comps.empty());
|
||||
|
||||
std::string CommonPrefix = Comps[0].TypedText;
|
||||
for (std::vector<Completion>::const_iterator I = Comps.begin() + 1,
|
||||
E = Comps.end();
|
||||
I != E; ++I) {
|
||||
size_t Len = std::min(CommonPrefix.size(), I->TypedText.size());
|
||||
for (const Completion &C : llvm::drop_begin(Comps)) {
|
||||
size_t Len = std::min(CommonPrefix.size(), C.TypedText.size());
|
||||
size_t CommonLen = 0;
|
||||
for (; CommonLen != Len; ++CommonLen) {
|
||||
if (CommonPrefix[CommonLen] != I->TypedText[CommonLen])
|
||||
if (CommonPrefix[CommonLen] != C.TypedText[CommonLen])
|
||||
break;
|
||||
}
|
||||
CommonPrefix.resize(CommonLen);
|
||||
|
|
|
@ -565,10 +565,8 @@ void MCAsmStreamer::emitAssemblerFlag(MCAssemblerFlag Flag) {
|
|||
void MCAsmStreamer::emitLinkerOptions(ArrayRef<std::string> Options) {
|
||||
assert(!Options.empty() && "At least one option is required!");
|
||||
OS << "\t.linker_option \"" << Options[0] << '"';
|
||||
for (ArrayRef<std::string>::iterator it = Options.begin() + 1,
|
||||
ie = Options.end(); it != ie; ++it) {
|
||||
OS << ", " << '"' << *it << '"';
|
||||
}
|
||||
for (const std::string &Opt : llvm::drop_begin(Options))
|
||||
OS << ", " << '"' << Opt << '"';
|
||||
EmitEOL();
|
||||
}
|
||||
|
||||
|
|
|
@ -1115,11 +1115,10 @@ void AArch64AsmPrinter::LowerFAULTING_OP(const MachineInstr &FaultingMI) {
|
|||
if (DefRegister != (Register)0)
|
||||
MI.addOperand(MCOperand::createReg(DefRegister));
|
||||
|
||||
for (auto I = FaultingMI.operands_begin() + OperandsBeginIdx,
|
||||
E = FaultingMI.operands_end();
|
||||
I != E; ++I) {
|
||||
for (const MachineOperand &MO :
|
||||
llvm::drop_begin(FaultingMI.operands(), OperandsBeginIdx)) {
|
||||
MCOperand Dest;
|
||||
lowerOperand(*I, Dest);
|
||||
lowerOperand(MO, Dest);
|
||||
MI.addOperand(Dest);
|
||||
}
|
||||
|
||||
|
|
|
@ -1313,10 +1313,9 @@ void X86AsmPrinter::LowerFAULTING_OP(const MachineInstr &FaultingMI,
|
|||
if (DefRegister != X86::NoRegister)
|
||||
MI.addOperand(MCOperand::createReg(DefRegister));
|
||||
|
||||
for (auto I = FaultingMI.operands_begin() + OperandsBeginIdx,
|
||||
E = FaultingMI.operands_end();
|
||||
I != E; ++I)
|
||||
if (auto MaybeOperand = MCIL.LowerMachineOperand(&FaultingMI, *I))
|
||||
for (const MachineOperand &MO :
|
||||
llvm::drop_begin(FaultingMI.operands(), OperandsBeginIdx))
|
||||
if (auto MaybeOperand = MCIL.LowerMachineOperand(&FaultingMI, MO))
|
||||
MI.addOperand(*MaybeOperand);
|
||||
|
||||
OutStreamer->AddComment("on-fault: " + HandlerLabel->getName());
|
||||
|
|
|
@ -4461,11 +4461,9 @@ struct VarArgMIPS64Helper : public VarArgHelper {
|
|||
void visitCallBase(CallBase &CB, IRBuilder<> &IRB) override {
|
||||
unsigned VAArgOffset = 0;
|
||||
const DataLayout &DL = F.getParent()->getDataLayout();
|
||||
for (auto ArgIt = CB.arg_begin() + CB.getFunctionType()->getNumParams(),
|
||||
End = CB.arg_end();
|
||||
ArgIt != End; ++ArgIt) {
|
||||
for (Value *A :
|
||||
llvm::drop_begin(CB.args(), CB.getFunctionType()->getNumParams())) {
|
||||
Triple TargetTriple(F.getParent()->getTargetTriple());
|
||||
Value *A = *ArgIt;
|
||||
Value *Base;
|
||||
uint64_t ArgSize = DL.getTypeAllocSize(A->getType());
|
||||
if (TargetTriple.getArch() == Triple::mips64) {
|
||||
|
|
|
@ -461,16 +461,14 @@ public:
|
|||
// update PH to point to the newly added preheader.
|
||||
BasicBlock *TopPH = OrigPH;
|
||||
unsigned Index = getSize() - 1;
|
||||
for (auto I = std::next(PartitionContainer.rbegin()),
|
||||
E = PartitionContainer.rend();
|
||||
I != E; ++I, --Index, TopPH = NewLoop->getLoopPreheader()) {
|
||||
auto *Part = &*I;
|
||||
for (auto &Part : llvm::drop_begin(llvm::reverse(PartitionContainer))) {
|
||||
NewLoop = Part.cloneLoopWithPreheader(TopPH, Pred, Index, LI, DT);
|
||||
|
||||
NewLoop = Part->cloneLoopWithPreheader(TopPH, Pred, Index, LI, DT);
|
||||
|
||||
Part->getVMap()[ExitBlock] = TopPH;
|
||||
Part->remapInstructions();
|
||||
setNewLoopID(OrigLoopID, Part);
|
||||
Part.getVMap()[ExitBlock] = TopPH;
|
||||
Part.remapInstructions();
|
||||
setNewLoopID(OrigLoopID, &Part);
|
||||
--Index;
|
||||
TopPH = NewLoop->getLoopPreheader();
|
||||
}
|
||||
Pred->getTerminator()->replaceUsesOfWith(OrigPH, TopPH);
|
||||
|
||||
|
|
Loading…
Reference in New Issue