[llvm] r237284 - [LoopIdiomRecognize] Use auto + range-based loop. NFC intended.
David Blaikie
dblaikie at gmail.com
Wed May 13 21:44:43 PDT 2015
On Wed, May 13, 2015 at 9:10 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:
>
> > On 2015 May 13, at 12:51, Davide Italiano <davide at freebsd.org> wrote:
> >
> > Author: davide
> > Date: Wed May 13 14:51:21 2015
> > New Revision: 237284
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=237284&view=rev
> > Log:
> > [LoopIdiomRecognize] Use auto + range-based loop. NFC intended.
> >
> >
> > Modified:
> > llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
> >
> > Modified: llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp?rev=237284&r1=237283&r2=237284&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (original)
> > +++ llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Wed May 13
> 14:51:21 2015
> > @@ -639,13 +639,12 @@ bool LoopIdiomRecognize::runOnCountableL
> >
> > bool MadeChange = false;
> > // Scan all the blocks in the loop that are not in subloops.
> > - for (Loop::block_iterator BI = CurLoop->block_begin(),
> > - E = CurLoop->block_end(); BI != E; ++BI) {
> > + for (auto BB : CurLoop->getBlocks()) {
>
> At a quick glance this looks like a copy, since it's not obvious
> that we're iterating through pointers. Please either use:
>
> for (BasicBlock *BB : ...)
>
> or
>
> for (auto *BB : ...)
>
Yep, pretty sure we have this in the style guide - don't rely on implicit
pointerness of auto.
>
>
>
> > // Ignore blocks in subloops.
> > - if (LI.getLoopFor(*BI) != CurLoop)
> > + if (LI.getLoopFor(BB) != CurLoop)
> > continue;
> >
> > - MadeChange |= runOnLoopBlock(*BI, BECount, ExitBlocks);
> > + MadeChange |= runOnLoopBlock(BB, BECount, ExitBlocks);
> > }
> > return MadeChange;
> > }
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150513/e86990ef/attachment.html>
More information about the llvm-commits
mailing list