NVPTX: Remove implicit ilist iterator conversions, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250779 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-10-20 00:54:09 +00:00
parent 8525f3a7bc
commit db991cb068
7 changed files with 20 additions and 25 deletions

View File

@ -718,7 +718,7 @@ static bool useFuncSeen(const Constant *C,
void NVPTXAsmPrinter::emitDeclarations(const Module &M, raw_ostream &O) {
llvm::DenseMap<const Function *, bool> seenMap;
for (Module::const_iterator FI = M.begin(), FE = M.end(); FI != FE; ++FI) {
const Function *F = FI;
const Function *F = &*FI;
if (F->isDeclaration()) {
if (F->use_empty())
@ -868,9 +868,8 @@ void NVPTXAsmPrinter::emitGlobals(const Module &M) {
DenseSet<const GlobalVariable *> GVVisiting;
// Visit each global variable, in order
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I)
VisitGlobalVariableForEmission(I, Globals, GVVisited, GVVisiting);
for (const GlobalVariable &I : M.globals())
VisitGlobalVariableForEmission(&I, Globals, GVVisited, GVVisiting);
assert(GVVisited.size() == M.getGlobalList().size() &&
"Missed a global variable");

View File

@ -267,14 +267,14 @@ bool NVPTXFavorNonGenericAddrSpaces::runOnFunction(Function &F) {
return false;
bool Changed = false;
for (Function::iterator B = F.begin(), BE = F.end(); B != BE; ++B) {
for (BasicBlock::iterator I = B->begin(), IE = B->end(); I != IE; ++I) {
for (BasicBlock &B : F) {
for (Instruction &I : B) {
if (isa<LoadInst>(I)) {
// V = load P
Changed |= optimizeMemoryInstruction(I, 0);
Changed |= optimizeMemoryInstruction(&I, 0);
} else if (isa<StoreInst>(I)) {
// store V, P
Changed |= optimizeMemoryInstruction(I, 1);
Changed |= optimizeMemoryInstruction(&I, 1);
}
}
}

View File

@ -81,7 +81,7 @@ bool GenericToNVVM::runOnModule(Module &M) {
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E;) {
GlobalVariable *GV = I++;
GlobalVariable *GV = &*I++;
if (GV->getType()->getAddressSpace() == llvm::ADDRESS_SPACE_GENERIC &&
!llvm::isTexture(*GV) && !llvm::isSurface(*GV) &&
!llvm::isSampler(*GV) && !GV->getName().startswith("llvm.")) {
@ -117,7 +117,7 @@ bool GenericToNVVM::runOnModule(Module &M) {
Value *Operand = II->getOperand(i);
if (isa<Constant>(Operand)) {
II->setOperand(
i, remapConstant(&M, I, cast<Constant>(Operand), Builder));
i, remapConstant(&M, &*I, cast<Constant>(Operand), Builder));
}
}
}
@ -132,10 +132,8 @@ bool GenericToNVVM::runOnModule(Module &M) {
// Walk through the metadata section and update the debug information
// associated with the global variables in the default address space.
for (Module::named_metadata_iterator I = M.named_metadata_begin(),
E = M.named_metadata_end();
I != E; I++) {
remapNamedMDNode(VM, I);
for (NamedMDNode &I : M.named_metadata()) {
remapNamedMDNode(VM, &I);
}
// Walk through the global variable initializers, and replace any use of

View File

@ -2071,10 +2071,9 @@ SDValue NVPTXTargetLowering::LowerFormalArguments(
std::vector<Type *> argTypes;
std::vector<const Argument *> theArgs;
for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
I != E; ++I) {
theArgs.push_back(I);
argTypes.push_back(I->getType());
for (const Argument &I : F->args()) {
theArgs.push_back(&I);
argTypes.push_back(I.getType());
}
// argTypes.size() (or theArgs.size()) and Ins.size() need not match.
// Ins.size() will be larger

View File

@ -69,7 +69,7 @@ void convertMemCpyToLoop(Instruction *ConvertedInst, Value *SrcAddr,
BasicBlock *LoopBB = BasicBlock::Create(Context, "loadstoreloop", &F, NewBB);
OrigBB->getTerminator()->setSuccessor(0, LoopBB);
IRBuilder<> Builder(OrigBB, OrigBB->getTerminator());
IRBuilder<> Builder(OrigBB->getTerminator());
// SrcAddr and DstAddr are expected to be pointer types,
// so no check is made here.
@ -214,7 +214,7 @@ void convertMemSetToLoop(Instruction *ConvertedInst, Value *DstAddr,
BasicBlock *LoopBB = BasicBlock::Create(Context, "loadstoreloop", &F, NewBB);
OrigBB->getTerminator()->setSuccessor(0, LoopBB);
IRBuilder<> Builder(OrigBB, OrigBB->getTerminator());
IRBuilder<> Builder(OrigBB->getTerminator());
// Cast pointer to the type of value getting stored
unsigned dstAS = cast<PointerType>(DstAddr->getType())->getAddressSpace();

View File

@ -173,8 +173,7 @@ void NVPTXLowerKernelArgs::markPointerAsGlobal(Value *Ptr) {
InsertPt = Arg->getParent()->getEntryBlock().begin();
} else {
// Insert right after Ptr if Ptr is an instruction.
InsertPt = cast<Instruction>(Ptr);
++InsertPt;
InsertPt = ++cast<Instruction>(Ptr)->getIterator();
assert(InsertPt != InsertPt->getParent()->end() &&
"We don't call this function with Ptr being a terminator.");
}
@ -182,9 +181,9 @@ void NVPTXLowerKernelArgs::markPointerAsGlobal(Value *Ptr) {
Instruction *PtrInGlobal = new AddrSpaceCastInst(
Ptr, PointerType::get(Ptr->getType()->getPointerElementType(),
ADDRESS_SPACE_GLOBAL),
Ptr->getName(), InsertPt);
Ptr->getName(), &*InsertPt);
Value *PtrInGeneric = new AddrSpaceCastInst(PtrInGlobal, Ptr->getType(),
Ptr->getName(), InsertPt);
Ptr->getName(), &*InsertPt);
// Replace with PtrInGeneric all uses of Ptr except PtrInGlobal.
Ptr->replaceAllUsesWith(PtrInGeneric);
PtrInGlobal->setOperand(0, Ptr);

View File

@ -367,7 +367,7 @@ void llvm::dumpBlock(Value *v, char *blockName) {
return;
for (Function::iterator it = F->begin(), ie = F->end(); it != ie; ++it) {
BasicBlock *B = it;
BasicBlock *B = &*it;
if (strcmp(B->getName().data(), blockName) == 0) {
B->dump();
return;