[llvm] r374963 - CodeExtractor: NFC: Use Range based loop
Aditya Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 18:50:21 PDT 2019
Author: hiraditya
Date: Tue Oct 15 18:50:21 2019
New Revision: 374963
URL: http://llvm.org/viewvc/llvm-project?rev=374963&view=rev
Log:
CodeExtractor: NFC: Use Range based loop
Reviewers: vsk, tejohnson, fhahn
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68924
Modified:
llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=374963&r1=374962&r2=374963&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Tue Oct 15 18:50:21 2019
@@ -961,12 +961,12 @@ Function *CodeExtractor::constructFuncti
// within the new function. This must be done before we lose track of which
// blocks were originally in the code region.
std::vector<User *> Users(header->user_begin(), header->user_end());
- for (unsigned i = 0, e = Users.size(); i != e; ++i)
+ for (auto &U : Users)
// The BasicBlock which contains the branch is not in the region
// modify the branch target to a new block
- if (Instruction *I = dyn_cast<Instruction>(Users[i]))
- if (I->isTerminator() && !Blocks.count(I->getParent()) &&
- I->getParent()->getParent() == oldFunction)
+ if (Instruction *I = dyn_cast<Instruction>(U))
+ if (I->isTerminator() && I->getFunction() == oldFunction &&
+ !Blocks.count(I->getParent()))
I->replaceUsesOfWith(header, newHeader);
return newFunction;
More information about the llvm-commits
mailing list