diff options
author | Aditya Kumar <hiraditya@msn.com> | 2019-10-16 01:50:21 +0000 |
---|---|---|
committer | Aditya Kumar <hiraditya@msn.com> | 2019-10-16 01:50:21 +0000 |
commit | 9d10b9d99b4d93114eb5d879878fcbb70f2d5b75 (patch) | |
tree | 3c76d22573db41292b3016a4b897b6e5a39eaa36 /llvm/lib/Transforms/Utils/CodeExtractor.cpp | |
parent | 8bb47cd8c30c29d064cefe2b69510160535727ae (diff) | |
download | bcm5719-llvm-9d10b9d99b4d93114eb5d879878fcbb70f2d5b75.tar.gz bcm5719-llvm-9d10b9d99b4d93114eb5d879878fcbb70f2d5b75.zip |
CodeExtractor: NFC: Use Range based loop
Reviewers: vsk, tejohnson, fhahn
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68924
llvm-svn: 374963
Diffstat (limited to 'llvm/lib/Transforms/Utils/CodeExtractor.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CodeExtractor.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index 0d05b6b32d8..0298ff9a395 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -961,12 +961,12 @@ Function *CodeExtractor::constructFunction(const ValueSet &inputs, // 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; |