llvm.org GIT mirror llvm / dc8be91
try to make comments more meaningful; NFC Retry r266541 without the range-based-for-loop-change that was wrong. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266658 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 4 years ago
1 changed file(s) with 7 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
801801 }
802802 }
803803
804 // This tests each Function to determine if it needs upgrading. When we find
805 // one we are interested in, we then upgrade all calls to reflect the new
806 // function.
807 void llvm::UpgradeCallsToIntrinsic(Function* F) {
804 void llvm::UpgradeCallsToIntrinsic(Function *F) {
808805 assert(F && "Illegal attempt to upgrade a non-existent intrinsic.");
809806
810 // Upgrade the function and check if it is a totaly new function.
807 // Check if this function should be upgraded and get the replacement function
808 // if there is one.
811809 Function *NewFn;
812810 if (UpgradeIntrinsicFunction(F, NewFn)) {
813 // Replace all uses to the old function with the new one if necessary.
814 for (Value::user_iterator UI = F->user_begin(), UE = F->user_end();
815 UI != UE;) {
811 // Replace all users of the old function with the new function or new
812 // instructions. This is not a range loop because the call is deleted.
813 for (auto UI = F->user_begin(), UE = F->user_end(); UI != UE; )
816814 if (CallInst *CI = dyn_cast(*UI++))
817815 UpgradeIntrinsicCall(CI, NewFn);
818 }
816
819817 // Remove old function, no longer used, from the module.
820818 F->eraseFromParent();
821819 }