[llvm] r266541 - use range loop, try to make comments more meaningful; NFCI
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 17 07:20:10 PDT 2016
Oops. Sorry about that. Thanks for the revert
On Sat, Apr 16, 2016 at 10:05 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:
> Reverted in r266550.
>
> > On 2016-Apr-16, at 20:59, Duncan P. N. Exon Smith via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> >
> >>
> >> On 2016-Apr-16, at 16:26, Sanjay Patel via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> >>
> >> Author: spatel
> >> Date: Sat Apr 16 18:26:16 2016
> >> New Revision: 266541
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=266541&view=rev
> >> Log:
> >> use range loop, try to make comments more meaningful; NFCI
> >>
> >> Modified:
> >> llvm/trunk/lib/IR/AutoUpgrade.cpp
> >>
> >> Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=266541&r1=266540&r2=266541&view=diff
> >>
> ==============================================================================
> >> --- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
> >> +++ llvm/trunk/lib/IR/AutoUpgrade.cpp Sat Apr 16 18:26:16 2016
> >> @@ -802,21 +802,18 @@ void llvm::UpgradeIntrinsicCall(CallInst
> >> }
> >> }
> >>
> >> -// 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++))
> >
> > This can't be range-for-ified. The call might get deleted below.
> >
> >> + // 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);
> >
> > ^ This deletes instructions sometimes.
> >
> >> - }
> >> +
> >> // Remove old function, no longer used, from the module.
> >> F->eraseFromParent();
> >> }
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160417/01ac8fc7/attachment.html>
More information about the llvm-commits
mailing list