1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Rangify some loops.

Patch by Philip Pfaffe!

llvm-svn: 241279
This commit is contained in:
Rafael Espindola 2015-07-02 15:55:09 +00:00
parent 4dd099db66
commit 7cab16c0e5

View File

@ -4457,13 +4457,11 @@ std::error_code BitcodeReader::materialize(GlobalValue *GV) {
stripDebugInfo(*F); stripDebugInfo(*F);
// Upgrade any old intrinsic calls in the function. // Upgrade any old intrinsic calls in the function.
for (UpgradedIntrinsicMap::iterator I = UpgradedIntrinsics.begin(), for (auto &I : UpgradedIntrinsics) {
E = UpgradedIntrinsics.end(); I != E; ++I) { if (I.first != I.second) {
if (I->first != I->second) { for (auto *U : I.first->users()) {
for (auto UI = I->first->user_begin(), UE = I->first->user_end(); if (CallInst *CI = dyn_cast<CallInst>(U))
UI != UE;) { UpgradeIntrinsicCall(CI, I.second);
if (CallInst* CI = dyn_cast<CallInst>(*UI++))
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 // 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 // module is materialized because there could always be another function body
// with calls to the old function. // with calls to the old function.
for (std::vector<std::pair<Function*, Function*> >::iterator I = for (auto &I : UpgradedIntrinsics) {
UpgradedIntrinsics.begin(), E = UpgradedIntrinsics.end(); I != E; ++I) { if (I.first != I.second) {
if (I->first != I->second) { for (auto *U : I.first->users()) {
for (auto UI = I->first->user_begin(), UE = I->first->user_end(); if (CallInst *CI = dyn_cast<CallInst>(U))
UI != UE;) { UpgradeIntrinsicCall(CI, I.second);
if (CallInst* CI = dyn_cast<CallInst>(*UI++))
UpgradeIntrinsicCall(CI, I->second);
} }
if (!I->first->use_empty()) if (!I.first->use_empty())
I->first->replaceAllUsesWith(I->second); I.first->replaceAllUsesWith(I.second);
I->first->eraseFromParent(); I.first->eraseFromParent();
} }
} }
std::vector<std::pair<Function*, Function*> >().swap(UpgradedIntrinsics); std::vector<std::pair<Function*, Function*> >().swap(UpgradedIntrinsics);