[llvm] r207755 - Update post-r203364 http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140303/207915.html
Duncan P. N. Exon Smith
dexonsmith at apple.com
Thu May 1 17:46:14 PDT 2014
On 2014-May-01, at 5:33, Yaron Keren <yaron.keren at gmail.com> wrote:
> Author: yrnkrn
> Date: Thu May 1 07:33:26 2014
> New Revision: 207755
>
> URL: http://llvm.org/viewvc/llvm-project?rev=207755&view=rev
> Log:
> Update post-r203364 http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140303/207915.html
> and ranged for loops.
>
> http://reviews.llvm.org/D3582
>
>
> Modified:
> llvm/trunk/docs/ProgrammersManual.rst
>
> Modified: llvm/trunk/docs/ProgrammersManual.rst
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.rst?rev=207755&r1=207754&r2=207755&view=diff
> ==============================================================================
> --- llvm/trunk/docs/ProgrammersManual.rst (original)
> +++ llvm/trunk/docs/ProgrammersManual.rst Thu May 1 07:33:26 2014
> @@ -1738,16 +1738,12 @@ chain of ``F``:
>
> Function *F = ...;
>
> - for (Value::use_iterator i = F->use_begin(), e = F->use_end(); i != e; ++i)
> - if (Instruction *Inst = dyn_cast<Instruction>(*i)) {
> + for (User *U : GV->users()) {
> + if (Instruction *Inst = dyn_cast<Instruction>(U)) {
> errs() << "F is used in instruction:\n";
> errs() << *Inst << "\n";
> }
>
> -Note that dereferencing a ``Value::use_iterator`` is not a very cheap operation.
> -Instead of performing ``*i`` above several times, consider doing it only once in
> -the loop body and reusing its result.
> -
> Alternatively, it's common to have an instance of the ``User`` Class (`doxygen
> <http://llvm.org/doxygen/classllvm_1_1User.html>`__) and need to know what
> ``Value``\ s are used by it. The list of all ``Value``\ s used by a ``User`` is
> @@ -1759,8 +1755,8 @@ instruction uses (that is, the operands
>
> Instruction *pi = ...;
>
> - for (User::op_iterator i = pi->op_begin(), e = pi->op_end(); i != e; ++i) {
> - Value *v = *i;
> + for (Use& U : pi->operands()) {
Style nit in the reference placement. Should be:
for (Use &U : pi->operands()) {
> + Value *v = U.get();
> // ...
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list