forked from OSchip/llvm-project
Use drop_begin (NFC)
This commit is contained in:
parent
58753dea15
commit
5605a1eedd
|
@ -1213,8 +1213,8 @@ void SystemZXPLINKFrameLowering::emitPrologue(MachineFunction &MF,
|
|||
// Mark the FramePtr as live at the beginning of every block except
|
||||
// the entry block. (We'll have marked R8 as live on entry when
|
||||
// saving the GPRs.)
|
||||
for (auto I = std::next(MF.begin()), E = MF.end(); I != E; ++I)
|
||||
I->addLiveIn(Regs.getFramePointerRegister());
|
||||
for (MachineBasicBlock &B : llvm::drop_begin(MF))
|
||||
B.addLiveIn(Regs.getFramePointerRegister());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -645,8 +645,7 @@ static LogicalResult printOperation(CppEmitter &emitter,
|
|||
}
|
||||
|
||||
// Declare variables for basic block arguments.
|
||||
for (auto it = std::next(blocks.begin()); it != blocks.end(); ++it) {
|
||||
Block &block = *it;
|
||||
for (Block &block : llvm::drop_begin(blocks)) {
|
||||
for (BlockArgument &arg : block.getArguments()) {
|
||||
if (emitter.hasValueInScope(arg))
|
||||
return functionOp.emitOpError(" block argument #")
|
||||
|
|
|
@ -485,17 +485,15 @@ void mlir::LLVM::detail::connectPHINodes(Region ®ion,
|
|||
const ModuleTranslation &state) {
|
||||
// Skip the first block, it cannot be branched to and its arguments correspond
|
||||
// to the arguments of the LLVM function.
|
||||
for (auto it = std::next(region.begin()), eit = region.end(); it != eit;
|
||||
++it) {
|
||||
Block *bb = &*it;
|
||||
llvm::BasicBlock *llvmBB = state.lookupBlock(bb);
|
||||
for (Block &bb : llvm::drop_begin(region)) {
|
||||
llvm::BasicBlock *llvmBB = state.lookupBlock(&bb);
|
||||
auto phis = llvmBB->phis();
|
||||
auto numArguments = bb->getNumArguments();
|
||||
auto numArguments = bb.getNumArguments();
|
||||
assert(numArguments == std::distance(phis.begin(), phis.end()));
|
||||
for (auto &numberedPhiNode : llvm::enumerate(phis)) {
|
||||
auto &phiNode = numberedPhiNode.value();
|
||||
unsigned index = numberedPhiNode.index();
|
||||
for (auto *pred : bb->getPredecessors()) {
|
||||
for (auto *pred : bb.getPredecessors()) {
|
||||
// Find the LLVM IR block that contains the converted terminator
|
||||
// instruction and use it in the PHI node. Note that this block is not
|
||||
// necessarily the same as state.lookupBlock(pred), some operations
|
||||
|
@ -504,9 +502,9 @@ void mlir::LLVM::detail::connectPHINodes(Region ®ion,
|
|||
llvm::Instruction *terminator =
|
||||
state.lookupBranch(pred->getTerminator());
|
||||
assert(terminator && "missing the mapping for a terminator");
|
||||
phiNode.addIncoming(
|
||||
state.lookupValue(getPHISourceValue(bb, pred, numArguments, index)),
|
||||
terminator->getParent());
|
||||
phiNode.addIncoming(state.lookupValue(getPHISourceValue(
|
||||
&bb, pred, numArguments, index)),
|
||||
terminator->getParent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ LogicalResult Serializer::processLoopOp(spirv::LoopOp loopOp) {
|
|||
// properly. We don't need to assign for the entry block, which is just for
|
||||
// satisfying MLIR region's structural requirement.
|
||||
auto &body = loopOp.body();
|
||||
for (Block &block : llvm::make_range(std::next(body.begin(), 1), body.end()))
|
||||
for (Block &block : llvm::drop_begin(body))
|
||||
getOrCreateBlockID(&block);
|
||||
|
||||
auto *headerBlock = loopOp.getHeaderBlock();
|
||||
|
|
Loading…
Reference in New Issue