summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-07-02 15:55:09 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-07-02 15:55:09 +0000
commit86e3340f3198a85f5d63c3a16489ffa5111e76d8 (patch)
tree9bf972e1465b6e2385e01dabaa99394a25c60dcf /llvm/lib/Bitcode
parentca95120f05c93f29c1301abf62f0eb5a2874962f (diff)
downloadbcm5719-llvm-86e3340f3198a85f5d63c3a16489ffa5111e76d8.tar.gz
bcm5719-llvm-86e3340f3198a85f5d63c3a16489ffa5111e76d8.zip
Rangify some loops.
Patch by Philip Pfaffe! llvm-svn: 241279
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index e22420784af..29131d43ab0 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -4457,13 +4457,11 @@ std::error_code BitcodeReader::materialize(GlobalValue *GV) {
stripDebugInfo(*F);
// Upgrade any old intrinsic calls in the function.
- for (UpgradedIntrinsicMap::iterator I = UpgradedIntrinsics.begin(),
- E = UpgradedIntrinsics.end(); I != E; ++I) {
- if (I->first != I->second) {
- for (auto UI = I->first->user_begin(), UE = I->first->user_end();
- UI != UE;) {
- if (CallInst* CI = dyn_cast<CallInst>(*UI++))
- UpgradeIntrinsicCall(CI, I->second);
+ for (auto &I : UpgradedIntrinsics) {
+ if (I.first != I.second) {
+ for (auto *U : I.first->users()) {
+ if (CallInst *CI = dyn_cast<CallInst>(U))
+ UpgradeIntrinsicCall(CI, I.second);
}
}
}
@@ -4531,17 +4529,15 @@ std::error_code BitcodeReader::materializeModule(Module *M) {
// delete the old functions to clean up. We can't do this unless the entire
// module is materialized because there could always be another function body
// with calls to the old function.
- for (std::vector<std::pair<Function*, Function*> >::iterator I =
- UpgradedIntrinsics.begin(), E = UpgradedIntrinsics.end(); I != E; ++I) {
- if (I->first != I->second) {
- for (auto UI = I->first->user_begin(), UE = I->first->user_end();
- UI != UE;) {
- if (CallInst* CI = dyn_cast<CallInst>(*UI++))
- UpgradeIntrinsicCall(CI, I->second);
+ for (auto &I : UpgradedIntrinsics) {
+ if (I.first != I.second) {
+ for (auto *U : I.first->users()) {
+ if (CallInst *CI = dyn_cast<CallInst>(U))
+ UpgradeIntrinsicCall(CI, I.second);
}
- if (!I->first->use_empty())
- I->first->replaceAllUsesWith(I->second);
- I->first->eraseFromParent();
+ if (!I.first->use_empty())
+ I.first->replaceAllUsesWith(I.second);
+ I.first->eraseFromParent();
}
}
std::vector<std::pair<Function*, Function*> >().swap(UpgradedIntrinsics);
OpenPOWER on IntegriCloud