diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2016-04-16 23:26:16 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2016-04-16 23:26:16 +0000 |
| commit | a770a7ec5defa7c17674c51bb68edb0f29152d0b (patch) | |
| tree | b46c8e5bf5d2c1a6daf26954536d0426f09a762a /llvm | |
| parent | a3f3de1747200717fa470e8dfd7c5dd1a31a4af7 (diff) | |
| download | bcm5719-llvm-a770a7ec5defa7c17674c51bb68edb0f29152d0b.tar.gz bcm5719-llvm-a770a7ec5defa7c17674c51bb68edb0f29152d0b.zip | |
use range loop, try to make comments more meaningful; NFCI
llvm-svn: 266541
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 121b43b7964..9ddfc91978e 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -802,21 +802,18 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { } } -// This tests each Function to determine if it needs upgrading. When we find -// one we are interested in, we then upgrade all calls to reflect the new -// function. -void llvm::UpgradeCallsToIntrinsic(Function* F) { +void llvm::UpgradeCallsToIntrinsic(Function *F) { assert(F && "Illegal attempt to upgrade a non-existent intrinsic."); - // Upgrade the function and check if it is a totaly new function. + // Check if this function should be upgraded and get the replacement function + // if there is one. Function *NewFn; if (UpgradeIntrinsicFunction(F, NewFn)) { - // Replace all uses to the old function with the new one if necessary. - for (Value::user_iterator UI = F->user_begin(), UE = F->user_end(); - UI != UE;) { - if (CallInst *CI = dyn_cast<CallInst>(*UI++)) + // Replace all users of the old function with the new function or new IR. + for (User *U : F->users()) + if (CallInst *CI = dyn_cast<CallInst>(U)) UpgradeIntrinsicCall(CI, NewFn); - } + // Remove old function, no longer used, from the module. F->eraseFromParent(); } |

