Skip to content
Snippets Groups Projects
Commit cbbe8273 authored by Akash Kothari's avatar Akash Kothari :speech_balloon:
Browse files

Eliminating some explicit use of iterators in loops.

parent 099d4909
No related branches found
No related tags found
No related merge requests found
......@@ -801,9 +801,10 @@ static void replaceOpenCLCallsWithVISCIntrinsics(Function *F) {
}
}
for (std::vector<CallInst *>::reverse_iterator ri = IItoRemove.rbegin(),
re = IItoRemove.rend(); ri != re; ++ri)
(*ri)->eraseFromParent();
//for (std::vector<CallInst *>::reverse_iterator ri = IItoRemove.rbegin(),
// re = IItoRemove.rend(); ri != re; ++ri)
for (CallInst *CI : reverse(IItoRemove))
CI->eraseFromParent();
}
......@@ -866,14 +867,11 @@ bool GenVISC::runOnModule(Module &M) {
std::vector<Instruction*> toBeErased;
std::vector<Function*> functions;
for (Module::iterator mi = M.begin(), me = M.end(); mi != me; ++mi) {
Function* f = &*mi;
functions.push_back(f);
}
for (auto &F : M)
functions.push_back(&F);
// Iterate over all functions in the module
for (unsigned i = 0; i < functions.size(); i++) {
Function* f = functions[i];
for (Function *f : functions) {
DEBUG(errs() << "Function: " << f->getName() << "\n");
// List with the required additions in the function's return type
......@@ -1646,7 +1644,7 @@ static Function* transformReturnTypeToStruct(Function* F) {
SmallVector<ReturnInst*, 8> Returns;
Function* newF = cloneFunction(F, FTy, false, &Returns);
// Replace ret void instruction with ret %RetTy undef
for(auto RI: Returns) {
for(auto &RI: Returns) {
DEBUG(errs() << "Found return inst: "<< *RI << "\n");
ReturnInst* newRI = ReturnInst::Create(newF->getContext(), UndefValue::get(RetTy));
ReplaceInstWithInst(RI, newRI);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment